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

Applying chex.dataclass wrapper yields error: Expected no arguments to class constructor (reportGeneralTypeIssues) #6536

Closed
carlosgmartin opened this issue Nov 24, 2023 · 3 comments
Labels
as designed Not a bug, working as intended bug Something isn't working

Comments

@carlosgmartin
Copy link

Applying the chex.dataclass wrapper to a class yields the following error:

import chex

@chex.dataclass(frozen=True)
class Class:
    x: int

Class(4)
$ pyright --version
pyright 1.1.337
$ python3 --version
Python 3.11.6
$ python3 -c "import chex; print(chex.__version__)"
0.1.85
$ pyright test.py
/Users/user/Desktop/test.py
  /Users/user/Desktop/test.py:7:1 - error: Expected no arguments to "Class" constructor (reportGeneralTypeIssues)
1 error, 0 warnings, 0 informations 
@carlosgmartin carlosgmartin added the bug Something isn't working label Nov 24, 2023
@erictraut
Copy link
Collaborator

erictraut commented Nov 24, 2023

This is a bug in the chex library. The chex.dataclass decorator has no type annotations despite the fact that the package contains a "py.typed" marker file. Please report the problem to the maintainers of this library.

@carlosgmartin
Copy link
Author

@erictraut What would be the correct type signature for chex.dataclass, to avoid this error?

@erictraut
Copy link
Collaborator

I recommend looking at the stdlib dataclass class in the typeshed dataclass.pyi stub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
as designed Not a bug, working as intended bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants