You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
464 B
Python
16 lines
464 B
Python
4 months ago
|
from typing import Sequence, Tuple
|
||
|
from pathlib import Path
|
||
|
|
||
|
|
||
|
def parse_files(text: str) -> Sequence[Tuple[Path, Path]]:
|
||
|
files = []
|
||
|
lines = [s for s in text.splitlines() if s]
|
||
|
for line in lines:
|
||
|
parts = line.split(">", 2)
|
||
|
if len(parts) == 1:
|
||
|
pair = (Path(parts[0].strip()), Path(parts[0].strip()))
|
||
|
else:
|
||
|
pair = (Path(parts[0].strip()), Path(parts[1].strip()))
|
||
|
files.append(pair)
|
||
|
return files
|