Skip to content
Open
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
5 changes: 2 additions & 3 deletions web3/method.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,10 @@ def process_params(
# the first parameter determines which method needs to be called
self.json_rpc_method = self.method_choice_depends_on_args(value=params[0])

pending_or_latest_filter_methods = [
if self.json_rpc_method in (
RPC.eth_newPendingTransactionFilter,
RPC.eth_newBlockFilter,
]
if self.json_rpc_method in pending_or_latest_filter_methods:
):
# For pending or latest filter methods, use params to determine
# which method to call, but don't pass them through with the request
params = []
Expand Down
3 changes: 1 addition & 2 deletions web3/middleware/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ def get_logs_multipart(
The getLog request is partitioned into multiple calls of the max number of blocks
``max_blocks``.
"""
_block_ranges = block_ranges(start_block, stop_block, max_blocks)
for from_block, to_block in _block_ranges:
for from_block, to_block in block_ranges(start_block, stop_block, max_blocks):
params = {
"fromBlock": from_block,
"toBlock": to_block,
Expand Down
9 changes: 3 additions & 6 deletions web3/providers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ def request_func(
"""
middleware: tuple[Middleware, ...] = middleware_onion.as_tuple_of_middleware()

cache_key = self._request_func_cache[0]
if cache_key != middleware:
if self._request_func_cache[0] != middleware:
self._request_func_cache = (
middleware,
combine_middleware(
Expand Down Expand Up @@ -184,15 +183,13 @@ def batch_request_func(
) -> Callable[..., list[RPCResponse] | RPCResponse]:
middleware: tuple[Middleware, ...] = middleware_onion.as_tuple_of_middleware()

cache_key = self._batch_request_func_cache[0]
if cache_key != middleware:
if self._batch_request_func_cache[0] != middleware:
accumulator_fn = self.make_batch_request
for mw in reversed(middleware):
initialized = mw(w3)
# type ignore bc in order to wrap the method, we have to call
# `wrap_make_batch_request` with the accumulator_fn as the argument
# which breaks the type hinting for this particular case.
accumulator_fn = initialized.wrap_make_batch_request( # type: ignore
accumulator_fn = mw(w3).wrap_make_batch_request( # type: ignore
accumulator_fn
)
self._batch_request_func_cache = (middleware, accumulator_fn)
Expand Down