Skip to content

Commit d4440ea

Browse files
committed
feat: optimize with iterators
1 parent 51b76f1 commit d4440ea

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,
@@ -1094,11 +1094,10 @@ def subscription_formatter(value: Any) -> Union[HexBytes, HexStr, Dict[str, Any]
10941094
}
10951095

10961096

1097-
@to_tuple
10981097
def combine_formatters(
10991098
formatter_maps: Collection[Dict[RPCEndpoint, Callable[..., TReturn]]],
11001099
method_name: RPCEndpoint,
1101-
) -> Iterable[Callable[..., TReturn]]:
1100+
) -> Iterator[Callable[..., TReturn]]:
11021101
for formatter_map in formatter_maps:
11031102
if method_name in formatter_map:
11041103
yield formatter_map[method_name]
@@ -1234,12 +1233,11 @@ def filter_wrapper(
12341233
}
12351234

12361235

1237-
@to_tuple
12381236
def apply_module_to_formatters(
12391237
formatters: Iterable[Callable[..., TReturn]],
12401238
module: "Module",
12411239
method_name: Union[RPCEndpoint, Callable[..., RPCEndpoint]],
1242-
) -> Iterable[Callable[..., TReturn]]:
1240+
) -> Iterator[Callable[..., TReturn]]:
12431241
for f in formatters:
12441242
yield partial(f, module, method_name)
12451243

0 commit comments

Comments
 (0)