Belle II Software  release-06-02-00
ArgumentsGenerator Class Reference

Public Member Functions

def __init__ (self, generator_function, *args, **kwargs)
 
def generator (self)
 

Public Attributes

 generator_function
 Generator function that has not been 'primed'.
 
 args
 Positional argument tuple used to 'prime' the ArgumentsGenerator.generator_function.
 
 kwargs
 Keyword argument dictionary used to 'prime' the ArgumentsGenerator.generator_function.
 

Detailed Description

Definition at line 79 of file backends.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  generator_function,
args,
**  kwargs 
)
Simple little class to hold a generator (uninitialised) and the necessary args/kwargs to
initialise it. This lets us re-use a generator by setting it up again fresh. This is not
optimal for expensive calculations, but it is nice for making large sequences of
Job input arguments on the fly.

Parameters:
    generator_function (py:function): A function (callable) that contains a ``yield`` statement. This generator
        should *not* be initialised i.e. you haven't called it with ``generator_function(*args, **kwargs)``
        yet. That will happen when accessing the `ArgumentsGenerator.generator` property.
    args (tuple): The positional arguments you want to send into the intialisation of the generator.
    kwargs (dict): The keyword arguments you want to send into the intialisation of the generator.

Definition at line 80 of file backends.py.

80  def __init__(self, generator_function, *args, **kwargs):
81  """
82  Simple little class to hold a generator (uninitialised) and the necessary args/kwargs to
83  initialise it. This lets us re-use a generator by setting it up again fresh. This is not
84  optimal for expensive calculations, but it is nice for making large sequences of
85  Job input arguments on the fly.
86 
87  Parameters:
88  generator_function (py:function): A function (callable) that contains a ``yield`` statement. This generator
89  should *not* be initialised i.e. you haven't called it with ``generator_function(*args, **kwargs)``
90  yet. That will happen when accessing the `ArgumentsGenerator.generator` property.
91  args (tuple): The positional arguments you want to send into the intialisation of the generator.
92  kwargs (dict): The keyword arguments you want to send into the intialisation of the generator.
93  """
94 
95  self.generator_function = generator_function
96 
97  self.args = args
98 
99  self.kwargs = kwargs
100 

Member Function Documentation

◆ generator()

def generator (   self)
Returns:
    generator: The initialised generator (using the args and kwargs for initialisation). It should be ready
    to have ``next``/``send`` called on it.

Definition at line 102 of file backends.py.


The documentation for this class was generated from the following file: