Skip to content

Commit

Permalink
chore: make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
gi0baro committed Jun 10, 2024
1 parent 4745366 commit 6916ede
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion starlette/middleware/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ async def coro() -> None:

assert message["type"] == "http.response.start"

async def body_stream() -> typing.AsyncGenerator[bytes, None]:
async def body_stream() -> (
typing.AsyncGenerator[
typing.Union[bytes, typing.MutableMapping[str, typing.Any]], None
]
):
async with recv_stream:
async for message in recv_stream:
if message["type"] == "http.response.pathsend":
Expand Down
4 changes: 2 additions & 2 deletions starlette/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def __init__(
self.headers["location"] = quote(str(url), safe=":/%#?=@[]!$&'()*+,;")


Content = typing.Union[str, bytes, memoryview]
Content = typing.Union[str, bytes, memoryview, typing.MutableMapping[str, typing.Any]]
SyncContentStream = typing.Iterable[Content]
AsyncContentStream = typing.AsyncIterable[Content]
ContentStream = typing.Union[AsyncContentStream, SyncContentStream]
Expand Down Expand Up @@ -254,7 +254,7 @@ async def stream_response(self, send: Send) -> None:
should_close_body = False
await send(chunk)
break
if not isinstance(chunk, (bytes, memoryview)):
if isinstance(chunk, str):
chunk = chunk.encode(self.charset)
await send({"type": "http.response.body", "body": chunk, "more_body": True})

Expand Down

0 comments on commit 6916ede

Please sign in to comment.