Service Customization Helpers

exception bosdyn.client.service_customization_helpers.InvalidCustomParamSpecError[source]

Bases: ValueError

Error indicating that the defined custom parameter Spec is invalid, with a list of error messages explaining why the spec is invalid

exception bosdyn.client.service_customization_helpers.InvalidCustomParamValueError(proto_error: CustomParamError)[source]

Bases: ValueError

Error indicating that the defined custom parameter value does not match the associated Spec, with a list of error messages explaining why.

bosdyn.client.service_customization_helpers.validate_dict_spec(dict_spec: Spec) None[source]

Checks that a DictParam.Spec is valid

Parameters:

dict_spec (service_customization_pb2.DictParam.Spec) – Spec to be validated

Returns:

None for a valid spec

Raises:

InvalidCustomParamSpecError with a list of error messages for invalid specs.

bosdyn.client.service_customization_helpers.create_value_validator(dict_spec: Spec) Callable[[DictParam], CustomParamError | None][source]

Checks if the DictParam.Spec is value and if so, returns a function that can be used to validate any DictParam value

Parameters:

dict_spec (service_customization_pb2.DictParam.Spec) – Spec to be validated and validate values against

Raises:

InvalidCustomParamSpecError with a list of error messages if the dict_spec is invalid

Returns:

A validate_value function that can be called on any value to verify it against this Spec. The returned function will itself return None if called on a valid value, and a CustomParamError with a status besides STATUS_OK for an invalid spec

bosdyn.client.service_customization_helpers.dict_params_to_dict(dict_param: DictParam, dict_spec: Spec, validate: bool = True) Dict[source]
bosdyn.client.service_customization_helpers.list_params_to_list(list_param: ListParam, list_spec: Spec, validate: bool = True) List[source]
bosdyn.client.service_customization_helpers.oneof_param_to_dict(oneof_param: OneOfParam, oneof_spec: Spec, validate: bool = True) List[source]
bosdyn.client.service_customization_helpers.check_types_match(param, proto_type)[source]
bosdyn.client.service_customization_helpers.custom_spec_to_default(spec)[source]

Create a default service_customization_pb2.CustomParam based off of the service_customization_pb2.CustomParam.Spec argument

Parameters:

spec (service_customization_pb2.CustomParam.Spec) – spec to which the parameter should be defaulted

bosdyn.client.service_customization_helpers.dict_spec_to_default(spec)[source]

Create a default service_customization_pb2.DictParam based off of the service_customization_pb2.DictParam.Spec argument.

Parameters:

spec (service_customization_pb2.DictParam.Spec) – spec to which the parameter should be defaulted

bosdyn.client.service_customization_helpers.list_spec_to_default(spec)[source]

Create a default service_customization_pb2.ListParam based off of the service_customization_pb2.ListParam.Spec argument

Parameters:

spec (service_customization_pb2.ListParam.Spec) – spec to which the parameter should be defaulted

bosdyn.client.service_customization_helpers.int_spec_to_default(spec)[source]

Create a default service_customization_pb2.IntParam based off of the service_customization_pb2.IntParam.Spec argument

Parameters:

spec (service_customization_pb2.IntParam.Spec) – spec to which the parameter should be defaulted

bosdyn.client.service_customization_helpers.double_spec_to_default(spec)[source]

Create a default service_customization_pb2.DoubleParam based off of the service_customization_pb2.DoubleParam.Spec argument

Parameters:

spec (service_customization_pb2.DoubleParam.Spec) – spec to which the parameter should be defaulted

bosdyn.client.service_customization_helpers.string_spec_to_default(spec)[source]

Create a default service_customization_pb2.StringParam based off of the service_customization_pb2.StringParam.Spec argument

Parameters:

spec (service_customization_pb2.StringParam.Spec) – spec to which the parameter should be defaulted

bosdyn.client.service_customization_helpers.roi_spec_to_default(spec)[source]

Create a default service_customization_pb2.RegionOfInterestParam based off of the service_customization_pb2.RegionOfInterestParam.Spec argument

Parameters:

spec (service_customization_pb2.RegionOfInterestParam.Spec) – spec to which the parameter should be defaulted

bosdyn.client.service_customization_helpers.bool_spec_to_default(spec)[source]

Create a default service_customization_pb2.BoolParam based off of the service_customization_pb2.BoolParam.Spec argument

