MCPcopy Create free account
hub / github.com/closeio/tasktiger / import_attribute

Function import_attribute

tasktiger/_internal.py:63–71  ·  view source on GitHub ↗

Return an attribute from a dotted path name (e.g. "path.to.func").

(name: str)

Source from the content-addressed store, hash-verified

61
62# from rq
63def import_attribute(name: str) -> Any:
64 """Return an attribute from a dotted path name (e.g. "path.to.func")."""
65 try:
66 sep = ":" if ":" in name else "." # For backwards compatibility
67 module_name, attribute = name.rsplit(sep, 1)
68 module = importlib.import_module(module_name)
69 return operator.attrgetter(attribute)(module)
70 except (ValueError, ImportError, AttributeError) as e:
71 raise TaskImportError(e)
72
73
74def gen_id() -> str:

Callers 4

should_retry_onMethod · 0.85
funcMethod · 0.85
get_runner_classFunction · 0.85

Calls 1

TaskImportErrorClass · 0.85

Tested by

no test coverage detected