pylint/checkers/classes.py
def _check_signature(self, method1, refmethod, class_type, cls):
        """check that the signature of the two given methods match
        """
        if not (
            isinstance(method1, astroid.FunctionDef)
            and isinstance(refmethod, astroid.FunctionDef)
        ):
            self.add_message(
                "method-check-failed", args=(method1, refmethod), node=method1
            )
            return

        instance = cls.instantiate_class()
        method1 = function_to_method(method1, instance)
        refmethod = function_to_method(refmethod, instance)

        # Don't care about functions with unknown argument (builtins).
        if method1.args.args is None or refmethod.args.args is None:
            return

        # Ignore private to class methods.
        if is_attr_private(method1.name):
            return
        # Ignore setters, they have an implicit extra argument,
        # which shouldn't be taken in consideration.
        if method1.decorators:
            for decorator in method1.decorators.nodes:
                if (
                    isinstance(decorator, astroid.Attribute)
                    and decorator.attrname == "setter"
                ):
                    return

        if _different_parameters(
            refmethod, method1, dummy_parameter_regex=self._dummy_rgx
        ):
            self.add_message(
                "arguments-differ", args=(class_type, method1.name), node=method1
            )
        elif len(method1.args.defaults) < len(refmethod.args.defaults):
            self.add_message(
                "signature-differs", args=(class_type, method1.name), node=method1
            )
def _check_signature(self, method1, refmethod, class_type, cls):
        """check that the signature of the two given methods match
        """
        if not (
            isinstance(method1, astroid.FunctionDef)
            and isinstance(refmethod, astroid.FunctionDef)
        ):
            self.add_message(
                "method-check-failed", args=(method1, refmethod), node=method1
            )
            return

        instance = cls.instantiate_class()
        method1 = function_to_method(method1, instance)
        refmethod = function_to_method(refmethod, instance)

        # Don't care about functions with unknown argument (builtins).
        if method1.args.args is None or refmethod.args.args is None:
            return

        # Ignore private to class methods.
        if is_attr_private(method1.name):
            return
        # Ignore setters, they have an implicit extra argument,
        # which shouldn't be taken in consideration.
        if method1.decorators:
            for decorator in method1.decorators.nodes:
                if (
                    isinstance(decorator, astroid.Attribute)
                    and decorator.attrname == "setter"
                ):
                    return

        if _different_parameters(
            refmethod, method1, dummy_parameter_regex=self._dummy_rgx
        ):
            self.add_message(
                "arguments-differ", args=(class_type, method1.name), node=method1
            )
        elif len(method1.args.defaults) < len(refmethod.args.defaults):
            self.add_message(
                "signature-differs", args=(class_type, method1.name), node=method1
            )
def _check_signature ( self , method1 , refmethod , class_type , cls ) : if not ( isinstance ( method1 , astroid . FunctionDef ) and isinstance ( refmethod , astroid . FunctionDef ) ) : self . add_message ( "method-check-failed" , args = ( method1 , refmethod ) , node = method1 ) return instance = cls . instantiate_class ( ) method1 = function_to_method ( method1 , instance ) refmethod = function_to_method ( refmethod , instance ) # Don't care about functions with unknown argument (builtins). if method1 . args . args is None or refmethod . args . args is None : return # Ignore private to class methods. if is_attr_private ( method1 . name ) : return # Ignore setters, they have an implicit extra argument, # which shouldn't be taken in consideration. if method1 . decorators : for decorator in method1 . decorators . nodes : if ( isinstance ( decorator , astroid . Attribute ) and decorator . attrname == "setter" ) : return if _different_parameters ( refmethod , method1 , dummy_parameter_regex = self . _dummy_rgx ) : self . add_message ( "arguments-differ" , args = ( class_type , method1 . name ) , node = method1 ) elif len ( method1 . args . defaults ) < len ( refmethod . args . defaults ) : self . add_message ( "signature-differs" , args = ( class_type , method1 . name ) , node = method1 )
check that the signature of the two given methods match
check that the signature of the two given methods match