Belle II Software  release-05-02-19
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 71 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 72 of file backends.py.

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

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 94 of file backends.py.


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