Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardo-rodrigues committed Jun 4, 2024
2 parents b3ca349 + 5136088 commit 85dc367
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
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

0 comments on commit 85dc367

Please sign in to comment.