Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lookup test for "does not match signature of the base method in ..." #2541

Open
ReimarBauer opened this issue Sep 27, 2024 · 4 comments
Open
Labels

Comments

@ReimarBauer
Copy link
Member

I've just seen a few warnings by Pycharm about

"Signature of method ... does not match signature of the base method ..."

e.g. closeEvent, changeEvent, moveEvent

a warning is not an error. I think we should lookup those and try to use the origin signature. When it is wanted as it is, we should flag them.

This can give a hint for an API change of our dependencies.

@matrss
Copy link
Collaborator

matrss commented Sep 27, 2024

What linter does pycharm use to generate these warnings? Can we incorporate it into our lint workflow?

@ReimarBauer
Copy link
Member Author

unfortunantely it looks like this one is built-in.

collected informations by perplexity. https://www.perplexity.ai/search/how-does-pycharm-do-the-test-f-XDcwnYHfR3KTtG0K.ATO2w#1

PyCharm does not use a specific linter to check for the Liskov Substitution Principle (LSP). Instead, PyCharm's built-in code inspection and analysis tools perform signature matching and type checking to help identify potential violations of LSP.

@anj20
Copy link
Contributor

anj20 commented Jan 31, 2025

Hi @ReimarBauer ,
I believe the issue is a method signature mismatch in changeEvent. The parameter should have a defined type, like this:
def changeEvent(self, event: QEvent):

@ReimarBauer
Copy link
Member Author

ReimarBauer commented Jan 31, 2025

Pycharm suggests a signature change to

def closeEvent(self, event, **kwargs)

because of QWidget.__init__,

def __init__(self, parent, QWidget=None, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__ 
        pass

Qwidget.QMainWindow

    def __init__(self, parent, QWidget=None, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__ 
        pass

the issue here about is find a way like pycharm does to find those problems and keep them fixed.

Of course we can follow the advice of Pycharm and clear these warnings. I am not sure if we easily can do have a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants