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

Method discover

Lib/importlib/_bootstrap_external.py:1287–1301  ·  view source on GitHub ↗
(cls, parent=None)

Source from the content-addressed store, hash-verified

1285
1286 @classmethod
1287 def discover(cls, parent=None):
1288 if parent is None:
1289 path = sys.path
1290 elif parent.submodule_search_locations is None:
1291 raise ValueError(f'{parent} is not a package module')
1292 else:
1293 path = parent.submodule_search_locations
1294
1295 for entry in set(path):
1296 if not isinstance(entry, str):
1297 continue
1298 if (finder := cls._path_importer_cache(entry)) is None:
1299 continue
1300 if discover := getattr(finder, 'discover', None):
1301 yield from discover(parent)
1302
1303 @staticmethod
1304 def find_distributions(*args, **kwargs):

Callers

nothing calls this directly

Calls 2

setFunction · 0.85
_path_importer_cacheMethod · 0.80

Tested by

no test coverage detected