diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bb8e6a1..2fdc65a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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 @@ -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 @@ -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"] diff --git a/src/skhep_testdata/remote_files.py b/src/skhep_testdata/remote_files.py index b85216c..d31ce83 100644 --- a/src/skhep_testdata/remote_files.py +++ b/src/skhep_testdata/remote_files.py @@ -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() @@ -110,8 +111,8 @@ 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): @@ -119,6 +120,7 @@ def remote_file( 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 diff --git a/tests/test_local_files.py b/tests/test_local_files.py index 34e8a76..d1295b4 100644 --- a/tests/test_local_files.py +++ b/tests/test_local_files.py @@ -1,6 +1,7 @@ from __future__ import annotations import os + import pytest import requests