(paths: Iterable[str])
| 165 | |
| 166 | |
| 167 | def dedupe_existing_paths(paths: Iterable[str]) -> list[str]: |
| 168 | deduped: list[str] = [] |
| 169 | seen: set[str] = set() |
| 170 | for entry in paths: |
| 171 | expanded = os.path.expanduser(entry) |
| 172 | if not expanded or expanded in seen: |
| 173 | continue |
| 174 | if not Path(expanded).exists(): |
| 175 | continue |
| 176 | deduped.append(expanded) |
| 177 | seen.add(expanded) |
| 178 | return deduped |
| 179 | |
| 180 | |
| 181 | @functools.lru_cache(maxsize=1) |
no test coverage detected