@@ -166,7 +166,7 @@ def __get__(
166
166
)
167
167
168
168
provider = module .w3 .provider
169
- if hasattr (provider , "_is_batching" ) and provider . _is_batching :
169
+ if getattr (provider , "_is_batching" , False ) :
170
170
if self .json_rpc_method in RPC_METHODS_UNSUPPORTED_DURING_BATCH :
171
171
raise MethodNotSupported (
172
172
f"Method `{ self .json_rpc_method } ` is not supported within a batch "
@@ -179,15 +179,15 @@ def __get__(
179
179
def __call__ (self , * args : Any , ** kwargs : Any ) -> Any :
180
180
return self .__get__ (self ._module )(* args , ** kwargs )
181
181
182
- @property
182
+ @functools . cached_property
183
183
def method_selector_fn (
184
184
self ,
185
- ) -> Callable [..., Union [ RPCEndpoint , Callable [..., RPCEndpoint ]] ]:
185
+ ) -> Callable [[], RPCEndpoint ]:
186
186
"""Gets the method selector from the config."""
187
187
if callable (self .json_rpc_method ):
188
188
return self .json_rpc_method
189
189
elif isinstance (self .json_rpc_method , (str ,)):
190
- return lambda * _ : self .json_rpc_method
190
+ return lambda : self .json_rpc_method
191
191
raise Web3ValueError (
192
192
"``json_rpc_method`` config invalid. May be a string or function"
193
193
)
0 commit comments