Parameters:

spec (service_customization_pb2.BoolParam.Spec) – spec to which the parameter should be defaulted

bosdyn.client.service_customization_helpers.one_of_spec_to_default(spec)[source]

Create a default service_customization_pb2.OneOfParam based off of the service_customization_pb2.OneOfParam.Spec argument

Parameters:

spec (service_customization_pb2.OneOfParam.Spec) – spec to which the parameter should be defaulted

bosdyn.client.service_customization_helpers.dict_param_coerce_to(param, spec)[source]

Coerce a service_customization_pb2.DictParam based off of the spec passed in. The parameter is modified in-place.

Parameters:
  • param (service_customization_pb2.DictParam) – parameter that requires coercing

  • spec (service_customization_pb2.DictParam.Spec) – spec to which the parameter should be coerced

Returns:

True if parameter was coerced False otherwise

bosdyn.client.service_customization_helpers.list_param_coerce_to(param, spec)[source]

Coerce a service_customization_pb2.ListParam based off of the spec passed in. The parameter is modified in-place.

Parameters:
  • param (service_customization_pb2.ListParam) – parameter that requires coercing

  • spec (service_customization_pb2.ListParam.Spec) – spec to which the parameter should be coerced

Returns:

True if parameter was coerced False otherwise

bosdyn.client.service_customization_helpers.int_param_coerce_to(param, spec)[source]

Coerce a service_customization_pb2.IntParam based off of the spec passed in. The parameter is modified in-place.

Parameters:
  • param (service_customization_pb2.IntParam) – parameter that requires coercing

  • spec (service_customization_pb2.Int.Spec) – spec to which the parameter should be coerced

Returns:

True if parameter was coerced False otherwise

bosdyn.client.service_customization_helpers.double_param_coerce_to(param, spec)[source]

Coerce a service_customization_pb2.CustomParam based off of the spec passed in. The parameter is modified in-place.

Parameters:
  • param (service_customization_pb2.DoubleParam) – parameter that requires coercing

  • spec (service_customization_pb2.DoubleParam.Spec) – spec to which the parameter should be coerced

Returns:

True if parameter was coerced False otherwise

bosdyn.client.service_customization_helpers.string_param_coerce_to(param, spec)[source]

Coerce a service_customization_pb2.StringParam based off of the spec passed in. The parameter is modified in-place.

Parameters:
  • param (service_customization_pb2.StringParam) – parameter that requires coercing

  • spec (service_customization_pb2.StringParam.Spec) – spec to which the parameter should be coerced

Returns:

True if parameter was coerced False otherwise

bosdyn.client.service_customization_helpers.roi_param_coerce_to(param, spec)[source]

Coercion is tricky with ROI parameters due to the fact that there is no standard frame size. ROI parameter is not modified in place; rather, a boolean value is returned.

Parameters:
  • param (service_customization_pb2.RegionOfInterestParam) – parameter that requires coercing

  • spec (service_customization_pb2.RegionOfInterestParam.Spec) – spec to which the parameter should be coerced

Returns:

True if service_and_source is unset or if the spec and the parameter match False otherwise

bosdyn.client.service_customization_helpers.one_of_param_coerce_to(param, spec)[source]

Coerce a service_customization_pb2.OneOfParam based off of the spec passed in. The parameter is modified in-place.

Parameters:
  • param (service_customization_pb2.OneOfParam) – parameter that requires coercing

  • spec (service_customization_pb2.OneOfParam.Spec) – spec to which the parameter should be coerced

Returns:

True if parameter was coerced False otherwise

bosdyn.client.service_customization_helpers.custom_param_coerce_to(param, spec)[source]

Coerce a service_customization_pb2.CustomParam based off of the spec passed in. The parameter is modified in-place.

Parameters:
  • param (service_customization_pb2.CustomParam) – parameter that requires coercing

  • spec (service_customization_pb2.CustomParam.Spec) – spec to which the parameter should be coerced

Returns:

True if parameter was coerced False otherwise

bosdyn.client.service_customization_helpers.make_custom_param_spec(spec: Spec | Spec | Spec | Spec | Spec | Spec | Spec | Spec) Spec[source]

Helper function to create a CustomParam.Spec

Parameters:

spec – spec to be wrapped by a CustomParam.Spec

