File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ def _scan_variables_in_module(self, module_name: str) -> None:
51
51
There is no method to verify if a module attribute is a constant,
52
52
After some experiment, here we assume if an attribute is a value
53
53
(without `__module__`) and not a module itself is a constant.
54
+
55
+ Note: Class (and other types) should be treated as a variable too
54
56
"""
55
57
for constant_name , _ in inspect .getmembers (
56
58
importlib .import_module (module_name ),
@@ -61,6 +63,13 @@ def _scan_variables_in_module(self, module_name: str) -> None:
61
63
full_path = f"{ module_name } .{ constant_name } "
62
64
self .variables .add (full_path )
63
65
66
+ for class_name , _class in inspect .getmembers (importlib .import_module (module_name ), inspect .isclass ):
67
+ # Skip imported and ones starting with "_"
68
+ if _class .__module__ != module_name or class_name .startswith ("_" ):
69
+ continue
70
+ full_path = f"{ module_name } .{ class_name } "
71
+ self .variables .add (full_path )
72
+
64
73
def _scan_classes_in_module (self , module_name : str ) -> None :
65
74
for class_name , _class in inspect .getmembers (importlib .import_module (module_name ), inspect .isclass ):
66
75
# Skip imported and ones starting with "_"
You can’t perform that action at this time.
0 commit comments