pylint/checkers/classes.py
def _different_parameters(original, overridden, dummy_parameter_regex):
    """Determine if the two methods have different parameters

    They are considered to have different parameters if:

       * they have different positional parameters, including different names

       * one of the methods is having variadics, while the other is not

       * they have different keyword only parameters.

    """
    original_parameters = _positional_parameters(original)
    overridden_parameters = _positional_parameters(overridden)

    different_positional = _has_different_parameters(
        original_parameters, overridden_parameters, dummy_parameter_regex
    )
    different_kwonly = _has_different_parameters(
        original.args.kwonlyargs, overridden.args.kwonlyargs, dummy_parameter_regex
    )
    if original.name in PYMETHODS:
        # Ignore the difference for special methods. If the parameter
        # numbers are different, then that is going to be caught by
        # unexpected-special-method-signature.
        # If the names are different, it doesn't matter, since they can't
        # be used as keyword arguments anyway.
        different_positional = different_kwonly = False

    # Both or none should have extra variadics, otherwise the method
    # loses or gains capabilities that are not reflected into the parent method,
    # leading to potential inconsistencies in the code.
    different_kwarg = (
        sum(1 for param in (original.args.kwarg, overridden.args.kwarg) if not param)
        == 1
    )
    different_vararg = (
        sum(1 for param in (original.args.vararg, overridden.args.vararg) if not param)
        == 1
    )

    return any(
        (different_positional, different_kwarg, different_vararg, different_kwonly)
    )
def _different_parameters(original, overridden, dummy_parameter_regex):
    original_parameters = _positional_parameters(original)
    overridden_parameters = _positional_parameters(overridden)

    different_positional = _has_different_parameters(
        original_parameters, overridden_parameters, dummy_parameter_regex
    )
    different_kwonly = _has_different_parameters(
        original.args.kwonlyargs, overridden.args.kwonlyargs, dummy_parameter_regex
    )
    if original.name in PYMETHODS:
        # Ignore the difference for special methods. If the parameter
        # numbers are different, then that is going to be caught by
        # unexpected-special-method-signature.
        # If the names are different, it doesn't matter, since they can't
        # be used as keyword arguments anyway.
        different_positional = different_kwonly = False

    # Both or none should have extra variadics, otherwise the method
    # loses or gains capabilities that are not reflected into the parent method,
    # leading to potential inconsistencies in the code.
    different_kwarg = (
        sum(1 for param in (original.args.kwarg, overridden.args.kwarg) if not param)
        == 1
    )
    different_vararg = (
        sum(1 for param in (original.args.vararg, overridden.args.vararg) if not param)
        == 1
    )

    return any(
        (different_positional, different_kwarg, different_vararg, different_kwonly)
    )
def _different_parameters ( original , overridden , dummy_parameter_regex ) : original_parameters = _positional_parameters ( original ) overridden_parameters = _positional_parameters ( overridden ) different_positional = _has_different_parameters ( original_parameters , overridden_parameters , dummy_parameter_regex ) different_kwonly = _has_different_parameters ( original . args . kwonlyargs , overridden . args . kwonlyargs , dummy_parameter_regex ) if original . name in PYMETHODS : # Ignore the difference for special methods. If the parameter # numbers are different, then that is going to be caught by # unexpected-special-method-signature. # If the names are different, it doesn't matter, since they can't # be used as keyword arguments anyway. different_positional = different_kwonly = False # Both or none should have extra variadics, otherwise the method # loses or gains capabilities that are not reflected into the parent method, # leading to potential inconsistencies in the code. different_kwarg = ( sum ( 1 for param in ( original . args . kwarg , overridden . args . kwarg ) if not param ) == 1 ) different_vararg = ( sum ( 1 for param in ( original . args . vararg , overridden . args . vararg ) if not param ) == 1 ) return any ( ( different_positional , different_kwarg , different_vararg , different_kwonly ) )
Determine if the two methods have different parameters

    They are considered to have different parameters if:

       * they have different positional parameters, including different names

       * one of the methods is having variadics, while the other is not

       * they have different keyword only parameters.
Determine if the two methods have different parameters