-
-
Notifications
You must be signed in to change notification settings - Fork 531
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 more type hints #3499
Add more type hints #3499
Conversation
da70943
to
4644970
Compare
4644970
to
012c486
Compare
@@ -256,33 +264,36 @@ def datetime_as_utctimestamp(value): | |||
return value.replace(tzinfo=dt.timezone.utc).timestamp() * 1000 | |||
|
|||
|
|||
def is_number(s): | |||
def is_number(s: Any) -> bool: |
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.
It would be even better to make this a type guard def is_number(s: Any) -> TypeGuard[float]
(needs typing_extensions
for now). This way s
will be known to be a float
in if is_number(s):
or after assert is_number(s)
.
I'm going to merge and continue in another PR. Otherwise we're inviting tons of merge conflicts. |
Codecov Report
@@ Coverage Diff @@
## master #3499 +/- ##
==========================================
- Coverage 82.80% 82.76% -0.05%
==========================================
Files 199 199
Lines 27296 27332 +36
==========================================
+ Hits 22603 22620 +17
- Misses 4693 4712 +19
Continue to review full report at Codecov.
|
Co-authored-by: Marc Skov Madsen <masma@orsted.dk> Co-authored-by: Philipp Rudiger <prudiger@anaconda.com>
Adds typehints to button.py and selected dependencies.