5656)
5757from async_substrate_interface .utils .storage import StorageKey
5858from async_substrate_interface .type_registry import _TYPE_REGISTRY
59- from async_substrate_interface .utils .decoding_attempt import (
59+ from async_substrate_interface .utils .decoding import (
6060 decode_query_map ,
61- _decode_scale_with_runtime ,
6261)
6362
6463if TYPE_CHECKING :
6564 from websockets .asyncio .client import ClientConnection
66- from concurrent .futures import ProcessPoolExecutor
6765
6866ResultHandler = Callable [[dict , Any ], Awaitable [tuple [dict , bool ]]]
6967
@@ -418,7 +416,6 @@ def __init__(
418416 last_key : Optional [str ] = None ,
419417 max_results : Optional [int ] = None ,
420418 ignore_decoding_errors : bool = False ,
421- executor : Optional ["ProcessPoolExecutor" ] = None ,
422419 ):
423420 self .records = records
424421 self .page_size = page_size
@@ -431,7 +428,6 @@ def __init__(
431428 self .params = params
432429 self .ignore_decoding_errors = ignore_decoding_errors
433430 self .loading_complete = False
434- self .executor = executor
435431 self ._buffer = iter (self .records ) # Initialize the buffer with initial records
436432
437433 async def retrieve_next_page (self , start_key ) -> list :
@@ -444,7 +440,6 @@ async def retrieve_next_page(self, start_key) -> list:
444440 start_key = start_key ,
445441 max_results = self .max_results ,
446442 ignore_decoding_errors = self .ignore_decoding_errors ,
447- executor = self .executor ,
448443 )
449444 if len (result .records ) < self .page_size :
450445 self .loading_complete = True
@@ -2867,7 +2862,6 @@ async def query_map(
28672862 page_size : int = 100 ,
28682863 ignore_decoding_errors : bool = False ,
28692864 reuse_block_hash : bool = False ,
2870- executor : Optional ["ProcessPoolExecutor" ] = None ,
28712865 ) -> AsyncQueryMapResult :
28722866 """
28732867 Iterates over all key-pairs located at the given module and storage_function. The storage
@@ -2972,54 +2966,16 @@ async def query_map(
29722966 if "error" in response :
29732967 raise SubstrateRequestException (response ["error" ]["message" ])
29742968 for result_group in response ["result" ]:
2975- if executor :
2976- # print(
2977- # ("prefix", type("prefix")),
2978- # ("runtime_registry", type(runtime.registry)),
2979- # ("param_types", type(param_types)),
2980- # ("params", type(params)),
2981- # ("value_type", type(value_type)),
2982- # ("key_hasher", type(key_hashers)),
2983- # ("ignore_decoding_errors", type(ignore_decoding_errors)),
2984- # )
2985- result = await asyncio .get_running_loop ().run_in_executor (
2986- executor ,
2987- decode_query_map ,
2988- result_group ["changes" ],
2989- prefix ,
2990- runtime .registry .registry ,
2991- param_types ,
2992- params ,
2993- value_type ,
2994- key_hashers ,
2995- ignore_decoding_errors ,
2996- )
2997- # max_workers = executor._max_workers
2998- # result_group_changes_groups = [result_group["changes"][i:i + max_workers] for i in range(0, len(result_group["changes"]), max_workers)]
2999- # all_results = executor.map(
3000- # self._decode_query_map,
3001- # result_group["changes"],
3002- # repeat(prefix),
3003- # repeat(runtime.registry),
3004- # repeat(param_types),
3005- # repeat(params),
3006- # repeat(value_type),
3007- # repeat(key_hashers),
3008- # repeat(ignore_decoding_errors)
3009- # )
3010- # for r in all_results:
3011- # result.extend(r)
3012- else :
3013- result = decode_query_map (
3014- result_group ["changes" ],
3015- prefix ,
3016- runtime .registry .registry ,
3017- param_types ,
3018- params ,
3019- value_type ,
3020- key_hashers ,
3021- ignore_decoding_errors ,
3022- )
2969+ result = decode_query_map (
2970+ result_group ["changes" ],
2971+ prefix ,
2972+ runtime ,
2973+ param_types ,
2974+ params ,
2975+ value_type ,
2976+ key_hashers ,
2977+ ignore_decoding_errors ,
2978+ )
30232979 return AsyncQueryMapResult (
30242980 records = result ,
30252981 page_size = page_size ,
@@ -3031,7 +2987,6 @@ async def query_map(
30312987 last_key = last_key ,
30322988 max_results = max_results ,
30332989 ignore_decoding_errors = ignore_decoding_errors ,
3034- executor = executor ,
30352990 )
30362991
30372992 async def submit_extrinsic (
0 commit comments