diff options
Diffstat (limited to 'pyreverse')
-rw-r--r-- | pyreverse/diadefslib.py | 22 | ||||
-rw-r--r-- | pyreverse/diagrams.py | 18 | ||||
-rw-r--r-- | pyreverse/main.py | 6 | ||||
-rw-r--r-- | pyreverse/utils.py | 2 |
4 files changed, 24 insertions, 24 deletions
diff --git a/pyreverse/diadefslib.py b/pyreverse/diadefslib.py index 68ca68c..ebdf095 100644 --- a/pyreverse/diadefslib.py +++ b/pyreverse/diadefslib.py @@ -18,8 +18,8 @@ from logilab.common.compat import builtins BUILTINS_NAME = builtins.__name__ -from logilab import astng -from logilab.astng.utils import LocalsVisitor +import astroid +from astroid.utils import LocalsVisitor from pylint.pyreverse.diagrams import PackageDiagram, ClassDiagram @@ -100,9 +100,9 @@ class DiaDefGenerator: for ass_nodes in klass_node.instance_attrs_type.values() + \ klass_node.locals_type.values(): for ass_node in ass_nodes: - if isinstance(ass_node, astng.Instance): + if isinstance(ass_node, astroid.Instance): ass_node = ass_node._proxied - if not (isinstance(ass_node, astng.Class) + if not (isinstance(ass_node, astroid.Class) and self.show_node(ass_node)): continue yield ass_node @@ -132,7 +132,7 @@ class DefaultDiadefGenerator(LocalsVisitor, DiaDefGenerator): LocalsVisitor.__init__(self) def visit_project(self, node): - """visit an astng.Project node + """visit an astroid.Project node create a diagram definition for packages """ @@ -144,7 +144,7 @@ class DefaultDiadefGenerator(LocalsVisitor, DiaDefGenerator): self.classdiagram = ClassDiagram('classes %s' % node.name, mode) def leave_project(self, node): - """leave the astng.Project node + """leave the astroid.Project node return the generated diagram definition """ @@ -153,7 +153,7 @@ class DefaultDiadefGenerator(LocalsVisitor, DiaDefGenerator): return self.classdiagram, def visit_module(self, node): - """visit an astng.Module node + """visit an astroid.Module node add this class to the package diagram definition """ @@ -162,7 +162,7 @@ class DefaultDiadefGenerator(LocalsVisitor, DiaDefGenerator): self.pkgdiagram.add_object(node.name, node) def visit_class(self, node): - """visit an astng.Class node + """visit an astroid.Class node add this class to the class diagram definition """ @@ -170,7 +170,7 @@ class DefaultDiadefGenerator(LocalsVisitor, DiaDefGenerator): self.extract_classes(node, anc_level, ass_level) def visit_from(self, node): - """visit astng.From and catch modules for package diagram + """visit astroid.From and catch modules for package diagram """ if self.pkgdiagram: self.pkgdiagram.add_from_depend(node, node.modname) @@ -215,8 +215,8 @@ class DiadefsHandler: def get_diadefs(self, project, linker): """get the diagrams configuration data - :param linker: astng.inspector.Linker(IdGeneratorMixIn, LocalsVisitor) - :param project: astng.manager.Project + :param linker: astroid.inspector.Linker(IdGeneratorMixIn, LocalsVisitor) + :param project: astroid.manager.Project """ # read and interpret diagram definitions (Diadefs) diff --git a/pyreverse/diagrams.py b/pyreverse/diagrams.py index b411bd0..7cb5930 100644 --- a/pyreverse/diagrams.py +++ b/pyreverse/diagrams.py @@ -16,7 +16,7 @@ """diagram objects """ -from logilab import astng +import astroid from pylint.pyreverse.utils import is_interface, FilterMixIn def set_counter(value): @@ -42,7 +42,7 @@ class Relationship(Figure): class DiagramEntity(Figure): - """a diagram object, i.e. a label associated to an astng node + """a diagram object, i.e. a label associated to an astroid node """ def __init__(self, title='No name', node=None): Figure.__init__(self) @@ -93,7 +93,7 @@ class ClassDiagram(Figure, FilterMixIn): def get_methods(self, node): """return visible methods""" return [m for m in node.values() - if isinstance(m, astng.Function) and self.show_attr(m.name)] + if isinstance(m, astroid.Function) and self.show_attr(m.name)] def add_object(self, title, node): """create a diagram object @@ -107,9 +107,9 @@ class ClassDiagram(Figure, FilterMixIn): """return class names if needed in diagram""" names = [] for ass_node in nodes: - if isinstance(ass_node, astng.Instance): + if isinstance(ass_node, astroid.Instance): ass_node = ass_node._proxied - if isinstance(ass_node, astng.Class) \ + if isinstance(ass_node, astroid.Class) \ and hasattr(ass_node, "name") and not self.has_node(ass_node): if ass_node.name not in names: ass_name = ass_node.name @@ -133,7 +133,7 @@ class ClassDiagram(Figure, FilterMixIn): def classes(self): """return all class nodes in the diagram""" - return [o for o in self.objects if isinstance(o.node, astng.Class)] + return [o for o in self.objects if isinstance(o.node, astroid.Class)] def classe(self, name): """return a class by its name, raise KeyError if not found @@ -173,9 +173,9 @@ class ClassDiagram(Figure, FilterMixIn): for name, values in node.instance_attrs_type.items() + \ node.locals_type.items(): for value in values: - if value is astng.YES: + if value is astroid.YES: continue - if isinstance( value, astng.Instance): + if isinstance( value, astroid.Instance): value = value._proxied try: ass_obj = self.object_from_node(value) @@ -191,7 +191,7 @@ class PackageDiagram(ClassDiagram): def modules(self): """return all module nodes in the diagram""" - return [o for o in self.objects if isinstance(o.node, astng.Module)] + return [o for o in self.objects if isinstance(o.node, astroid.Module)] def module(self, name): """return a module by its name, raise KeyError if not found diff --git a/pyreverse/main.py b/pyreverse/main.py index 4e4458c..cdd6607 100644 --- a/pyreverse/main.py +++ b/pyreverse/main.py @@ -21,8 +21,8 @@ import sys, os from logilab.common.configuration import ConfigurationMixIn -from logilab.astng.manager import ASTNGManager -from logilab.astng.inspector import Linker +from astroid.manager import AstroidManager +from astroid.inspector import Linker from pylint.pyreverse.diadefslib import DiadefsHandler from pylint.pyreverse import writer @@ -92,7 +92,7 @@ class Run(ConfigurationMixIn): def __init__(self, args): ConfigurationMixIn.__init__(self, usage=__doc__) insert_default_options() - self.manager = ASTNGManager() + self.manager = AstroidManager() self.register_options_provider(self.manager) args = self.load_command_line_configuration() sys.exit(self.run(args)) diff --git a/pyreverse/utils.py b/pyreverse/utils.py index ea8b67c..58263b6 100644 --- a/pyreverse/utils.py +++ b/pyreverse/utils.py @@ -50,7 +50,7 @@ def insert_default_options(): -# astng utilities ########################################################### +# astroid utilities ########################################################### SPECIAL = re.compile('^__[A-Za-z0-9]+[A-Za-z0-9_]*__$') PRIVATE = re.compile('^__[_A-Za-z0-9]*[A-Za-z0-9]+_?$') |