@@ -256,17 +256,17 @@ def to_py_arg_name(name: str) -> str:
256256
257257
258258def get_complete_args_from_initial_arg (
259- initial_args : List [str ], elipsis_args : List [str ]
259+ initial_args : List [str ], ellipsis_args : List [str ]
260260) -> List [str ]:
261261 """
262- Get the complete argument list from a list with elipsis .
262+ Get the complete argument list from a list with ellipsis .
263263
264264 Parameters
265265 ----------
266266 initial_args : list
267267 List of initial arguments.
268268
269- elipsis_args : list
269+ ellipsis_args : list
270270 List of containing the elipsed arguments.
271271
272272 Returns
@@ -277,14 +277,12 @@ def get_complete_args_from_initial_arg(
277277 Examples
278278 --------
279279 >>> initial_args = ['energytype', 'cname1', 'cname2', 'cname3', 'cname4', 'cname5', 'cname6']
280- >>> elipsis_args = ['Cname1', ' Cname2',' …']
281- >>> get_complete_args_from_initial_arg(initial_args, elipsis_args )
280+ >>> ellipsis_args = ['Cname1', ' Cname2',' …']
281+ >>> get_complete_args_from_initial_arg(initial_args, ellipsis_args )
282282 ['cname1', 'cname2', 'cname3', 'cname4', 'cname5', 'cname6']
283283 """
284-
285- first_arg_name = to_py_arg_name (elipsis_args [0 ])
286- name_without_iter , first_num = get_iter_values (first_arg_name )
287-
284+ first_arg_name = to_py_arg_name (ellipsis_args [0 ])
285+ name_without_iter , _ = get_iter_values (first_arg_name )
288286 complete_args = []
289287 for i , arg in enumerate (initial_args ):
290288 if name_without_iter in arg :
@@ -293,14 +291,14 @@ def get_complete_args_from_initial_arg(
293291 return complete_args
294292
295293
296- def is_elipsis (name : str ) -> bool :
294+ def is_ellipsis (name : str ) -> bool :
297295 """
298- Check if a name is an elipsis .
296+ Check if a name is an ellipsis .
299297
300298 Returns
301299 -------
302300 bool
303- True if the argument is an elipsis , False otherwise.
301+ True if the argument is an ellipsis , False otherwise.
304302 """
305303 if any (elips in name for elips in [". . ." , "..." , "…" ]):
306304 return True
@@ -2137,7 +2135,7 @@ def args(self):
21372135
21382136 elif arg in ["..." , ". . ." ]:
21392137 # Elipsis, needs to be skipped
2140- pass
2138+ args . append ( "..." )
21412139
21422140 elif arg .isidentifier () is False :
21432141 raise ValueError (
@@ -2158,6 +2156,21 @@ def args(self):
21582156 args [j ] = f"{ arg } { i :d} "
21592157 i += 1
21602158
2159+ # Handle ellipsis expansion
2160+ if "..." in args :
2161+ ellipsis_index = args .index ("..." )
2162+ previous_arg = args [ellipsis_index - 1 ]
2163+ next_arg = args [ellipsis_index + 1 ]
2164+ name_without_iter , previous_iter = get_iter_values (previous_arg )
2165+ _ , next_iter = get_iter_values (next_arg )
2166+ if previous_iter and next_iter :
2167+ expanded_args = []
2168+ for i in range (previous_iter + 1 , next_iter ):
2169+ expanded_args .append (name_without_iter + str (i ))
2170+ args = args [:ellipsis_index ] + expanded_args + args [ellipsis_index + 1 :]
2171+ else : # one of them is not iterable - ``xn`` for instance
2172+ args .remove ("..." )
2173+
21612174 return args
21622175
21632176
@@ -2665,6 +2678,16 @@ def __init__(
26652678 self ._terms = terms
26662679 self ._description = description
26672680 self ._initial_arguments = initial_arguments
2681+ if "VAL1" in self ._initial_arguments :
2682+ print (self ._initial_arguments )
2683+
2684+ # def fix_initial_arguments(self, initial_arguments: List) -> None:
2685+ # """Fix the initial arguments."""
2686+ # # All arguments are present, need to add the missing ones
2687+ # _, start_iter = get_iter_values(ellipsis_args[0])
2688+ # _, end_iter = get_iter_values(ellipsis_args[-1])
2689+ # for i in range(start_iter, end_iter + 1):
2690+ # complete_args.append(f"{name_without_iter}{i}")
26682691
26692692 @property
26702693 def py_arg_name (self ) -> str :
@@ -2679,33 +2702,32 @@ def description(self) -> str:
26792702 return str (self ._description )
26802703
26812704 @property
2682- def is_arg_elipsis (self ):
2705+ def is_arg_ellipsis (self ):
26832706 """
2684- Check if the argument is an elipsis .
2707+ Check if the argument is an ellipsis .
26852708
26862709 Returns
26872710 -------
26882711 bool
2689- True if the argument is an elipsis , False otherwise.
2712+ True if the argument is an ellipsis , False otherwise.
26902713 """
2691- return is_elipsis (str (self ._name ))
2714+ return is_ellipsis (str (self ._name ))
26922715
26932716 @property
26942717 def multiple_args (self ):
26952718 additional_args = []
26962719 if "," in str (self ._name ):
26972720 split_name = str (self ._name ).split ("," )
2698- if not self .is_arg_elipsis :
2721+ if not self .is_arg_ellipsis :
26992722 for item_name in split_name :
27002723 arg_name = item_name .strip ()
27012724 new_arg = Argument (
27022725 self ._terms , arg_name , self ._initial_arguments , self ._description
27032726 )
27042727 additional_args .append (new_arg )
27052728 else :
2706-
27072729 complete_args = get_complete_args_from_initial_arg (
2708- elipsis_args = split_name , initial_args = self ._initial_arguments
2730+ ellipsis_args = split_name , initial_args = self ._initial_arguments
27092731 )
27102732
27112733 if len (complete_args ) > 0 :
@@ -2724,7 +2746,7 @@ def multiple_args(self):
27242746 self ._terms , arg_name , self ._initial_arguments , self ._description
27252747 )
27262748 additional_args .append (new_arg )
2727- elif is_elipsis (item_name ):
2749+ elif is_ellipsis (item_name ):
27282750
27292751 if "+" in split_name [i + 1 ]:
27302752 number_final_iter , (
0 commit comments