Skip to content

Commit

Permalink
changes from comments on PR #3096 & minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
fselmo committed Sep 15, 2023
1 parent 2018342 commit ec360a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions web3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
build_strict_registry,
map_abi_data,
)
from web3._utils.compat import (
Self,
)
from web3._utils.empty import (
empty,
)
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion web3/providers/websocket/websocket_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ec360a5

Please sign in to comment.