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
@@ -278,7 +278,7 @@ def inspect_all(
278278 config : Optional [dict ] = None ,
279279 ignore : OptionalListOfStrings = None ,
280280 select : OptionalListOfStrings = None ,
281- importance_threshold : Importance = Importance .BEST_PRACTICE_SUGGESTION ,
281+ importance_threshold : Union [ str , Importance ] = Importance .BEST_PRACTICE_SUGGESTION ,
282282 n_jobs : int = 1 ,
283283 skip_validate : bool = False ,
284284 progress_bar : bool = True ,
@@ -305,7 +305,7 @@ def inspect_all(
305305 Names of functions to skip.
306306 select: list of strings, optional
307307 Names of functions to pick out of available checks.
308- importance_threshold : string, optional
308+ importance_threshold : string or Importance , optional
309309 Ignores tests with an assigned importance below this threshold.
310310 Importance has three levels:
311311 CRITICAL
@@ -338,6 +338,9 @@ def inspect_all(
338338 Common options are 'draft' or 'published'.
339339 Defaults to the most recent published version, or if not published then the most recent draft version.
340340 """
341+ importance_threshold = (
342+ Importance [importance_threshold ] if isinstance (importance_threshold , str ) else importance_threshold
343+ )
341344 modules = modules or []
342345 n_jobs = calculate_number_of_cpu (requested_cpu = n_jobs )
343346 if progress_bar_options is None :
@@ -413,7 +416,7 @@ def inspect_nwb(
413416 config : dict = None ,
414417 ignore : OptionalListOfStrings = None ,
415418 select : OptionalListOfStrings = None ,
416- importance_threshold : Importance = Importance .BEST_PRACTICE_SUGGESTION ,
419+ importance_threshold : Union [ str , Importance ] = Importance .BEST_PRACTICE_SUGGESTION ,
417420 driver : str = None ,
418421 skip_validate : bool = False ,
419422) -> List [InspectorMessage ]:
@@ -434,7 +437,7 @@ def inspect_nwb(
434437 Names of functions to skip.
435438 select: list, optional
436439 Names of functions to pick out of available checks.
437- importance_threshold : string, optional
440+ importance_threshold : string or Importance , optional
438441 Ignores tests with an assigned importance below this threshold.
439442 Importance has three levels:
440443 CRITICAL
@@ -450,6 +453,9 @@ def inspect_nwb(
450453 Skip the PyNWB validation step. This may be desired for older NWBFiles (< schema version v2.10).
451454 The default is False, which is also recommended.
452455 """
456+ importance_threshold = (
457+ Importance [importance_threshold ] if isinstance (importance_threshold , str ) else importance_threshold
458+ )
453459 if any (x is not None for x in [config , ignore , select , importance_threshold ]):
454460 checks = configure_checks (
455461 checks = checks , config = config , ignore = ignore , select = select , importance_threshold = importance_threshold
0 commit comments