Skip to content

Commit 944db34

Browse files
committed
fix(types): update type hints in web3._utils.method_formatters.py
1 parent 8a7bef1 commit 944db34

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

web3/_utils/method_formatters.py

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
BlockIdentifier,
106106
Formatters,
107107
RPCEndpoint,
108+
RPCResponse,
108109
SimulateV1Payload,
109110
StateOverrideParams,
110111
TReturn,
@@ -650,19 +651,15 @@ def storage_key_to_hexstr(value: Union[bytes, int, str]) -> HexStr:
650651
)
651652

652653
block_result_formatters_copy = BLOCK_RESULT_FORMATTERS.copy()
653-
block_result_formatters_copy.update(
654-
{
655-
"calls": apply_list_to_array_formatter(
656-
type_aware_apply_formatters_to_dict(
657-
{
658-
"returnData": HexBytes,
659-
"logs": apply_list_to_array_formatter(log_entry_formatter),
660-
"gasUsed": to_integer_if_hex,
661-
"status": to_integer_if_hex,
662-
}
663-
)
664-
)
665-
}
654+
block_result_formatters_copy["calls"] = apply_list_to_array_formatter(
655+
type_aware_apply_formatters_to_dict(
656+
{
657+
"returnData": HexBytes,
658+
"logs": apply_list_to_array_formatter(log_entry_formatter),
659+
"gasUsed": to_integer_if_hex,
660+
"status": to_integer_if_hex,
661+
}
662+
)
666663
)
667664
simulate_v1_result_formatter = apply_formatter_if(
668665
is_not_null,
@@ -1252,7 +1249,7 @@ def apply_module_to_formatters(
12521249
def get_result_formatters(
12531250
method_name: Union[RPCEndpoint, Callable[..., RPCEndpoint]],
12541251
module: "Module",
1255-
) -> Dict[str, Callable[..., Any]]:
1252+
) -> Callable[[RPCResponse], Any]:
12561253
formatters = combine_formatters((PYTHONIC_RESULT_FORMATTERS,), method_name)
12571254
formatters_requiring_module = combine_formatters(
12581255
(FILTER_RESULT_FORMATTERS,), method_name
@@ -1265,7 +1262,7 @@ def get_result_formatters(
12651262

12661263
def get_error_formatters(
12671264
method_name: Union[RPCEndpoint, Callable[..., RPCEndpoint]],
1268-
) -> Callable[..., Any]:
1265+
) -> Callable[[RPCResponse], Any]:
12691266
# Note error formatters work on the full response dict
12701267
error_formatter_maps = (ERROR_FORMATTERS,)
12711268
formatters = combine_formatters(error_formatter_maps, method_name)
@@ -1275,7 +1272,7 @@ def get_error_formatters(
12751272

12761273
def get_null_result_formatters(
12771274
method_name: Union[RPCEndpoint, Callable[..., RPCEndpoint]],
1278-
) -> Callable[..., Any]:
1275+
) -> Callable[[RPCResponse], Any]:
12791276
formatters = combine_formatters((NULL_RESULT_FORMATTERS,), method_name)
12801277

12811278
return compose(*formatters)

0 commit comments

Comments
 (0)