labthings_fastapi.utilities.object_reference_to_object
Load objects from object references.
Functions
|
Convert a string reference to an object. |
Module Contents
- labthings_fastapi.utilities.object_reference_to_object.object_reference_to_object(object_reference: str) Any
Convert a string reference to an object.
This is taken from: https://packaging.python.org/en/latest/specifications/entry-points/
The format of the string is
module_name:qualnamewherequalnameis the fully qualified name of the object within the module. This is the same format used by entrypoints` insetup.pyfiles.- Parameters:
object_reference – a string referencing a Python object to import.
- Returns:
the Python object.
- Raises:
ImportError – if the referenced object cannot be found or imported.