Skip to content

Commit

Permalink
improve type-hints for BasePlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
mscheltienne committed Nov 20, 2023
1 parent 5a0944d commit dd4ead0
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions mne_lsl/player/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ def __init__(self, fname: Union[str, Path], chunk_size: int = 64) -> None:
# This method should end on a self._reset_variables()

@fill_doc
def anonymize(self, daysback=None, keep_his=False, *, verbose=None):
def anonymize(
self,
daysback: Optional[int] = None,
keep_his: bool = False,
*,
verbose: Optional[Union[bool, str, int]] = None,
) -> None:
"""Anonymize the measurement information in-place.
Parameters
Expand Down Expand Up @@ -121,7 +127,7 @@ def rename_channels(
mapping: Union[dict[str, str], Callable],
allow_duplicates: bool = False,
*,
verbose=None,
verbose: Optional[Union[bool, str, int]] = None,
) -> None:
"""Rename channels.
Expand All @@ -140,14 +146,18 @@ def rename_channels(
rename_channels(self.info, mapping, allow_duplicates)

@abstractmethod
def start(self) -> None:
def start(self) -> None: # pragma: no cover
"""Start streaming data."""
pass

@abstractmethod
@fill_doc
def set_channel_types(
self, mapping: dict[str, str], *, on_unit_change: str = "warn", verbose=None
self,
mapping: dict[str, str],
*,
on_unit_change: str = "warn",
verbose: Optional[Union[bool, str, int]] = None,
) -> None:
"""Define the sensor type of channels.
Expand Down Expand Up @@ -217,7 +227,7 @@ def set_channel_units(self, mapping: dict[str, Union[str, int]]) -> None:
)

def set_meas_date(
self, meas_date: Optional[Union[datetime, float, tuple[float]]]
self, meas_date: Optional[Union[datetime, float, tuple[float, float]]]
) -> None:
"""Set the measurement start date.
Expand Down Expand Up @@ -263,7 +273,7 @@ def _check_not_started(self, name: str):
)

@abstractmethod
def _stream(self) -> None:
def _stream(self) -> None: # pragma: no cover
"""Push a chunk of data from the raw object to the real-time stream.
Don't use raw.get_data but indexing which is faster.
Expand Down Expand Up @@ -301,7 +311,7 @@ def __exit__(self, exc_type, exc_value, exc_tracebac):
self.stop()

@staticmethod
def __repr__(self):
def __repr__(self): # pragma: no cover
"""Representation of the instance."""
# This method must define the string representation of the player, e.g.
# <Player: {self._fname}>
Expand Down

0 comments on commit dd4ead0

Please sign in to comment.