General Package Utility Functions
Utility functions useful for various package things like
getting the signature matching
-
boa.utils.get_callable_signature(callable: Callable) → Signature[source]
- Parameters
callable (Callable) –
- Return type
Signature
-
boa.utils.get_dictionary_matching_signature(signature: Signature, d: dict, match_private: bool = False, exclude_fields: Optional[list[str]] = None, accept_all_kwargs: bool = True) → dict[source]
- Parameters
-
- Return type
dict
-
boa.utils.get_dictionary_from_callable(callable: Callable, d: dict, **kwargs) → dict[source]
- Parameters
-
- Return type
dict
-
boa.utils.serialize_init_args(class_, *, parents: Optional[list[Type]] = None, match_private: bool = False, **kwargs)[source]
Given an object, return a dictionary of the arguments that are
needed by its constructor.
- Parameters
-
Given a dictionary, extract the arguments required for the
given class’s constructor.
- Parameters
-
- Return type
dict[str, Any]
-
boa.utils.torch_device()[source]
-
boa.utils.convert_type(maybe_iterable, conversion: dict, new_dict: Optional[dict] = None)[source]
- Parameters
-
-
boa.utils.deprecation(message, version_to_remove=None)[source]
-
class boa.utils.StrEnum(value)[source]
Bases: str, Enum
Enum where members are also (and must be) strings
-
classmethod from_str_or_enum(value: Union[str, StrEnum]) → StrEnum[source]
- Parameters
value (Union[str, StrEnum]) –
- Return type
StrEnum
-
boa.utils.check_min_package_version(package, minimum_version, should_trunc_to_same_len=True)[source]
Helper to decide if the package you are using meets minimum version requirement for some feature.
-
boa.utils.yaml_dump(data: dict | str, path: PathLike) → None[source]
- Parameters
data (dict | str) –
path (PathLike) –
- Return type
None