CallbackDefinition

class passengersim.callbacks.configured.CallbackDefinition(factory: Callable[[BaseModel], Any], when: 'initialize_sample' | 'begin_sample' | 'daily' | 'end_sample' | 'finalize_sample' | None, parameters_model: type[BaseModel], version: str, output_name: str | None = None, kind: 'factory' | 'callback' | 'tracer' = 'factory', source: Any = None)[source]

Bases: object

Factory metadata used to validate and construct one callback per simulation.

Methods

__init__(factory, when, parameters_model, ...)

Attributes

kind

How this definition was registered; see DefinitionKind.

output_name

Expected name of the tracer returned by the factory, or None for an ordinary callback.

source

The function or class given to register_callback() or register_tracer().

factory

Construct a fresh callable from one validated options model.

when

Lifecycle hook for the constructed callback.

parameters_model

Schema used for runtime validation without changing explicit config.

version

Implementation version checked against an explicit config requirement.

factory : Callable[[BaseModel], Any]

Construct a fresh callable from one validated options model.

when : Literal['initialize_sample', 'begin_sample', 'daily', 'end_sample', 'finalize_sample'] | None

Lifecycle hook for the constructed callback.

None for a factory returning a tracer, which then runs on the hooks the tracer itself declares (see tracer_hooks()).

parameters_model : type[BaseModel]

Schema used for runtime validation without changing explicit config.

version : str

Implementation version checked against an explicit config requirement.

output_name : str | None = None

Expected name of the tracer returned by the factory, or None for an ordinary callback.

kind : Literal['factory', 'callback', 'tracer'] = 'factory'

How this definition was registered; see DefinitionKind.

source : Any = None

The function or class given to register_callback() or register_tracer().

None for a factory registration. Used to decide whether a later registration under the same name may replace this one.