| 14 | |
| 15 | |
| 16 | class FakeFSCache(FileSystemCache): |
| 17 | def __init__(self, files: set[str]) -> None: |
| 18 | self.files = {os.path.abspath(f) for f in files} |
| 19 | |
| 20 | def isfile(self, path: str) -> bool: |
| 21 | return path in self.files |
| 22 | |
| 23 | def isdir(self, path: str) -> bool: |
| 24 | if not path.endswith(os.sep): |
| 25 | path += os.sep |
| 26 | return any(f.startswith(path) for f in self.files) |
| 27 | |
| 28 | def listdir(self, path: str) -> list[str]: |
| 29 | if not path.endswith(os.sep): |
| 30 | path += os.sep |
| 31 | return list({f[len(path) :].split(os.sep)[0] for f in self.files if f.startswith(path)}) |
| 32 | |
| 33 | def init_under_package_root(self, path: str) -> bool: |
| 34 | return False |
| 35 | |
| 36 | |
| 37 | def normalise_path(path: str) -> str: |
no outgoing calls
searching dependent graphs…