Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer newer JSON cache files to older #524

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions extra_data/run_files_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,17 @@
loaded_data = []
t0 = time.monotonic()

paths_mtimes = []

for path in self.candidate_paths:
try:
st = os.stat(path)
paths_mtimes.append((path, st.st_mtime))
except (FileNotFoundError, PermissionError):

Check notice

Code scanning / CodeQL

Empty except Note

'except' clause does nothing but pass and there is no explanatory comment.
takluyver marked this conversation as resolved.
Show resolved Hide resolved
pass

# Try the newest found file (greatest mtime) first
for path, _ in sorted(paths_mtimes, key=lambda x: x[1], reverse=True):
try:
with open(path) as f:
loaded_data = json.load(f)
Expand Down
Loading