class and method names
lucsorel opened this issue · 1 comments
lucsorel commented
class and method names
lucsorel commented
function calls are well traced (module and function names), but class methods are not for now:
- method names appear without the class name before them
- named tuples appear as
namedtuple_Person
as module name instead of their proper module (thus placed outside of their module in the diagram) and their instantiation refers to the__new__
function name without the proper Person class name
Hints
When instantiating a named tuple (but that may apply to other classes too):
frame.f_globals.get('__new__')
refers to<function Person.__new__ at 0x7fc50d9b3820>
frame.f_locals.get('_cls')
refers to<class 'bin.module.Person'>
from typing import NamedTuple
from pydoctrace.doctrace import trace_to_sequence_puml, trace_to_component_puml
class Person(NamedTuple):
firstname: str
lastname: str
def create_person(firstname, lastname):
return Person(firstname, lastname)
# @trace_to_sequence_puml
@trace_to_component_puml
def main():
person = create_person("Suzie", "Q")
print(person)
if __name__ == "__main__":
main()