Skip to content

Commit 83cdfaa

Browse files
author
Benjamin Moody
committed
Fix type inference for ALLOWED_TYPES.
When using mypy to check the package, it will attempt to infer types that are not specified. Currently, mypy is able to understand that constructing a dict from a Sequence[Tuple[X, Y]] yields a Dict[X, Y], but if we use lists instead of tuples, mypy doesn't understand and seems to think the result is a Dict[X, X]. This is probably a bug in mypy, but in any case, using tuples here rather than lists is more idiomatic and doesn't affect the behavior of the code.
1 parent b88774a commit 83cdfaa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

wfdb/io/record.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1661,7 +1661,7 @@ def multi_to_single(self, physical, return_res=64, expanded=False):
16611661
# this library
16621662
ALLOWED_TYPES = dict(
16631663
[
1664-
[index, _header.FIELD_SPECS.loc[index, "allowed_types"]]
1664+
(index, _header.FIELD_SPECS.loc[index, "allowed_types"])
16651665
for index in _header.FIELD_SPECS.index
16661666
]
16671667
)

0 commit comments

Comments
 (0)