Skip to content

Fix class Data(Protocol) types declaration (Again!) #286

@lsantric

Description

@lsantric

Related to #276

This produced errors in pyright:

class Data(Protocol):
    def keys(self): ...
    def __getitem__(self, item): ...
    def __contains__(self, item): ...

Was fixed in pr #278 to:

class Data(Protocol):
    def keys(self) -> Any: ...
    def __getitem__(self, *args, **kwargs) -> Any: ...
    def __contains__(self, *args, **kwargs) -> bool: ...

But this produces warnings in pycharm so i recommend:

class Data(Protocol):
    def keys(self) -> Any: ...
    def __getitem__(self, __key, /) -> Any: ...
    def __contains__(self, __x, /) -> bool: ...

Seems to be compatible with mypy, black, pyright and pycharm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions