@@ -454,8 +454,8 @@ def inspect_nwb(
454454 nwbfile_path = str (nwbfile_path )
455455 filterwarnings (action = "ignore" , message = "No cached namespaces found in .*" )
456456 filterwarnings (action = "ignore" , message = "Ignoring cached namespace .*" )
457- if not skip_validate :
458- with pynwb . NWBHDF5IO ( path = nwbfile_path , mode = "r" , load_namespaces = True , driver = driver ) as io :
457+ with pynwb . NWBHDF5IO ( path = nwbfile_path , mode = "r" , load_namespaces = True , driver = driver ) as io :
458+ if not skip_validate :
459459 validation_errors = pynwb .validate (io = io )
460460 for validation_error in validation_errors :
461461 yield InspectorMessage (
@@ -466,19 +466,18 @@ def inspect_nwb(
466466 file_path = nwbfile_path ,
467467 )
468468
469- try :
470- with pynwb .NWBHDF5IO (path = nwbfile_path , mode = "r" , load_namespaces = True , driver = driver ) as io :
469+ try :
471470 nwbfile = io .read ()
472471 for inspector_message in run_checks (nwbfile = nwbfile , checks = checks ):
473472 inspector_message .file_path = nwbfile_path
474473 yield inspector_message
475- except Exception as ex :
476- yield InspectorMessage (
477- message = traceback .format_exc (),
478- importance = Importance .ERROR ,
479- check_function_name = f"During io.read() - { type (ex )} : { str (ex )} " ,
480- file_path = nwbfile_path ,
481- )
474+ except Exception as ex :
475+ yield InspectorMessage (
476+ message = traceback .format_exc (),
477+ importance = Importance .ERROR ,
478+ check_function_name = f"During io.read() - { type (ex )} : { str (ex )} " ,
479+ file_path = nwbfile_path ,
480+ )
482481
483482
484483def run_checks (nwbfile : pynwb .NWBFile , checks : list ):
0 commit comments