| 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: |