From 9221834703eeded7c55ba3224ab5a67abc7fb818 Mon Sep 17 00:00:00 2001 From: Garrett Date: Thu, 28 Sep 2023 13:55:50 -0700 Subject: [PATCH 1/5] Update manage_neuroconv.py --- pyflask/manageNeuroconv/manage_neuroconv.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index dfab86f58..3b3ee2ca1 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -69,22 +69,24 @@ def replace_none_with_nan(json_object, json_schema): dict: The modified JSON object with None values replaced by NaN. """ - def replace_none_recursive(obj, schema): + def coerce_schema_compliance_recursive(obj, schema): if isinstance(obj, dict): for key, value in obj.items(): if key in schema.get("properties", {}): prop_schema = schema["properties"][key] if prop_schema.get("type") == "number" and value is None: - obj[key] = math.nan + obj[key] = math.nan # Turn None into NaN if a number is expected (JavaScript JSON.stringify turns NaN into None) + elif prop_schema.get("type") == "number" and isinstance(value, int): + obj[key] = float(value) # Turn integer into float if an integer is expected (JavaScript coerces floats with trailing zeros to integers) else: - replace_none_recursive(value, prop_schema) + coerce_schema_compliance_recursive(value, prop_schema) elif isinstance(obj, list): for item in obj: - replace_none_recursive(item, schema.get("items", {})) + coerce_schema_compliance_recursive(item, schema.get("items", {})) return obj - return replace_none_recursive(copy.deepcopy(json_object), resolve_references(copy.deepcopy(json_schema))) + return coerce_schema_compliance_recursive(copy.deepcopy(json_object), resolve_references(copy.deepcopy(json_schema))) def locate_data(info: dict) -> dict: @@ -363,7 +365,7 @@ def update_conversion_progress(**kwargs): info["metadata"].update(Ecephys=dict()) resolved_metadata = replace_none_with_nan( - info["metadata"], converter.get_metadata_schema() + info["metadata"], resolve_references(converter.get_metadata_schema()) ) # Ensure Ophys NaN values are resolved # if is_supported_recording_interface(recording_interface, info["metadata"]): From 83b80d7d541d1c76e207ec14fa0269db3f41f3c4 Mon Sep 17 00:00:00 2001 From: Garrett Date: Thu, 28 Sep 2023 13:59:04 -0700 Subject: [PATCH 2/5] Update manage_neuroconv.py --- pyflask/manageNeuroconv/manage_neuroconv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index 3b3ee2ca1..935a17af2 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -77,7 +77,7 @@ def coerce_schema_compliance_recursive(obj, schema): if prop_schema.get("type") == "number" and value is None: obj[key] = math.nan # Turn None into NaN if a number is expected (JavaScript JSON.stringify turns NaN into None) elif prop_schema.get("type") == "number" and isinstance(value, int): - obj[key] = float(value) # Turn integer into float if an integer is expected (JavaScript coerces floats with trailing zeros to integers) + obj[key] = float(value) # Turn integer into float if an integer is expected (JavaScript / JSON Schema coerces floats with trailing zeros to integers) else: coerce_schema_compliance_recursive(value, prop_schema) elif isinstance(obj, list): From a0c41826c8ffa9f628306e9748460b4afc2c520a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 21:01:05 +0000 Subject: [PATCH 3/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyflask/manageNeuroconv/manage_neuroconv.py | 14 +++++++++++--- src/main/main.ts | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index 935a17af2..7113e8eed 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -75,9 +75,15 @@ def coerce_schema_compliance_recursive(obj, schema): if key in schema.get("properties", {}): prop_schema = schema["properties"][key] if prop_schema.get("type") == "number" and value is None: - obj[key] = math.nan # Turn None into NaN if a number is expected (JavaScript JSON.stringify turns NaN into None) + obj[ + key + ] = ( + math.nan + ) # Turn None into NaN if a number is expected (JavaScript JSON.stringify turns NaN into None) elif prop_schema.get("type") == "number" and isinstance(value, int): - obj[key] = float(value) # Turn integer into float if an integer is expected (JavaScript / JSON Schema coerces floats with trailing zeros to integers) + obj[key] = float( + value + ) # Turn integer into float if an integer is expected (JavaScript / JSON Schema coerces floats with trailing zeros to integers) else: coerce_schema_compliance_recursive(value, prop_schema) elif isinstance(obj, list): @@ -86,7 +92,9 @@ def coerce_schema_compliance_recursive(obj, schema): return obj - return coerce_schema_compliance_recursive(copy.deepcopy(json_object), resolve_references(copy.deepcopy(json_schema))) + return coerce_schema_compliance_recursive( + copy.deepcopy(json_object), resolve_references(copy.deepcopy(json_schema)) + ) def locate_data(info: dict) -> dict: diff --git a/src/main/main.ts b/src/main/main.ts index 0f78f25c1..f15f363fb 100755 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -184,7 +184,7 @@ const exitPyProc = async () => { const killAllPreviousProcesses = async () => { const fetch = globalThis.fetch - + if (fetch){ console.log("Killing all previous processes"); From f1aaafd16f660c9eaf61ed06ba8f282cedd4717c Mon Sep 17 00:00:00 2001 From: Garrett Date: Thu, 28 Sep 2023 15:15:30 -0700 Subject: [PATCH 4/5] Update manage_neuroconv.py --- pyflask/manageNeuroconv/manage_neuroconv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index 7113e8eed..1888a0f10 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -83,7 +83,7 @@ def coerce_schema_compliance_recursive(obj, schema): elif prop_schema.get("type") == "number" and isinstance(value, int): obj[key] = float( value - ) # Turn integer into float if an integer is expected (JavaScript / JSON Schema coerces floats with trailing zeros to integers) + ) # Turn integer into float if a number, the JSON Schema equivalent to float, is expected (JavaScript coerces floats with trailing zeros to integers) else: coerce_schema_compliance_recursive(value, prop_schema) elif isinstance(obj, list): From 8d28b0265bbdec992875726521cb6996432ed211 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 29 Sep 2023 15:26:26 +0000 Subject: [PATCH 5/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/renderer/src/progress/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/src/progress/index.js b/src/renderer/src/progress/index.js index b30fb5eb7..14bc2a2f1 100644 --- a/src/renderer/src/progress/index.js +++ b/src/renderer/src/progress/index.js @@ -42,7 +42,7 @@ function decode(message) { function drill(o, callback) { if (o && typeof o === "object") { - const copy = Array.isArray(o) ? [...o] : { ...o } ; + const copy = Array.isArray(o) ? [...o] : { ...o }; for (let k in copy) copy[k] = drill(copy[k], callback); return copy; } else return callback(o);