@@ -141,28 +141,27 @@ def parse_call_method_name(call_method_name: str) -> Tuple[str, List[Any]]:
141141 Tuple of method_name and a list of arguments.
142142 """
143143
144- dollar_func = False
144+ is_special_method = False
145+ args : List [Any ] = []
146+ kwargs : Dict [str , Any ] = {}
147+ method_name = call_method_name
145148
146149 # Deal with special methods that start with a "$"
147- if call_method_name .startswith ("$" ):
148- dollar_func = True
149- call_method_name = call_method_name [1 :]
150+ if method_name .startswith ("$" ):
151+ is_special_method = True
152+ method_name = method_name [1 :]
150153
151- tree = ast .parse (call_method_name , "eval" )
152- method_name = call_method_name
153- args : List [Any ] = []
154- kwargs : Dict [str , Any ] = {}
154+ tree = ast .parse (method_name , "eval" )
155+ statement = tree .body [0 ].value
155156
156- if tree .body and isinstance (tree . body [ 0 ]. value , ast .Call ):
157+ if tree .body and isinstance (statement , ast .Call ):
157158 call = tree .body [0 ].value
158159 method_name = call .func .id
159160 args = [eval_value (arg ) for arg in call .args ]
160-
161- # Not returned, but might be usable
162161 kwargs = {kw .arg : eval_value (kw .value ) for kw in call .keywords }
163162
164163 # Add "$" back to special functions
165- if dollar_func :
164+ if is_special_method :
166165 method_name = f"${ method_name } "
167166
168167 return (method_name , args , kwargs )
0 commit comments