pylint/checkers/base.py
def visit_assignname(self, node):
        """check module level assigned names"""
        self._check_assign_to_new_keyword_violation(node.name, node)
        frame = node.frame()
        assign_type = node.assign_type()
        if isinstance(assign_type, astroid.Comprehension):
            self._check_name("inlinevar", node.name, node)
        elif isinstance(frame, astroid.Module):
            if isinstance(assign_type, astroid.Assign) and not in_loop(assign_type):
                if isinstance(utils.safe_infer(assign_type.value), astroid.ClassDef):
                    self._check_name("class", node.name, node)
                else:
                    if not _redefines_import(node):
                        # Don't emit if the name redefines an import
                        # in an ImportError except handler.
                        self._check_name("const", node.name, node)
            elif isinstance(assign_type, astroid.ExceptHandler):
                self._check_name("variable", node.name, node)
        elif isinstance(frame, astroid.FunctionDef):
            # global introduced variable aren't in the function locals
            if node.name in frame and node.name not in frame.argnames():
                if not _redefines_import(node):
                    self._check_name("variable", node.name, node)
        elif isinstance(frame, astroid.ClassDef):
            if not list(frame.local_attr_ancestors(node.name)):
                self._check_name("class_attribute", node.name, node)
def visit_assignname(self, node):
        self._check_assign_to_new_keyword_violation(node.name, node)
        frame = node.frame()
        assign_type = node.assign_type()
        if isinstance(assign_type, astroid.Comprehension):
            self._check_name("inlinevar", node.name, node)
        elif isinstance(frame, astroid.Module):
            if isinstance(assign_type, astroid.Assign) and not in_loop(assign_type):
                if isinstance(utils.safe_infer(assign_type.value), astroid.ClassDef):
                    self._check_name("class", node.name, node)
                else:
                    if not _redefines_import(node):
                        # Don't emit if the name redefines an import
                        # in an ImportError except handler.
                        self._check_name("const", node.name, node)
            elif isinstance(assign_type, astroid.ExceptHandler):
                self._check_name("variable", node.name, node)
        elif isinstance(frame, astroid.FunctionDef):
            # global introduced variable aren't in the function locals
            if node.name in frame and node.name not in frame.argnames():
                if not _redefines_import(node):
                    self._check_name("variable", node.name, node)
        elif isinstance(frame, astroid.ClassDef):
            if not list(frame.local_attr_ancestors(node.name)):
                self._check_name("class_attribute", node.name, node)
def visit_assignname ( self , node ) : self . _check_assign_to_new_keyword_violation ( node . name , node ) frame = node . frame ( ) assign_type = node . assign_type ( ) if isinstance ( assign_type , astroid . Comprehension ) : self . _check_name ( "inlinevar" , node . name , node ) elif isinstance ( frame , astroid . Module ) : if isinstance ( assign_type , astroid . Assign ) and not in_loop ( assign_type ) : if isinstance ( utils . safe_infer ( assign_type . value ) , astroid . ClassDef ) : self . _check_name ( "class" , node . name , node ) else : if not _redefines_import ( node ) : # Don't emit if the name redefines an import # in an ImportError except handler. self . _check_name ( "const" , node . name , node ) elif isinstance ( assign_type , astroid . ExceptHandler ) : self . _check_name ( "variable" , node . name , node ) elif isinstance ( frame , astroid . FunctionDef ) : # global introduced variable aren't in the function locals if node . name in frame and node . name not in frame . argnames ( ) : if not _redefines_import ( node ) : self . _check_name ( "variable" , node . name , node ) elif isinstance ( frame , astroid . ClassDef ) : if not list ( frame . local_attr_ancestors ( node . name ) ) : self . _check_name ( "class_attribute" , node . name , node )
check module level assigned names
check module level assigned names