ros_sugar.config.base_validators#

Module Contents#

Functions#

gt

Validates that field is greater than value

lt

Validates that field is lesser than value

in_

Validates that value is in a given list

list_contained_in

Validates that all elements in a given list are in values

in_range

Validates that a given value is within range

in_range_discretized

Validates that a given value is within range with a given step

API#

ros_sugar.config.base_validators.gt(value: Union[int, float])#

Validates that field is greater than value

Parameters:

value (int | float) – Value

Returns:

Attrs validator function

Return type:

func

ros_sugar.config.base_validators.lt(value: Union[int, float])#

Validates that field is lesser than value

Parameters:

value (int | float) – Value

Returns:

Attrs validator function

Return type:

func

ros_sugar.config.base_validators.in_(values: List)#

Validates that value is in a given list

Parameters:

values (List) – Reference list of values

Returns:

Attrs validator function

Return type:

func

ros_sugar.config.base_validators.list_contained_in(values: List)#

Validates that all elements in a given list are in values

Parameters:

values (List) – Reference list of values

Returns:

Attrs validator function

Return type:

func

ros_sugar.config.base_validators.in_range(min_value: Union[float, int], max_value: Union[float, int])#

Validates that a given value is within range

Parameters:
  • min_value (Union[float, int]) – Minimum value

  • max_value (Union[float, int]) – Maximum value

Returns:

Attrs validator function

Return type:

func

ros_sugar.config.base_validators.in_range_discretized(step: Union[float, int], min_value: Union[float, int], max_value: Union[float, int])#

Validates that a given value is within range with a given step

Parameters:
  • step (Union[float, int]) – Step size

  • min_value (Union[float, int]) – Minimum value

  • max_value (Union[float, int]) – Maximum value

Returns:

Attrs validator function

Return type:

func