diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 101620f7..8fae0b37 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,14 +16,14 @@ repos: - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.1 + rev: v0.4.4 hooks: - id: ruff args: [--fix, --show-fixes] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 + rev: v1.10.0 hooks: - id: mypy additional_dependencies: ["pytest"] diff --git a/src/asphalt/core/component.py b/src/asphalt/core/component.py index 5aef6869..915bfabf 100644 --- a/src/asphalt/core/component.py +++ b/src/asphalt/core/component.py @@ -144,8 +144,7 @@ def run_complete(f: Future[int | None]) -> None: sys.exit(1) elif retval is not None: warn( - "run() must return an integer or None, not %s" - % qualified_name(retval.__class__) + f"run() must return an integer or None, not {qualified_name(retval.__class__)}" ) sys.exit(1) else: diff --git a/src/asphalt/core/context.py b/src/asphalt/core/context.py index 84c052c8..2546110a 100644 --- a/src/asphalt/core/context.py +++ b/src/asphalt/core/context.py @@ -130,9 +130,9 @@ def generate_value(self, ctx: Context) -> Any: def __repr__(self) -> str: typenames = ", ".join(qualified_name(cls) for cls in self.types) value_repr = ( - "factory=%s" % callable_name(self.value_or_factory) + f"factory={callable_name(self.value_or_factory)}" if self.is_factory - else "value=%r" % self.value_or_factory + else f"value={self.value_or_factory!r}" ) return ( f"{self.__class__.__name__}({value_repr}, types=[{typenames}], name={self.name!r}, " diff --git a/tests/test_context.py b/tests/test_context.py index b2551042..408b51f0 100644 --- a/tests/test_context.py +++ b/tests/test_context.py @@ -567,8 +567,8 @@ def runs_in_default_worker() -> None: await runs_in_default_worker() exc.match( - r"the first positional argument to %s\(\) has to be a Context instance" - % callable_name(runs_in_default_worker) + rf"the first positional argument to " + rf"{callable_name(runs_in_default_worker)}\(\) has to be a Context instance" ) @@ -640,8 +640,8 @@ async def start(ctx: Context) -> None: await start(None) exc.match( - r"the first positional argument to %s\(\) has to be a Context instance" - % callable_name(start) + rf"the first positional argument to {callable_name(start)}\(\) has to be a " + rf"Context instance" ) @pytest.mark.asyncio