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

Method find_modules

Lib/_pyrepl/_module_completer.py:110–115  ·  view source on GitHub ↗

Find all modules under 'path' that start with 'prefix'.

(self, path: str, prefix: str)

Source from the content-addressed store, hash-verified

108 return sorted({*submodules, *attributes}), action
109
110 def find_modules(self, path: str, prefix: str) -> list[str]:
111 """Find all modules under 'path' that start with 'prefix'."""
112 modules = self._find_modules(path, prefix)
113 # Filter out invalid module names
114 # (for example those containing dashes that cannot be imported with 'import')
115 return [mod for mod in modules if mod.isidentifier()]
116
117 def _find_modules(self, path: str, prefix: str) -> list[str]:
118 if not path:

Callers 1

completeMethod · 0.95

Calls 2

_find_modulesMethod · 0.95
isidentifierMethod · 0.80

Tested by

no test coverage detected