Skip to content

Commit e9c4219

Browse files
committed
feat: optimize with iterators
1 parent 6f745f9 commit e9c4219

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

web3/_utils/method_formatters.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Collection,
88
Dict,
99
Iterable,
10+
Iterator,
1011
NoReturn,
1112
Tuple,
1213
TypeVar,
@@ -35,7 +36,6 @@
3536
is_string,
3637
to_checksum_address,
3738
to_list,
38-
to_tuple,
3939
)
4040
from eth_utils.toolz import (
4141
complement,
@@ -1099,11 +1099,10 @@ def subscription_formatter(value: Any) -> Union[HexBytes, HexStr, Dict[str, Any]
10991099
}
11001100

11011101

1102-
@to_tuple
11031102
def combine_formatters(
11041103
formatter_maps: Collection[Dict[RPCEndpoint, Callable[..., TReturn]]],
11051104
method_name: RPCEndpoint,
1106-
) -> Iterable[Callable[..., TReturn]]:
1105+
) -> Iterator[Callable[..., TReturn]]:
11071106
for formatter_map in formatter_maps:
11081107
if method_name in formatter_map:
11091108
yield formatter_map[method_name]
@@ -1241,12 +1240,11 @@ def filter_wrapper(
12411240
}
12421241

12431242

1244-
@to_tuple
12451243
def apply_module_to_formatters(
12461244
formatters: Iterable[Callable[..., TReturn]],
12471245
module: "Module",
12481246
method_name: Union[RPCEndpoint, Callable[..., RPCEndpoint]],
1249-
) -> Iterable[Callable[..., TReturn]]:
1247+
) -> Iterator[Callable[..., TReturn]]:
12501248
for f in formatters:
12511249
yield partial(f, module, method_name)
12521250

0 commit comments

Comments
 (0)