Skip to content
This repository was archived by the owner on Mar 11, 2023. It is now read-only.

Commit eed6d80

Browse files
authored
Merge pull request #105 from JulienPalard/mdk/cache-args
2 parents e024458 + fae940f commit eed6d80

4 files changed

Lines changed: 5 additions & 28 deletions

File tree

potodo/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
__author__ = """Jules Lasne"""
44
__email__ = "jules.lasne@gmail.com"
5-
__version__ = "0.19.1"
5+
__version__ = "0.19.2"

potodo/cache.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import pickle
44
from pathlib import Path
55
from tempfile import NamedTemporaryFile
6-
from typing import Any
76
from typing import cast
87
from typing import Dict
98

@@ -12,7 +11,6 @@
1211

1312

1413
def get_cache_file_content(
15-
cache_args: Any,
1614
path: str = ".potodo/cache.pickle",
1715
) -> Dict[Path, PoFileStats]:
1816
logging.debug("Trying to load cache from %s", path)
@@ -24,18 +22,18 @@ def get_cache_file_content(
2422
return {}
2523
else:
2624
logging.debug("Found cache")
27-
if data.get("version") != VERSION or cache_args != data.get("args"):
25+
if data.get("version") != VERSION:
2826
logging.info("Found old cache, ignored it.")
2927
return {}
3028
else:
3129
return cast(Dict[Path, PoFileStats], data["data"])
3230

3331

3432
def set_cache_content(
35-
obj: Dict[Path, PoFileStats], cache_args: Any, path: str = ".potodo/cache.pickle"
33+
obj: Dict[Path, PoFileStats], path: str = ".potodo/cache.pickle"
3634
) -> None:
3735
os.makedirs(os.path.dirname(path), exist_ok=True)
38-
data = {"version": VERSION, "args": cache_args, "data": obj}
36+
data = {"version": VERSION, "data": obj}
3937
with NamedTemporaryFile(
4038
mode="wb", delete=False, dir=str(Path(path).parent), prefix=Path(path).name
4139
) as tmp:

potodo/po_file.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import logging
33
import os
44
from pathlib import Path
5-
from typing import Any
65
from typing import Callable
76
from typing import Dict
87
from typing import Iterable
@@ -74,7 +73,6 @@ def is_within(file: Path, excluded: Path) -> bool:
7473
def get_po_stats_from_repo_or_cache(
7574
repo_path: Path,
7675
exclude: Iterable[Path],
77-
cache_args: Any,
7876
ignore_matches: Callable[[str], bool],
7977
no_cache: bool = False,
8078
) -> Mapping[str, List[PoFileStats]]:
@@ -115,7 +113,6 @@ def get_po_stats_from_repo_or_cache(
115113
}
116114
else:
117115
cached_files = get_cache_file_content(
118-
cache_args=cache_args,
119116
path=str(repo_path.resolve()) + "/.potodo/cache.pickle",
120117
)
121118
po_stats_per_directory = dict()
@@ -131,7 +128,6 @@ def get_po_stats_from_repo_or_cache(
131128
po_stats_per_directory[directory].append(cached_file)
132129
set_cache_content(
133130
cached_files,
134-
cache_args,
135131
path=str(repo_path.resolve()) + "/.potodo/cache.pickle",
136132
)
137133

potodo/potodo.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,29 +81,12 @@ def non_interactive_output(
8181
) -> None:
8282
dir_stats: List[Any] = []
8383
# Initialize the arguments
84-
cache_args = {
85-
"path": path,
86-
"exclude": exclude,
87-
"above": above,
88-
"below": below,
89-
"only_fuzzy": only_fuzzy,
90-
"offline": offline,
91-
"hide_reserved": hide_reserved,
92-
"counts": counts,
93-
"json_format": json_format,
94-
"exclude_fuzzy": exclude_fuzzy,
95-
"exclude_reserved": exclude_reserved,
96-
"only_reserved": only_reserved,
97-
"show_reservation_dates": show_reservation_dates,
98-
"no_cache": no_cache,
99-
"is_interactive": is_interactive,
100-
}
10184
issue_reservations = get_issue_reservations(offline, hide_reserved, path)
10285

10386
total_translated: int = 0
10487
total_entries: int = 0
10588
po_files_and_dirs = get_po_stats_from_repo_or_cache(
106-
path, exclude, cache_args, ignore_matches, no_cache
89+
path, exclude, ignore_matches, no_cache
10790
)
10891
for directory_name, po_files in sorted(po_files_and_dirs.items()):
10992
# For each directory and files in this directory

0 commit comments

Comments
 (0)