22from http import HTTPStatus
33import json
44from ssl import SSLContext
5- from typing import Any , Dict , List , Optional , Type , AsyncIterator
5+ from typing import Any , Dict , List , Optional , Self , Type , AsyncIterator
66from rath .links .types import Payload
77import aiohttp
88from graphql import OperationType
@@ -43,7 +43,11 @@ class AIOHttpLink(AsyncTerminatingLink):
4343 """ssl_context is the SSLContext to use for the aiohttp session. By default, this
4444 is a context that uses the certifi CA bundle."""
4545
46- auth_errors : List [HTTPStatus ] = Field (default_factory = lambda : (HTTPStatus .FORBIDDEN ,))
46+ auth_errors : List [HTTPStatus ] = Field (
47+ default_factory = lambda : [
48+ HTTPStatus .FORBIDDEN ,
49+ ]
50+ )
4751 """auth_errors is a list of HTTPStatus codes that indicate that the request was
4852 unauthorized. By default, this is just HTTPStatus.FORBIDDEN, but you can
4953 override this to include other status codes that indicate that the request was
@@ -56,9 +60,9 @@ class AIOHttpLink(AsyncTerminatingLink):
5660
5761 _connected = False
5862
59- async def __aenter__ (self ) -> None :
63+ async def __aenter__ (self ) -> Self :
6064 """Entery point for the async context manager"""
61- pass
65+ return self
6266
6367 async def aconnect (self , operation : Operation ) -> None :
6468 """Connects the link to the server
@@ -69,7 +73,12 @@ async def aconnect(self, operation: Operation) -> None:
6973 """
7074 self ._connected = True
7175
72- async def __aexit__ (self , exc_type : Optional [Type [BaseException ]], exc_val : Optional [BaseException ], traceback : Optional [Any ]) -> None :
76+ async def __aexit__ (
77+ self ,
78+ exc_type : Optional [Type [BaseException ]],
79+ exc_val : Optional [BaseException ],
80+ traceback : Optional [Any ],
81+ ) -> None :
7382 """Exit point for the async context manager"""
7483 pass
7584
0 commit comments