Skip to content

Commit e0c4d21

Browse files
committed
Fixing imports
Signed-off-by Kelvin R <kelvinrbNsc@gmail.com>
1 parent 967f4ad commit e0c4d21

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

monai/utils/module.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
from typing import Any, Iterable, cast
3030
import 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

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import versioneer
2424

25-
# TODO: debug mode -g -O0, compile test cases
25+
# TODO: debug mode -g -O0, compile test cases
2626

2727
RUN_BUILD = os.getenv("BUILD_MONAI", "0") == "1"
2828
FORCE_CUDA = os.getenv("FORCE_CUDA", "0") == "1" # flag ignored if BUILD_MONAI is False

0 commit comments

Comments
 (0)