Skip to content

Commit baca6e0

Browse files
authored
[DLMED] remove warning (#1962)
Signed-off-by: Nic Ma <[email protected]>
1 parent 7581255 commit baca6e0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

monai/utils/module.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,9 @@ def min_version(the_module, min_version_str: str = "") -> bool:
9696
Returns True if the module's version is greater or equal to the 'min_version'.
9797
When min_version_str is not provided, it always returns True.
9898
"""
99-
if not min_version_str:
99+
if not min_version_str or not hasattr(the_module, "__version__"):
100100
return True # always valid version
101-
if not hasattr(the_module, "__version__"):
102-
warnings.warn(f"{the_module} has no attribute __version__ in min_version check.")
103-
return True # min_version is the default, shouldn't be noisy
101+
104102
mod_version = tuple(int(x) for x in the_module.__version__.split(".")[:2])
105103
required = tuple(int(x) for x in min_version_str.split(".")[:2])
106104
return mod_version >= required

0 commit comments

Comments
 (0)