From 256f65bfa014cfdbd528f3c15b555856321a9b73 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 14 Jun 2024 19:42:46 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/daily_tests.yml | 2 +- .../core/components/FileSystemSelector.js | 9 +++++---- .../frontend/core/components/InspectorList.js | 13 ++++++------- .../frontend/core/components/NWBFilePreview.js | 6 +----- .../guided-mode/options/GuidedInspectorPage.js | 17 +++++++---------- .../components/pages/inspect/InspectPage.js | 2 +- src/electron/frontend/utils/popups.ts | 2 +- src/pyflask/manageNeuroconv/manage_neuroconv.py | 6 +++--- src/pyflask/namespaces/neuroconv.py | 1 + 9 files changed, 26 insertions(+), 32 deletions(-) diff --git a/.github/workflows/daily_tests.yml b/.github/workflows/daily_tests.yml index f3e2d5596..fcae04f53 100644 --- a/.github/workflows/daily_tests.yml +++ b/.github/workflows/daily_tests.yml @@ -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 diff --git a/src/electron/frontend/core/components/FileSystemSelector.js b/src/electron/frontend/core/components/FileSystemSelector.js index da6f4925e..d9d444d8e 100644 --- a/src/electron/frontend/core/components/FileSystemSelector.js +++ b/src/electron/frontend/core/components/FileSystemSelector.js @@ -280,9 +280,11 @@ export class FilesystemSelector extends LitElement { >` : ""}`} -
- ${this.value ? html`
this.#handleFiles()}>${unsafeSVG(restartSVG)}
` : ""} -
+
+ ${this.value + ? html`
this.#handleFiles()}>${unsafeSVG(restartSVG)}
` + : ""} +
${this.multiple && isArray && this.value.length > 1 ? new List({ @@ -293,7 +295,6 @@ export class FilesystemSelector extends LitElement { }, }) : ""} - ${isMultipleTypes ? html`
diff --git a/src/electron/frontend/core/components/InspectorList.js b/src/electron/frontend/core/components/InspectorList.js index 790124124..5af3ac696 100644 --- a/src/electron/frontend/core/components/InspectorList.js +++ b/src/electron/frontend/core/components/InspectorList.js @@ -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 @@ -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; diff --git a/src/electron/frontend/core/components/NWBFilePreview.js b/src/electron/frontend/core/components/NWBFilePreview.js index c5cc63cb2..43ead6138 100644 --- a/src/electron/frontend/core/components/NWBFilePreview.js +++ b/src/electron/frontend/core/components/NWBFilePreview.js @@ -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 ? { diff --git a/src/electron/frontend/core/components/pages/guided-mode/options/GuidedInspectorPage.js b/src/electron/frontend/core/components/pages/guided-mode/options/GuidedInspectorPage.js index 3121939b2..f8ecf6219 100644 --- a/src/electron/frontend/core/components/pages/guided-mode/options/GuidedInspectorPage.js +++ b/src/electron/frontend/core/components/pages/guided-mode/options/GuidedInspectorPage.js @@ -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."; @@ -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 }, diff --git a/src/electron/frontend/core/components/pages/inspect/InspectPage.js b/src/electron/frontend/core/components/pages/inspect/InspectPage.js index e97605d83..e711673b3 100644 --- a/src/electron/frontend/core/components/pages/inspect/InspectPage.js +++ b/src/electron/frontend/core/components/pages/inspect/InspectPage.js @@ -39,7 +39,7 @@ export class InspectPage extends Page { } ); - console.log(result) + console.log(result); closeProgressPopup(); diff --git a/src/electron/frontend/utils/popups.ts b/src/electron/frontend/utils/popups.ts index b89928d1d..d7584704c 100644 --- a/src/electron/frontend/utils/popups.ts +++ b/src/electron/frontend/utils/popups.ts @@ -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(); }); diff --git a/src/pyflask/manageNeuroconv/manage_neuroconv.py b/src/pyflask/manageNeuroconv/manage_neuroconv.py index eac97906a..007491060 100644 --- a/src/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/src/pyflask/manageNeuroconv/manage_neuroconv.py @@ -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: @@ -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 @@ -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) diff --git a/src/pyflask/namespaces/neuroconv.py b/src/pyflask/namespaces/neuroconv.py index b5246c991..4312d427b 100644 --- a/src/pyflask/namespaces/neuroconv.py +++ b/src/pyflask/namespaces/neuroconv.py @@ -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"})