Skip to content

Commit

Permalink
[DLMED] fix windows test
Browse files Browse the repository at this point in the history
Signed-off-by: Nic Ma <[email protected]>
  • Loading branch information
Nic-Ma committed Dec 20, 2021
1 parent 1a9bb2d commit 5f11e8e
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions monai/apps/mmars/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,17 @@ def __init__(self, pkgs: Sequence[str], modules: Sequence[str]):
def _create_classes_table(self):
class_table = {}
for pkg in self.pkgs:
package = __import__(pkg)
package = importlib.import_module(pkg)

for _, modname, _ in pkgutil.walk_packages(path=package.__path__, prefix=package.__name__ + "."):
if modname.startswith(pkg):
if any(name in modname for name in self.modules):
try:
module = importlib.import_module(modname)
for name, obj in inspect.getmembers(module):
if inspect.isclass(obj) and obj.__module__ == modname:
class_table[name] = modname
except ModuleNotFoundError:
pass
if any(name in modname for name in self.modules):
try:
module = importlib.import_module(modname)
for name, obj in inspect.getmembers(module):
if inspect.isclass(obj) and obj.__module__ == modname:
class_table[name] = modname
except ModuleNotFoundError:
pass
return class_table

def get_module_name(self, class_name):
Expand Down

0 comments on commit 5f11e8e

Please sign in to comment.