signal_checks
signal_checks ¤
Consistent input checks for detector calls (wired in by Base).
Every public method of a detector in ts_shape.events is wrapped so that
its signal arguments are checked the same way, whichever pack it is in:
- a signal uuid (any argument named
*_uuid/*_uuids, exceptevent_uuid) that does not occur in a non-empty frame emits a :class:~ts_shape.errors.DataQualityWarningnaming the uuids that do -- instead of silently returning an empty result; - a frame without the uuid column raises
:class:
~ts_shape.errors.ColumnNotFoundError(aValueError) instead of a bareKeyErrordeep inside the method; - a column argument (
value_column,value_column_<role>,<role>_column) that names a column the frame does not have raises :class:~ts_shape.errors.ColumnNotFoundErrorlisting the columns, when the method looks it up.
The checks never change a result.
remember_uuids ¤
remember_uuids(
obj: Any, frame: DataFrame, column: str, uuids: set[str]
) -> None
Record uuids (as text) as the values of frame[column].
Used while obj.dataframe is still frame (the same object, with
the same length); a detector that replaces its frame gets its uuids
computed again.
check_signals ¤
check_signals(
obj: Any,
fn: Callable[..., Any],
args: tuple,
kwargs: dict,
) -> None
Warn about signal uuids that are not in obj.dataframe.
checked ¤
checked(fn: Callable[..., Any]) -> Callable[..., Any]
Wrap a detector method with :func:check_signals (outermost call only).
checked_init ¤
checked_init(fn: Callable[..., Any]) -> Callable[..., Any]
Wrap a detector constructor: column check before, uuid check after.