Skip to content

Commit

Permalink
Remove unnecessary comprehensions (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloliverx authored Nov 30, 2022
1 parent 202dce5 commit 52e6832
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
6 changes: 2 additions & 4 deletions httpcore/_async/http2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@

def has_body_headers(request: Request) -> bool:
return any(
[
k.lower() == b"content-length" or k.lower() == b"transfer-encoding"
for k, v in request.headers
]
k.lower() == b"content-length" or k.lower() == b"transfer-encoding"
for k, v in request.headers
)


Expand Down
2 changes: 1 addition & 1 deletion httpcore/_async/http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def merge_headers(
"""
default_headers = [] if default_headers is None else list(default_headers)
override_headers = [] if override_headers is None else list(override_headers)
has_override = set([key.lower() for key, value in override_headers])
has_override = set(key.lower() for key, value in override_headers)
default_headers = [
(key, value)
for key, value in default_headers
Expand Down
2 changes: 1 addition & 1 deletion httpcore/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def include_request_headers(
url: "URL",
content: Union[None, bytes, Iterable[bytes], AsyncIterable[bytes]],
) -> List[Tuple[bytes, bytes]]:
headers_set = set([k.lower() for k, v in headers])
headers_set = set(k.lower() for k, v in headers)

if b"host" not in headers_set:
default_port = DEFAULT_PORTS.get(url.scheme)
Expand Down
6 changes: 2 additions & 4 deletions httpcore/_sync/http2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@

def has_body_headers(request: Request) -> bool:
return any(
[
k.lower() == b"content-length" or k.lower() == b"transfer-encoding"
for k, v in request.headers
]
k.lower() == b"content-length" or k.lower() == b"transfer-encoding"
for k, v in request.headers
)


Expand Down
2 changes: 1 addition & 1 deletion httpcore/_sync/http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def merge_headers(
"""
default_headers = [] if default_headers is None else list(default_headers)
override_headers = [] if override_headers is None else list(override_headers)
has_override = set([key.lower() for key, value in override_headers])
has_override = set(key.lower() for key, value in override_headers)
default_headers = [
(key, value)
for key, value in default_headers
Expand Down

0 comments on commit 52e6832

Please sign in to comment.