bosdyn.client.service_customization_helpers.make_dict_child_spec(param_spec: Spec | Spec | Spec | Spec | Spec | Spec | Spec | Spec, ui_info: UserInterfaceInfo | None = None) ChildSpec[source]

Helper function to create a DictParam.ChildSpec

Parameters:
  • param_spec – spec for DictParam.ChildSpec that is converted into a CustomParam.Spec when forming the ChildSpec

  • ui_info – instantiation of service_customization_pb2.UserInterfaceInfo

bosdyn.client.service_customization_helpers.make_dict_param_spec(specs: Dict[str, ChildSpec], is_hidden_by_default: bool) Spec[source]

Helper function to create a DictParam.Spec

Parameters:
  • specs – specs contained by the DictParam

  • is_hidden_by_default – controls whether the UI shows this spec as collapsed by default

bosdyn.client.service_customization_helpers.make_one_of_child_spec(dict_param_spec: Spec, ui_info: UserInterfaceInfo | None = None) ChildSpec[source]

Helper function to create a OneOfParam.ChildSpec

Parameters:
  • dict_param_spec – spec for OneOfParam.ChildSpec

  • ui_info – instantiation of service_customization_pb2.UserInterfaceInfo

bosdyn.client.service_customization_helpers.make_one_of_param_spec(specs: Dict[str, ChildSpec], default_key: str | None = None) Spec[source]

Helper function to create a OneOfParam.Spec

Parameters:
  • specs – specs contained by the OneOfParam

  • default_key – the key to which the OneOfParam.Spec should default in the UI

bosdyn.client.service_customization_helpers.make_list_param_spec(element_spec: Spec, min_number_of_values: int | None = None, max_number_of_values: int | None = None) Spec[source]

Helper function to create a ListParam.Spec

Parameters:
  • element_spec – spec for each element of the list

  • min_number_of_values – minimum number of elements in the list

  • max_number_of_values – maximum number of elements in the list

bosdyn.client.service_customization_helpers.make_int64_param_spec(default_value: int | None = None, units: Units | None = None, min_value: int | None = None, max_value: int | None = None) Spec[source]

Helper function to create an Int64Param.Spec

Parameters:
  • default_value – starting value for Int64Param

  • units – units of the Int64Param

  • min_value – smallest value the Int64Param may be

  • max_value – largest value the Int64Param may be

bosdyn.client.service_customization_helpers.make_double_param_spec(default_value: float | None = None, units: Units | None = None, min_value: float | None = None, max_value: float | None = None) Spec[source]

Helper function to create a DoubleParam.Spec

Parameters:
  • default_value – starting value for DoubleParam

  • units – units of the DoubleParam

  • min_value – smallest value the DoubleParam may be

  • max_value – largest value the DoubleParam may be

bosdyn.client.service_customization_helpers.make_string_param_spec(options: List[str] | None = None, editable: bool | None = None, default_value: str | None = None) Spec[source]

Helper function to create a StringParam.Spec

Parameters:
  • options – predetermined options the StringParam may be

  • editable – whether the value may be edited

  • default_value – initial value for StringParam

bosdyn.client.service_customization_helpers.make_bool_param_spec(default_value: bool | None = None) Spec[source]

Helper function to create an BoolParam.Spec

Parameters:

default_value – starting value for BoolParam

bosdyn.client.service_customization_helpers.make_region_of_interest_param_spec(service_and_source: ServiceAndSource | None = None, default_area: AreaI | None = None, allows_rectangle: bool = False) Spec[source]

Helper function to create a RegionOfInterestParam.Spec

Parameters:
  • service_and_source – service and source to which the RegionOfInterestParam should adhere

  • default_area – starting area for the RegionOfInterestParam

  • allows_rectangle – whether a rectangle may be drawn for the selected area

bosdyn.client.service_customization_helpers.make_user_interface_info(display_name: str | None = None, description: str | None = None, display_order: int | None = None) UserInterfaceInfo[source]

Helper function to create UserInterfaceInfo

Parameters:
  • display_name – human-readable name displayed by the UI

  • description – additional information for parameter (used in conjunction with display_name)

  • display_order – order in which the fields should be displayed

bosdyn.client.service_customization_helpers.make_roi_service_and_source(service: str, source: str) ServiceAndSource[source]

Helper function to create a RegionOfInterestParam.ServiceAndSource

Parameters:
  • service – the ImageService providing the image

  • source – the ImageSource providing the image