Skip to content

Commit 4d4233f

Browse files
authored
Merge pull request #445 from MIT-LCP/type-fixes
Fix incorrect type annotations and type inference
2 parents e8ec6b0 + 5564dc9 commit 4d4233f

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

wfdb/io/_header.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import datetime
2-
from typing import Collection, List, Tuple
2+
from typing import Any, Dict, List, Optional, Sequence, Tuple
33

44
import numpy as np
55
import pandas as pd
@@ -598,6 +598,10 @@ class MultiHeaderMixin(BaseHeaderMixin):
598598
599599
"""
600600

601+
n_seg: int
602+
seg_len: Sequence[int]
603+
segments: Optional[Sequence]
604+
601605
def set_defaults(self):
602606
"""
603607
Set defaults for fields needed to write the header if they have
@@ -920,7 +924,7 @@ def contained_ranges(self, sig_name: str) -> List[Tuple[int, int]]:
920924

921925
def contained_combined_ranges(
922926
self,
923-
sig_names: Collection[str],
927+
sig_names: Sequence[str],
924928
) -> List[Tuple[int, int]]:
925929
"""
926930
Given a collection of signal name, return the sample ranges that
@@ -1010,7 +1014,7 @@ def _parse_record_line(record_line: str) -> dict:
10101014
10111015
"""
10121016
# Dictionary for record fields
1013-
record_fields = {}
1017+
record_fields: Dict[str, Any] = {}
10141018

10151019
# Read string fields from record line
10161020
match = rx_record.match(record_line)

wfdb/io/download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Config(object):
2323
2424
"""
2525

26-
pass
26+
db_index_url: str
2727

2828

2929
# The configuration database index url. Uses PhysioNet index by default.

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
)

wfdb/io/util.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import math
55
import os
66

7-
from typing import Sequence, Tuple
7+
from typing import List, Sequence, Tuple
88

99

1010
def lines_to_file(file_name: str, write_dir: str, lines: Sequence[str]):
@@ -102,8 +102,9 @@ def upround(x, base):
102102

103103

104104
def overlapping_ranges(
105-
ranges_1: Tuple[int, int], ranges_2: Tuple[int, int]
106-
) -> Tuple[int, int]:
105+
ranges_1: Sequence[Tuple[int, int]],
106+
ranges_2: Sequence[Tuple[int, int]],
107+
) -> List[Tuple[int, int]]:
107108
"""
108109
Given two collections of integer ranges, return a list of ranges
109110
in which both input inputs overlap.

0 commit comments

Comments
 (0)