From c820308139689518443478e011830d744138297e Mon Sep 17 00:00:00 2001 From: Jennings Zhang Date: Fri, 14 Apr 2023 16:21:08 -0400 Subject: [PATCH] Fix bug where left and right file are the same --- surfigures/inputs/find.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/surfigures/inputs/find.py b/surfigures/inputs/find.py index 164ad60..504443b 100644 --- a/surfigures/inputs/find.py +++ b/surfigures/inputs/find.py @@ -183,5 +183,5 @@ def _is_side_folder(folder: Path, side: str) -> bool: def _corresponding_right_path_to(path: Path) -> Optional[Path]: possible_paths = map(lambda l, r: path.with_name(path.name.replace(l, r)), constants.LEFT_WORDS, constants.RIGHT_WORDS) - existing_right_paths = filter(lambda f: f.exists(), possible_paths) + existing_right_paths = filter(lambda f: f.exists() and f != path, possible_paths) return next(existing_right_paths, None)