Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions monai/utils/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,11 +540,11 @@ def version_leq(lhs: str, rhs: str) -> bool:
"""

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

lhs_, rhs_ = parse_version_strs(lhs, rhs)
Expand All @@ -567,12 +567,12 @@ def version_geq(lhs: str, rhs: str) -> bool:

"""
lhs, rhs = str(lhs), str(rhs)
pkging, has_ver = optional_import("packaging.Version")
pkging, has_ver = optional_import("packaging.version")

if has_ver:
try:
return cast(bool, pkging.version.Version(lhs) >= pkging.version.Version(rhs))
except pkging.version.InvalidVersion:
return cast(bool, pkging.Version(lhs) >= pkging.Version(rhs))
except pkging.InvalidVersion:
return True

lhs_, rhs_ = parse_version_strs(lhs, rhs)
Expand Down
Loading