MCPcopy Index your code
hub / github.com/python/cpython / iter_submodules

Method iter_submodules

Lib/_pyrepl/_module_completer.py:202–210  ·  view source on GitHub ↗

Iterate over all submodules of the given parent modules.

(self, parent_modules: list[pkgutil.ModuleInfo])

Source from the content-addressed store, hash-verified

200 return not module_name.startswith("_")
201
202 def iter_submodules(self, parent_modules: list[pkgutil.ModuleInfo]) -> Iterator[pkgutil.ModuleInfo]:
203 """Iterate over all submodules of the given parent modules."""
204 specs = [info.module_finder.find_spec(info.name, None)
205 for info in parent_modules if info.ispkg]
206 search_locations = set(chain.from_iterable(
207 getattr(spec, 'submodule_search_locations', [])
208 for spec in specs if spec
209 ))
210 return pkgutil.iter_modules(search_locations)
211
212 def get_path_and_prefix(self, dotted_name: str) -> tuple[str, str]:
213 """

Callers 1

_find_modulesMethod · 0.95

Calls 2

setFunction · 0.85
find_specMethod · 0.45

Tested by

no test coverage detected