@@ -522,14 +522,14 @@ def generate(self, script=None, variables=None, fences=("{", "}")):
522522
523523 Args:
524524 script (str): The string contents of the script file.
525- variables (dict): the variables to be replaced, if ommitted
526- uses the internal variables found
527- fences ((str,str)): A 2 position tuple, that encloses
525+ variables (dict): The variables to be replaced. If omitted,
526+ uses the internal variables found.
527+ fences ((str, str)): A 2- position tuple that encloses
528528 template variables (start and end).
529529
530530 Returns:
531- str: The script that has expanded its values based on
532- ` data`.
531+ tuple[ str, dict] : The expanded script and a dict of replaced values
532+ based on `` data` `.
533533 """
534534
535535 replaced = {}
@@ -553,23 +553,24 @@ def generate(self, script=None, variables=None, fences=("{", "}")):
553553
554554 @staticmethod
555555 def permutation_generator (exp_dict ):
556- """Creates a cartisian product of a {key: list, ...} object.
556+ """Creates a cartesian product of a `` {key: list, ...}`` object.
557557
558558 Args:
559- exp_dict (dict): The dictionary to process
559+ exp_dict (dict): The dictionary to process.
560560
561561 Returns:
562- list: A list of dictionaries containing the resulting
563- cartisian product.
562+ list[dict] : A list of dictionaries containing the resulting
563+ cartesian product.
564564
565- For example
565+ Example::
566566 my_dict = {"key1": ["value1", "value2"], "key2": ["value3", "value4"]}
567- out = permutation_generator(my_dict)
568- out # [{"key1": "value1", "key2": 'value3"},
569- # {"key1": "value1", "key2": "value4"},
570- # {"key1": "value2", "key2": "value3"},
571- # {"key1": "value2", "key2": "value4"}
572-
567+ out = ExperimentExecutor.permutation_generator(my_dict)
568+ # out == [
569+ # {"key1": "value1", "key2": "value3"},
570+ # {"key1": "value1", "key2": "value4"},
571+ # {"key1": "value2", "key2": "value3"},
572+ # {"key1": "value2", "key2": "value4"},
573+ # ]
573574 """
574575 keys , values = zip (* exp_dict .items ())
575576 return [dict (zip (keys , value )) for value in itertools .product (* values )]
@@ -707,16 +708,16 @@ def generate_experiment_batch_scripts(self, out_mode=None, replace_all=True):
707708 self .generate_setup_from_configuration (configuration , replace_all )
708709
709710 def generate_submit (self , name = None , job_type = 'slurm' ):
710- """Generates a list of commands based on the permutations for submission
711+ """Generates a list of commands based on the permutations for submission.
711712
712713 Args:
713- name (str): Name of the experiments
714- job_type (str): name of the job type used at submission such
715- as ee, slurm, jsrun, mpirun, sh, bash
714+ name (str): Name of the experiments.
715+ job_type (str): Name of the job type used at submission such
716+ as ee, slurm, jsrun, mpirun, sh, bash.
716717
717718 Returns:
718- None: prepars the internal data for the experiments, if set
719- to verbose , prints them
719+ None: Prepares the internal data for the experiments. If ``verbose``
720+ is set , prints them.
720721 """
721722
722723 if ".json" not in name :
0 commit comments