corelay.base
A module that contains core CoRelAy classes, such as Param.
Classes
A single parameter slot, which can be used to parameterize implementations of |
- class corelay.base.Param[source]
Bases:
SlotA single parameter slot, which can be used to parameterize implementations of
Processor. The instances ofParamin aProcessorimplementation are tracked by aTracker.- __init__(dtype: type[Any] | tuple[type[Any], ...], default: Any = None, mandatory: bool = False, positional: bool = False, identifier: bool = False) None[source]
Initializes a new
Paraminstance, and configures its type and default value of the parameter.- Parameters:
dtype (type[Any] | tuple[type[Any], ...]) – The allowed type(s) of the parameter. This can be a single
typeor atupleof multipletypeinstances.default (Any) – The default value of the parameter. This must be an instance of one of the types specified in the
dtypeparameter.mandatory (bool) – A value indicating whether this parameter is mandatory. If
True, the default value will be removed. Defaults toFalse.positional (bool) – A value indicating whether this parameter will have to be passed as a positional argument to
Processor.__init__. IfTrue, the parameter will be passed as a positional argument toProcessor.__init__, otherwise it will be passed as a keyword argument. Defaults toFalse.identifier (bool) – A value indicating whether this parameter should be used to identify a
Processor. IfTrue, the parameter will be used to identify aProcessor. This is useful for distinguishing processors, when caching their outputs. Defaults toFalse.
- Return type:
None
- property is_positional: bool
Gets or sets a value indicating whether this parameter can be assigned as a positional argument to
Processor.__init__.- Returns:
Returns
Trueif this parameter can be assigned as a positional argument toProcessor.__init__andFalseotherwise.- Return type: