Skip to content

Commit

Permalink
🐛 Backport to python 3.8 .
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalkrupinski committed Feb 23, 2024
1 parent 3767ceb commit ef78a74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/rybak/tree_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ def _render_file(self, template_name: str, target_name: str, data: TemplateData)
)

def remove_stale(self) -> None:
for path, _, files in self._context.target_root.walk(False):
existing_dir_path = path.relative_to(self._context.target_root)
for path, _, files in os.walk(self._context.target_root, False):
existing_dir_path = Path(path).relative_to(self._context.target_root)
removed_files: MutableSet[str] = set()

for file_name in files:
Expand Down
5 changes: 2 additions & 3 deletions tests/compare.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from collections.abc import Iterable
from pathlib import Path
from typing import Optional
from typing import Iterable, Optional, Tuple


def dir_content(root: Path) -> Iterable[tuple[str, Optional[str]]]:
def dir_content(root: Path) -> Iterable[Tuple[str, Optional[str]]]:
return sorted(
(str(path.relative_to(root)), path.read_text() if path.is_file() else None) for path in root.rglob('*')
)

0 comments on commit ef78a74

Please sign in to comment.