diff options
-rw-r--r-- | examples/custom.py | 6 | ||||
-rw-r--r-- | pylint/checkers/base.py | 8 | ||||
-rw-r--r-- | pylint/checkers/classes.py | 8 | ||||
-rw-r--r-- | pylint/checkers/logging.py | 4 | ||||
-rw-r--r-- | pylint/checkers/stdlib.py | 2 | ||||
-rw-r--r-- | pylint/checkers/strings.py | 10 | ||||
-rw-r--r-- | pylint/checkers/typecheck.py | 8 | ||||
-rw-r--r-- | pylint/checkers/utils.py | 12 | ||||
-rw-r--r-- | pylint/pyreverse/diadefslib.py | 2 | ||||
-rw-r--r-- | pylint/pyreverse/inspector.py | 14 | ||||
-rw-r--r-- | pylint/test/unittest_utils.py | 4 |
11 files changed, 39 insertions, 39 deletions
diff --git a/examples/custom.py b/examples/custom.py index 2182b776e..ee4ed65cf 100644 --- a/examples/custom.py +++ b/examples/custom.py @@ -20,11 +20,11 @@ class MyAstroidChecker(BaseChecker): # this is important so that your checker is executed before others priority = -1 - def visit_callfunc(self, node): - """called when a CallFunc node is encountered. + def visit_call(self, node): + """called when a Call node is encountered. See astroid for the description of available nodes.""" - if not (isinstance(node.func, astroid.Getattr) + if not (isinstance(node.func, astroid.Attribute) and isinstance(node.func.expr, astroid.Name) and node.func.expr.name == 'properties' and node.func.attrname == 'create'): diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py index a0d8c4313..f676cba48 100644 --- a/pylint/checkers/base.py +++ b/pylint/checkers/base.py @@ -74,7 +74,7 @@ REVERSED_COMPS = {'<': '>', '<=': '>=', '>': '<', '>=': '<='} def _redefines_import(node): - """ Detect that the given node (AssName) is inside an + """ Detect that the given node (AssignName) is inside an exception handler and redefines an import from the tryexcept body. Returns True if the node redefines an import, False otherwise. """ @@ -738,7 +738,7 @@ functions, methods # These nodes are excepted, since they are not constant # values, requiring a computation to happen. The only type # of node in this list which doesn't have this property is - # Getattr, which is excepted because the conditional statement + # Attribute, which is excepted because the conditional statement # can be used to verify that the attribute was set inside a class, # which is definitely a valid use case. except_nodes = (astroid.Attribute, astroid.Call, @@ -969,7 +969,7 @@ functions, methods @utils.check_messages('eval-used', 'exec-used', 'bad-reversed-sequence') def visit_call(self, node): - """visit a CallFunc node -> check if this is not a blacklisted builtin + """visit a Call node -> check if this is not a blacklisted builtin call and check for * or ** use """ if isinstance(node.func, astroid.Name): @@ -1507,7 +1507,7 @@ class LambdaForComprehensionChecker(_BasicChecker): @utils.check_messages('deprecated-lambda') def visit_call(self, node): - """visit a CallFunc node, check if map or filter are called with a + """visit a Call node, check if map or filter are called with a lambda """ if not node.args: diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index 9975220b3..98c52c1dd 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -233,9 +233,9 @@ def _called_in_methods(func, klass, methods): except astroid.NotFoundError: continue for infer_method in infered: - for callfunc in infer_method.nodes_of_class(astroid.Call): + for call in infer_method.nodes_of_class(astroid.Call): try: - bound = next(callfunc.func.infer()) + bound = next(call.func.infer()) except (astroid.InferenceError, StopIteration): continue if not isinstance(bound, astroid.BoundMethod): @@ -624,7 +624,7 @@ a metaclass class method.'} except astroid.NotFoundError: for node in nodes: if node.frame().name not in defining_methods: - # If the attribute was set by a callfunc in any + # If the attribute was set by a call in any # of the defining methods, then don't emit # the warning. if _called_in_methods(node.frame(), cnode, @@ -844,7 +844,7 @@ a metaclass class method.'} self._check_in_slots(node) def _check_in_slots(self, node): - """ Check that the given assattr node + """ Check that the given AssignAttr node is defined in the class slots. """ infered = safe_infer(node.expr) diff --git a/pylint/checkers/logging.py b/pylint/checkers/logging.py index d9c1fd78b..96edb1d24 100644 --- a/pylint/checkers/logging.py +++ b/pylint/checkers/logging.py @@ -185,8 +185,8 @@ class LoggingChecker(checkers.BaseChecker): """Checks that function call is not format_string.format(). Args: - node (astroid.node_classes.CallFunc): - CallFunc AST node to be checked. + node (astroid.node_classes.Call): + Call AST node to be checked. """ func = utils.safe_infer(node.func) types = ('str', 'unicode') diff --git a/pylint/checkers/stdlib.py b/pylint/checkers/stdlib.py index 38282c27e..51c886b44 100644 --- a/pylint/checkers/stdlib.py +++ b/pylint/checkers/stdlib.py @@ -179,7 +179,7 @@ class StdlibChecker(BaseChecker): @utils.check_messages('bad-open-mode', 'redundant-unittest-assert', 'deprecated-method') def visit_call(self, node): - """Visit a CallFunc node.""" + """Visit a Call node.""" try: for inferred in node.func.infer(): if inferred.root().name == OPEN_MODULE: diff --git a/pylint/checkers/strings.py b/pylint/checkers/strings.py index 8135b4122..01de6276c 100644 --- a/pylint/checkers/strings.py +++ b/pylint/checkers/strings.py @@ -196,19 +196,19 @@ def parse_format_method_string(format_string): num_args += 1 return keys, num_args, len(manual_pos_arg) -def get_args(callfunc): - """Get the arguments from the given `CallFunc` node. +def get_args(call): + """Get the arguments from the given `Call` node. Return a tuple, where the first element is the number of positional arguments and the second element is the keyword arguments in a dict. """ - if callfunc.keywords: + if call.keywords: named = {arg.arg: utils.safe_infer(arg.value) - for arg in callfunc.keywords} + for arg in call.keywords} else: named = {} - positional = len(callfunc.args) + positional = len(call.args) return positional, named def get_access_path(key, parts): diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py index 8ae8f4467..db032f766 100644 --- a/pylint/checkers/typecheck.py +++ b/pylint/checkers/typecheck.py @@ -739,16 +739,16 @@ accessed. Python regular expressions are accepted.'} else: self.add_message('assignment-from-none', node=node) - def _check_uninferable_callfunc(self, node): + def _check_uninferable_call(self, node): """ - Check that the given uninferable CallFunc node does not + Check that the given uninferable Call node does not call an actual function. """ if not isinstance(node.func, astroid.Attribute): return # Look for properties. First, obtain - # the lhs of the Getattr node and search the attribute + # the lhs of the Attribute node and search the attribute # there. If that attribute is a property or a subclass of properties, # then most likely it's not callable. @@ -812,7 +812,7 @@ accessed. Python regular expressions are accepted.'} self.add_message('not-callable', node=node, args=node.func.as_string()) - self._check_uninferable_callfunc(node) + self._check_uninferable_call(node) try: called, implicit_args, callable_name = _determine_callable(called) diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index 5ed188655..5275d9f74 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -284,7 +284,7 @@ def is_ancestor_name(frame, node): return False def assign_parent(node): - """return the higher parent which is not an AssName, Tuple or List node + """return the higher parent which is not an AssignName, Tuple or List node """ while node and isinstance(node, (astroid.AssignName, astroid.Tuple, @@ -418,10 +418,10 @@ def is_attr_private(attrname): regex = re.compile('^_{2,}.*[^_]+_?$') return regex.match(attrname) -def get_argument_from_call(callfunc_node, position=None, keyword=None): +def get_argument_from_call(call_node, position=None, keyword=None): """Returns the specified argument from a function call. - :param astroid.Call callfunc_node: Node representing a function call to check. + :param astroid.Call call_node: Node representing a function call to check. :param int position: position of the argument. :param str keyword: the keyword of the argument. @@ -435,11 +435,11 @@ def get_argument_from_call(callfunc_node, position=None, keyword=None): raise ValueError('Must specify at least one of: position or keyword.') if position is not None: try: - return callfunc_node.args[position] + return call_node.args[position] except IndexError: pass - if keyword and callfunc_node.keywords: - for arg in callfunc_node.keywords: + if keyword and call_node.keywords: + for arg in call_node.keywords: if arg.arg == keyword: return arg.value diff --git a/pylint/pyreverse/diadefslib.py b/pylint/pyreverse/diadefslib.py index 16831cccb..21a3fc182 100644 --- a/pylint/pyreverse/diadefslib.py +++ b/pylint/pyreverse/diadefslib.py @@ -161,7 +161,7 @@ class DefaultDiadefGenerator(LocalsVisitor, DiaDefGenerator): self.extract_classes(node, anc_level, ass_level) def visit_importfrom(self, node): - """visit astroid.From and catch modules for package diagram + """visit astroid.ImportFrom and catch modules for package diagram """ if self.pkgdiagram: self.pkgdiagram.add_from_depend(node, node.modname) diff --git a/pylint/pyreverse/inspector.py b/pylint/pyreverse/inspector.py index a6b8704dc..895bfd0d2 100644 --- a/pylint/pyreverse/inspector.py +++ b/pylint/pyreverse/inspector.py @@ -165,9 +165,9 @@ class Linker(IdGeneratorMixIn, utils.LocalsVisitor): baseobj.specializations = specializations # resolve instance attributes node.instance_attrs_type = collections.defaultdict(list) - for assattrs in node.instance_attrs.values(): - for assattr in assattrs: - self.handle_assattr_type(assattr, node) + for assignattrs in node.instance_attrs.values(): + for assignattr in assignattrs: + self.handle_assignattr_type(assignattr, node) # resolve implemented interface try: node.implements = list(interfaces(node, self.inherited_interfaces)) @@ -192,7 +192,7 @@ class Linker(IdGeneratorMixIn, utils.LocalsVisitor): link_function = visit_functiondef def visit_assignname(self, node): - """visit an astroid.AssName node + """visit an astroid.AssignName node handle locals_type """ @@ -226,8 +226,8 @@ class Linker(IdGeneratorMixIn, utils.LocalsVisitor): pass @staticmethod - def handle_assattr_type(node, parent): - """handle an astroid.AssAttr node + def handle_assignattr_type(node, parent): + """handle an astroid.assignattr node handle instance_attrs_type """ @@ -249,7 +249,7 @@ class Linker(IdGeneratorMixIn, utils.LocalsVisitor): self._imported_module(node, name[0], relative) def visit_importfrom(self, node): - """visit an astroid.From node + """visit an astroid.ImportFrom node resolve module dependencies """ diff --git a/pylint/test/unittest_utils.py b/pylint/test/unittest_utils.py index 1bb69b292..3497ca292 100644 --- a/pylint/test/unittest_utils.py +++ b/pylint/test/unittest_utils.py @@ -39,7 +39,7 @@ class TestPyLintASTWalker(object): @check_messages('second-message', 'third-message') def visit_assignname(self, module): - self.called.add('assname') + self.called.add('assignname') @check_messages('second-message') def leave_assignname(self, module): @@ -53,7 +53,7 @@ class TestPyLintASTWalker(object): checker = self.Checker() walker.add_checker(checker) walker.walk(astroid.parse("x = func()")) - assert set(['module', 'assname']) == checker.called + assert {'module', 'assignname'} == checker.called def test_deprecated_methods(self): class Checker(object): |