Skip to content

Commit

Permalink
Merge pull request #430 from NeurodataWithoutBorders/use_dandi_config
Browse files Browse the repository at this point in the history
[Bug] Use dandi config in all inspection
  • Loading branch information
CodyCBakerPhD authored Oct 16, 2023
2 parents 0c6dfd9 + 7e89039 commit 0bde0f8
Showing 1 changed file with 14 additions and 37 deletions.
51 changes: 14 additions & 37 deletions pyflask/manageNeuroconv/manage_neuroconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,40 +528,18 @@ def inspect_nwb_file(payload):
from nwbinspector import inspect_nwbfile
from nwbinspector.nwbinspector import InspectorOutputJSONEncoder

return json.loads(
json.dumps(
list(
inspect_nwbfile(
ignore=[
"check_description",
"check_data_orientation",
], # TODO: remove when metadata control is exposed
**payload,
)
),
cls=InspectorOutputJSONEncoder,
messages = list(
inspect_nwbfile(
ignore=[
"check_description",
"check_data_orientation",
], # TODO: remove when metadata control is exposed
config="dandi",
**payload,
)
)


def inspect_nwb_file(payload):
from nwbinspector import inspect_nwbfile
from nwbinspector.nwbinspector import InspectorOutputJSONEncoder

return json.loads(
json.dumps(
list(
inspect_nwbfile(
ignore=[
"check_description",
"check_data_orientation",
], # TODO: remove when metadata control is exposed
**payload,
)
),
cls=InspectorOutputJSONEncoder,
)
)
return json.loads(json.dumps(obj=messages, cls=InspectorOutputJSONEncoder))


def inspect_nwb_folder(payload):
Expand All @@ -575,16 +553,15 @@ def inspect_nwb_folder(payload):
"check_description",
"check_data_orientation",
], # TODO: remove when metadata control is exposed
config="dandi",
**payload,
)
)

# messages = organize_messages(messages, levels=["importance", "message"])

return json.loads(json.dumps(messages, cls=InspectorOutputJSONEncoder))
return json.loads(json.dumps(obj=messages, cls=InspectorOutputJSONEncoder))


def aggregate_symlinks_in_new_directory(paths, reason="", folder_path=None):
def _aggregate_symlinks_in_new_directory(paths, reason="", folder_path=None):
if folder_path is None:
folder_path = GUIDE_ROOT_FOLDER / ".temp" / reason / f"temp_{datetime.now().strftime('%Y%m%d-%H%M%S')}"

Expand All @@ -594,7 +571,7 @@ def aggregate_symlinks_in_new_directory(paths, reason="", folder_path=None):
path = Path(path)
new_path = folder_path / path.name
if path.is_dir():
aggregate_symlinks_in_new_directory(
_aggregate_symlinks_in_new_directory(
list(map(lambda name: os.path.join(path, name), os.listdir(path))), None, new_path
)
else:
Expand All @@ -604,7 +581,7 @@ def aggregate_symlinks_in_new_directory(paths, reason="", folder_path=None):


def inspect_multiple_filesystem_objects(paths):
tmp_folder_path = aggregate_symlinks_in_new_directory(paths, "inspect")
tmp_folder_path = _aggregate_symlinks_in_new_directory(paths, "inspect")
result = inspect_nwb_folder({"path": tmp_folder_path})
rmtree(tmp_folder_path)
return result

0 comments on commit 0bde0f8

Please sign in to comment.