Skip to content

Commit ab52bd3

Browse files
author
pacrob
committed
type sync filter and ignore typing for async filter tests
1 parent 8737c20 commit ab52bd3

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

web3/_utils/events.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ async def deploy(self, async_w3: "Web3") -> "AsyncLogFilter":
439439
arg._immutable = True
440440
self._immutable = True
441441

442-
log_filter = await async_w3.eth.filter(self.filter_params)
442+
log_filter = await async_w3.eth.filter(self.filter_params) # type: ignore
443443
log_filter.filter_params = self.filter_params
444444
log_filter.set_data_filters(self.data_argument_values)
445445
log_filter.builder = self

web3/_utils/module_testing/eth_module.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ async def test_eth_getBlockTransactionCountByNumber_block_with_txn(
14671467

14681468
@pytest.mark.asyncio
14691469
async def test_async_eth_new_filter(self, async_w3: "Web3") -> None:
1470-
filter = await async_w3.eth.filter({})
1470+
filter = await async_w3.eth.filter({}) # type: ignore
14711471

14721472
changes = await async_w3.eth.get_filter_changes(
14731473
filter.filter_id
@@ -1484,7 +1484,7 @@ async def test_async_eth_new_filter(self, async_w3: "Web3") -> None:
14841484

14851485
@pytest.mark.asyncio
14861486
async def test_async_eth_new_block_filter(self, async_w3: "Web3") -> None:
1487-
filter = await async_w3.eth.filter("latest")
1487+
filter = await async_w3.eth.filter("latest") # type: ignore
14881488
assert is_string(filter.filter_id)
14891489

14901490
changes = await async_w3.eth.get_filter_changes(
@@ -1500,7 +1500,7 @@ async def test_async_eth_new_block_filter(self, async_w3: "Web3") -> None:
15001500
async def test_async_eth_new_pending_transaction_filter(
15011501
self, async_w3: "Web3"
15021502
) -> None:
1503-
filter = await async_w3.eth.filter("pending")
1503+
filter = await async_w3.eth.filter("pending") # type: ignore
15041504
assert is_string(filter.filter_id)
15051505

15061506
changes = await async_w3.eth.get_filter_changes(
@@ -1514,7 +1514,7 @@ async def test_async_eth_new_pending_transaction_filter(
15141514

15151515
@pytest.mark.asyncio
15161516
async def test_async_eth_uninstall_filter(self, async_w3: "Web3") -> None:
1517-
filter = await async_w3.eth.filter({})
1517+
filter = await async_w3.eth.filter({}) # type: ignore
15181518
assert is_string(filter.filter_id)
15191519

15201520
success = await async_w3.eth.uninstall_filter(filter.filter_id) # type: ignore

web3/eth.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
)
5353
from web3._utils.filters import (
5454
AsyncFilter,
55+
Filter,
5556
select_filter_method,
5657
)
5758
from web3._utils.rpc_abi import (
@@ -635,7 +636,9 @@ async def get_storage_at(
635636
) -> HexBytes:
636637
return await self._get_storage_at(account, position, block_identifier)
637638

638-
filter: Method[Callable[..., Awaitable[AsyncFilter]]] = Method(
639+
filter: Method[
640+
Callable[[Optional[Union[str, FilterParams, HexStr]]], Awaitable[AsyncFilter]]
641+
] = Method(
639642
method_choice_depends_on_args=select_filter_method(
640643
if_new_block_filter=RPC.eth_newBlockFilter,
641644
if_new_pending_transaction_filter=RPC.eth_newPendingTransactionFilter,
@@ -958,7 +961,9 @@ def fee_history(
958961
) -> FeeHistory:
959962
return self._fee_history(block_count, newest_block, reward_percentiles)
960963

961-
filter: Method[Callable[..., Any]] = Method(
964+
filter: Method[
965+
Callable[[Optional[Union[str, FilterParams, HexStr]]], Filter]
966+
] = Method(
962967
method_choice_depends_on_args=select_filter_method(
963968
if_new_block_filter=RPC.eth_newBlockFilter,
964969
if_new_pending_transaction_filter=RPC.eth_newPendingTransactionFilter,

0 commit comments

Comments
 (0)