Skip to content

Commit

Permalink
Fixing imports
Browse files Browse the repository at this point in the history
Signed-off-by Kelvin R <kelvinrbNsc@gmail.com>
  • Loading branch information
K-Rilla committed Jul 27, 2024
1 parent 967f4ad commit e0c4d21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions monai/utils/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
from typing import Any, Iterable, cast
import torch

import importlib.metadata

## import importlib.metadata
## from packaging import version

# bundle config system flags
# set MONAI_EVAL_EXPR=1 to use 'eval', default value: run_eval=True
Expand Down Expand Up @@ -74,10 +74,10 @@ def look_up_option(
Raise a value error possibly with a guess of the closest match.
Args:
opt_str: The option string or Enum to look up.
opt_str: The option string or Enum to look up.
supported: The collection of supported options, it can be list, tuple, set, dict, or Enum.
default: If it is given, this method will return `default` when `opt_str` is not found,
instead of raising a `ValueError`. Otherwise, it defaults to `"no_default"`,
instead of raising a `ValueError`. Otherwise, it defaults to `"no_default"`,
so that the method may raise a `ValueError`.
print_all_options: whether to print all available options when `opt_str` is not found. Defaults to True
Expand Down Expand Up @@ -566,10 +566,10 @@ def version_leq(lhs: str, rhs: str) -> bool:
"""

lhs, rhs = str(lhs), str(rhs)
pkging, has_ver = optional_import("packaging")
has_ver = optional_import("packaging")
if has_ver:
try:
return cast(bool, pkging.version.Version(lhs) <= pkging.version.Version(rhs))
return cast(bool, version(lhs) <= version(rhs))
except version.InvalidVersion:
return True

Expand All @@ -593,10 +593,10 @@ def version_geq(lhs: str, rhs: str) -> bool:
"""
lhs, rhs = str(lhs), str(rhs)
pkging, has_ver = optional_import("packaging")
has_ver = optional_import("packaging")
if has_ver:
try:
return cast(bool, pkging.version.Version(lhs) >= pkging.version.Version(rhs))
return cast(bool, version(lhs) >= version(rhs))
except version.InvalidVersion:
return True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import versioneer

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

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

0 comments on commit e0c4d21

Please sign in to comment.