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 Sep 26, 2023
1 parent 8c4f47d commit 949db9b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
15 changes: 9 additions & 6 deletions pyflask/manageNeuroconv/manage_neuroconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

announcer = MessageAnnouncer()


def replace_nan_with_none(data):
if isinstance(data, dict):
# If it's a dictionary, iterate over its items and replace NaN values with None
Expand All @@ -23,10 +24,11 @@ def replace_nan_with_none(data):
return None # Replace NaN with None
else:
return data

def resolve_references(schema, root_schema = None):


def resolve_references(schema, root_schema=None):
from jsonschema import RefResolver

"""
Recursively resolve references in a JSON schema based on the root schema.
Expand All @@ -45,19 +47,17 @@ def resolve_references(schema, root_schema = None):
resolver = RefResolver.from_schema(root_schema)
return resolver.resolve(schema["$ref"])[1]


if "properties" in schema:
for key, prop_schema in schema["properties"].items():
schema["properties"][key] = resolve_references(prop_schema, root_schema)

if "items" in schema:
schema["items"] = resolve_references(schema["items"], root_schema)

return schema


def replace_none_with_nan(json_object, json_schema):

import math
import copy

Expand All @@ -71,6 +71,7 @@ def replace_none_with_nan(json_object, json_schema):
Returns:
dict: The modified JSON object with None values replaced by NaN.
"""

def replace_none_recursive(obj, schema):
if isinstance(obj, dict):
for key, value in obj.items():
Expand Down Expand Up @@ -364,7 +365,9 @@ def update_conversion_progress(**kwargs):
if "Ecephys" not in info["metadata"]:
info["metadata"].update(Ecephys=dict())

resolved_metadata = replace_none_with_nan(info["metadata"], converter.get_metadata_schema()) # Ensure Ophys NaN values are resolved
resolved_metadata = replace_none_with_nan(
info["metadata"], converter.get_metadata_schema()
) # Ensure Ophys NaN values are resolved

# if is_supported_recording_interface(recording_interface, info["metadata"]):
# electrode_column_results = ecephys_metadata["ElectrodeColumns"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,7 @@ export class GuidedMetadataPage extends ManagedPage {
results,
globals: aggregateGlobalMetadata,

ignore:
[
"Ophys",
"subject_id",
"session_id"
],
ignore: ["Ophys", "subject_id", "session_id"],

conditionalRequirements: [
{
Expand Down

0 comments on commit 949db9b

Please sign in to comment.