MCPcopy Create free account
hub / github.com/apache/arrow / _resolve_object

Function _resolve_object

python/scripts/update_stub_docstrings.py:39–61  ·  view source on GitHub ↗

Resolve an object by dotted path from a module.

(module, path)

Source from the content-addressed store, hash-verified

37
38
39def _resolve_object(module, path):
40 """Resolve an object by dotted path from a module."""
41 if not path:
42 return module, None, module.__name__
43
44 parts = path.split(".")
45 parent = None
46 obj = module
47
48 for part in parts:
49 parent = obj
50 try:
51 obj = getattr(obj, part)
52 except AttributeError:
53 try:
54 obj = vars(parent).get(part)
55 if obj is not None:
56 continue
57 except TypeError:
58 pass
59 return None, None, None
60
61 return obj, parent, getattr(obj, "__name__", parts[-1])
62
63
64def _get_docstring(name, module, indentation):

Callers 1

_get_docstringFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected