Skip to content

Commit b24e469

Browse files
author
Benjamin Moody
committed
MultiHeaderMixin: declare types of object attributes.
mypy (and likely other static analysis tools) will complain if an object attribute is used without being defined either in the class or the class's __init__ method. The MultiHeaderMixin class is not public and not meant to be instantiated at all, but refers to attributes that are defined by the MultiRecord class which inherits from it. Declare the types of these attributes here so that mypy knows they exist.
1 parent 21e8674 commit b24e469

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

wfdb/io/_header.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import datetime
2-
from typing import List, Sequence, Tuple
2+
from typing import 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

0 commit comments

Comments
 (0)