Hello everybody,

I write about the tool pyreverse,
in the package pylint
http://pypi.python.org/pypi/pyreverse

I found that when we have a statically typed
attribute in a class
(typed --> we create it on the fly so
the type is assigned), and we would like
the diamond arrow in the UML diagram,
pyreverse get it right only if the
two classes are in the same module.

Here a minimal example; you'll find
attached the diagramas I got.

#----------------------------
# this is the file module1.py
class Wave:
    def hi(self):
        print "hello world"
#----------------------------

#----------------------------
#!/usr/bin/python

# this is file main.py
import module1

class WaveUser():
    def __init__(self):
        self.wave = module1.Wave()

wu = WaveUser()
wu.wave.hi()
#----------------------------

now I create the diagrams:

bash-3.2$ pyreverse module1.py main.py
[...]
bash-3.2$ dot -Tpng classes_No_Name.dot -o wrong.png

(you'll find the file wrong.png here:
http://www-sop.inria.fr/members/Giovanni.Gherdovich/tmp/wrong.png
Now the same thing but all in one module:

#----------------------------
#!/usr/bin/python

# this is file main.py
class Wave:
    def hi(self):
        print "hello world"

class WaveUser():
    def __init__(self):
        self.wave = Wave()

wu = WaveUser()
wu.wave.hi()
#----------------------------

Again, I launch pyreverse:

bash-3.2$ pyreverse main.py
[...]
bash-3.2$ dot -Tpng classes_No_Name.dot -o right.png

(right.png is here:
http://www-sop.inria.fr/members/Giovanni.Gherdovich/tmp/right.png )

Am I missing something, i.e. some options from
command line?
Should I consider this a bug?

Best regards,
Giovanni Gherdovich
dev engineer, INRIA Sophia Antipolis

PS: This message was sent to python-proje...@logilab.fr
few days ago, but apparently didn't get thru.

_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to