Skip to content

Commit abf8d69

Browse files
committed
feat: quietly ignore failed compound type shortening
1 parent 8df2558 commit abf8d69

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

py2puml/inspection/inspectclass.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from inspect import isabstract
44
from re import compile as re_compile
55
from typing import Dict, List, Type
6+
from warnings import warn
67

78
from py2puml.domain.umlclass import UmlAttribute, UmlClass
89
from py2puml.domain.umlitem import UmlItem
@@ -68,9 +69,13 @@ def inspect_static_attributes(
6869
attr_type = concrete_type
6970
# compound type (tuples, lists, dictionaries, etc.)
7071
else:
71-
attr_type, full_namespaced_definitions = shorten_compound_type_annotation(
72-
attr_raw_type, module_resolver
73-
)
72+
try:
73+
attr_type, full_namespaced_definitions = shorten_compound_type_annotation(
74+
attr_raw_type, module_resolver
75+
)
76+
except ValueError:
77+
warn(f'Failed to shorten compound type annotation "{attr_raw_type}" for attribute "{attr_name}". Skipping.')
78+
continue
7479
relations_by_target_fqdn.update(
7580
{
7681
attr_fqn: UmlRelation(uml_class.fqn, attr_fqn, RelType.COMPOSITION)

0 commit comments

Comments
 (0)