Skip to content

Commit 11a0672

Browse files
committed
feat: optimize with iterators
1 parent 147ded0 commit 11a0672

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: web3/_utils/method_formatters.py

+3-5
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,
@@ -1048,11 +1048,10 @@ def subscription_formatter(value: Any) -> Union[HexBytes, HexStr, Dict[str, Any]
10481048
}
10491049

10501050

1051-
@to_tuple
10521051
def combine_formatters(
10531052
formatter_maps: Collection[Dict[RPCEndpoint, Callable[..., TReturn]]],
10541053
method_name: RPCEndpoint,
1055-
) -> Iterable[Callable[..., TReturn]]:
1054+
) -> Iterator[Callable[..., TReturn]]:
10561055
for formatter_map in formatter_maps:
10571056
if method_name in formatter_map:
10581057
yield formatter_map[method_name]
@@ -1190,12 +1189,11 @@ def filter_wrapper(
11901189
}
11911190

11921191

1193-
@to_tuple
11941192
def apply_module_to_formatters(
11951193
formatters: Iterable[Callable[..., TReturn]],
11961194
module: "Module",
11971195
method_name: Union[RPCEndpoint, Callable[..., RPCEndpoint]],
1198-
) -> Iterable[Callable[..., TReturn]]:
1196+
) -> Iterator[Callable[..., TReturn]]:
11991197
for f in formatters:
12001198
yield partial(f, module, method_name)
12011199

0 commit comments

Comments
 (0)