Skip to content

Typing not working properly when positional argument is defined in subclass with redefined kwargs #1023

Open
@Rizhiy

Description

@Rizhiy

Describe the bug
Using pyright for type checking produces the following errors:

from attrs import define


@define
class A:
    foo: int
    bar: str = "baz"


@define
class B(A):
    zoo: float
    bar: str = "zaz"


b = B(1, 2.7)
print(b)
>>> B(foo=1, zoo=2.7, bar='zaz')

image
image

Not sure whether the problem is with attrs type definitions or with pyright, so will create issues in both places.

Perhaps types are not defined properly somewhere?

Metadata

Metadata

Assignees

No one assigned

    Labels

    TypingTyping/stub/Mypy/PyRight related bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions