hyped.common.utils module¶
A Collection of utility functions used throughout the project.
- hyped.common.utils.is_package_installed(package_name: str) bool[source]¶
Check if a package with the given name is installed.
- hyped.common.utils.is_python_version_less_than(major, minor: int = 0, micro: int = 0)[source]¶
Check if the current Python version is less than the provided version.
- hyped.common.utils.tmp_setattr(instance: object, attribute: str, value: Any) Generator[None, None, None][source]¶
Temporarily set an attribute on an object and restore its original value afterward.
This context manager temporarily sets the specified attribute on the given object to a new value. Upon exiting the context, the original value is restored. If the attribute did not exist prior to the context, it will be removed when the context exits.
- Parameters:
- Yields:
None – Yields control to the context block.
- Raises:
AttributeError – If the attribute cannot be set or removed on the given object.