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

stubgen.py: handle method aliases similarly to function aliases #735

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wojdyr
Copy link
Contributor

@wojdyr wojdyr commented Sep 26, 2024

Added support for method aliases (in the same class):

A.attr("old_name") = A.attr("new_name")

will generate in class A in pyi:

old_name = new_name

@wjakob
Copy link
Owner

wjakob commented Sep 26, 2024

What if the method is a function or a method from another class? It seems to me like the name of the initializer must have the __qualname__ if it is different from where it is being inserted.

Also, could there be issues when the method references something that hasn't been declared yet? What if the stubs say

class A:
    f = A.g
    def g(self): ...

This would be an error in Python. Stubs are sometimes a bit more forgiving, but I'm wondering if it is the case here.

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

Successfully merging this pull request may close these issues.

2 participants