(self, package_prefix, prefix)
| 586 | raise ImportError(fullname) |
| 587 | |
| 588 | def iter_modules(self, package_prefix, prefix): |
| 589 | paths = self._cache_module_path(package_prefix.rstrip('.')) |
| 590 | if paths is not None: |
| 591 | # Note: it's ok to yield duplicates because pkgutil discards them |
| 592 | |
| 593 | # Yield from cache |
| 594 | import re |
| 595 | rx = re.compile(re.escape(package_prefix) + r'([^.]+)$') |
| 596 | # Save result to temporary list to prevent 'RuntimeError: dictionary changed size during iteration' |
| 597 | found = [] |
| 598 | for mod, path in self.module_path_cache.items(): |
| 599 | if path is not None: |
| 600 | m = rx.match(mod) |
| 601 | if m: |
| 602 | found.append((prefix + m.group(1), self.is_package(mod))) |
| 603 | yield from found |
| 604 | |
| 605 | # Yield from file system |
| 606 | for path in paths: |
| 607 | abs_path = _path_join(self.source_root, path) |
| 608 | for dir_item in _os.listdir(abs_path): |
| 609 | if self._path_is_simple_dir(_path_join(abs_path, dir_item)): |
| 610 | yield prefix + dir_item, True |
| 611 | elif dir_item.endswith(self.PY_EXT) and _path_isfile(_path_join(abs_path, dir_item)): |
| 612 | yield prefix + dir_item[:-len(self.PY_EXT)], False |
| 613 | |
| 614 | def _isdir(self, path): |
| 615 | """ Unlike _path_isdir() this function don't follow symlink """ |
nothing calls this directly
no test coverage detected