@utils.check_messages('disallowed-name', 'invalid-name', 'assign-to-new-keyword', 'non-ascii-name')
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):
            if isinstance(utils.safe_infer(assign_type.value), astroid.ClassDef):
                self._check_name('class', node.name, node)
            elif ((not _redefines_import(node)) and isinstance(utils.safe_infer(assign_type.value), astroid.Const)):
                self._check_name('const', node.name, node)
        elif isinstance(assign_type, astroid.ExceptHandler):
            self._check_name('variable', node.name, node)
        elif (isinstance(assign_type, astroid.AnnAssign) and utils.is_assign_name_annotated_with(node, 'Final')):
            self._check_name('const', node.name, node)
    elif isinstance(frame, astroid.FunctionDef):
        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))):
            for ancestor in frame.ancestors():
                if (((ancestor.name == 'Enum') and (ancestor.root().name == 'enum')) or utils.is_assign_name_annotated_with(node, 'Final')):
                    self._check_name('class_const', node.name, node)
                    break
            else:
                self._check_name('class_attribute', node.name, node)
check module level assigned names
@utils.check_messages('disallowed-name', 'invalid-name', 'assign-to-new-keyword', 'non-ascii-name')
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):
            if isinstance(utils.safe_infer(assign_type.value), astroid.ClassDef):
                self._check_name('class', node.name, node)
            elif ((not _redefines_import(node)) and isinstance(utils.safe_infer(assign_type.value), astroid.Const)):
                self._check_name('const', node.name, node)
        elif isinstance(assign_type, astroid.ExceptHandler):
            self._check_name('variable', node.name, node)
        elif (isinstance(assign_type, astroid.AnnAssign) and utils.is_assign_name_annotated_with(node, 'Final')):
            self._check_name('const', node.name, node)
    elif isinstance(frame, astroid.FunctionDef):
        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))):
            for ancestor in frame.ancestors():
                if (((ancestor.name == 'Enum') and (ancestor.root().name == 'enum')) or utils.is_assign_name_annotated_with(node, 'Final')):
                    self._check_name('class_const', node.name, node)
                    break
            else:
                self._check_name('class_attribute', node.name, node)