Is there a way to make Pyreverse display arrows for lists?

46 Views Asked by At

I noticed that when a class has a single instance of another class that the arrow between the two classes is being displayed without any problems. But Pyreverse doesn't display arrows between classes if the instance variable is a list. Is there any way to display the arrow between two classes in that case?

Given is the following Python code:

class Class1:
    def __init__(self):
        self.attribute: str

class Class2:
    def __init__(self):
        self.attribute: str

class Class3:
    def __init__(self):
        self.class1_single_instance: Class1
        self.class2_list_instance: list[Class2]

The following UML diagram is produced by Pyreverse: actual output

However I would like to have an output like this: ideal output

As you can see in the ideal output there is an arrow between Class1 and Class2 and the cardinality * is given in order to differentiate between instance variables with cardinality 1 and instance variables with arbitrary cardinality.

I appreciate your help!

0

There are 0 best solutions below