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

mypy strict doesn't like make_wpistruct #103

Open
truher opened this issue Oct 10, 2024 · 3 comments
Open

mypy strict doesn't like make_wpistruct #103

truher opened this issue Oct 10, 2024 · 3 comments

Comments

@truher
Copy link
Contributor

truher commented Oct 10, 2024

I think the default None for the cls argument is the issue. What does it mean for cls to be None?

def make_wpistruct(cls=None, /, *, name: typing.Optional[str] = None):

Type of "make_wpistruct" is partially unknown
  Type of "make_wpistruct" is "(cls: Unknown | None = None, /, *, name: str | None = None) -> (((cls: Unknown) -> Unknown) | Unknown)"Pylance[reportUnknownMemberType](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportUnknownMemberType)
Untyped class decorator obscures type of class; ignoring decoratorPylance[reportUntypedClassDecorator](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportUntypedClassDecorator)
@virtuald
Copy link
Member

It's a class decorator, and I think that's the standard way to write a decorator? There's probably an example somewhere how one should properly annotate class decorators.

@auscompgeek
Copy link
Member

I don't believe it's currently possible to accurately type hint this decorator without intersection types.

@truher
Copy link
Contributor Author

truher commented Oct 10, 2024

i see. ok, thanks.

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

3 participants