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

self.__attrs_init__ doesn't play well with pylance/pyright #1360

Open
kevinleahy-switchdin opened this issue Oct 18, 2024 · 1 comment
Open

Comments

@kevinleahy-switchdin
Copy link

Python version: 3.12.5
attrs version: 23.2.0
pylance version: v2024.10.1

code:

import attrs


@attrs.define
class MyClass:
    x: int

    def __init__(self, x: int):
        self.__attrs_init__(x)
#              ^^^^^^^^^^
#  Cannot access attribute "__attrs_init__" for class "MyClass*"
#  Attribute "__attrs_init__" is unknown Pylance[reportAttributeAccessIssue]
@hynek
Copy link
Member

hynek commented Nov 9, 2024

This is on Pyright/Pylance but unless someone writes a PEP that solves it in a general way, I wouldn't hold my breath for support and add a type ignore.

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