Skip to content

pyreverse methods do not show parameters #2139

@ChrisMayfield

Description

@ChrisMayfield

Pyreverse does not seem to include any parameters in UML class diagrams. All methods are listed with empty parameter lists.

Steps to reproduce

  1. Write a Python class with methods that take parameters (see code below)
  2. pyreverse -o png -f ALL cow.py (see png below)

Current behavior

All methods are shown having no parameters (empty parentheses).

Expected behavior

The eat and move methods should have item and delta parameters shown in the diagram. And __init__ should perhaps have position (even though it has a default value).

pylint --version output

pylint 1.9.1,
astroid 1.6.4
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 03:03:55)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]

"""A Cow can speak, move, and eat."""


class Cow(object):
    """Cows are simple animals.

    Cows have 4 legs (are "quadrupeds") and walk,
    eat grass (are "herbivores"), and say "moo".
    """

    def __init__(self, position=(0, 0)):
        """Instantiate a new instance of the Cow class.

        In instantiating the cow class, you may opt to provide
        a starting position.
        """
        self.position = position
        self.stomach = []
        self.respired = 0

    def speak(self):
        """Cow says "moo"."""
        return "moo"

    def move(self, delta):
        """Cow walks on 4 legs."""
        self.position = (self.position[0] + delta[0],
                         self.position[1] + delta[1])
        return "This quadruped walked to " + str(self.position)

    def eat(self, item):
        """Cow eats grass."""
        if item == "grass":
            self.stomach.append(item)
            return "ate " + item
        else:
            return "This herbivore doesn't eat " + item

    def respire(self):
        """Cow respired."""
        self.respired += 1
        return "This cow respired through its nostrils."

cow

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancement ✨Improvement to a componentpyreverseRelated to pyreverse component

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions