Compute the highest level where an __init__ file is found.
(fscache: FileSystemCache, id: str, path: str, prefix: str)
| 770 | |
| 771 | |
| 772 | def highest_init_level(fscache: FileSystemCache, id: str, path: str, prefix: str) -> int: |
| 773 | """Compute the highest level where an __init__ file is found.""" |
| 774 | if is_init_file(path): |
| 775 | path = os.path.dirname(path) |
| 776 | level = 0 |
| 777 | for i in range(id.count(".")): |
| 778 | path = os.path.dirname(path) |
| 779 | if any( |
| 780 | fscache.isfile_case(os_path_join(path, f"__init__{extension}"), prefix) |
| 781 | for extension in PYTHON_EXTENSIONS |
| 782 | ): |
| 783 | level = i + 1 |
| 784 | return level |
| 785 | |
| 786 | |
| 787 | def mypy_path() -> list[str]: |
no test coverage detected
searching dependent graphs…