Skip to main content

NullTimeKeeper

This class provides a no-op implementation of a time-tracking interface, allowing for timing operations to be bypassed without changing calling code. It features a context manager that performs no timing actions and a results method that produces no output.

Methods


timed()

@classmethod
def timed(
name: str
) - > Iterator[None]

Provides a no-op context manager for timing blocks of code, allowing for consistent API usage when performance tracking is disabled.

Parameters

NameTypeDescription
namestrThe identifier for the code block being timed, used for compatibility with active time keepers.

Returns

TypeDescription
Iterator[None]A context manager that yields control back to the caller without performing any timing operations.

@classmethod
def print_results() - > None

Executes a no-op operation for printing timing statistics, ensuring no output is generated when timing is inactive.

Returns

TypeDescription
NoneNothing is returned.