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

Enable mypy option --warn-return-any #612

Merged
merged 2 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions httpcore/_async/http2.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ async def _read_incoming_data(
self._connection_error = True
raise exc

events = self._h2_state.receive_data(data)
events: typing.List[h2.events.Event] = self._h2_state.receive_data(data)

return events

Expand Down Expand Up @@ -381,8 +381,8 @@ async def _wait_for_outgoing_flow(self, request: Request, stream_id: int) -> int
WindowUpdated frames have increased the flow rate.
https://tools.ietf.org/html/rfc7540#section-6.9
"""
local_flow = self._h2_state.local_flow_control_window(stream_id)
max_frame_size = self._h2_state.max_outbound_frame_size
local_flow: int = self._h2_state.local_flow_control_window(stream_id)
max_frame_size: int = self._h2_state.max_outbound_frame_size
flow = min(local_flow, max_frame_size)
while flow == 0:
await self._receive_events(request)
Expand Down
6 changes: 3 additions & 3 deletions httpcore/_sync/http2.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def _read_incoming_data(
self._connection_error = True
raise exc

events = self._h2_state.receive_data(data)
events: typing.List[h2.events.Event] = self._h2_state.receive_data(data)

return events

Expand Down Expand Up @@ -381,8 +381,8 @@ def _wait_for_outgoing_flow(self, request: Request, stream_id: int) -> int:
WindowUpdated frames have increased the flow rate.
https://tools.ietf.org/html/rfc7540#section-6.9
"""
local_flow = self._h2_state.local_flow_control_window(stream_id)
max_frame_size = self._h2_state.max_outbound_frame_size
local_flow: int = self._h2_state.local_flow_control_window(stream_id)
max_frame_size: int = self._h2_state.max_outbound_frame_size
flow = min(local_flow, max_frame_size)
while flow == 0:
self._receive_events(request)
Expand Down
2 changes: 1 addition & 1 deletion httpcore/backends/trio.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def read(
exc_map = {trio.TooSlowError: ReadTimeout, trio.BrokenResourceError: ReadError}
with map_exceptions(exc_map):
with trio.fail_after(timeout_or_inf):
return await self._stream.receive_some(max_bytes=max_bytes)
return await self._stream.receive_some(max_bytes=max_bytes) # type: ignore[no-any-return]
michaeloliverx marked this conversation as resolved.
Show resolved Hide resolved

async def write(
self, buffer: bytes, timeout: typing.Optional[float] = None
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ no_implicit_optional = True
show_error_codes = True
warn_unused_ignores = True
disallow_untyped_calls = True
warn_return_any = True

[mypy-tests.*]
disallow_untyped_defs = False
Expand Down