Skip to content

Conversation

Dreamsorcerer
Copy link
Member

@Dreamsorcerer Dreamsorcerer commented May 25, 2025

Goals

  • Separate logic between the proxy version and the main version, which have different requirements. This reduces need for asserts etc. where we know an attribute will not be None in one case, but not the other. The proxy code now uses the internal ClientRequestBase, while ClientRequest is for the main request and will be exposed to middlewares.
  • Rename some attributes/methods to better reflect what middleware users should be accessing (and matching what we've actually documented).
  • Ensure body is always Payload (it was only not when None was passed previously), and strip out the redundant code that tries to send an empty body.
  • Make it easier to make additions to ClientRequest in future releases without breaking subclasses.

@Dreamsorcerer Dreamsorcerer requested a review from asvetlov as a code owner May 25, 2025 13:05
@Dreamsorcerer Dreamsorcerer added the backport:skip Skip backport bot label May 25, 2025
Copy link

codecov bot commented May 25, 2025

❌ 128 Tests Failed:

Tests completed Failed Passed Skipped
4227 128 4099 41
View the top 3 failed test(s) by shortest run time
tests.test_client_request::test_skip_default_useragent_header[pyloop]
Stack Traces | 0.068s run time
make_client_request = <function make_client_request.<locals>.maker at 0x7fc17f4b85e0>

    #x1B[0m#x1B[94masync#x1B[39;49;00m #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtest_skip_default_useragent_header#x1B[39;49;00m(#x1B[90m#x1B[39;49;00m
        make_client_request: _RequestMaker,#x1B[90m#x1B[39;49;00m
    ) -> #x1B[94mNone#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
>       req = make_client_request(#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mget#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, URL(#x1B[33m"#x1B[39;49;00m#x1B[33mhttp://python.org/#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m), skip_auto_headers={istr(#x1B[33m"#x1B[39;49;00m#x1B[33muser-agent#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m)}#x1B[90m#x1B[39;49;00m
        )#x1B[90m#x1B[39;49;00m

make_client_request = <function make_client_request.<locals>.maker at 0x7fc17f4b85e0>

#x1B[1m#x1B[31mtests/test_client_request.py#x1B[0m:369: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

