Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix incorrect type annotations and type inference #445

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

Merged
merged 6 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions wfdb/io/_header.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import datetime
from typing import Collection, List, Tuple
from typing import Any, Dict, List, Optional, Sequence, Tuple

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -598,6 +598,10 @@ class MultiHeaderMixin(BaseHeaderMixin):

"""

n_seg: int
seg_len: Sequence[int]
segments: Optional[Sequence]

def set_defaults(self):
"""
Set defaults for fields needed to write the header if they have
Expand Down Expand Up @@ -920,7 +924,7 @@ def contained_ranges(self, sig_name: str) -> List[Tuple[int, int]]:

def contained_combined_ranges(
self,
sig_names: Collection[str],
sig_names: Sequence[str],
) -> List[Tuple[int, int]]:
"""
Given a collection of signal name, return the sample ranges that
Expand Down Expand Up @@ -1010,7 +1014,7 @@ def _parse_record_line(record_line: str) -> dict:

"""
# Dictionary for record fields
record_fields = {}
record_fields: Dict[str, Any] = {}

# Read string fields from record line
match = rx_record.match(record_line)
Expand Down
2 changes: 1 addition & 1 deletion wfdb/io/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Config(object):

"""

pass
db_index_url: str


# The configuration database index url. Uses PhysioNet index by default.
Expand Down
2 changes: 1 addition & 1 deletion wfdb/io/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ def multi_to_single(self, physical, return_res=64, expanded=False):
# this library
ALLOWED_TYPES = dict(
[
[index, _header.FIELD_SPECS.loc[index, "allowed_types"]]
(index, _header.FIELD_SPECS.loc[index, "allowed_types"])
for index in _header.FIELD_SPECS.index
]
)
Expand Down
7 changes: 4 additions & 3 deletions wfdb/io/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import math
import os

from typing import Sequence, Tuple
from typing import List, Sequence, Tuple


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


def overlapping_ranges(
ranges_1: Tuple[int, int], ranges_2: Tuple[int, int]
) -> Tuple[int, int]:
ranges_1: Sequence[Tuple[int, int]],
ranges_2: Sequence[Tuple[int, int]],
) -> List[Tuple[int, int]]:
"""
Given two collections of integer ranges, return a list of ranges
in which both input inputs overlap.
Expand Down