Skip to content

Adds introspection for class associated constants #5157

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yogevm15
Copy link
Contributor

I'm not sure about the stub generation. If I understood the code correctly, the class consts exported as class attribute methods rather than actual class variables. So, how should we generate them in the stub?

@@ -18,6 +18,9 @@ class ClassWithDecorators:
class ClassWithoutConstructor: ...

class EmptyClass:
@classmethod
@property
def CLS_ATTRIBUTE(cls, /): ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think CLS_ATTRIBUTE: Final = 42 will work because EmptyClass().CLS_ATTRIBUTE works too.

We should maybe reuse the same code as for module constants.

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