method = 'get', url = URL('http://python.org/')
kwargs = {'skip_auto_headers': {'user-agent'}}
default_args = {'auth': None, 'chunked': None, 'compress': False, 'cookies': <BaseCookie: >, ...}

    #x1B[0m#x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mmaker#x1B[39;49;00m(#x1B[90m#x1B[39;49;00m
        method: #x1B[96mstr#x1B[39;49;00m, url: URL, **kwargs: Unpack[ClientRequestArgs]#x1B[90m#x1B[39;49;00m
    ) -> ClientRequest:#x1B[90m#x1B[39;49;00m
        #x1B[94mnonlocal#x1B[39;49;00m request, session#x1B[90m#x1B[39;49;00m
        session = ClientSession()#x1B[90m#x1B[39;49;00m
        default_args: ClientRequestArgs = {#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mparams#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: {},#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mheaders#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: CIMultiDict[#x1B[96mstr#x1B[39;49;00m](),#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mskip_auto_headers#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mdata#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mcookies#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: BaseCookie[#x1B[96mstr#x1B[39;49;00m](),#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mauth#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mversion#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: HttpVersion11,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mcompress#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mFalse#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mchunked#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mexpect100#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mFalse#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mresponse_class#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: ClientResponse,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mproxy#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mproxy_auth#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mtimer#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: TimerNoop(),#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33msession#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: session,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mssl#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mTrue#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mproxy_headers#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mtraces#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: [],#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mtrust_env#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mFalse#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mserver_hostname#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        }#x1B[90m#x1B[39;49;00m
>       request = ClientRequest(method, url, **(default_args | kwargs))#x1B[90m#x1B[39;49;00m
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       TypeError: ClientRequest.__init__() missing 1 required keyword-only argument: 'loop'#x1B[0m

default_args = {'auth': None, 'chunked': None, 'compress': False, 'cookies': <BaseCookie: >, ...}
kwargs     = {'skip_auto_headers': {'user-agent'}}
method     = 'get'
request    = None
session    = <aiohttp.client.ClientSession object at 0x7fc18001af00>
url        = URL('http://python.org/')

#x1B[1m#x1B[31mtests/conftest.py#x1B[0m:425: TypeError
tests.test_client_request::test_host_port_none_port[pyloop]
Stack Traces | 0.074s run time
make_client_request = <function make_client_request.<locals>.maker at 0x7fc17f85c860>

    #x1B[0m#x1B[94masync#x1B[39;49;00m #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtest_host_port_none_port#x1B[39;49;00m(make_client_request: _RequestMaker) -> #x1B[94mNone#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
>       req = make_client_request(#x1B[33m"#x1B[39;49;00m#x1B[33mget#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, URL(#x1B[33m"#x1B[39;49;00m#x1B[33munix:.../localhost/path#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m))#x1B[90m#x1B[39;49;00m
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m

make_client_request = <function make_client_request.<locals>.maker at 0x7fc17f85c860>

#x1B[1m#x1B[31mtests/test_client_request.py#x1B[0m:211: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

method = 'get', url = URL('unix:.../localhost/path'), kwargs = {}
default_args = {'auth': None, 'chunked': None, 'compress': False, 'cookies': <BaseCookie: >, ...}

    #x1B[0m#x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mmaker#x1B[39;49;00m(#x1B[90m#x1B[39;49;00m
        method: #x1B[96mstr#x1B[39;49;00m, url: URL, **kwargs: Unpack[ClientRequestArgs]#x1B[90m#x1B[39;49;00m
    ) -> ClientRequest:#x1B[90m#x1B[39;49;00m
        #x1B[94mnonlocal#x1B[39;49;00m request, session#x1B[90m#x1B[39;49;00m
        session = ClientSession()#x1B[90m#x1B[39;49;00m
        default_args: ClientRequestArgs = {#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mparams#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: {},#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mheaders#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: CIMultiDict[#x1B[96mstr#x1B[39;49;00m](),#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mskip_auto_headers#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mdata#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mcookies#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: BaseCookie[#x1B[96mstr#x1B[39;49;00m](),#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mauth#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mversion#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: HttpVersion11,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mcompress#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mFalse#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mchunked#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mexpect100#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mFalse#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mresponse_class#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: ClientResponse,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mproxy#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mproxy_auth#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mtimer#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: TimerNoop(),#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33msession#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: session,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mssl#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mTrue#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mproxy_headers#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mtraces#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: [],#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mtrust_env#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mFalse#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mserver_hostname#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        }#x1B[90m#x1B[39;49;00m
>       request = ClientRequest(method, url, **(default_args | kwargs))#x1B[90m#x1B[39;49;00m
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       TypeError: ClientRequest.__init__() missing 1 required keyword-only argument: 'loop'#x1B[0m

default_args = {'auth': None, 'chunked': None, 'compress': False, 'cookies': <BaseCookie: >, ...}
kwargs     = {}
method     = 'get'
request    = None
session    = <aiohttp.client.ClientSession object at 0x7fc18001af00>
url        = URL('unix:.../localhost/path')

#x1B[1m#x1B[31mtests/conftest.py#x1B[0m:425: TypeError
tests.test_client_request::test_host_port_nondefault_wss[pyloop]
Stack Traces | 0.075s run time
make_client_request = <function make_client_request.<locals>.maker at 0x7fc17f85ce00>

    #x1B[0m#x1B[94masync#x1B[39;49;00m #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtest_host_port_nondefault_wss#x1B[39;49;00m(make_client_request: _RequestMaker) -> #x1B[94mNone#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
>       req = make_client_request(#x1B[33m"#x1B[39;49;00m#x1B[33mget#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, URL(#x1B[33m"#x1B[39;49;00m#x1B[33mwss://python.org:960/#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m))#x1B[90m#x1B[39;49;00m
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m

make_client_request = <function make_client_request.<locals>.maker at 0x7fc17f85ce00>

#x1B[1m#x1B[31mtests/test_client_request.py#x1B[0m:204: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

method = 'get', url = URL('wss://python.org:960/'), kwargs = {}
default_args = {'auth': None, 'chunked': None, 'compress': False, 'cookies': <BaseCookie: >, ...}

    #x1B[0m#x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mmaker#x1B[39;49;00m(#x1B[90m#x1B[39;49;00m
        method: #x1B[96mstr#x1B[39;49;00m, url: URL, **kwargs: Unpack[ClientRequestArgs]#x1B[90m#x1B[39;49;00m
    ) -> ClientRequest:#x1B[90m#x1B[39;49;00m
        #x1B[94mnonlocal#x1B[39;49;00m request, session#x1B[90m#x1B[39;49;00m
        session = ClientSession()#x1B[90m#x1B[39;49;00m
        default_args: ClientRequestArgs = {#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mparams#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: {},#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mheaders#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: CIMultiDict[#x1B[96mstr#x1B[39;49;00m](),#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mskip_auto_headers#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mdata#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mcookies#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: BaseCookie[#x1B[96mstr#x1B[39;49;00m](),#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mauth#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mversion#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: HttpVersion11,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mcompress#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mFalse#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mchunked#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mexpect100#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mFalse#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mresponse_class#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: ClientResponse,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mproxy#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mproxy_auth#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mtimer#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: TimerNoop(),#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33msession#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: session,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mssl#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mTrue#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mproxy_headers#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mtraces#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: [],#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mtrust_env#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mFalse#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            #x1B[33m"#x1B[39;49;00m#x1B[33mserver_hostname#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        }#x1B[90m#x1B[39;49;00m
>       request = ClientRequest(method, url, **(default_args | kwargs))#x1B[90m#x1B[39;49;00m
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       TypeError: ClientRequest.__init__() missing 1 required keyword-only argument: 'loop'#x1B[0m

default_args = {'auth': None, 'chunked': None, 'compress': False, 'cookies': <BaseCookie: >, ...}
kwargs     = {}
method     = 'get'
request    = None
session    = <aiohttp.client.ClientSession object at 0x7fc18001b560>
url        = URL('wss://python.org:960/')

#x1B[1m#x1B[31mtests/conftest.py#x1B[0m:425: TypeError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@@ -190,623 +193,352 @@ class ConnectionKey(NamedTuple):
proxy_headers_hash: Optional[int] # hash(CIMultiDict)


class ClientRequest:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can back-port a limited version of this to keep back-ports more manageable. Right now automatic back-porting fails far too often, and we aren't any closer to releasing 4.x so we are going to have to deal with that for a long time which makes the risk of back-port errors higher.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. Will have to move backportable parts to another PR and merge, then update this one.

Copy link

codspeed-hq bot commented May 25, 2025

CodSpeed Performance Report

Merging #11012 will degrade performances by 9.34%

Comparing clientrequest-refactor (0cdf184) with master (4824648)

Summary

❌ 1 regressions
✅ 58 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
test_send_client_request_one_hundred[pyloop] 2.5 ms 2.8 ms -9.34%

@bdraco
Copy link
Member

bdraco commented May 26, 2025

Sorry about the conflicts

musicinmybrain pushed a commit to musicinmybrain/aiohttp that referenced this pull request Jul 5, 2025
Bumps [pip](https://github.com/pypa/pip) from 24.3.1 to 25.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/pypa/pip/blob/main/NEWS.rst">pip's
changelog</a>.</em></p>
<blockquote>
<h1>25.0 (2025-01-26)</h1>
<h2>Deprecations and Removals</h2>
<ul>
<li>Deprecate the <code>no-python-version-warning</code> flag as it has
long done nothing
since Python 2 support was removed in pip 21.0.
(<code>[#13154](pypa/pip#13154)
&lt;https://github.com/pypa/pip/issues/13154&gt;</code>_)</li>
</ul>
<h2>Features</h2>
<ul>
<li>Prefer to display :pep:<code>639</code>
<code>License-Expression</code> in <code>pip show</code> if metadata
version is at least 2.4.
(<code>[#13112](pypa/pip#13112)
&lt;https://github.com/pypa/pip/issues/13112&gt;</code>_)</li>
<li>Support :pep:<code>639</code> <code>License-Expression</code> and
<code>License-File</code> metadata fields in JSON
output. <code>pip inspect</code> and <code>pip install --report</code>
now emit
<code>license_expression</code> and <code>license_file</code> fields in
the <code>metadata</code> object,
if the corresponding fields are present in the installed
<code>METADATA</code> file.
(<code>[#13134](pypa/pip#13134)
&lt;https://github.com/pypa/pip/issues/13134&gt;</code>_)</li>
<li>Files in the network cache will inherit the read/write permissions
of pip's cache
directory (in addition to the current user retaining read/write access).
This
enables a single cache to be shared among multiple users.
(<code>[aio-libs#11012](pypa/pip#11012)
&lt;https://github.com/pypa/pip/issues/11012&gt;</code>_)</li>
<li>Return the size, along with the number, of files cleared on
<code>pip cache purge</code> and <code>pip cache remove</code>
(<code>[#12176](pypa/pip#12176)
&lt;https://github.com/pypa/pip/issues/12176&gt;</code>_)</li>
<li>Cache <code>python-requires</code> checks while filtering potential
installation candidates.
(<code>[#13128](pypa/pip#13128)
&lt;https://github.com/pypa/pip/issues/13128&gt;</code>_)</li>
<li>Optimize package collection by avoiding unnecessary URL parsing and
other processing.
(<code>[#13132](pypa/pip#13132)
&lt;https://github.com/pypa/pip/issues/13132&gt;</code>_)</li>
</ul>
<h2>Bug Fixes</h2>
<ul>
<li>Reorder the encoding detection when decoding a requirements file,
relying on
UTF-8 over the locale encoding by default, matching the documented
behaviour.
(<code>[#12771](pypa/pip#12771)
&lt;https://github.com/pypa/pip/issues/12771&gt;</code>_)</li>
<li>The pip version self check is disabled on
<code>EXTERNALLY-MANAGED</code> environments.
(<code>[#11820](pypa/pip#11820)
&lt;https://github.com/pypa/pip/issues/11820&gt;</code>_)</li>
<li>Fix a security bug allowing a specially crafted wheel to execute
code during
installation. (<code>[#13079](pypa/pip#13079)
&lt;https://github.com/pypa/pip/issues/13079&gt;</code>_)</li>
<li>The inclusion of <code>packaging</code> 24.2 changes how pre-release
specifiers with <code>&lt;</code> and <code>&gt;</code>
behave. Including a pre-release version with these specifiers now
implies
accepting pre-releases (e.g., <code>&lt;2.0dev</code> can include
<code>1.0rc1</code>). To avoid
implying pre-releases, avoid specifying them (e.g., use
<code>&lt;2.0</code>).
The exception is <code>!=</code>, which never implies pre-releases.
(<code>[#13163](pypa/pip#13163)
&lt;https://github.com/pypa/pip/issues/13163&gt;</code>_)</li>
<li>The <code>--cert</code> and <code>--client-cert</code> command-line
options are now respected while
installing build dependencies. Consequently, the private
<code>_PIP_STANDALONE_CERT</code>
environment variable is no longer used.
(<code>[aio-libs#5502](pypa/pip#5502)
&lt;https://github.com/pypa/pip/issues/5502&gt;</code>_)</li>
<li>The <code>--proxy</code> command-line option is now respected while
installing build dependencies.
(<code>[aio-libs#6018](pypa/pip#6018)
&lt;https://github.com/pypa/pip/issues/6018&gt;</code>_)</li>
</ul>
<h2>Vendored Libraries</h2>
<ul>
<li>Upgrade CacheControl to 0.14.1</li>
<li>Upgrade idna to 3.10</li>
<li>Upgrade msgpack to 1.1.0</li>
<li>Upgrade packaging to 24.2</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/pypa/pip/commit/f47b5874299848c688336ae7c8d69534013fe2c6"><code>f47b587</code></a>
Bump for release</li>
<li><a
href="https://github.com/pypa/pip/commit/74a7f3335338712af44be95241daf62e756f27ec"><code>74a7f33</code></a>
Update AUTHORS.txt</li>
<li><a
href="https://github.com/pypa/pip/commit/a008888a5b123e8d5e4667bdd21e4b42f3fc034c"><code>a008888</code></a>
Merge pull request <a
href="https://redirect.github.com/pypa/pip/issues/13171">#13171</a> from
pypa/dependabot/github_actions/github-actions-...</li>
<li><a
href="https://github.com/pypa/pip/commit/d265fb7427c3ba4dbd10e4874a0bebea2e59350e"><code>d265fb7</code></a>
Merge pull request <a
href="https://redirect.github.com/pypa/pip/issues/13174">#13174</a> from
ichard26/changelog</li>
<li><a
href="https://github.com/pypa/pip/commit/d35384ef91cb372a5223a01f980e5deb84c8fde5"><code>d35384e</code></a>
Copyedit news entries before 25.0</li>
<li><a
href="https://github.com/pypa/pip/commit/adc4f9951b51b6a06e405b8960dd0c5f030f0fb5"><code>adc4f99</code></a>
Reorder requirements file decoding (<a
href="https://redirect.github.com/pypa/pip/issues/12795">#12795</a>)</li>
<li><a
href="https://github.com/pypa/pip/commit/40c42149a51a63e8416c047d5ddc0da1694387ea"><code>40c4214</code></a>
Bump pypa/gh-action-pypi-publish in the github-actions group</li>
<li><a
href="https://github.com/pypa/pip/commit/6b0fb904803fbb3ce7da63966b2759407b6cd9dc"><code>6b0fb90</code></a>
Merge pull request <a
href="https://redirect.github.com/pypa/pip/issues/13048">#13048</a> from
sbidoul/trusted-publisher-sbi</li>
<li><a
href="https://github.com/pypa/pip/commit/c7fb1e13ec79b1b48481ac245144c2b368e64f7d"><code>c7fb1e1</code></a>
Merge pull request <a
href="https://redirect.github.com/pypa/pip/issues/13145">#13145</a> from
befeleme/pip-show-pep639</li>
<li><a
href="https://github.com/pypa/pip/commit/41c807c5938d269703c6ff2644fb3b7dc88eda4e"><code>41c807c</code></a>
Show License-Expression if present in package metadata</li>
<li>Additional commits viewable in <a
href="https://github.com/pypa/pip/compare/24.3.1...25.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pip&package-manager=pip&previous-version=24.3.1&new-version=25.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
from aiohttp.compression_utils import ZLibBackend, ZLibBackendProtocol, set_zlib_backend
from aiohttp.http import WS_KEY
from aiohttp.helpers import BaseTimerContext, BasicAuth, TimerNoop

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'BaseTimerContext' is not used.
Import of 'BasicAuth' is not used.

Copilot Autofix

AI 1 day ago

To fix the problem of the unused import, we should remove BaseTimerContext from the import statement on line 38 in tests/conftest.py. The other imported names (BasicAuth, TimerNoop) should remain untouched unless CodeQL also reports them as unused. No further changes are necessary, and removing just the unused import will not alter existing functionality.

Suggested changeset 1
tests/conftest.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/conftest.py b/tests/conftest.py
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -35,7 +35,7 @@
     Fingerprint,
 )
 from aiohttp.compression_utils import ZLibBackend, ZLibBackendProtocol, set_zlib_backend
-from aiohttp.helpers import BaseTimerContext, BasicAuth, TimerNoop
+from aiohttp.helpers import BasicAuth, TimerNoop
 from aiohttp.http import WS_KEY, HttpVersion, HttpVersion11
 from aiohttp.test_utils import get_unused_port_socket, loop_context
 from aiohttp.tracing import Trace
EOF
@@ -35,7 +35,7 @@
Fingerprint,
)
from aiohttp.compression_utils import ZLibBackend, ZLibBackendProtocol, set_zlib_backend
from aiohttp.helpers import BaseTimerContext, BasicAuth, TimerNoop
from aiohttp.helpers import BasicAuth, TimerNoop
from aiohttp.http import WS_KEY, HttpVersion, HttpVersion11
from aiohttp.test_utils import get_unused_port_socket, loop_context
from aiohttp.tracing import Trace
Copilot is powered by AI and may make mistakes. Always verify output.
from aiohttp.compression_utils import ZLibBackend, ZLibBackendProtocol, set_zlib_backend
from aiohttp.http import WS_KEY
from aiohttp.helpers import BaseTimerContext, BasicAuth, TimerNoop
from aiohttp.http import WS_KEY, HttpVersion, HttpVersion11

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'HttpVersion' is not used.

Copilot Autofix

AI 1 day ago

To fix the unused import, remove the reference to HttpVersion from the import statement on line 39. That is, change:

from aiohttp.http import WS_KEY, HttpVersion, HttpVersion11

to:

from aiohttp.http import WS_KEY, HttpVersion11

This removes the unused symbol without affecting the other (possibly used) imports, and leaves the codebase cleaner. Only line 39 in tests/conftest.py needs to be changed.


Suggested changeset 1
tests/conftest.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/conftest.py b/tests/conftest.py
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -36,7 +36,7 @@
 )
 from aiohttp.compression_utils import ZLibBackend, ZLibBackendProtocol, set_zlib_backend
 from aiohttp.helpers import BaseTimerContext, BasicAuth, TimerNoop
-from aiohttp.http import WS_KEY, HttpVersion, HttpVersion11
+from aiohttp.http import WS_KEY, HttpVersion11
 from aiohttp.test_utils import get_unused_port_socket, loop_context
 from aiohttp.tracing import Trace
 from aiohttp.typedefs import Query
EOF
@@ -36,7 +36,7 @@
)
from aiohttp.compression_utils import ZLibBackend, ZLibBackendProtocol, set_zlib_backend
from aiohttp.helpers import BaseTimerContext, BasicAuth, TimerNoop
from aiohttp.http import WS_KEY, HttpVersion, HttpVersion11
from aiohttp.http import WS_KEY, HttpVersion11
from aiohttp.test_utils import get_unused_port_socket, loop_context
from aiohttp.tracing import Trace
from aiohttp.typedefs import Query
Copilot is powered by AI and may make mistakes. Always verify output.
from aiohttp.test_utils import get_unused_port_socket, loop_context
from aiohttp.tracing import Trace

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'Trace' is not used.

Copilot Autofix

AI 1 day ago

To fix an unused import, simply remove the corresponding import line.
Specifically, in tests/conftest.py, delete the line:

from aiohttp.tracing import Trace

No additional changes are necessary since no part of the visible code uses Trace, and we are not to introduce other imports or substitute the usage.


Suggested changeset 1
tests/conftest.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/conftest.py b/tests/conftest.py
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -38,7 +38,7 @@
 from aiohttp.helpers import BaseTimerContext, BasicAuth, TimerNoop
 from aiohttp.http import WS_KEY, HttpVersion, HttpVersion11
 from aiohttp.test_utils import get_unused_port_socket, loop_context
-from aiohttp.tracing import Trace
+
 from aiohttp.typedefs import Query
 
 try:
EOF
@@ -38,7 +38,7 @@
from aiohttp.helpers import BaseTimerContext, BasicAuth, TimerNoop
from aiohttp.http import WS_KEY, HttpVersion, HttpVersion11
from aiohttp.test_utils import get_unused_port_socket, loop_context
from aiohttp.tracing import Trace

from aiohttp.typedefs import Query

try:
Copilot is powered by AI and may make mistakes. Always verify output.
@@ -11,7 +11,9 @@
from collections import defaultdict, deque
from concurrent import futures
from contextlib import closing, suppress
from http.cookies import BaseCookie

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'BaseCookie' is not used.

Copilot Autofix

AI 4 days ago

The optimal solution is to remove the unused import statement for BaseCookie (from http.cookies import BaseCookie on line 14) from tests/test_connector.py. This change should be restricted solely to the removal of that line. No other code changes are necessary since there is no usage of BaseCookie in the shown code, and the absence of the import will have no effect on the rest of the file.


Suggested changeset 1
tests/test_connector.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/test_connector.py b/tests/test_connector.py
--- a/tests/test_connector.py
+++ b/tests/test_connector.py
@@ -11,7 +11,6 @@
 from collections import defaultdict, deque
 from concurrent import futures
 from contextlib import closing, suppress
-from http.cookies import BaseCookie
 from typing import (
     Any,
     Awaitable,
EOF
@@ -11,7 +11,6 @@
from collections import defaultdict, deque
from concurrent import futures
from contextlib import closing, suppress
from http.cookies import BaseCookie
from typing import (
Any,
Awaitable,
Copilot is powered by AI and may make mistakes. Always verify output.
)
from unittest import mock

import pytest
from multidict import CIMultiDict

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'CIMultiDict' is not used.

Copilot Autofix

AI 4 days ago

To fix the problem, the unused import statement should be removed from the code. Specifically, delete the line from multidict import CIMultiDict (line 32) in tests/test_connector.py. This reduces unnecessary dependencies, cleans up the code, and removes potential confusion about the presence of an unused module.

Suggested changeset 1
tests/test_connector.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/test_connector.py b/tests/test_connector.py
--- a/tests/test_connector.py
+++ b/tests/test_connector.py
@@ -29,7 +29,6 @@
 from unittest import mock
 
 import pytest
-from multidict import CIMultiDict
 from pytest_mock import MockerFixture
 from yarl import URL
 
EOF
@@ -29,7 +29,6 @@
from unittest import mock

import pytest
from multidict import CIMultiDict
from pytest_mock import MockerFixture
from yarl import URL

Copilot is powered by AI and may make mistakes. Always verify output.
@@ -50,10 +56,13 @@
_ConnectTunnelConnection,
_DNSCacheTable,
)
from aiohttp.helpers import TimerNoop

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'TimerNoop' is not used.

Copilot Autofix

AI 4 days ago

To fix the unused import error, we should remove the line from aiohttp.helpers import TimerNoop at line 58 in tests/test_connector.py. This will eliminate the unnecessary dependency and improve code clarity and maintainability. No other changes are required, as nothing else depends on this symbol.


Suggested changeset 1
tests/test_connector.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/test_connector.py b/tests/test_connector.py
--- a/tests/test_connector.py
+++ b/tests/test_connector.py
@@ -55,7 +55,6 @@
     _ConnectTunnelConnection,
     _DNSCacheTable,
 )
-from aiohttp.helpers import TimerNoop
 from aiohttp.pytest_plugin import AiohttpClient, AiohttpServer
 from aiohttp.test_utils import unused_port
 from aiohttp.tracing import Trace
EOF
@@ -55,7 +55,6 @@
_ConnectTunnelConnection,
_DNSCacheTable,
)
from aiohttp.helpers import TimerNoop
from aiohttp.pytest_plugin import AiohttpClient, AiohttpServer
from aiohttp.test_utils import unused_port
from aiohttp.tracing import Trace
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +40 to +45
from aiohttp.client_reqrep import (
ClientRequest,
ClientRequestArgs,
ClientResponse,
Fingerprint,
)

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'Fingerprint' is not used.

Copilot Autofix

AI 1 day ago

To fix the problem, we should remove the unused symbol from the import statement. Specifically, in the multi-line import statement from aiohttp.client_reqrep (lines 31–36), we can simply remove Fingerprint, from the symbol list. This is the recommended way, as it eliminates the unused import without impacting any functional code. No other changes are required, since the rest of the file and import statement remain valid, and no functionality is altered.

Suggested changeset 1
tests/conftest.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/conftest.py b/tests/conftest.py
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -32,7 +32,6 @@
     ClientRequest,
     ClientRequestArgs,
     ClientResponse,
-    Fingerprint,
 )
 from aiohttp.compression_utils import ZLibBackend, ZLibBackendProtocol, set_zlib_backend
 from aiohttp.helpers import BaseTimerContext, BasicAuth, TimerNoop
EOF
@@ -32,7 +32,6 @@
ClientRequest,
ClientRequestArgs,
ClientResponse,
Fingerprint,
)
from aiohttp.compression_utils import ZLibBackend, ZLibBackendProtocol, set_zlib_backend
from aiohttp.helpers import BaseTimerContext, BasicAuth, TimerNoop
Copilot is powered by AI and may make mistakes. Always verify output.
ClientResponse,
Fingerprint,
_gen_default_accept_encoding,
)
from aiohttp.compression_utils import ZLibBackend
from aiohttp.connector import Connection
from aiohttp.http import HttpVersion10, HttpVersion11, StreamWriter
from aiohttp.hdrs import METH_DELETE
from aiohttp.helpers import TimerNoop

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'TimerNoop' is not used.

Copilot Autofix

AI 1 day ago

To fix the unused import problem, simply remove the line where TimerNoop is imported from aiohttp.helpers. Specifically, delete line 41: from aiohttp.helpers import TimerNoop in tests/test_client_request.py. No further code changes or replacement for this import are required, and this will eliminate the unnecessary dependency and improve code readability.

Suggested changeset 1
tests/test_client_request.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/test_client_request.py b/tests/test_client_request.py
--- a/tests/test_client_request.py
+++ b/tests/test_client_request.py
@@ -38,7 +38,7 @@
 from aiohttp.compression_utils import ZLibBackend
 from aiohttp.connector import Connection
 from aiohttp.hdrs import METH_DELETE
-from aiohttp.helpers import TimerNoop
+
 from aiohttp.http import HttpVersion, HttpVersion10, HttpVersion11, StreamWriter
 from aiohttp.multipart import MultipartWriter
 from aiohttp.typedefs import LooseCookies
EOF
@@ -38,7 +38,7 @@
from aiohttp.compression_utils import ZLibBackend
from aiohttp.connector import Connection
from aiohttp.hdrs import METH_DELETE
from aiohttp.helpers import TimerNoop

from aiohttp.http import HttpVersion, HttpVersion10, HttpVersion11, StreamWriter
from aiohttp.multipart import MultipartWriter
from aiohttp.typedefs import LooseCookies
Copilot is powered by AI and may make mistakes. Always verify output.
from aiohttp.http import HttpVersion10, HttpVersion11, StreamWriter
from aiohttp.hdrs import METH_DELETE
from aiohttp.helpers import TimerNoop
from aiohttp.http import HttpVersion, HttpVersion10, HttpVersion11, StreamWriter

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'HttpVersion' is not used.

Copilot Autofix

AI 1 day ago

To fix the unused import error, the best approach is to remove only the unused symbol, HttpVersion, from the import statement at line 42. If the other symbols in the same import (HttpVersion10, HttpVersion11, StreamWriter) are used elsewhere, they should remain. The region to change is thus just the import statement itself, removing HttpVersion while leaving the rest of the code intact.

Suggested changeset 1
tests/test_client_request.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/test_client_request.py b/tests/test_client_request.py
--- a/tests/test_client_request.py
+++ b/tests/test_client_request.py
@@ -39,7 +39,7 @@
 from aiohttp.connector import Connection
 from aiohttp.hdrs import METH_DELETE
 from aiohttp.helpers import TimerNoop
-from aiohttp.http import HttpVersion, HttpVersion10, HttpVersion11, StreamWriter
+from aiohttp.http import HttpVersion10, HttpVersion11, StreamWriter
 from aiohttp.multipart import MultipartWriter
 from aiohttp.typedefs import LooseCookies
 
EOF
@@ -39,7 +39,7 @@
from aiohttp.connector import Connection
from aiohttp.hdrs import METH_DELETE
from aiohttp.helpers import TimerNoop
from aiohttp.http import HttpVersion, HttpVersion10, HttpVersion11, StreamWriter
from aiohttp.http import HttpVersion10, HttpVersion11, StreamWriter
from aiohttp.multipart import MultipartWriter
from aiohttp.typedefs import LooseCookies

Copilot is powered by AI and may make mistakes. Always verify output.
@Dreamsorcerer Dreamsorcerer force-pushed the clientrequest-refactor branch from 872f647 to deec35d Compare August 28, 2025 21:00
from aiohttp.connector import _SSL_CONTEXT_VERIFIED
from aiohttp.helpers import TimerNoop
from aiohttp.http import HttpVersion

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'HttpVersion' is not used.

Copilot Autofix

AI 4 days ago

To fix the problem, we should simply remove the unused import statement from the file. Specifically, delete the line from aiohttp.http import HttpVersion (line 21). This change is safe and does not affect any other logic in the file, as HttpVersion is not referenced anywhere in the provided code. No further code changes or imports are required.

Suggested changeset 1
tests/test_proxy.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/test_proxy.py b/tests/test_proxy.py
--- a/tests/test_proxy.py
+++ b/tests/test_proxy.py
@@ -18,7 +18,6 @@
 )
 from aiohttp.connector import _SSL_CONTEXT_VERIFIED
 from aiohttp.helpers import TimerNoop
-from aiohttp.http import HttpVersion
 
 if sys.version_info >= (3, 11):
     from typing import Unpack
EOF
@@ -18,7 +18,6 @@
)
from aiohttp.connector import _SSL_CONTEXT_VERIFIED
from aiohttp.helpers import TimerNoop
from aiohttp.http import HttpVersion

if sys.version_info >= (3, 11):
from typing import Unpack
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip Skip backport bot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants