Closed alecandido closed 3 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 99.94%. Comparing base (
4f57f37
) to head (e1179f8
). Report is 3 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
These changes would have to be applied throughout the entire module, no?
These changes would have to be applied throughout the entire module, no?
Yes, and I'm planning to do a consistent review of types at some point (there are further improvements/fixes to add). But these methods are very common, so I decided to fix these immediately, instead of delaying them with everything else.
Moreover, I checked that most of the usage of Tuple[]
are consistent, since they refer to fixed length tuples. There might be some further occurrences just in the quantum_info
module.
@renatomello: for me, this PR is ready as it is. But if you want to do something else, we can discuss (though I will not commit soon to much more, that's why I'd prefer to open a new one later on).
I wasn't aware of the Tuple[type, ...]
syntax, thanks for pointing out.
A quite trivial fix, just because I noticed it while working on Qibolab.
Tuples are immutable containers, thus the plain type hint is dedicated to the fixed size ones. To return a variable size tuple,
tuple[MyType, ...]
is required.tuple[MyType]
is describing a 1-element tuple, whose element has typeMyType
.Conversely, lists and dictionaries are mutable, and their basic and only type hints are not imposing any restriction on the length.