|
Revision 181, 0.8 kB
(checked in by arjanmol, 6 years ago)
|
*** empty log message ***
|
- Property svn:eol-style set to
native
- Property svn:executable set to
*
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
import sys |
|---|
| 11 |
|
|---|
| 12 |
sys.path.append("..") |
|---|
| 13 |
|
|---|
| 14 |
from gaphor.UML import * |
|---|
| 15 |
|
|---|
| 16 |
done = [ object ] |
|---|
| 17 |
def print_vars(cls): |
|---|
| 18 |
global done |
|---|
| 19 |
done.append(cls) |
|---|
| 20 |
print cls.__name__ + ":" |
|---|
| 21 |
dict = cls._attrdef |
|---|
| 22 |
for key in dict.keys(): |
|---|
| 23 |
print "\t" + key + ":", |
|---|
| 24 |
if type(dict[key][0]) is type(Sequence): |
|---|
| 25 |
print "Sequence of " + dict[key][1].__name__, |
|---|
| 26 |
else: |
|---|
| 27 |
print "Instance of " + dict[key][1].__name__, |
|---|
| 28 |
if len(dict[key]) > 2: |
|---|
| 29 |
print "( <-> " + dict[key][2] + ")" |
|---|
| 30 |
else: |
|---|
| 31 |
print "" |
|---|
| 32 |
for base in cls.__bases__: |
|---|
| 33 |
if base not in done: |
|---|
| 34 |
print_vars(base) |
|---|
| 35 |
|
|---|
| 36 |
args = sys.argv[1:] |
|---|
| 37 |
|
|---|
| 38 |
if args: |
|---|
| 39 |
cls = eval(args[0]) |
|---|
| 40 |
print_vars(cls) |
|---|
| 41 |
else: |
|---|
| 42 |
print "Usage: " + sys.argv[0] + " <UML class name>" |
|---|
| 43 |
sys.exit(1) |
|---|