예제 #1
0
 def visit_call(self, node: nodes.Call) -> None:
     if isinstance(node.func, nodes.Name):
         name = node.func.name
         # ignore the name if it's not a builtin (i.e. not defined in the
         # locals nor globals scope)
         if not (name in node.frame(future=True) or name in node.root()):
             if name in self.linter.config.bad_functions:
                 hint = BUILTIN_HINTS.get(name)
                 args = f"{name!r}. {hint}" if hint else repr(name)
                 self.add_message("bad-builtin", node=node, args=args)
예제 #2
0
파일: custom.py 프로젝트: hippo91/pylint
    def visit_call(self, node: nodes.Call) -> None:
        """Called when a :class:`.nodes.Call` node is visited.

        See :mod:`astroid` for the description of available nodes.
        """
        if not (isinstance(node.func, nodes.Attribute)
                and isinstance(node.func.expr, nodes.Name)
                and node.func.expr.name == self.config.store_locals_indicator
                and node.func.attrname == "create"):
            return
        in_class = node.frame()
        for param in node.args:
            in_class.locals[param.name] = node
예제 #3
0
 def visit_call(self, node: nodes.Call) -> None:
     """Visit a Call node -> check if this is not a disallowed builtin
     call and check for * or ** use.
     """
     self._check_misplaced_format_function(node)
     if isinstance(node.func, nodes.Name):
         name = node.func.name
         # ignore the name if it's not a builtin (i.e. not defined in the
         # locals nor globals scope)
         if not (name in node.frame(future=True) or name in node.root()):
             if name == "exec":
                 self.add_message("exec-used", node=node)
             elif name == "reversed":
                 self._check_reversed(node)
             elif name == "eval":
                 self.add_message("eval-used", node=node)