pylint/checkers/classes.py
def _definition_equivalent_to_call(definition, call):
    """Check if a definition signature is equivalent to a call."""
    if definition.kwargs:
        same_kw_variadics = definition.kwargs in call.starred_kws
    else:
        same_kw_variadics = not call.starred_kws
    if definition.varargs:
        same_args_variadics = definition.varargs in call.starred_args
    else:
        same_args_variadics = not call.starred_args
    same_kwonlyargs = all(kw in call.kws for kw in definition.kwonlyargs)
    same_args = definition.args == call.args

    no_additional_kwarg_arguments = True
    if call.kws:
        for keyword in call.kws:
            is_arg = keyword in call.args
            is_kwonly = keyword in definition.kwonlyargs
            if not is_arg and not is_kwonly:
                # Maybe this argument goes into **kwargs,
                # or it is an extraneous argument.
                # In any case, the signature is different than
                # the call site, which stops our search.
                no_additional_kwarg_arguments = False
                break

    return all(
        (
            same_args,
            same_kwonlyargs,
            same_args_variadics,
            same_kw_variadics,
            no_additional_kwarg_arguments,
        )
    )
def _definition_equivalent_to_call(definition, call):
    if definition.kwargs:
        same_kw_variadics = definition.kwargs in call.starred_kws
    else:
        same_kw_variadics = not call.starred_kws
    if definition.varargs:
        same_args_variadics = definition.varargs in call.starred_args
    else:
        same_args_variadics = not call.starred_args
    same_kwonlyargs = all(kw in call.kws for kw in definition.kwonlyargs)
    same_args = definition.args == call.args

    no_additional_kwarg_arguments = True
    if call.kws:
        for keyword in call.kws:
            is_arg = keyword in call.args
            is_kwonly = keyword in definition.kwonlyargs
            if not is_arg and not is_kwonly:
                # Maybe this argument goes into **kwargs,
                # or it is an extraneous argument.
                # In any case, the signature is different than
                # the call site, which stops our search.
                no_additional_kwarg_arguments = False
                break

    return all(
        (
            same_args,
            same_kwonlyargs,
            same_args_variadics,
            same_kw_variadics,
            no_additional_kwarg_arguments,
        )
    )
def _definition_equivalent_to_call ( definition , call ) : if definition . kwargs : same_kw_variadics = definition . kwargs in call . starred_kws else : same_kw_variadics = not call . starred_kws if definition . varargs : same_args_variadics = definition . varargs in call . starred_args else : same_args_variadics = not call . starred_args same_kwonlyargs = all ( kw in call . kws for kw in definition . kwonlyargs ) same_args = definition . args == call . args no_additional_kwarg_arguments = True if call . kws : for keyword in call . kws : is_arg = keyword in call . args is_kwonly = keyword in definition . kwonlyargs if not is_arg and not is_kwonly : # Maybe this argument goes into **kwargs, # or it is an extraneous argument. # In any case, the signature is different than # the call site, which stops our search. no_additional_kwarg_arguments = False break return all ( ( same_args , same_kwonlyargs , same_args_variadics , same_kw_variadics , no_additional_kwarg_arguments , ) )
Check if a definition signature is equivalent to a call.
Check if a definition signature is equivalent to a call .