-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Replace plugin.args_invariant_decorator_callback with use of ParamSpec #92
Conversation
…c, to support mypy 1.7
7fa3498
to
8db07b5
Compare
8db07b5
to
b712386
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good on a surface level, but I haven't checked that these match with the real project.
I solemnly swear that all of the statistics classes were copy-pasted from current trio. :-) stubtest is happy so I think there's relatively little that could be incorrect. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beyond these issues, looks fine.
(but I may have missed something)
class _IOStatistics: | ||
tasks_waiting: int = attr.ib() | ||
monitors: int = attr.ib() | ||
backend: Literal["kqueue"] = attr.ib(init=False, default="kqueue") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think init=False
or default matters for these but tbh probably fine to keep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
init= impacts the signature of the generated __init__
which stubtest will notice mismatches in
Resolves #90, a regression that appeared with mypy 1.7. In order to have ParamSpec available, we now require at least mypy 1.0.
args_invariant_decorator_callback
is modeled off the mypycontextlib
plugin which was replaced with use of ParamSpec in Oct 2022 (python/mypy@3108669); mypy 1.0 came out in Feb 2023.The test described in #90 no longer fails now that this hook has been removed.
While we're here, update stubs to be consistent with Trio's new inline stubs to satisfy CI. This included:
__aexit__
instead of using a star-args shortcut