baybe.parameters.selectors.to_parameter_selector¶
- baybe.parameters.selectors.to_parameter_selector(x: str | type[Parameter] | Collection[str] | Collection[type[Parameter]] | ParameterSelectorProtocol, /)[source]¶
Convert shorthand notations to parameter selectors.
Convenience converter that allows users to specify parameter selectors using simpler types:
A callable (i.e., an existing selector or any object satisfying
ParameterSelectorProtocol) is passed through unchanged.A single string is interpreted as a parameter name and wrapped into a
NameSelector.A single
Parametersubclass is wrapped into aTypeSelector.A collection of strings is converted to a
NameSelector.A collection of
Parametersubclasses is converted to aTypeSelector.
- Parameters:
x (
str|type[Parameter] |Collection[str] |Collection[type[Parameter]] |ParameterSelectorProtocol) – The object to convert.- Return type:
- Returns:
The corresponding parameter selector.
- Raises:
TypeError – If the input cannot be converted to a parameter selector.