Skip to content

Commit

Permalink
ci: Fix interface scan omits types (e.g., ConnectorResourceReference) (
Browse files Browse the repository at this point in the history
  • Loading branch information
aahung authored Feb 9, 2023
1 parent 1361032 commit 787dd9e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bin/public_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def _scan_variables_in_module(self, module_name: str) -> None:
There is no method to verify if a module attribute is a constant,
After some experiment, here we assume if an attribute is a value
(without `__module__`) and not a module itself is a constant.
Note: Class (and other types) should be treated as a variable too
"""
for constant_name, _ in inspect.getmembers(
importlib.import_module(module_name),
Expand All @@ -61,6 +63,13 @@ def _scan_variables_in_module(self, module_name: str) -> None:
full_path = f"{module_name}.{constant_name}"
self.variables.add(full_path)

for class_name, _class in inspect.getmembers(importlib.import_module(module_name), inspect.isclass):
# Skip imported and ones starting with "_"
if _class.__module__ != module_name or class_name.startswith("_"):
continue
full_path = f"{module_name}.{class_name}"
self.variables.add(full_path)

def _scan_classes_in_module(self, module_name: str) -> None:
for class_name, _class in inspect.getmembers(importlib.import_module(module_name), inspect.isclass):
# Skip imported and ones starting with "_"
Expand Down

0 comments on commit 787dd9e

Please sign in to comment.