Skip to content

Commit 8d16cee

Browse files
committed
Fix: Preventing from collecting imported classes
would collect imported classes e.g. those from core sklearn, for testing, which is undesired behavior, the fix filters away any classes that are not from the imported module i.e. they are not defined within target module
1 parent f98fbef commit 8d16cee

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

denmune_skl/utils/discovery.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ def is_abstract(c):
7777
module = import_module(module_name)
7878
classes = inspect.getmembers(module, inspect.isclass)
7979
classes = [
80-
(name, est_cls) for name, est_cls in classes if not name.startswith("_")
80+
(name, est_cls)
81+
for name, est_cls in classes
82+
# Prevents discovery util function from collecting imported classes
83+
# from sklearn
84+
if not name.startswith("_") and est_cls.__module__ == module_name
8185
]
8286

8387
all_classes.extend(classes)

0 commit comments

Comments
 (0)