ska_sdp_piper.piper.piper_undefined module
- class ska_sdp_piper.piper.piper_undefined.PiperUndefined[source]
Bases:
objectSentinel class to represent an uninitialized configuration parameter.
In the Piper framework, developers must provide default values so that configurations can be dumped to YAML. However, standard defaults like
Noneare often valid configuration values themselves.This class provides a unique sentinel, PIPER_UNDEFINED, to explicitly mark parameters that must be provided by the user at runtime, distinguishing them from both
Noneand valid data.- static check(value)[source]
Check if a value is undefined, either by matching the JSON representation or being the
PIPER_UNDEFINEDsingleton.
- static validate(value, handler, info)[source]
Validate if the value is the
PIPER_UNDEFINEDsentinel. If the validation context doesn't allowPIPER_UNDEFINEDvalues, then raise exceptions. This must be used as a "wrap"-type validator for a pydantic field.- Parameters:
- Return type:
- Returns:
If value is a equivalent of
PIPER_UNDEFINED, then thePIPER_UNDEFINEDsentinel. Else, the result of the pyndatic's default validation handler.- Raises:
AssertionError -- If the value is
PIPER_UNDEFINEDbut the validation context specifically disallows unset fields (allow_unset=False).
- static serialize(value, handler, info)[source]
Serialize the
PIPER_UNDEFINEDsentinel based on the output mode. If value is- Parameters:
- Return type:
- Returns:
If value is a equivalent of
PIPER_UNDEFINED, then either:the string "!__PIPER_UNDEFINED__!" if mode is 'json'
otherwise the
PIPER_UNDEFINEDobject.
Else, the result of the pyndatic's default serializer handler.
- ska_sdp_piper.piper.piper_undefined.PIPER_UNDEFINED = <PIPER_UNDEFINED>
The singleton instance of the PiperUndefined sentinel used across the Piper framework to denote config parameters with undefined values while defining the stage. User must provide values for such parameters while running the pipeline.