Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 23, 2024
1 parent 944bf7b commit a055e95
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 15 deletions.
1 change: 1 addition & 0 deletions examples/aiohttp/dynamic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from aiohttp.abc import Request
from aiohttp.web_app import Application
from aiohttp.web_response import Response

from asphalt.core import Component, Context, inject, resource


Expand Down
3 changes: 2 additions & 1 deletion examples/fastapi/dynamic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from asphalt.core import Component, Context, inject, resource
from fastapi import FastAPI
from fastapi.responses import PlainTextResponse

from asphalt.core import Component, Context, inject, resource


async def root() -> str:
return "Hello, world!"
Expand Down
3 changes: 2 additions & 1 deletion examples/litestar/dynamic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from asphalt.core import Component, Context, require_resource
from litestar import Litestar, get

from asphalt.core import Component, Context, require_resource


@get("/")
async def root() -> str:
Expand Down
3 changes: 2 additions & 1 deletion examples/starlette/dynamic.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from asphalt.core import Component, Context, inject, resource
from starlette.applications import Starlette
from starlette.requests import Request
from starlette.responses import PlainTextResponse, Response

from asphalt.core import Component, Context, inject, resource


async def root(request: Request) -> Response:
return PlainTextResponse("Hello, world!")
Expand Down
1 change: 1 addition & 0 deletions src/asphalt/web/aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from aiohttp.web_request import Request
from aiohttp.web_response import Response
from aiohttp.web_runner import AppRunner, TCPSite

from asphalt.core import (
ContainerComponent,
Context,
Expand Down
3 changes: 2 additions & 1 deletion src/asphalt/web/asgi3.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
Scope,
WebSocketScope,
)
from uvicorn import Config

from asphalt.core import (
ContainerComponent,
Context,
context_teardown,
resolve_reference,
)
from uvicorn import Config

T_Application = TypeVar("T_Application", bound=ASGI3Application)

Expand Down
3 changes: 2 additions & 1 deletion src/asphalt/web/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
from collections.abc import Awaitable, Callable

from asgiref.typing import ASGI3Application, HTTPScope
from asphalt.core import Context
from django.core.handlers.asgi import ASGIHandler, ASGIRequest
from django.http import HttpRequest, HttpResponse
from django.utils.decorators import async_only_middleware

from asphalt.core import Context

from .asgi3 import ASGIComponent


Expand Down
3 changes: 2 additions & 1 deletion src/asphalt/web/fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
from typing import Any, get_type_hints

from asgiref.typing import ASGI3Application
from asphalt.core import Context, require_resource, resolve_reference
from fastapi import Depends, FastAPI
from fastapi.routing import APIRoute, APIWebSocketRoute

from asphalt.core import Context, require_resource, resolve_reference

from .asgi3 import ASGIComponent
from .starlette import AsphaltMiddleware

Expand Down
2 changes: 1 addition & 1 deletion src/asphalt/web/litestar.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from typing import Any

from asgiref.typing import ASGI3Application, HTTPScope, WebSocketScope
from asphalt.core import Context, require_resource, resolve_reference
from litestar import Litestar, Request
from litestar.middleware import AbstractMiddleware
from litestar.types import ControllerRouterHandler, Receive, Scope, Send

from asphalt.core import Context, require_resource, resolve_reference
from asphalt.web.asgi3 import ASGIComponent


Expand Down
2 changes: 1 addition & 1 deletion src/asphalt/web/starlette.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from typing import Any

from asgiref.typing import ASGI3Application, HTTPScope, WebSocketScope
from asphalt.core import Context, current_context, resolve_reference
from starlette.applications import Starlette
from starlette.middleware.base import BaseHTTPMiddleware, RequestResponseEndpoint
from starlette.requests import Request
from starlette.responses import Response
from starlette.types import Receive, Scope, Send

from asphalt.core import Context, current_context, resolve_reference
from asphalt.web.asgi3 import ASGIComponent


Expand Down
3 changes: 2 additions & 1 deletion tests/django_app/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from asphalt.core import inject, resource
from django.http import HttpRequest, HttpResponse, JsonResponse

from asphalt.core import inject, resource


@inject
async def index(
Expand Down
3 changes: 2 additions & 1 deletion tests/test_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

import pytest
import websockets
from asphalt.core import Component, Context, inject, require_resource, resource
from httpx import AsyncClient

from asphalt.core import Component, Context, inject, require_resource, resource

try:
from aiohttp.abc import Request
from aiohttp.web_app import Application
Expand Down
2 changes: 1 addition & 1 deletion tests/test_asgi3.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
Scope,
WebSocketScope,
)
from asphalt.core import Context, current_context, inject, resource
from httpx import AsyncClient

from asphalt.core import Context, current_context, inject, resource
from asphalt.web.asgi3 import ASGIComponent


Expand Down
3 changes: 2 additions & 1 deletion tests/test_django.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import pytest
from asgiref.typing import ASGI3Application
from asphalt.core import Context
from httpx import AsyncClient

from asphalt.core import Context

try:
from django.core.handlers.asgi import ASGIHandler

Expand Down
2 changes: 1 addition & 1 deletion tests/test_fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import pytest
import websockets
from asgiref.typing import ASGI3Application, HTTPScope, WebSocketScope
from asphalt.core import Component, Context, inject, require_resource, resource
from fastapi import FastAPI
from httpx import AsyncClient
from starlette.requests import Request
from starlette.responses import JSONResponse, PlainTextResponse, Response
from starlette.websockets import WebSocket

from asphalt.core import Component, Context, inject, require_resource, resource
from asphalt.web.fastapi import AsphaltDepends, FastAPIComponent

from .test_asgi3 import TextReplacerMiddleware
Expand Down
3 changes: 2 additions & 1 deletion tests/test_litestar.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import pytest
import websockets
from asgiref.typing import ASGI3Application, HTTPScope, WebSocketScope
from asphalt.core import Component, Context, require_resource
from httpx import AsyncClient

from asphalt.core import Component, Context, require_resource

try:
from litestar import Litestar, MediaType, Request, get, websocket_listener

Expand Down
2 changes: 1 addition & 1 deletion tests/test_starlette.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import pytest
import websockets
from asgiref.typing import ASGI3Application, HTTPScope, WebSocketScope
from asphalt.core import Component, Context, inject, require_resource, resource
from httpx import AsyncClient
from starlette.applications import Starlette
from starlette.requests import Request
from starlette.responses import JSONResponse, PlainTextResponse, Response
from starlette.websockets import WebSocket

from asphalt.core import Component, Context, inject, require_resource, resource
from asphalt.web.starlette import StarletteComponent

from .test_asgi3 import TextReplacerMiddleware
Expand Down

0 comments on commit a055e95

Please sign in to comment.