Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusSintonen committed Jun 15, 2024
1 parent b6fd02c commit 6e4b9aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions httpcore/_async/connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
AsyncIterable,
AsyncIterator,
Iterable,
Iterator,
List,
Optional,
Type,
Expand Down Expand Up @@ -272,12 +271,15 @@ def _assign_requests_to_connections(self) -> List[AsyncConnectionInterface]:
continue

origin = pool_request.request.url.origin
available_connections_iter: Iterator[AsyncConnectionInterface] = (
connection
for connection in self._connections
if connection.can_handle_request(origin) and connection.is_available()
available_connection = next(
(
connection
for connection in self._connections
if connection.can_handle_request(origin)
and connection.is_available()
),
None,
)
available_connection = next(available_connections_iter, None)

# There are three cases for how we may be able to handle the request:
#
Expand Down
14 changes: 8 additions & 6 deletions httpcore/_sync/connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
Iterable,
Iterator,
Iterable,
Iterator,
List,
Optional,
Type,
Expand Down Expand Up @@ -272,12 +271,15 @@ def _assign_requests_to_connections(self) -> List[ConnectionInterface]:
continue

origin = pool_request.request.url.origin
available_connections_iter: Iterator[ConnectionInterface] = (
connection
for connection in self._connections
if connection.can_handle_request(origin) and connection.is_available()
available_connection = next(
(
connection
for connection in self._connections
if connection.can_handle_request(origin)
and connection.is_available()
),
None,
)
available_connection = next(available_connections_iter, None)

# There are three cases for how we may be able to handle the request:
#
Expand Down

0 comments on commit 6e4b9aa

Please sign in to comment.