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

Add --trust-repo option to download CLI command #807

Merged
merged 6 commits into from
Oct 1, 2024
Prev Previous commit
Next Next commit
Resolve SonarCloud complain: Remove unused parameter token
  • Loading branch information
juhoinkinen committed Sep 30, 2024
commit 4dfa2d1962ed0752748fedc4b148fe19d037edf2
4 changes: 2 additions & 2 deletions annif/hfh_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
f'Download allowed from "{repo_id}" because "--trust-repo" flag is used.'
)
return
if _is_repo_in_cache(repo_id, token):
if _is_repo_in_cache(repo_id):
logger.debug(
f'Download allowed from "{repo_id}" because repo is already in cache.'
)
Expand All @@ -42,15 +42,15 @@
)


def _is_repo_in_cache(repo_id, token):
def _is_repo_in_cache(repo_id):
from huggingface_hub import CacheNotFound, scan_cache_dir

Check warning on line 46 in annif/hfh_util.py

View check run for this annotation

Codecov / codecov/patch

annif/hfh_util.py#L46

Added line #L46 was not covered by tests

try:
cache = scan_cache_dir()
except CacheNotFound as err:
logger.debug(str(err) + "\nNo HFH cache found.")
return False
return repo_id in [info.repo_id for info in cache.repos]

Check warning on line 53 in annif/hfh_util.py

View check run for this annotation

Codecov / codecov/patch

annif/hfh_util.py#L48-L53

Added lines #L48 - L53 were not covered by tests


def get_matching_projects(pattern: str) -> list[AnnifProject]:
Expand Down
Loading