pylint/checkers/variables.py
def visit_functiondef(self, node):
        """visit function: update consumption analysis variable and check locals
        """
        self._to_consume.append(NamesConsumer(node, "function"))
        if not (
            self.linter.is_message_enabled("redefined-outer-name")
            or self.linter.is_message_enabled("redefined-builtin")
        ):
            return
        globs = node.root().globals
        for name, stmt in node.items():
            if utils.is_inside_except(stmt):
                continue
            if name in globs and not isinstance(stmt, astroid.Global):
                definition = globs[name][0]
                if (
                    isinstance(definition, astroid.ImportFrom)
                    and definition.modname == FUTURE
                ):
                    # It is a __future__ directive, not a symbol.
                    continue

                line = definition.fromlineno
                if not self._is_name_ignored(stmt, name):
                    self.add_message(
                        "redefined-outer-name", args=(name, line), node=stmt
                    )

            elif utils.is_builtin(name) and not self._should_ignore_redefined_builtin(
                stmt
            ):
                # do not print Redefining builtin for additional builtins
                self.add_message("redefined-builtin", args=name, node=stmt)
def visit_functiondef(self, node):
        """visit function: update consumption analysis variable and check locals
        """
        self._to_consume.append(NamesConsumer(node, "function"))
        if not (
            self.linter.is_message_enabled("redefined-outer-name")
            or self.linter.is_message_enabled("redefined-builtin")
        ):
            return
        globs = node.root().globals
        for name, stmt in node.items():
            if utils.is_inside_except(stmt):
                continue
            if name in globs and not isinstance(stmt, astroid.Global):
                definition = globs[name][0]
                if (
                    isinstance(definition, astroid.ImportFrom)
                    and definition.modname == FUTURE
                ):
                    # It is a __future__ directive, not a symbol.
                    continue

                line = definition.fromlineno
                if not self._is_name_ignored(stmt, name):
                    self.add_message(
                        "redefined-outer-name", args=(name, line), node=stmt
                    )

            elif utils.is_builtin(name) and not self._should_ignore_redefined_builtin(
                stmt
            ):
                # do not print Redefining builtin for additional builtins
                self.add_message("redefined-builtin", args=name, node=stmt)
def visit_functiondef ( self , node ) : self . _to_consume . append ( NamesConsumer ( node , "function" ) ) if not ( self . linter . is_message_enabled ( "redefined-outer-name" ) or self . linter . is_message_enabled ( "redefined-builtin" ) ) : return globs = node . root ( ) . globals for name , stmt in node . items ( ) : if utils . is_inside_except ( stmt ) : continue if name in globs and not isinstance ( stmt , astroid . Global ) : definition = globs [ name ] [ 0 ] if ( isinstance ( definition , astroid . ImportFrom ) and definition . modname == FUTURE ) : # It is a __future__ directive, not a symbol. continue line = definition . fromlineno if not self . _is_name_ignored ( stmt , name ) : self . add_message ( "redefined-outer-name" , args = ( name , line ) , node = stmt ) elif utils . is_builtin ( name ) and not self . _should_ignore_redefined_builtin ( stmt ) : # do not print Redefining builtin for additional builtins self . add_message ( "redefined-builtin" , args = name , node = stmt )
visit function: update consumption analysis variable and check locals
visit function : update consumption analysis variable and check locals