Skip to content

Commit 6f25e47

Browse files
committed
fix
1 parent b4b10b6 commit 6f25e47

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

faster_web3/_utils/events.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ def construct_event_data_set(
178178

179179
normalized_args = {
180180
key: value if is_list_like(value) else [value]
181-
# type ignored b/c at this point arguments is always a dict
182-
for key, value in arguments.items() # type: ignore
181+
for key, value in arguments.items()
183182
}
184183

185184
non_indexed_args = exclude_indexed_event_inputs(event_abi)
@@ -497,7 +496,7 @@ def _build_argument_filters_from_event_abi(
497496
array_to_tuple: Final = apply_formatter_if(is_list_like, tuple)
498497

499498

500-
def _normalize_match_values(match_values: Collection[Any]) -> Iterable[Any]:
499+
def _normalize_match_values(match_values: Collection[Any]) -> Tuple[Any, ...]:
501500
return tuple(map(array_to_tuple, match_values))
502501

503502

@@ -535,7 +534,6 @@ def match_values(self) -> None:
535534

536535
@final
537536
class DataArgumentFilter(BaseArgumentFilter):
538-
# type ignore b/c conflict with BaseArgumentFilter.match_values type
539537
@property
540538
def match_values(self) -> Union[
541539
Tuple[TypeStr, Tuple[Any, ...]],
@@ -550,12 +548,11 @@ def __init__(self, arg_type: TypeStr, abi_codec: ABICodec) -> None:
550548
super().__init__(arg_type)
551549
self.abi_codec: Final = abi_codec
552550

553-
def _get_match_values(self) -> Iterable[HexStr]:
551+
def _get_match_values(self) -> Tuple[HexStr, ...]:
554552
return tuple(map(self._encode, cast(Tuple[Any, ...], self._match_values)))
555553

556-
# type ignore b/c conflict with BaseArgumentFilter.match_values type
557554
@property
558-
def match_values(self) -> Optional[Tuple[HexStr, ...]]: # type: ignore
555+
def match_values(self) -> Optional[Tuple[HexStr, ...]]:
559556
return self._get_match_values() if self._match_values is not None else None
560557

561558
def _encode(self, value: Any) -> HexStr:

tests/core/filtering/test_basic_filter_tests.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ def test_filtering_sequential_blocks_with_bounded_range(
99

1010
initial_block_number = w3.eth.block_number
1111

12-
builder.toBlock = initial_block_number + 100
12+
# this line doesn't actually do anything but we had to change it because
13+
# you can't assign a non-existent attribute to a compiled class.
14+
# I'm not sure what the original intent was but the test passes with or
15+
# without it.
16+
builder.to_block = initial_block_number + 100
17+
1318
filter_ = builder.deploy(w3)
1419
for _ in range(100):
1520
emitter.functions.logNoArgs(which=1).transact()
@@ -45,7 +50,13 @@ async def test_async_filtering_sequential_blocks_with_bounded_range(
4550
builder = async_emitter.events.LogNoArguments.build_filter()
4651
builder.from_block = "latest"
4752
initial_block_number = await async_w3.eth.block_number
48-
builder.toBlock = initial_block_number + 100
53+
54+
# this line doesn't actually do anything but we had to change it because
55+
# you can't assign a non-existent attribute to a compiled class.
56+
# I'm not sure what the original intent was but the test passes with or
57+
# without it.
58+
builder.to_block = initial_block_number + 100
59+
4960
filter_ = await builder.deploy(async_w3)
5061
for _ in range(100):
5162
await async_emitter.functions.logNoArgs(which=1).transact()

0 commit comments

Comments
 (0)