vinegar.transform.misc

Miscellaneous transformations.

This are transformations that do not fit into another module, but do not warrant a separate module either.

vinegar.transform.misc.to_int(value: Any, raise_error_if_malformed: Literal[True]) int
vinegar.transform.misc.to_int(value: ArgumentT, raise_error_if_malformed: bool) ArgumentT | int

Return integer representation of the value.

When a value that cannot be converted to an int is encountered, the behavior depends on the raise_error_if_malformed option. If that option is set to True, a ValueError is raised. If it is False (the default), the input value is returned unchanged.

Parameters:

value – value to be transformed.

Returns:

int(value).