Skip to content

Commit

Permalink
Fix linters
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex committed Sep 20, 2024
1 parent fb5ffb8 commit 72bdd2d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
1 change: 0 additions & 1 deletion mangum/handlers/alb.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def body(self) -> bytes:

@property
def scope(self) -> Scope:

headers = transform_headers(self.event)
list_headers = [list(x) for x in headers]
# Unique headers. If there are duplicates, it will use the last defined.
Expand Down
1 change: 0 additions & 1 deletion mangum/protocols/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ async def send(self, message: Message) -> None:
self.headers = message.get("headers", [])
self.state = HTTPCycleState.RESPONSE
elif self.state is HTTPCycleState.RESPONSE and message["type"] == "http.response.body":

body = message.get("body", b"")
more_body = message.get("more_body", False)
self.buffer.write(body)
Expand Down
2 changes: 0 additions & 2 deletions mangum/protocols/lifespan.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,12 @@ async def run(self) -> None:
async def receive(self) -> Message:
"""Awaited by the application to receive ASGI `lifespan` events."""
if self.state is LifespanCycleState.CONNECTING:

# Connection established. The next event returned by the queue will be
# `lifespan.startup` to inform the application that the connection is
# ready to receive lfiespan messages.
self.state = LifespanCycleState.STARTUP

elif self.state is LifespanCycleState.STARTUP:

# Connection shutting down. The next event returned by the queue will be
# `lifespan.shutdown` to inform the application that the connection is now
# closing so that it may perform cleanup.
Expand Down
18 changes: 12 additions & 6 deletions mangum/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def get_remaining_time_in_millis(self) -> int:


class ASGI(Protocol):
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: ... # pragma: no cover
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
... # pragma: no cover


LifespanMode: TypeAlias = Literal["auto", "on", "off"]
Expand All @@ -120,15 +121,20 @@ class LambdaConfig(TypedDict):


class LambdaHandler(Protocol):
def __init__(self, *args: Any) -> None: ... # pragma: no cover
def __init__(self, *args: Any) -> None:
... # pragma: no cover

@classmethod
def infer(cls, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> bool: ... # pragma: no cover
def infer(cls, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> bool:
... # pragma: no cover

@property
def body(self) -> bytes: ... # pragma: no cover
def body(self) -> bytes:
... # pragma: no cover

@property
def scope(self) -> Scope: ... # pragma: no cover
def scope(self) -> Scope:
... # pragma: no cover

def __call__(self, response: Response) -> dict: ... # pragma: no cover
def __call__(self, response: Response) -> dict:
... # pragma: no cover
3 changes: 2 additions & 1 deletion tests/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from mangum.types import Receive, Scope, Send


async def app(scope: Scope, receive: Receive, send: Send): ...
async def app(scope: Scope, receive: Receive, send: Send):
...


def test_default_settings():
Expand Down

0 comments on commit 72bdd2d

Please sign in to comment.