abulka / pynsource

Reverse engineer Python source code into UML
http://pynsource.com
283 stars 40 forks source link

Option to display arguments (and their types) for methods of classes #77

Open abulka opened 4 years ago

abulka commented 4 years ago

Display arguments (and their types) to methods displayed in UML classes. Raised in #75. E.g.

------------------------------
  Class Whatever
------------------------------
__init__(self, a: int, s: str)
doA(self)
doB(self, fred: Fred)
------------------------------

Probably want an option to turn this on and off, as it would add a lot more information to the UML diagram, which some users may not want. Perhaps an option to remove the self argument as it is always going to be there for regular methods of a class.

For class methods and static methods - some indicator showing this should be displayed.

MShekow commented 3 years ago

Do you have any plans on when to implement these features (as well as the related ones created on July 25)? The typing annotations support since 1.77 is better, but the diagrams still lack clarity with these features missing.

ghost commented 2 years ago

Hi

I also would love this feature! As an addition you can also make a feature to display class member variable types.

abulka commented 2 years ago

@pygamedev re displaying class member variable types, Pynsource already does this e.g.

class SomeType: pass

class Foo():
    foovar: SomeType = SomeType()
    def __init__(self, val):
        self.selfvar = val

print(Foo.foovar)
f = Foo(20)
print(f.selfvar)

generates

image

though admittedly having the type appear next to the class variable and/or on the association line would be nice too, which is probably what you mean. Thanks for the feedback.