MCPcopy Create free account
hub / github.com/python-arq/arq / import_string

Function import_string

arq/utils.py:138–153  ·  view source on GitHub ↗

Taken from pydantic.utils.

(dotted_path: str)

Source from the content-addressed store, hash-verified

136
137
138def import_string(dotted_path: str) -> Any:
139 """
140 Taken from pydantic.utils.
141 """
142 from importlib import import_module
143
144 try:
145 module_path, class_name = dotted_path.strip(' ').rsplit('.', 1)
146 except ValueError as e:
147 raise ImportError(f'"{dotted_path}" doesn\'t look like a module path') from e
148
149 module = import_module(module_path)
150 try:
151 return getattr(module, class_name)
152 except AttributeError as e:
153 raise ImportError(f'Module "{module_path}" does not define a "{class_name}" attribute') from e

Callers 3

cliFunction · 0.85
cronFunction · 0.85
funcFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…