Conversation
Codecov Report
@@ Coverage Diff @@
## master #1530 +/- ##
==========================================
- Coverage 91.66% 91.33% -0.34%
==========================================
Files 20 20
Lines 3457 3510 +53
==========================================
+ Hits 3169 3206 +37
- Misses 288 304 +16
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1530 +/- ##
==========================================
- Coverage 91.66% 91.33% -0.34%
==========================================
Files 20 20
Lines 3457 3510 +53
==========================================
+ Hits 3169 3206 +37
- Misses 288 304 +16
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
| ''' | ||
| import collections | ||
| Measurement = collections.namedtuple('Measurement', ['voltage', 'current', 'in_compliance']) | ||
| measurement = typing.NamedTuple('Measurement', [('voltage', 'float'), ('current', 'float'), ('in_compliance', 'bool')]) |
There was a problem hiding this comment.
The preferred method for type hinting namedtuples is to create a class that inherits from typing.NamedTuple. This would require the couple of namedtuples we have to be moved to custom types. I did not do that work for this PR.
FYI, there is a separate GitHub issue about that: #1885
| return attribute_value_ctype.value.decode(self._encoding) | ||
|
|
||
| def _open_installed_devices_session(self, driver): | ||
| def _open_installed_devices_session(self, driver: str) -> typing.Tuple[int, int]: |
There was a problem hiding this comment.
typing.Tuple, typing.List, typing.Dict, etc. are deprecated in Python 3.9 and later. Use tuple[T], list[T], dict[K,V], etc.
| ''' These are code-generated ''' | ||
|
|
||
| def _get_error(self, error_description_size=[1024]): | ||
| def _get_error(self, error_description_size: typing.Iterable[int] = [1024]) -> typing.Tuple[int, str]: |
There was a problem hiding this comment.
collections.abc.Iterable[T]
| return int(vi_ctype.value) | ||
|
|
||
| def wait_for_debounce(self, maximum_time_ms=hightime.timedelta(milliseconds=-1)): | ||
| def wait_for_debounce(self, maximum_time_ms: typing.Union['hightime.timedelta', 'datetime.timedelta', int] = hightime.timedelta(milliseconds=-1)) -> None: |
There was a problem hiding this comment.
FYI, if you use from __future__ import annotations, you can write this as maximum_time_ms: hightime.timedelta | datetime.timedelta | int even though Python 3.9 does not support the new union syntax.
What does this Pull Request accomplish?
type_in_documentationmetadata since it mostly has the information needed - we need the complete list of possible types in the API, not just the type that is passed into the DLLtyping.NamedTuple. This would require the couple of namedtuples we have to be moved to custom types. I did not do that work for this PR.List issues fixed by this Pull Request below, if any.What testing has been done?