Skip to content

Support accessing __doc__ from cls #123

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

Closed
migeed-z opened this issue Apr 21, 2025 · 2 comments
Closed

Support accessing __doc__ from cls #123

migeed-z opened this issue Apr 21, 2025 · 2 comments
Assignees

Comments

@migeed-z
Copy link
Contributor

class Foo:
    @classmethod
    def foo(cls) -> None:
        cls.__doc__


Expectation: no type error
Actual:ERROR 4:9-20: Instance-only attributedocof classFoo is not visible on the class [missing-attribute]

@grievejia
Copy link
Contributor

grievejia commented Apr 24, 2025

I suspect this ultimately comes from how type.__doc__ is defined on typeshed. Verified that this PR would fix the issue if it were merged into typeshed. Now we just need to wait and see if typeshed upstream is OK with the patch.

@grievejia grievejia self-assigned this Apr 24, 2025
@grievejia grievejia marked this as a duplicate of #116 Apr 25, 2025
@grievejia
Copy link
Contributor

According to the feedback from upstream, we probably need to relax our check for now and treat every class toplevel attribute as initialized in stub files.

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

No branches or pull requests

2 participants