Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/2810.breaking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed deprecated ``manager.request_async`` and associated methods.
37 changes: 0 additions & 37 deletions web3/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
Union,
cast,
)
import uuid
from uuid import (
UUID,
)

from eth_utils.toolz import (
pipe,
Expand All @@ -24,12 +20,8 @@
HexBytes,
)

from web3._utils.decorators import (
deprecated_for,
)
from web3._utils.threads import ( # noqa: F401
ThreadWithReturn,
spawn,
)
from web3.datastructures import (
NamedElementOnion,
Expand Down Expand Up @@ -106,7 +98,6 @@ def __init__(
middlewares: Optional[Sequence[Tuple[Middleware, str]]] = None,
) -> None:
self.w3 = w3
self.pending_requests: Dict[UUID, ThreadWithReturn[RPCResponse]] = {}

if provider is None:
self.provider = AutoProvider()
Expand Down Expand Up @@ -243,31 +234,3 @@ async def coro_request(
return self.formatted_response(
response, params, error_formatters, null_result_formatters
)

@deprecated_for("coro_request")
def request_async(self, raw_method: str, raw_params: Any) -> UUID:
request_id = uuid.uuid4()
self.pending_requests[request_id] = spawn(
self.request_blocking,
raw_method=raw_method,
raw_params=raw_params,
)
return request_id

def receive_blocking(
self, request_id: UUID, timeout: Optional[float] = None
) -> Any:
try:
request = self.pending_requests.pop(request_id)
except KeyError:
raise KeyError(f"Request for id:{request_id} not found")
else:
response = request.get(timeout=timeout)

if "error" in response:
raise ValueError(response["error"])

return response["result"]

def receive_async(self, request_id: UUID, *args: Any, **kwargs: Any) -> NoReturn:
raise NotImplementedError("Callback pattern not implemented")