options_model_from_signature¶
- passengersim.callbacks.configured.options_model_from_signature(cls: type) type[BaseModel][source]¶
Build a configured-callback options model from a class’s constructor.
Each keyword-capable constructor parameter becomes a field, with the parameter’s annotation as its type (or
Anyif there is none, or it cannot be resolved) and its default, if any. Anameparameter is left out: a configured tracer uses its declaration ID as its result name. Unknown options are rejected (extra="forbid").- Parameters:
- cls : type¶
The class whose
__init__signature is read.
- Returns:
type[pydantic.BaseModel] – A model named
<ClassName>Options.- Raises:
TypeError – If the constructor takes positional-only parameters,
*args, or**kwargs, which cannot be described by an options model, or a parameter’s annotation fails to evaluate for a reason other than an undefined name, or names a type that Pydantic cannot validate.