Skip to content

Commit 5a2d6ac

Browse files
committed
fix(types): update type hints in web3._utils.method_formatters.py
1 parent 8a2f478 commit 5a2d6ac

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

web3/_utils/method_formatters.py

+13-16
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
BlockIdentifier,
102102
Formatters,
103103
RPCEndpoint,
104+
RPCResponse,
104105
SimulateV1Payload,
105106
StateOverrideParams,
106107
TReturn,
@@ -600,19 +601,15 @@ def storage_key_to_hexstr(value: Union[bytes, int, str]) -> HexStr:
600601
)
601602

602603
block_result_formatters_copy = BLOCK_RESULT_FORMATTERS.copy()
603-
block_result_formatters_copy.update(
604-
{
605-
"calls": apply_list_to_array_formatter(
606-
type_aware_apply_formatters_to_dict(
607-
{
608-
"returnData": HexBytes,
609-
"logs": apply_list_to_array_formatter(log_entry_formatter),
610-
"gasUsed": to_integer_if_hex,
611-
"status": to_integer_if_hex,
612-
}
613-
)
614-
)
615-
}
604+
block_result_formatters_copy["calls"] = apply_list_to_array_formatter(
605+
type_aware_apply_formatters_to_dict(
606+
{
607+
"returnData": HexBytes,
608+
"logs": apply_list_to_array_formatter(log_entry_formatter),
609+
"gasUsed": to_integer_if_hex,
610+
"status": to_integer_if_hex,
611+
}
612+
)
616613
)
617614
simulate_v1_result_formatter = apply_formatter_if(
618615
is_not_null,
@@ -1201,7 +1198,7 @@ def apply_module_to_formatters(
12011198
def get_result_formatters(
12021199
method_name: Union[RPCEndpoint, Callable[..., RPCEndpoint]],
12031200
module: "Module",
1204-
) -> Dict[str, Callable[..., Any]]:
1201+
) -> Callable[[RPCResponse], Any]:
12051202
formatters = combine_formatters((PYTHONIC_RESULT_FORMATTERS,), method_name)
12061203
formatters_requiring_module = combine_formatters(
12071204
(FILTER_RESULT_FORMATTERS,), method_name
@@ -1214,7 +1211,7 @@ def get_result_formatters(
12141211

12151212
def get_error_formatters(
12161213
method_name: Union[RPCEndpoint, Callable[..., RPCEndpoint]]
1217-
) -> Callable[..., Any]:
1214+
) -> Callable[[RPCResponse], Any]:
12181215
# Note error formatters work on the full response dict
12191216
error_formatter_maps = (ERROR_FORMATTERS,)
12201217
formatters = combine_formatters(error_formatter_maps, method_name)
@@ -1224,7 +1221,7 @@ def get_error_formatters(
12241221

12251222
def get_null_result_formatters(
12261223
method_name: Union[RPCEndpoint, Callable[..., RPCEndpoint]]
1227-
) -> Callable[..., Any]:
1224+
) -> Callable[[RPCResponse], Any]:
12281225
formatters = combine_formatters((NULL_RESULT_FORMATTERS,), method_name)
12291226

12301227
return compose(*formatters)

0 commit comments

Comments
 (0)