| 229 | |
| 230 | |
| 231 | def get_dirs_from_args(args: Iterable[str]) -> list[Path]: |
| 232 | def is_option(x: str) -> bool: |
| 233 | return x.startswith("-") |
| 234 | |
| 235 | def get_file_part_from_node_id(x: str) -> str: |
| 236 | return x.split("::", maxsplit=1)[0] |
| 237 | |
| 238 | def get_dir_from_path(path: Path) -> Path: |
| 239 | if path.is_dir(): |
| 240 | return path |
| 241 | return path.parent |
| 242 | |
| 243 | # These look like paths but may not exist |
| 244 | possible_paths = ( |
| 245 | absolutepath(get_file_part_from_node_id(arg)) |
| 246 | for arg in args |
| 247 | if not is_option(arg) |
| 248 | ) |
| 249 | |
| 250 | return [get_dir_from_path(path) for path in possible_paths if safe_exists(path)] |
| 251 | |
| 252 | |
| 253 | def parse_override_ini(override_ini: Sequence[str] | None) -> ConfigDict: |