def _check_redefinition(self, redeftype, node):
    'check for redefinition of a function / method / class name'
    parent_frame = node.parent.frame()
    redefinitions = parent_frame.locals[node.name]
    defined_self = next((local for local in redefinitions if (not utils.is_overload_stub(local))), node)
    if ((defined_self is not node) and (not astroid.are_exclusive(node, defined_self))):
        if (isinstance(parent_frame, astroid.ClassDef) and (node.name in REDEFINABLE_METHODS)):
            return
        if utils.is_overload_stub(node):
            return
        if isinstance(node.parent, astroid.If):
            if (isinstance(node.parent.test, astroid.UnaryOp) and (node.parent.test.op == 'not') and isinstance(node.parent.test.operand, astroid.Name) and (node.parent.test.operand.name == node.name)):
                return
            if (isinstance(node.parent.test, astroid.Compare) and isinstance(node.parent.test.left, astroid.Name) and (node.parent.test.left.name == node.name) and (node.parent.test.ops[0][0] == 'is') and isinstance(node.parent.test.ops[0][1], astroid.Const) and (node.parent.test.ops[0][1].value is None)):
                return
        try:
            redefinition_index = redefinitions.index(node)
        except ValueError:
            pass
        else:
            for redefinition in redefinitions[:redefinition_index]:
                inferred = utils.safe_infer(redefinition)
                if (inferred and isinstance(inferred, astroid.Instance) and (inferred.qname() == TYPING_FORWARD_REF_QNAME)):
                    return
        dummy_variables_rgx = lint_utils.get_global_option(self, 'dummy-variables-rgx', default=None)
        if (dummy_variables_rgx and dummy_variables_rgx.match(node.name)):
            return
        self.add_message('function-redefined', node=node, args=(redeftype, defined_self.fromlineno))
check for redefinition of a function / method / class name
def _check_redefinition(self, redeftype, node):
    
    parent_frame = node.parent.frame()
    redefinitions = parent_frame.locals[node.name]
    defined_self = next((local for local in redefinitions if (not utils.is_overload_stub(local))), node)
    if ((defined_self is not node) and (not astroid.are_exclusive(node, defined_self))):
        if (isinstance(parent_frame, astroid.ClassDef) and (node.name in REDEFINABLE_METHODS)):
            return
        if utils.is_overload_stub(node):
            return
        if isinstance(node.parent, astroid.If):
            if (isinstance(node.parent.test, astroid.UnaryOp) and (node.parent.test.op == 'not') and isinstance(node.parent.test.operand, astroid.Name) and (node.parent.test.operand.name == node.name)):
                return
            if (isinstance(node.parent.test, astroid.Compare) and isinstance(node.parent.test.left, astroid.Name) and (node.parent.test.left.name == node.name) and (node.parent.test.ops[0][0] == 'is') and isinstance(node.parent.test.ops[0][1], astroid.Const) and (node.parent.test.ops[0][1].value is None)):
                return
        try:
            redefinition_index = redefinitions.index(node)
        except ValueError:
            pass
        else:
            for redefinition in redefinitions[:redefinition_index]:
                inferred = utils.safe_infer(redefinition)
                if (inferred and isinstance(inferred, astroid.Instance) and (inferred.qname() == TYPING_FORWARD_REF_QNAME)):
                    return
        dummy_variables_rgx = lint_utils.get_global_option(self, 'dummy-variables-rgx', default=None)
        if (dummy_variables_rgx and dummy_variables_rgx.match(node.name)):
            return
        self.add_message('function-redefined', node=node, args=(redeftype, defined_self.fromlineno))