Definition at line 79 of file backends.py.
◆ __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):
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.
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.
95 self.generator_function = generator_function
◆ generator()
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: