MCPcopy Create free account
hub / github.com/OpenNMT/CTranslate2 / get_module_map

Function get_module_map

docs/generate.py:58–71  ·  view source on GitHub ↗

Map true modules to exported name

(module, module_path)

Source from the content-addressed store, hash-verified

56
57
58def get_module_map(module, module_path):
59 """Map true modules to exported name"""
60 if not module_is_public(module):
61 return {}
62 m = {}
63 for symbol_name in dir(module):
64 if symbol_name.startswith("_"):
65 continue
66 symbol = getattr(module, symbol_name)
67 symbol_path = "%s.%s" % (module_path, symbol_name)
68 m[symbol] = symbol_path
69 if inspect.ismodule(symbol):
70 m.update(get_module_map(symbol, symbol_path))
71 return m
72
73
74def get_first_public_parent(cls):

Callers 1

generate.pyFile · 0.85

Calls 1

module_is_publicFunction · 0.85

Tested by

no test coverage detected