apache_beam.typehints.typecheck module¶
Runtime type checking support.
For internal use only; no backwards-compatibility guarantees.
- class apache_beam.typehints.typecheck.AbstractDoFnWrapper(dofn)[source]¶
Bases:
DoFn
An abstract class to create wrapper around DoFn
- class apache_beam.typehints.typecheck.OutputCheckWrapperDoFn(dofn, full_label)[source]¶
Bases:
AbstractDoFnWrapper
A DoFn that verifies against common errors in the output type.
- class apache_beam.typehints.typecheck.TypeCheckWrapperDoFn(dofn, type_hints, label=None)[source]¶
Bases:
AbstractDoFnWrapper
A wrapper around a DoFn which performs type-checking of input and output.
- static type_check(type_constraint, datum, is_input)[source]¶
Typecheck a PTransform related datum according to a type constraint.
This function is used to optionally type-check either an input or an output to a PTransform.
- Parameters:
type_constraint – An instance of a typehints.TypeContraint, one of the white-listed builtin Python types, or a custom user class.
datum – An instance of a Python object.
is_input – True if ‘datum’ is an input to a PTransform’s DoFn. False otherwise.
- Raises:
TypeError – If ‘datum’ fails to type-check according to ‘type_constraint’.
- class apache_beam.typehints.typecheck.TypeCheckCombineFn(combinefn, type_hints, label=None)[source]¶
Bases:
CombineFn
A wrapper around a CombineFn performing type-checking of input and output.