From e4966b023130915c2684a90b6a3017520cb893ba Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 5 Apr 2024 23:14:09 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyflask/apis/neuroconv.py | 3 +++ pyflask/app.py | 1 + pyflask/manageNeuroconv/manage_neuroconv.py | 9 +++------ .../data/GuidedBackendConfiguration.js | 19 ++++++++----------- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/pyflask/apis/neuroconv.py b/pyflask/apis/neuroconv.py index c65244a05..38aaf5a12 100644 --- a/pyflask/apis/neuroconv.py +++ b/pyflask/apis/neuroconv.py @@ -127,6 +127,7 @@ def post(self): if notBadRequestException(exception): neuroconv_api.abort(500, str(exception)) + @neuroconv_api.route("/configuration") class GetBackendConfiguration(Resource): @neuroconv_api.doc(responses={200: "Success", 400: "Bad Request", 500: "Internal server error"}) @@ -138,6 +139,7 @@ def post(self): if notBadRequestException(exception): neuroconv_api.abort(500, str(exception)) + @neuroconv_api.route("/configuration/set") class SetBackendConfiguration(Resource): @neuroconv_api.doc(responses={200: "Success", 400: "Bad Request", 500: "Internal server error"}) @@ -149,6 +151,7 @@ def post(self): if notBadRequestException(exception): neuroconv_api.abort(500, str(exception)) + validate_parser = neuroconv_api.parser() validate_parser.add_argument("parent", type=dict, required=True) validate_parser.add_argument("function_name", type=str, required=True) diff --git a/pyflask/app.py b/pyflask/app.py index e40330730..924e9454a 100644 --- a/pyflask/app.py +++ b/pyflask/app.py @@ -106,6 +106,7 @@ def get_cpu_count(): return dict(physical=physical, logical=logical) + @app.route("/get-recommended-species") def get_species(): from dandi.metadata.util import species_map diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index 480bb158a..f5afaeec6 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -667,6 +667,7 @@ def get_interface_alignment(info: dict) -> dict: return timestamps + def get_backend_configuration(info): from neuroconv.tools.nwb_helpers import get_default_backend_configuration from pynwb import NWBHDF5IO @@ -682,11 +683,8 @@ def set_backend_configuration(info): from pynwb import NWBHDF5IO with NWBHDF5IO(info["nwbfile_path"], "r") as io: - nwbfile= io.read() - configure_backend( - nwbfile=nwbfile, backend_configuration=info["configuration"] - ) - + nwbfile = io.read() + configure_backend(nwbfile=nwbfile, backend_configuration=info["configuration"]) def convert_to_nwb(info: dict) -> str: @@ -783,7 +781,6 @@ def update_conversion_progress(**kwargs): ] del ecephys_metadata["ElectrodeColumns"] - # from neuroconv.utils import NWBMetaDataEncoder # from neuroconv.datainterfaces.ecephys.basesortingextractorinterface import BaseSortingExtractorInterface diff --git a/src/renderer/src/stories/pages/guided-mode/data/GuidedBackendConfiguration.js b/src/renderer/src/stories/pages/guided-mode/data/GuidedBackendConfiguration.js index bc5a0fe8b..026de98df 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedBackendConfiguration.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedBackendConfiguration.js @@ -25,7 +25,6 @@ export class GuidedBackendConfigurationPage extends ManagedPage { form; - header = { subtitle: "Configure your backend", }; @@ -35,14 +34,14 @@ export class GuidedBackendConfigurationPage extends ManagedPage { skip: { condition: (v) => v === false, skip: true, - } - } - } + }, + }, + }; footer = { onNext: async () => { await this.save(); // Save in case the conversion fails - await this.form.validate() + await this.form.validate(); // for (let { form } of this.forms) await form.validate(); // Will throw an error in the callback return this.to(1); }, @@ -66,19 +65,18 @@ export class GuidedBackendConfigurationPage extends ManagedPage { } render() { - this.#updateRendered(true); const { stubs } = this.info.globalState.preview; const stubArray = getStubArray(stubs); const nwbfile_path = stubArray[0].file; - const promise = run('configuration', { + const promise = run("configuration", { nwbfile_path, - backend: "hdf5" + backend: "hdf5", }) .then((backendOptions) => { - console.log(backendOptions) + console.log(backendOptions); return (this.form = new JSONSchemaForm({ schema: {}, results: {}, @@ -96,8 +94,7 @@ export class GuidedBackendConfigurationPage extends ManagedPage { this.#toggleRendered(); }); - return untilResult - + return untilResult; } }