diff --git a/httpcore/_async/http2.py b/httpcore/_async/http2.py index d7412f0f..c832d1e7 100644 --- a/httpcore/_async/http2.py +++ b/httpcore/_async/http2.py @@ -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 ) diff --git a/httpcore/_async/http_proxy.py b/httpcore/_async/http_proxy.py index 48d37cd3..b69430fc 100644 --- a/httpcore/_async/http_proxy.py +++ b/httpcore/_async/http_proxy.py @@ -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 diff --git a/httpcore/_models.py b/httpcore/_models.py index c9781959..bc557606 100644 --- a/httpcore/_models.py +++ b/httpcore/_models.py @@ -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) diff --git a/httpcore/_sync/http2.py b/httpcore/_sync/http2.py index 7fd29a5a..a0244bbb 100644 --- a/httpcore/_sync/http2.py +++ b/httpcore/_sync/http2.py @@ -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 ) diff --git a/httpcore/_sync/http_proxy.py b/httpcore/_sync/http_proxy.py index 3dadf9af..c70d8c9c 100644 --- a/httpcore/_sync/http_proxy.py +++ b/httpcore/_sync/http_proxy.py @@ -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