diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2018-08-15 22:40:56 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2018-08-15 22:40:56 +0200 |
commit | e837bb112591dced80eb7ddbae532aec9fcd19bb (patch) | |
tree | c36562cb8eb8730e3c5644a46f35bb7ba6713e8d | |
parent | 7295c95cf23a2f4c05d1cb16f3da26663aed444e (diff) | |
download | pylint-git-e837bb112591dced80eb7ddbae532aec9fcd19bb.tar.gz |
Rename variables to remove licentious language
-rw-r--r-- | pylint/checkers/utils.py | 12 | ||||
-rw-r--r-- | pylint/pyreverse/diadefslib.py | 40 | ||||
-rw-r--r-- | pylint/pyreverse/diagrams.py | 24 | ||||
-rw-r--r-- | pylint/pyreverse/main.py | 4 | ||||
-rw-r--r-- | pylint/pyreverse/writer.py | 4 |
5 files changed, 42 insertions, 42 deletions
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index ec47ff1e9..216f9b24b 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -212,8 +212,8 @@ def is_defined_before(var_node): _node = var_node.parent while _node: if isinstance(_node, (COMP_NODE_TYPES, astroid.For)): - for ass_node in _node.nodes_of_class(astroid.AssignName): - if ass_node.name == varname: + for assign_node in _node.nodes_of_class(astroid.AssignName): + if assign_node.name == varname: return True elif isinstance(_node, astroid.With): for expr, ids in _node.items: @@ -240,8 +240,8 @@ def is_defined_before(var_node): return True elif isinstance(_node, astroid.ExceptHandler): if isinstance(_node.name, astroid.AssignName): - ass_node = _node.name - if ass_node.name == varname: + assign_node = _node.name + if assign_node.name == varname: return True _node = _node.parent # possibly multiple statements on the same line using semi colon separator @@ -249,8 +249,8 @@ def is_defined_before(var_node): _node = stmt.previous_sibling() lineno = stmt.fromlineno while _node and _node.fromlineno == lineno: - for ass_node in _node.nodes_of_class(astroid.AssignName): - if ass_node.name == varname: + for assign_node in _node.nodes_of_class(astroid.AssignName): + if assign_node.name == varname: return True for imp_node in _node.nodes_of_class((astroid.ImportFrom, astroid.Import)): if varname in [name[1] or name[0] for name in imp_node.names]: diff --git a/pylint/pyreverse/diadefslib.py b/pylint/pyreverse/diadefslib.py index 0bec91dc5..afd5312ea 100644 --- a/pylint/pyreverse/diadefslib.py +++ b/pylint/pyreverse/diadefslib.py @@ -56,20 +56,20 @@ class DiaDefGenerator: self.module_names = self._set_option(self.config.module_names) all_ancestors = self._set_option(self.config.all_ancestors) all_associated = self._set_option(self.config.all_associated) - anc_level, ass_level = (0, 0) + anc_level, association_level = (0, 0) if all_ancestors: anc_level = -1 if all_associated: - ass_level = -1 + association_level = -1 if self.config.show_ancestors is not None: anc_level = self.config.show_ancestors if self.config.show_associated is not None: - ass_level = self.config.show_associated - self.anc_level, self.ass_level = anc_level, ass_level + association_level = self.config.show_associated + self.anc_level, self.association_level = anc_level, association_level def _get_levels(self): """help function for search levels""" - return self.anc_level, self.ass_level + return self.anc_level, self.association_level def show_node(self, node): """true if builtins and not show_builtins""" @@ -95,27 +95,27 @@ class DiaDefGenerator: """return associated nodes of a class node""" if level == 0: return - for ass_nodes in list(klass_node.instance_attrs_type.values()) + \ + for association_nodes in list(klass_node.instance_attrs_type.values()) + \ list(klass_node.locals_type.values()): - for ass_node in ass_nodes: - if isinstance(ass_node, astroid.Instance): - ass_node = ass_node._proxied - if not (isinstance(ass_node, astroid.ClassDef) - and self.show_node(ass_node)): + for node in association_nodes: + if isinstance(node, astroid.Instance): + node = node._proxied + if not (isinstance(node, astroid.ClassDef) + and self.show_node(node)): continue - yield ass_node + yield node - def extract_classes(self, klass_node, anc_level, ass_level): + def extract_classes(self, klass_node, anc_level, association_level): """extract recursively classes related to klass_node""" if self.classdiagram.has_node(klass_node) or not self.show_node(klass_node): return self.add_class(klass_node) for ancestor in self.get_ancestors(klass_node, anc_level): - self.extract_classes(ancestor, anc_level-1, ass_level) + self.extract_classes(ancestor, anc_level - 1, association_level) - for ass_node in self.get_associated(klass_node, ass_level): - self.extract_classes(ass_node, anc_level, ass_level-1) + for node in self.get_associated(klass_node, association_level): + self.extract_classes(node, anc_level, association_level - 1) class DefaultDiadefGenerator(LocalsVisitor, DiaDefGenerator): @@ -164,8 +164,8 @@ class DefaultDiadefGenerator(LocalsVisitor, DiaDefGenerator): add this class to the class diagram definition """ - anc_level, ass_level = self._get_levels() - self.extract_classes(node, anc_level, ass_level) + anc_level, association_level = self._get_levels() + self.extract_classes(node, anc_level, association_level) def visit_importfrom(self, node): """visit astroid.ImportFrom and catch modules for package diagram @@ -196,8 +196,8 @@ class ClassDiadefGenerator(DiaDefGenerator): klass = klass.split('.')[-1] klass = next(module.ilookup(klass)) - anc_level, ass_level = self._get_levels() - self.extract_classes(klass, anc_level, ass_level) + anc_level, association_level = self._get_levels() + self.extract_classes(klass, anc_level, association_level) return self.classdiagram # diagram handler ############################################################# diff --git a/pylint/pyreverse/diagrams.py b/pylint/pyreverse/diagrams.py index 46eeb807d..27e1092e1 100644 --- a/pylint/pyreverse/diagrams.py +++ b/pylint/pyreverse/diagrams.py @@ -81,11 +81,11 @@ class ClassDiagram(Figure, FilterMixIn): if isinstance(m, astroid.FunctionDef) and decorated_with_property(m) ] - for node_name, ass_nodes in list(node.instance_attrs_type.items()) + \ + for node_name, associated_nodes in list(node.instance_attrs_type.items()) + \ list(node.locals_type.items()) + properties: if not self.show_attr(node_name): continue - names = self.class_names(ass_nodes) + names = self.class_names(associated_nodes) if names: node_name = "%s : %s" % (node_name, ", ".join(names)) attrs.append(node_name) @@ -112,14 +112,14 @@ class ClassDiagram(Figure, FilterMixIn): def class_names(self, nodes): """return class names if needed in diagram""" names = [] - for ass_node in nodes: - if isinstance(ass_node, astroid.Instance): - ass_node = ass_node._proxied - if isinstance(ass_node, astroid.ClassDef) \ - and hasattr(ass_node, "name") and not self.has_node(ass_node): - if ass_node.name not in names: - ass_name = ass_node.name - names.append(ass_name) + for node in nodes: + if isinstance(node, astroid.Instance): + node = node._proxied + if isinstance(node, astroid.ClassDef) \ + and hasattr(node, "name") and not self.has_node(node): + if node.name not in names: + node_name = node.name + names.append(node_name) return names def nodes(self): @@ -184,8 +184,8 @@ class ClassDiagram(Figure, FilterMixIn): if isinstance(value, astroid.Instance): value = value._proxied try: - ass_obj = self.object_from_node(value) - self.add_relationship(ass_obj, obj, 'association', name) + associated_obj = self.object_from_node(value) + self.add_relationship(associated_obj, obj, 'association', name) except KeyError: continue diff --git a/pylint/pyreverse/main.py b/pylint/pyreverse/main.py index 12547872b..ea79bae24 100644 --- a/pylint/pyreverse/main.py +++ b/pylint/pyreverse/main.py @@ -51,8 +51,8 @@ OPTIONS = ( dict(short="A", default=None, help="show all ancestors off all classes in <projects>")), ("show-associated", - dict(short='s', action="store", metavar='<ass_level>', type='int', - help='show <ass_level> levels of associated classes not in <projects>')), + dict(short='s', action="store", metavar='<association_level>', type='int', + help='show <association_level> levels of associated classes not in <projects>')), ("all-associated", dict(short='S', default=None, help='show recursively all associated off all associated classes')), diff --git a/pylint/pyreverse/writer.py b/pylint/pyreverse/writer.py index 9df1eff4d..f11cb7966 100644 --- a/pylint/pyreverse/writer.py +++ b/pylint/pyreverse/writer.py @@ -22,7 +22,7 @@ class DiagramWriter: """ def __init__(self, config, styles): self.config = config - self.pkg_edges, self.inh_edges, self.imp_edges, self.ass_edges = styles + self.pkg_edges, self.inh_edges, self.imp_edges, self.association_edges = styles self.printer = None # defined in set_printer def write(self, diadefs): @@ -66,7 +66,7 @@ class DiagramWriter: # generate associations for rel in diagram.get_relationships('association'): self.printer.emit_edge(rel.from_object.fig_id, rel.to_object.fig_id, - label=rel.name, **self.ass_edges) + label=rel.name, **self.association_edges) def set_printer(self, file_name, basename): """set printer""" |