Skip to content

Commit

Permalink
add unknown type for builtin attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
xmnlab committed Jun 25, 2024
1 parent 7105519 commit 0b7db00
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/umlizer/class_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _get_classic_class_structure(klass: Type[Any]) -> ClassDef:
for k in list(klass.__dict__.keys()):
if k.startswith('__') or k in _methods:
continue
value = klass_anno.get(k, '')
value = klass_anno.get(k, 'UNKNOWN')
fields[k] = getattr(value, '__value__', str(value))

if not fields:
Expand Down Expand Up @@ -334,6 +334,7 @@ def _get_classes_from_module(module_path: str) -> list[Type[Any]]:
print(f' Error loading module {module_name} '.center(80, '='))
print(e)
print('.' * 80)
sys.path = original_path
return []
return classes_list

Expand Down Expand Up @@ -385,21 +386,19 @@ def load_classes_definition(
If the provided path is not a directory.
"""
classes_list = []
module_files = []

path_str = str(source)

if not os.path.exists(path_str):
raise_error(f'Path "{path_str}" doesn\'t exist.', 1)
if os.path.isdir(path_str):
sys.path.insert(0, path_str)

for f in _search_modules(path_str):
classes_list.extend(_get_classes_from_module(f))
module_files.extend(_search_modules(path_str))
else:
classes_list.extend(_get_classes_from_module(path_str))
module_files.append(path_str)

result = []
for c in classes_list:
result.append(_get_class_structure(c))
for file_path in module_files:
classes_list.extend(_get_classes_from_module(file_path))

return result
return [_get_class_structure(cls) for cls in classes_list]

0 comments on commit 0b7db00

Please sign in to comment.