Skip to content

Commit

Permalink
add parameters with annotation to the methods
Browse files Browse the repository at this point in the history
  • Loading branch information
xmnlab committed Jun 25, 2024
1 parent 0b7db00 commit 6c5aa01
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/umlizer/class_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,14 @@ def _get_entity_class_uml(klass: ClassDef) -> str:
methods_raw = []
for m_name, m_metadata in methods_struct.items():
m_visibility = '-' if m_name.startswith('_') else '+'
m_type = m_metadata.get('return', 'Any')
methods_raw.append(f'{m_visibility} {m_name}(): {m_type}')
m_type = m_metadata.get('return', 'Any').replace('builtins.', '')
m_params_raw = [
f"{k}: {v.replace('builtins.', '')}"
for k, v in m_metadata.items()
if k != 'return'
]
m_params = ', '.join(m_params_raw)
methods_raw.append(f'{m_visibility} {m_name}({m_params}): {m_type}')

methods = '\\l'.join(methods_raw) + '\\l'

Expand Down

0 comments on commit 6c5aa01

Please sign in to comment.