2929from typing import Any , Iterable , cast
3030import torch
3131
32- import importlib .metadata
33-
32+ ## import importlib.metadata
33+ ## from packaging import version
3434
3535# bundle config system flags
3636# set MONAI_EVAL_EXPR=1 to use 'eval', default value: run_eval=True
@@ -74,10 +74,10 @@ def look_up_option(
7474 Raise a value error possibly with a guess of the closest match.
7575
7676 Args:
77- opt_str: The option string or Enum to look up.
77+ opt_str: The option string or Enum to look up.
7878 supported: The collection of supported options, it can be list, tuple, set, dict, or Enum.
7979 default: If it is given, this method will return `default` when `opt_str` is not found,
80- instead of raising a `ValueError`. Otherwise, it defaults to `"no_default"`,
80+ instead of raising a `ValueError`. Otherwise, it defaults to `"no_default"`,
8181 so that the method may raise a `ValueError`.
8282 print_all_options: whether to print all available options when `opt_str` is not found. Defaults to True
8383
@@ -566,10 +566,10 @@ def version_leq(lhs: str, rhs: str) -> bool:
566566 """
567567
568568 lhs , rhs = str (lhs ), str (rhs )
569- pkging , has_ver = optional_import ("packaging" )
569+ has_ver = optional_import ("packaging" )
570570 if has_ver :
571571 try :
572- return cast (bool , pkging . version . Version (lhs ) <= pkging . version . Version (rhs ))
572+ return cast (bool , version (lhs ) <= version (rhs ))
573573 except version .InvalidVersion :
574574 return True
575575
@@ -593,10 +593,10 @@ def version_geq(lhs: str, rhs: str) -> bool:
593593
594594 """
595595 lhs , rhs = str (lhs ), str (rhs )
596- pkging , has_ver = optional_import ("packaging" )
596+ has_ver = optional_import ("packaging" )
597597 if has_ver :
598598 try :
599- return cast (bool , pkging . version . Version (lhs ) >= pkging . version . Version (rhs ))
599+ return cast (bool , version (lhs ) >= version (rhs ))
600600 except version .InvalidVersion :
601601 return True
602602
0 commit comments