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

chore: [pre-commit.ci] pre-commit autoupdate #152

Merged
merged 4 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -18,7 +18,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.3.0
rev: 24.4.2
hooks:
- id: black

Expand All @@ -29,7 +29,7 @@ repos:
args: [--include-version-classifiers, --max-py-version=3.11]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
rev: v1.10.0
hooks:
# 3.9 is broken due to https://github.com/python/typeshed/pull/5216 and https://github.com/python/typeshed/pull/5214
- id: mypy
Expand All @@ -41,7 +41,7 @@ repos:
- types-requests

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.3.5"
rev: "v0.4.7"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
10 changes: 6 additions & 4 deletions src/skhep_testdata/remote_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def get_config_for_file(cls, filename: str) -> dict[str, str]:
config = cls._all_files.get(filename, None)

if not config:
raise RuntimeError("Unknown remote file: %s" % filename)
msg = f"Unknown remote file: {filename}"
raise RuntimeError(msg)

return config.copy()

Expand Down Expand Up @@ -110,15 +111,16 @@ def remote_file(
) -> str:
config = RemoteDatasetList.get_config_for_file(filename)
if not config and raise_missing:
raise RuntimeError("Unknown %s cannot be found" % filename)
return None
msg = f"Unknown {filename} cannot be found"
raise RuntimeError(msg)

path = os.path.join(data_dir, filename)
if not os.path.isfile(path):
config["data_dir"] = data_dir
fetch_remote_dataset(**config) # type: ignore[arg-type]

if not os.path.isfile(path) and raise_missing:
raise RuntimeError("%s cannot be found" % filename)
msg = f"{filename} cannot be found"
raise RuntimeError(msg)

return path
1 change: 1 addition & 0 deletions tests/test_local_files.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import os

import pytest
import requests

Expand Down
Loading