MCPcopy Create free account
hub / github.com/google-deepmind/chex / find_internal_python_modules

Function find_internal_python_modules

docs/ext/coverage_check.py:27–46  ·  view source on GitHub ↗

Returns `(name, module)` for all submodules under `root_module`.

(
    root_module: types.ModuleType,)

Source from the content-addressed store, hash-verified

25
26
27def find_internal_python_modules(
28 root_module: types.ModuleType,) -> Sequence[Tuple[str, types.ModuleType]]:
29 """Returns `(name, module)` for all submodules under `root_module`."""
30 modules = set([(root_module.__name__, root_module)])
31 visited = set()
32 to_visit = [root_module]
33
34 while to_visit:
35 mod = to_visit.pop()
36 visited.add(mod)
37
38 for name in dir(mod):
39 obj = getattr(mod, name)
40 if inspect.ismodule(obj) and obj not in visited:
41 if obj.__name__.startswith(_module.__name__):
42 if '_src' not in obj.__name__:
43 to_visit.append(obj)
44 modules.add((obj.__name__, obj))
45
46 return sorted(modules)
47
48
49def get_public_symbols() -> Sequence[Tuple[str, types.ModuleType]]:

Callers 1

get_public_symbolsFunction · 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…