symforce.type_helpers module#

deduce_input_type(parameter, func, is_first_parameter)[source]#

Attempt to deduce the type of an input parameter to a function

Strategy:

  1. If it’s annotated with something, return that

  2. If it’s the first parameter and its name is “self”, search for a type by the class part of the function’s qualified name

Parameters:
Return type:

Any | Type

deduce_input_types(func)[source]#

Attempt to deduce input types from the type annotations on func, to be used by Codegen.function.

See the docstring on deduce_input_type() for deduction strategy

Parameters:

func (Callable) –

Return type:

Sequence[Any | Type]

symbolic_inputs(func, input_types=None)[source]#

Return symbolic arguments for the inputs to func

Parameters:
Returns:

A tuple with a symbolic object for each input to func

Return type:

Values

See also: sf.util.symbolic_eval