-
-
Notifications
You must be signed in to change notification settings - Fork 351
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
Add missing type annotations to _core/_mock_clock.py
#2740
Add missing type annotations to _core/_mock_clock.py
#2740
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2740 +/- ##
=======================================
Coverage 98.90% 98.90%
=======================================
Files 113 113
Lines 16683 16683
Branches 3025 3025
=======================================
Hits 16501 16501
Misses 125 125
Partials 57 57
|
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.
Just one small comment
trio/_core/_mock_clock.py
Outdated
@@ -62,7 +62,7 @@ class MockClock(Clock, metaclass=Final): | |||
|
|||
""" | |||
|
|||
def __init__(self, rate: float = 0.0, autojump_threshold: float = inf): | |||
def __init__(self, rate: float = 0.0, autojump_threshold: float = inf) -> None: |
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.
Err, are we doing this or not...? Maybe put this in your bigger PR about these and punt decisions to that central place?
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.
With the changes I made with verify_types.json
, it said that this PR adds 2 new typed functions, so I think this change will be important for 100% type completion for the entire project
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.
Oh does pyright require this? Could you check please? If so, I'm totally on board with adding -> None
everywhere: that adds software to ensure we are consistently putting the -> None
everywhere.
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 section of pep 484 talks about __init__ -> None
annotations: https://peps.python.org/pep-0484/#the-meaning-of-annotations
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.
With the changes I made with
verify_types.json
, it said that this PR adds 2 new typed functions, so I think this change will be important for 100% type completion for the entire project
That's because it counts the class itself as another symbol that's now fully typed. If you reverted only this one change it wouldn't change the output.
mypy
has resolved that parenthetical in a different way, and seems like pyright
does too here, in them not requiring -> None
if all other parameters to __init__
are typed. I can't even get mypy
to complain if I add --strict
, so I'm a bit curious what configuration you're using that flags it.
This PR adds missing type annotations to
_core/_mock_clock.py
.