diff options
author | Emile Anclin <emile.anclin@logilab.fr> | 2008-09-02 12:06:01 +0200 |
---|---|---|
committer | Emile Anclin <emile.anclin@logilab.fr> | 2008-09-02 12:06:01 +0200 |
commit | 5f07d71f177eda51f043663701cef3eaa25d25a3 (patch) | |
tree | ab89a9201c5e635fa19881155bd160a39f5ce128 /pyreverse | |
parent | 89a4fb6d68375e0a754b84251264711999d177bc (diff) | |
download | pylint-git-5f07d71f177eda51f043663701cef3eaa25d25a3.tar.gz |
doc, docstrings and some cleanup
Diffstat (limited to 'pyreverse')
-rw-r--r-- | pyreverse/diadefslib.py | 25 | ||||
-rw-r--r-- | pyreverse/diagrams.py | 9 |
2 files changed, 20 insertions, 14 deletions
diff --git a/pyreverse/diadefslib.py b/pyreverse/diadefslib.py index 1b18414d7..b36acdb6d 100644 --- a/pyreverse/diadefslib.py +++ b/pyreverse/diadefslib.py @@ -56,17 +56,18 @@ class DiadefsResolverHelper: """fetch objects in the project according to the diagram definition from a XML file """ - def __init__(self, project, linker): + def __init__(self, project, linker, config): + self.mode = config.mode self._p = project self.linker = linker - def resolve_packages(self, diadef, mode, diagram=None): + def resolve_packages(self, diadef, diagram=None): """take a package diagram definition dictionnary and return matching objects """ if diagram is None: diagram = PackageDiagram(diadef.get('name', - 'No name packages diagram'), mode) + 'No name packages diagram'), self.mode) for package in diadef['package']: name = package['name'] module = self.get_module(name) @@ -78,17 +79,17 @@ class DiadefsResolverHelper: for node, title in self.get_classes(module): self.linker.visit(node) diagram.add_object(title, node) - self.resolve_classes(diadef, mode, diagram) + self.resolve_classes(diadef, diagram) return diagram - def resolve_classes(self, diadef, mode, diagram=None): + def resolve_classes(self, diadef, diagram=None): """take a class diagram definition dictionnary and return a Diagram instance (given in paramaters or created) """ class_defs = diadef.get('class', []) if diagram is None: diagram = ClassDiagram(diadef.get('name', - 'No name classes diagram'), mode) + 'No name classes diagram'), self.mode) for klass in class_defs: name, module = klass['name'], klass.get('owner', '') c = self.get_class(module, name) @@ -153,15 +154,15 @@ class DiaDefGenerator: def _set_default_options(self): """set different default options with _default dictionary""" mod = {None:False, True:True, False:False} - if self.config.classes: + if self.config.classes: # defaults for class diagram mod[None] = True self.module_names = mod[self.config.module_names] - self._all_ancestors = mod[self.config.all_ancestors] - self._all_associated = mod[self.config.all_associated] + all_ancestors = mod[self.config.all_ancestors] + all_associated = mod[self.config.all_associated] anc_level, ass_level = (0, 0) - if self._all_ancestors: + if all_ancestors: anc_level = -1 - if self._all_associated: + if all_associated: ass_level = -1 if self.config.show_ancestors is not None: anc_level = self.config.show_ancestors @@ -323,7 +324,7 @@ class DiadefsHandler: diagrams = [] if self.config.diadefs_file is not None: diadefs = read_diadefs_file(self.config.diadefs_file) - resolver = DiadefsResolverHelper(project, linker) + resolver = DiadefsResolverHelper(project, linker, self.config) for class_diagram in diadefs.get('class-diagram', ()): resolver.resolve_classes(class_diagram) for package_diagram in diadefs.get('package-diagram', ()): diff --git a/pyreverse/diagrams.py b/pyreverse/diagrams.py index d0a018b76..639ed175a 100644 --- a/pyreverse/diagrams.py +++ b/pyreverse/diagrams.py @@ -20,9 +20,11 @@ from logilab import astng from pyreverse.utils import is_interface, FilterMixIn def set_counter(value): + """Figure counter (re)set""" Figure._UID_COUNT = value class Figure: + """base class for counter handling""" _UID_COUNT = 0 def __init__(self): Figure._UID_COUNT += 1 @@ -48,7 +50,7 @@ class DiagramEntity(Figure): self.node = node class ClassDiagram(Figure, FilterMixIn): - """a class diagram objet + """main class diagram handling """ TYPE = 'class' def __init__(self, title, mode): @@ -60,7 +62,8 @@ class ClassDiagram(Figure, FilterMixIn): self._nodes = {} self.depends = [] - def add_relationship(self, from_object, to_object, relation_type, name=None): + def add_relationship(self, from_object, to_object, + relation_type, name=None): """create a relation ship """ rel = Relationship(from_object, to_object, relation_type, name) @@ -179,6 +182,8 @@ class ClassDiagram(Figure, FilterMixIn): continue class PackageDiagram(ClassDiagram): + """package diagram handling + """ TYPE = 'package' def modules(self): |