@@ -166,7 +166,7 @@ def __get__(
166166 )
167167
168168 provider = module .w3 .provider
169- if hasattr (provider , "_is_batching" ) and provider . _is_batching :
169+ if getattr (provider , "_is_batching" , False ) :
170170 if self .json_rpc_method in RPC_METHODS_UNSUPPORTED_DURING_BATCH :
171171 raise MethodNotSupported (
172172 f"Method `{ self .json_rpc_method } ` is not supported within a batch "
@@ -179,15 +179,15 @@ def __get__(
179179 def __call__ (self , * args : Any , ** kwargs : Any ) -> Any :
180180 return self .__get__ (self ._module )(* args , ** kwargs )
181181
182- @property
182+ @functools . cached_property
183183 def method_selector_fn (
184184 self ,
185- ) -> Callable [..., Union [ RPCEndpoint , Callable [..., RPCEndpoint ]] ]:
185+ ) -> Callable [[], RPCEndpoint ]:
186186 """Gets the method selector from the config."""
187187 if callable (self .json_rpc_method ):
188188 return self .json_rpc_method
189189 elif isinstance (self .json_rpc_method , (str ,)):
190- return lambda * _ : self .json_rpc_method
190+ return lambda : self .json_rpc_method
191191 raise Web3ValueError (
192192 "``json_rpc_method`` config invalid. May be a string or function"
193193 )
0 commit comments