odata_query.typing module

odata_query.typing.infer_return_type(node: Call) Optional[Type[_Node]][source]

Tries to infer the type of a function call node.

Parameters:

node – The node to infer the type for.

Returns:

The inferred type or None if unable to infer.

odata_query.typing.infer_type(node: _Node) Optional[Type[_Node]][source]

Tries to infer the type of node.

Parameters:

node – The node to infer the type for.

Returns:

The inferred type or None if unable to infer.

odata_query.typing.typecheck(node: _Node, expected_type: Union[Type, Tuple[Type, ...]], field_name: str) None[source]

Checks that the inferred type of node is (one) of expected_type, and raises ArgumentTypeException if not.

Parameters:
  • node – The node to type check.

  • expected_type – The allowed type(s) the node can have.

  • field_name – The name of the field you’re typechecking. Only used in the exception.

Raises:

ArgumentTypeException