attrs icon indicating copy to clipboard operation
attrs copied to clipboard

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

Open kevinleahy-switchdin opened this issue 1 year ago • 1 comments

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]

kevinleahy-switchdin avatar Oct 18 '24 03:10 kevinleahy-switchdin

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.

hynek avatar Nov 09 '24 05:11 hynek