Skip to content

dev(narugo): use new cache key (with mtime and size) for local index files#65

Merged
narugo1992 merged 1 commit intomainfrom
dev/idxcache
Apr 4, 2025
Merged

dev(narugo): use new cache key (with mtime and size) for local index files#65
narugo1992 merged 1 commit intomainfrom
dev/idxcache

Conversation

@narugo1992
Copy link
Copy Markdown
Contributor

No description provided.

@narugo1992 narugo1992 added the enhancement New feature or request label Apr 4, 2025
@narugo1992 narugo1992 self-assigned this Apr 4, 2025
@narugo1992 narugo1992 requested a review from Copilot April 4, 2025 17:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

hfutils/index/local_fetch.py:40

  • [nitpick] Consider renaming the reused variable 'idx_file' when extracting it from the cache key tuple in 'tar_get_index' (line 81) to 'resolved_idx_file' to improve code clarity.
idx_file = idx_file or default_index_file

hfutils/index/local_fetch.py:86

  • There is a potential issue if the provided index file does not exist; the function returns a cache key with (idx_file, None, None) and then attempts to open the file, which may raise an error. Consider adding a check or error handling prior to opening the file.
with open(idx_file, 'r') as f:

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 4, 2025

Codecov Report

Attention: Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 87.11%. Comparing base (9afdd55) to head (a742a60).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
hfutils/index/local_fetch.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #65      +/-   ##
==========================================
- Coverage   87.12%   87.11%   -0.01%     
==========================================
  Files          60       60              
  Lines        2050     2057       +7     
==========================================
+ Hits         1786     1792       +6     
- Misses        264      265       +1     
Flag Coverage Δ
unittests 87.11% <93.33%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@narugo1992 narugo1992 requested a review from Copilot April 4, 2025 17:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

hfutils/index/local_fetch.py:36

  • Update the example in the docstring to reflect that the function now returns a tuple (file path, mtime, size) instead of just a string.
>>> key = _tar_get_cache_key('archive.tar', 'index.json')

hfutils/index/local_fetch.py:81

  • [nitpick] Consider using a more descriptive variable name for the file path extracted from the cache key tuple (e.g., 'normalized_idx_file') rather than reassigning 'idx_file', to improve clarity.
idx_file, _, _ = cache_key

@narugo1992 narugo1992 merged commit 2aea1db into main Apr 4, 2025
65 of 70 checks passed
@narugo1992 narugo1992 deleted the dev/idxcache branch April 4, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants