88from pathlib import Path
99from collections .abc import Iterable
1010from enum import Enum
11- from typing import Optional , List
11+ from typing import Union , Optional , List
1212from concurrent .futures import ProcessPoolExecutor , as_completed
1313from types import FunctionType
1414from warnings import filterwarnings , warn
@@ -153,10 +153,7 @@ def configure_checks(
153153@click .argument ("path" )
154154@click .option ("--modules" , help = "Modules to import prior to reading the file(s)." )
155155@click .option (
156- "--report-file-path" ,
157- default = None ,
158- help = "Save path for the report file." ,
159- type = click .Path (writable = True ),
156+ "--report-file-path" , default = None , help = "Save path for the report file." , type = click .Path (writable = True ),
160157)
161158@click .option ("--overwrite" , help = "Overwrite an existing report file at the location." , is_flag = True )
162159@click .option ("--levels" , help = "Comma-separated names of InspectorMessage attributes to organize by." )
@@ -278,7 +275,7 @@ def inspect_all(
278275 config : Optional [dict ] = None ,
279276 ignore : OptionalListOfStrings = None ,
280277 select : OptionalListOfStrings = None ,
281- importance_threshold : Importance = Importance .BEST_PRACTICE_SUGGESTION ,
278+ importance_threshold : Union [ str , Importance ] = Importance .BEST_PRACTICE_SUGGESTION ,
282279 n_jobs : int = 1 ,
283280 skip_validate : bool = False ,
284281 progress_bar : bool = True ,
@@ -305,7 +302,7 @@ def inspect_all(
305302 Names of functions to skip.
306303 select: list of strings, optional
307304 Names of functions to pick out of available checks.
308- importance_threshold : string, optional
305+ importance_threshold : string or Importance , optional
309306 Ignores tests with an assigned importance below this threshold.
310307 Importance has three levels:
311308 CRITICAL
@@ -336,6 +333,9 @@ def inspect_all(
336333 Common options are 'draft' or 'published'.
337334 Defaults to the most recent published version, or if not published then the most recent draft version.
338335 """
336+ importance_threshold = (
337+ Importance [importance_threshold ] if isinstance (importance_threshold , str ) else importance_threshold
338+ )
339339 modules = modules or []
340340 if progress_bar_options is None :
341341 progress_bar_options = dict (position = 0 , leave = False )
@@ -410,7 +410,7 @@ def inspect_nwb(
410410 config : dict = None ,
411411 ignore : OptionalListOfStrings = None ,
412412 select : OptionalListOfStrings = None ,
413- importance_threshold : Importance = Importance .BEST_PRACTICE_SUGGESTION ,
413+ importance_threshold : Union [ str , Importance ] = Importance .BEST_PRACTICE_SUGGESTION ,
414414 driver : str = None ,
415415 skip_validate : bool = False ,
416416) -> List [InspectorMessage ]:
@@ -431,7 +431,7 @@ def inspect_nwb(
431431 Names of functions to skip.
432432 select: list, optional
433433 Names of functions to pick out of available checks.
434- importance_threshold : string, optional
434+ importance_threshold : string or Importance , optional
435435 Ignores tests with an assigned importance below this threshold.
436436 Importance has three levels:
437437 CRITICAL
@@ -447,6 +447,9 @@ def inspect_nwb(
447447 Skip the PyNWB validation step. This may be desired for older NWBFiles (< schema version v2.10).
448448 The default is False, which is also recommended.
449449 """
450+ importance_threshold = (
451+ Importance [importance_threshold ] if isinstance (importance_threshold , str ) else importance_threshold
452+ )
450453 if any (x is not None for x in [config , ignore , select , importance_threshold ]):
451454 checks = configure_checks (
452455 checks = checks , config = config , ignore = ignore , select = select , importance_threshold = importance_threshold
0 commit comments