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

Method _find_children

Lib/importlib/_bootstrap_external.py:1452–1472  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1450 return path_hook_for_FileFinder
1451
1452 def _find_children(self):
1453 with _os.scandir(self.path) as scan_iterator:
1454 while True:
1455 try:
1456 entry = next(scan_iterator)
1457 if entry.name == _PYCACHE:
1458 continue
1459 # packages
1460 if entry.is_dir() and '.' not in entry.name:
1461 yield entry.name
1462 # files
1463 if entry.is_file():
1464 yield from {
1465 entry.name.removesuffix(suffix)
1466 for suffix, _ in self._loaders
1467 if entry.name.endswith(suffix)
1468 }
1469 except OSError:
1470 pass # ignore exceptions from next(scan_iterator) and os.DirEntry
1471 except StopIteration:
1472 break
1473
1474 def discover(self, parent=None):
1475 if parent and parent.submodule_search_locations is None:

Callers 1

discoverMethod · 0.95

Calls 5

scandirMethod · 0.45
is_dirMethod · 0.45
is_fileMethod · 0.45
removesuffixMethod · 0.45
endswithMethod · 0.45

Tested by

no test coverage detected