Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 14, 2024
1 parent d1f050e commit 256f65b
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/daily_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
echo "ExampleDataCache: ${{ needs.ExampleDataCache.result }}"
echo "ExampleDataTests: ${{ needs.ExampleDataTests.result }}"
- name: debugging
run: export test=(${{ needs.DevTests.result }} == 'failure' || ${{ needs.LiveServices.result }} == 'failure' || ${{ needs.BuildTests.result }} == 'failure' || ${{ needs.ExampleDataCache.result }} == 'failure' || ${{ needs.ExampleDataTests.result }} == 'failure')
run: export test=(${{ needs.DevTests.result }} == 'failure' || ${{ needs.LiveServices.result }} == 'failure' || ${{ needs.BuildTests.result }} == 'failure' || ${{ needs.ExampleDataCache.result }} == 'failure' || ${{ needs.ExampleDataTests.result }} == 'failure')
- name: debugging print
run: echo $test
#- name: Printout logic trigger
Expand Down
9 changes: 5 additions & 4 deletions src/electron/frontend/core/components/FileSystemSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,11 @@ export class FilesystemSelector extends LitElement {
>`
: ""}`}
<div class="controls">
${this.value ? html`<div @click=${() => this.#handleFiles()}>${unsafeSVG(restartSVG)}</div>` : ""}
</div>
<div class="controls">
${this.value
? html`<div @click=${() => this.#handleFiles()}>${unsafeSVG(restartSVG)}</div>`
: ""}
</div>
</button>
${this.multiple && isArray && this.value.length > 1
? new List({
Expand All @@ -293,7 +295,6 @@ export class FilesystemSelector extends LitElement {
},
})
: ""}
</div>
${isMultipleTypes
? html`<div id="button-div">
Expand Down
13 changes: 6 additions & 7 deletions src/electron/frontend/core/components/InspectorList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import { getMessageType, isErrorImportance } from "../validation";

import { unsafeHTML } from "lit/directives/unsafe-html.js";

import { header } from '../../utils/text'
import { header } from "../../utils/text";

const sortAlphabeticallyWithNumberedStrings = (a, b) => {
if (a === b) return 0;
return a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' });
}

return a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" });
};

const sortList = (items) => {
return items
Expand All @@ -23,19 +22,19 @@ const sortList = (items) => {
else if (lowA) return 1;
else return -1;
})

.sort((a, b) => {
const aCritical = isErrorImportance.includes(a.importance);
const bCritical = isErrorImportance.includes(b.importance);
if (aCritical && bCritical) return 0;
else if (aCritical) return -1;
else return 1;
})
});
};

const aggregateMessages = (items) => {
let messages = {};
console.log(items)
console.log(items);
items.forEach((item) => {
const copy = { ...item };
delete copy.file_path;
Expand Down
6 changes: 1 addition & 5 deletions src/electron/frontend/core/components/NWBFilePreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,7 @@ export class NWBFilePreview extends LitElement {
{ path: fileArr[0].info.file, ...options },
{ title }
) // Inspect the first file
: await run(
"neuroconv/inspect",
{ path, ...options },
{ title: title + "s" }
); // Inspect the folder
: await run("neuroconv/inspect", { path, ...options }, { title: title + "s" }); // Inspect the folder
const result = onlyFirstFile
? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,29 +134,27 @@ export class GuidedInspectorPage extends Page {
return html`
${until(
(async () => {
this.report = inspector;
const oneFile = fileArr.length <= 1;
const willRun = !this.report
const willRun = !this.report;
const swalOpts = willRun ? await createProgressPopup({ title: oneFile ? title : `${title}s` }) : {};
const { close: closeProgressPopup } = swalOpts;
if (oneFile) {
if (!this.report) {
const result = await run(
"neuroconv/inspect",
{ path: fileArr[0].info.file, ...options, request_id: swalOpts.id },
swalOpts
).catch((error) => {
this.notify(error.message, "error");
return null;
})
.finally(() => closeProgressPopup());
)
.catch((error) => {
this.notify(error.message, "error");
return null;
})
.finally(() => closeProgressPopup());
if (!result) return "Failed to generate inspector report.";
Expand All @@ -182,7 +180,6 @@ export class GuidedInspectorPage extends Page {
const path = getSharedPath(fileArr.map(({ info }) => info.file));
if (!this.report) {
const result = await run(
"neuroconv/inspect_folder",
{ path, ...options, request_id: swalOpts.id },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class InspectPage extends Page {
}
);

console.log(result)
console.log(result);

closeProgressPopup();

Expand Down
2 changes: 1 addition & 1 deletion src/electron/frontend/utils/popups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const createProgressPopup = async (
options.showCancelButton = true;
options.customClass = { actions: "swal-conversion-actions" };
}

await openProgressSwal(options, (result) => {
if (!result.isConfirmed) cancelController.abort();
});
Expand Down
6 changes: 3 additions & 3 deletions src/pyflask/manageNeuroconv/manage_neuroconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -1438,10 +1438,9 @@ def _inspect_all(url, config):
from nwbinspector.utils import calculate_number_of_cpu
from tqdm_publisher import TQDMProgressSubscriber


path = config.pop("path", None)

paths = [ path ] if path else config.pop("paths", [])
paths = [path] if path else config.pop("paths", [])

nwbfile_paths = []
for path in paths:
Expand All @@ -1450,7 +1449,7 @@ def _inspect_all(url, config):
nwbfile_paths.append(posix_path)
else:
nwbfile_paths.extend(list(posix_path.rglob("*.nwb")))

request_id = config.pop("request_id", None)

n_jobs = config.get("n_jobs", -2) # Default to all but one CPU
Expand Down Expand Up @@ -1542,6 +1541,7 @@ def _aggregate_symlinks_in_new_directory(paths, reason="", folder_path=None) ->

return folder_path


def _format_spikeglx_meta_file(bin_file_path: str) -> str:
bin_file_path = Path(bin_file_path)

Expand Down
1 change: 1 addition & 0 deletions src/pyflask/namespaces/neuroconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def post(self):
else:
return upload_multiple_filesystem_objects_to_dandi(**neuroconv_namespace.payload)


@neuroconv_namespace.route("/announce/progress")
class InspectNWBFolder(Resource):
@neuroconv_namespace.doc(responses={200: "Success", 400: "Bad Request", 500: "Internal server error"})
Expand Down

0 comments on commit 256f65b

Please sign in to comment.