diff --git a/web3/main.py b/web3/main.py index e668b45bb1..b97aea0c51 100644 --- a/web3/main.py +++ b/web3/main.py @@ -60,6 +60,9 @@ build_strict_registry, map_abi_data, ) +from web3._utils.compat import ( + Self, +) from web3._utils.empty import ( empty, ) @@ -539,7 +542,7 @@ def __init__( self.ws = WebsocketConnection(self) # async for w3 in w3.persistent_websocket(provider) - async def __aiter__(self) -> AsyncIterator["_PersistentConnectionWeb3"]: + async def __aiter__(self) -> AsyncIterator[Self]: while True: try: yield self @@ -548,7 +551,7 @@ async def __aiter__(self) -> AsyncIterator["_PersistentConnectionWeb3"]: continue # async with w3.persistent_websocket(provider) as w3 - async def __aenter__(self) -> "_PersistentConnectionWeb3": + async def __aenter__(self) -> Self: await self.provider.connect() return self diff --git a/web3/providers/websocket/websocket_v2.py b/web3/providers/websocket/websocket_v2.py index 5fd527c13a..6bc513e990 100644 --- a/web3/providers/websocket/websocket_v2.py +++ b/web3/providers/websocket/websocket_v2.py @@ -146,7 +146,7 @@ async def disconnect(self) -> None: self._request_processor.clear_caches() self.logger.debug( f'Successfully disconnected from endpoint: "{self.endpoint_uri}" ' - "the request processor transient caches were cleared." + "and the request processor transient caches were cleared." ) async def make_request(self, method: RPCEndpoint, params: Any) -> RPCResponse: