Skip to content

Commit b58dbca

Browse files
committed
Fix mypy errors
1 parent 664d95f commit b58dbca

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/zorg/runners.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def run_edit(cfg: EditConfig) -> int:
3131
zo_paths = expand_file_group_paths(
3232
cfg.zo_paths, file_group_map=cfg.file_group_map
3333
)
34-
zo_paths = _zdir_paths(cfg.zettel_dir, zo_paths)
34+
zo_paths = _add_paths_to_zdir(cfg.zettel_dir, zo_paths)
3535
for zo_path in zo_paths:
3636
for pattern, tmpl_path in cfg.template_pattern_map.items():
3737
if match := pattern.match(zo_path.stem):
@@ -53,8 +53,17 @@ def run_edit(cfg: EditConfig) -> int:
5353
return 0
5454

5555

56-
def _zdir_paths(zdir: PathLike, paths: Iterable[PathLike]) -> list[Path]:
57-
return [p if zdir in p.parents else zdir / p for p in paths]
56+
def _add_paths_to_zdir(
57+
zdir: PathLike, paths: Iterable[PathLike]
58+
) -> list[Path]:
59+
zdir_path = Path(zdir)
60+
new_paths = []
61+
for p in paths:
62+
path = Path(p)
63+
new_paths.append(
64+
path if zdir_path in path.parents else zdir_path / path
65+
)
66+
return new_paths
5867

5968

6069
def _start_vim_loop(zo_paths: Iterable[Path], cfg: EditConfig) -> None:
@@ -83,7 +92,7 @@ def _start_vim_loop(zo_paths: Iterable[Path], cfg: EditConfig) -> None:
8392

8493
cfg.keep_alive_file.unlink()
8594
vimala.vim(
86-
*_zdir_paths(cfg.zettel_dir, paths),
95+
*_add_paths_to_zdir(cfg.zettel_dir, paths),
8796
commands=_process_vim_commands(cfg.zettel_dir, cfg.vim_commands),
8897
)
8998

0 commit comments

Comments
 (0)