|
OpenQuizz
Une application de gestion des contenus pédagogiques
|

Public Member Functions | |
| def | __init__ (self, iterable, undefined, recurse=None, depth0=0) |
| def | length (self) |
| def | __len__ (self) |
| def | depth (self) |
| def | index (self) |
| def | revindex0 (self) |
| def | revindex (self) |
| def | first (self) |
| def | last (self) |
| def | previtem (self) |
| def | nextitem (self) |
| def | cycle (self, *args) |
| def | changed (self, *value) |
| def | __iter__ (self) |
| def | __next__ (self) |
| def | __call__ (self, iterable) |
| def | __repr__ (self) |
Data Fields | |
| depth0 | |
Static Public Attributes | |
| index0 | |
A wrapper iterable for dynamic ``for`` loops, with information about the loop and iteration.
| def __init__ | ( | self, | |
| iterable, | |||
| undefined, | |||
recurse = None, |
|||
depth0 = 0 |
|||
| ) |
:param iterable: Iterable to wrap.
:param undefined: :class:`Undefined` class to use for next and
previous items.
:param recurse: The function to render the loop body when the
loop is marked recursive.
:param depth0: Incremented when looping recursively.
| def __call__ | ( | self, | |
| iterable | |||
| ) |
When iterating over nested data, render the body of the loop recursively with the given inner iterable data. The loop must have the ``recursive`` marker for this to work.
| def __iter__ | ( | self | ) |
| def __len__ | ( | self | ) |
| def __next__ | ( | self | ) |
| def __repr__ | ( | self | ) |
| def changed | ( | self, | |
| * | value | ||
| ) |
Return ``True`` if previously called with a different value (including when called for the first time). :param value: One or more values to compare to the last call.
| def cycle | ( | self, | |
| * | args | ||
| ) |
Return a value from the given args, cycling through based on the current :attr:`index0`. :param args: One or more values to cycle through.
| def depth | ( | self | ) |
How many levels deep a recursive loop currently is, starting at 1.
| def first | ( | self | ) |
Whether this is the first iteration of the loop.
| def index | ( | self | ) |
Current iteration of the loop, starting at 1.
| def last | ( | self | ) |
Whether this is the last iteration of the loop. Causes the iterable to advance early. See :func:`itertools.groupby` for issues this can cause. The :func:`groupby` filter avoids that issue.
Reimplemented in AsyncLoopContext.
| def length | ( | self | ) |
Length of the iterable. If the iterable is a generator or otherwise does not have a size, it is eagerly evaluated to get a size.
Reimplemented in AsyncLoopContext.
| def nextitem | ( | self | ) |
The item in the next iteration. Undefined during the last iteration. Causes the iterable to advance early. See :func:`itertools.groupby` for issues this can cause. The :func:`groupby` filter avoids that issue.
Reimplemented in AsyncLoopContext.
| def previtem | ( | self | ) |
The item in the previous iteration. Undefined during the first iteration.
| def revindex | ( | self | ) |
Number of iterations from the end of the loop, ending at 1. Requires calculating :attr:`length`.
Reimplemented in AsyncLoopContext.
| def revindex0 | ( | self | ) |
Number of iterations from the end of the loop, ending at 0. Requires calculating :attr:`length`.
Reimplemented in AsyncLoopContext.
| depth0 |
|
static |