Skip to content

Commit 5564dc9

Browse files
author
Benjamin Moody
committed
_parse_record_line: annotate type of record_fields variable.
This variable is used in a strange way; initially it contains string values extracted from the record line, then later these string values are replaced with appropriately-typed values for each field. However, there's no real way to make this type-safe without changing the API of the function. Annotate the variable's type so that mypy will not treat it as a Dict[str, Optional[str]].
1 parent b24e469 commit 5564dc9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

wfdb/io/_header.py

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

44
import numpy as np
55
import pandas as pd
@@ -1014,7 +1014,7 @@ def _parse_record_line(record_line: str) -> dict:
10141014
10151015
"""
10161016
# Dictionary for record fields
1017-
record_fields = {}
1017+
record_fields: Dict[str, Any] = {}
10181018

10191019
# Read string fields from record line
10201020
match = rx_record.match(record_line)

0 commit comments

Comments
 (0)