spekk.transformations.base.TransformedFunction#
- class spekk.transformations.base.TransformedFunction(wrapped_fn: Union[<built-in function callable>, ForwardRef('TransformedFunction')], transformation: 'Transformation')[source]#
Bases:
Buildable- __init__(wrapped_fn: callable | TransformedFunction, transformation: Transformation) None#
Methods
__init__(wrapped_fn, transformation)build(input_spec)Return a copy of this object with information about what happens to the spec when the function is called.
traverse(*[, depth_first])Recursively yield the potentially nested
TransformedFunction.Attributes
The spec for the input kwargs for the function.
The spec of the final returned value from the transformed function.
The spec for the input kwargs that are passed down into the wrapped function after the transformation has been applied.
The spec of the returned value from the wrapped function.
The original function that was wrapped by the transformation.
The
Transformationthat was applied to the wrapped function.- build(input_spec: Spec) TransformedFunction[source]#
Return a copy of this object with information about what happens to the spec when the function is called.
- output_spec: Spec | None = None#
The spec of the final returned value from the transformed function.
- passed_spec: Spec | None = None#
The spec for the input kwargs that are passed down into the wrapped function after the transformation has been applied.
- transformation: Transformation#
The
Transformationthat was applied to the wrapped function.
- traverse(*, depth_first: bool = False)[source]#
Recursively yield the potentially nested
TransformedFunction.>>> from spekk.transformations import ForAll, compose, TransformedFunction >>> tf = compose(abs, ForAll("x"), ForAll("y")) >>> for t in tf.traverse(): ... if isinstance(t, TransformedFunction): ... t = t.transformation # Print transformation, not TransformedFunction ... print(repr(t)) ForAll("y") ForAll("x") <built-in function abs>
- wrapped_fn: callable | TransformedFunction#
The original function that was wrapped by the transformation.