@@ -29,10 +29,10 @@ def handle_inheritance_relation(
2929 )
3030
3131def inspect_static_attributes (
32- class_type_fqn : str ,
33- definition_attrs : List [UmlAttribute ],
3432 class_type : Type ,
33+ class_type_fqn : str ,
3534 root_module_name : str ,
35+ domain_items_by_fqn : Dict [str , UmlItem ],
3636 domain_relations : List [UmlRelation ]
3737) -> List [UmlAttribute ]:
3838 '''
@@ -46,7 +46,8 @@ def inspect_static_attributes(
4646 name = class_type .__name__ ,
4747 fqn = class_type_fqn ,
4848 attributes = definition_attrs ,
49- is_abstract = isabstract (class_type )
49+ is_abstract = isabstract (class_type ),
50+ methods = []
5051 )
5152 domain_items_by_fqn [class_type_fqn ] = uml_class
5253 # investigate_domain_definition(class_type)
@@ -91,49 +92,33 @@ def inspect_static_attributes(
9192def inspect_methods (
9293 definition_methods , class_type ,
9394):
94- no_dunder = lambda x : not (x [0 ].startswith ('__' ) or x [0 ].endswith ('__' ))
95+ no_dunder = lambda method_name : not (method_name [0 ].startswith ('__' ) or method_name [0 ].endswith ('__' ))
9596 methods = filter (no_dunder , getmembers (class_type , callable ))
9697 for name , method in methods :
97- signature = signature (method )
98+ method_signature = signature (method )
9899 uml_method = UmlMethod (
99100 name = name ,
100- signature = str (signature ),
101+ signature = str (method_signature ),
101102 )
102103 definition_methods .append (uml_method )
103104
104105
105- def handle_class_type (
106- class_type : Type ,
107- class_type_fqn : str ,
108- domain_items_by_fqn : Dict [str , UmlItem ],
109- ) -> UmlClass :
110- definition_attrs : List [UmlAttribute ] = []
111- definition_methods : List [UmlMethod ] = []
112- uml_class = UmlClass (
113- name = class_type .__name__ ,
114- fqn = class_type_fqn ,
115- attributes = definition_attrs ,
116- methods = definition_methods ,
117- is_abstract = isabstract (class_type )
118- )
119- domain_items_by_fqn [class_type_fqn ] = uml_class
120- return uml_class
121-
122106def inspect_class_type (
123107 class_type : Type ,
124108 class_type_fqn : str ,
125109 root_module_name : str ,
126110 domain_items_by_fqn : Dict [str , UmlItem ],
127111 domain_relations : List [UmlRelation ]
128112):
129- uml_class = handle_class_type ( class_type , class_type_fqn , domain_items_by_fqn )
130- inspect_static_attributes (
131- class_type_fqn , uml_class . attributes , class_type , root_module_name , domain_relations
113+ attributes = inspect_static_attributes (
114+ class_type , class_type_fqn , root_module_name ,
115+ domain_items_by_fqn , domain_relations
132116 )
133- inspect_methods (uml_class .methods , class_type )
134117 instance_attributes , compositions = parse_class_constructor (class_type , class_type_fqn , root_module_name )
135- uml_class . attributes .extend (instance_attributes )
118+ attributes .extend (instance_attributes )
136119 domain_relations .extend (compositions .values ())
120+
121+ inspect_methods (domain_items_by_fqn [class_type_fqn ].methods , class_type )
137122
138123 handle_inheritance_relation (class_type , class_type_fqn , root_module_name , domain_relations )
139124
@@ -144,12 +129,13 @@ def inspect_dataclass_type(
144129 domain_items_by_fqn : Dict [str , UmlItem ],
145130 domain_relations : List [UmlRelation ]
146131):
147- uml_class = handle_class_type (class_type , class_type_fqn , domain_items_by_fqn )
148- inspect_static_attributes (
149- class_type_fqn , uml_class .attributes , class_type , root_module_name , domain_relations
150- )
151- inspect_methods (uml_class .methods , class_type )
152- for attribute in uml_class .attributes :
132+ for attribute in inspect_static_attributes (
133+ class_type ,
134+ class_type_fqn ,
135+ root_module_name ,
136+ domain_items_by_fqn ,
137+ domain_relations
138+ ):
153139 attribute .static = False
154140
155- handle_inheritance_relation (class_type , class_type_fqn , root_module_name , domain_relations )
141+ handle_inheritance_relation (class_type , class_type_fqn , root_module_name , domain_relations )
0 commit comments