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

[pre-commit.ci] pre-commit autoupdate #114

Closed
wants to merge 4 commits into from
Closed
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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# * Run "pre-commit install".
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-toml
- id: check-yaml
Expand All @@ -16,14 +16,14 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.4.1
hooks:
- id: ruff
args: [--fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.9.0
hooks:
- id: mypy
additional_dependencies: ["pytest"]
1 change: 1 addition & 0 deletions examples/tutorial1/echo/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This is the client code for the Asphalt echo server tutorial."""

import sys
from asyncio import open_connection

Expand Down
1 change: 1 addition & 0 deletions examples/tutorial1/echo/server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This is the server code for the Asphalt echo server tutorial."""

from asyncio import StreamReader, StreamWriter, start_server

from asphalt.core import Component, Context, run_application
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial2/webnotifier/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This is the root component for the Asphalt webnotifier tutorial."""

# isort: off
import logging
from difflib import HtmlDiff
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial2/webnotifier/detector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This is the change detector component for the Asphalt webnotifier tutorial."""

# isort: off
from __future__ import annotations

Expand Down
6 changes: 2 additions & 4 deletions src/asphalt/core/concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@ def executor(
) -> Callable[
[Callable[Concatenate[Context, P], T_Retval]],
Callable[Concatenate[Context, P], T_Retval | Awaitable[T_Retval]],
]:
...
]: ...


@overload
def executor(
func_or_executor: Callable[Concatenate[Context, P], T_Retval],
) -> Callable[Concatenate[Context, P], T_Retval | Awaitable[T_Retval]]:
...
) -> Callable[Concatenate[Context, P], T_Retval | Awaitable[T_Retval]]: ...


def executor(
Expand Down
20 changes: 6 additions & 14 deletions src/asphalt/core/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ def __init__(self, type: type, name: str) -> None:
self.name = name

def __str__(self):
return "no matching resource was found for type={typename} name={self.name!r}".format(
self=self, typename=qualified_name(self.type)
)
return f"no matching resource was found for type={qualified_name(self.type)} name={self.name!r}"


class TeardownError(Exception):
Expand All @@ -207,9 +205,7 @@ def __str__(self):
"\n".join(format_exception(type(exc), exc, exc.__traceback__))
for exc in self.exceptions
)
return "{} exceptions(s) were raised by teardown callbacks:\n{}{}".format(
len(self.exceptions), separator, tracebacks
)
return f"{len(self.exceptions)} exceptions(s) were raised by teardown callbacks:\n{separator}{tracebacks}"


class NoCurrentContext(Exception):
Expand Down Expand Up @@ -845,15 +841,13 @@ def outer_wrapper(func: Callable[..., T_Retval]) -> Callable[..., Future[T_Retva
@overload
def context_teardown(
func: Callable[[T_Context], AsyncGenerator[None, Exception | None]],
) -> Callable[[T_Context], Coroutine[Any, Any, None]]:
...
) -> Callable[[T_Context], Coroutine[Any, Any, None]]: ...


@overload
def context_teardown(
func: Callable[[T_Self, T_Context], AsyncGenerator[None, Exception | None]],
) -> Callable[[T_Self, T_Context], Coroutine[Any, Any, None]]:
...
) -> Callable[[T_Self, T_Context], Coroutine[Any, Any, None]]: ...


def context_teardown(
Expand Down Expand Up @@ -993,13 +987,11 @@ def Dependency(name: str = "default") -> Any:
@overload
def inject(
func: Callable[P, Coroutine[Any, Any, T_Retval]],
) -> Callable[P, Coroutine[Any, Any, T_Retval]]:
...
) -> Callable[P, Coroutine[Any, Any, T_Retval]]: ...


@overload
def inject(func: Callable[P, T_Retval]) -> Callable[P, T_Retval]:
...
def inject(func: Callable[P, T_Retval]) -> Callable[P, T_Retval]: ...


def inject(func: Callable[P, Any]) -> Callable[P, Any]:
Expand Down
8 changes: 2 additions & 6 deletions src/asphalt/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,7 @@ def create_object(self, type: type | str, **constructor_kwargs) -> Any:
plugin_class = self.resolve(type)
if not isclass(plugin_class) or not issubclass(plugin_class, self.base_class):
raise TypeError(
"{} is not a subclass of {}".format(
qualified_name(plugin_class), qualified_name(self.base_class)
)
f"{qualified_name(plugin_class)} is not a subclass of {qualified_name(self.base_class)}"
)

return plugin_class(**constructor_kwargs)
Expand Down Expand Up @@ -210,6 +208,4 @@ def all(self) -> list[Any]:
return values

def __repr__(self):
return "{0.__class__.__name__}(namespace={0.namespace!r}, base_class={1})".format(
self, qualified_name(self.base_class)
)
return f"{self.__class__.__name__}(namespace={self.namespace!r}, base_class={qualified_name(self.base_class)})"
Loading