![]() |
Qucs-S S-parameter Viewer & RF Synthesis Tools
|

Public Member Functions | |
| None | __init__ (self, t.Iterable[V] iterable, t.Type["Undefined"] undefined, t.Optional["LoopRenderFunc"] recurse=None, int depth0=0) |
| int | length (self) |
| int | __len__ (self) |
| int | depth (self) |
| int | index (self) |
| int | revindex0 (self) |
| int | revindex (self) |
| bool | first (self) |
| bool | last (self) |
| t.Union[t.Any, "Undefined"] | previtem (self) |
| t.Union[t.Any, "Undefined"] | nextitem (self) |
| V | cycle (self, *V args) |
| bool | changed (self, *t.Any value) |
| "LoopContext" | __iter__ (self) |
| t.Tuple[t.Any, "LoopContext"] | __next__ (self) |
| str | __call__ (self, t.Iterable[V] iterable) |
| str | __repr__ (self) |
Public Attributes | |
| depth0 | |
| index0 | |
Static Public Attributes | |
| int | index0 = -1 |
Protected Member Functions | |
| t.Any | _peek_next (self) |
Static Protected Member Functions | |
| t.Iterator[V] | _to_iterator (t.Iterable[V] iterable) |
Protected Attributes | |
| _iterable | |
| _iterator | |
| _undefined | |
| _recurse | |
| _length | |
| _after | |
| _last_changed_value | |
| _before | |
| _current | |
Static Protected Attributes | |
| t | _length = None |
| t | _after = missing |
| t | _current = missing |
| t | _before = missing |
| t | _last_changed_value = missing |
A wrapper iterable for dynamic ``for`` loops, with information about the loop and iteration.
| None jinja2.runtime.LoopContext.__init__ | ( | self, | |
| t.Iterable[V] | iterable, | ||
| t.Type["Undefined"] | undefined, | ||
| t.Optional["LoopRenderFunc"] | recurse = None, |
||
| int | 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.
| str jinja2.runtime.LoopContext.__call__ | ( | self, | |
| t.Iterable[V] | 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.
|
protected |
Return the next element in the iterable, or :data:`missing` if the iterable is exhausted. Only peeks one item ahead, caching the result in :attr:`_last` for use in subsequent checks. The cache is reset when :meth:`__next__` is called.
Reimplemented in jinja2.runtime.AsyncLoopContext.
| bool jinja2.runtime.LoopContext.changed | ( | self, | |
| *t.Any | 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.
| V jinja2.runtime.LoopContext.cycle | ( | self, | |
| *V | 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.
| int jinja2.runtime.LoopContext.depth | ( | self | ) |
How many levels deep a recursive loop currently is, starting at 1.
| bool jinja2.runtime.LoopContext.first | ( | self | ) |
Whether this is the first iteration of the loop.
| int jinja2.runtime.LoopContext.index | ( | self | ) |
Current iteration of the loop, starting at 1.
| bool jinja2.runtime.LoopContext.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 jinja2.runtime.AsyncLoopContext.
| int jinja2.runtime.LoopContext.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 jinja2.runtime.AsyncLoopContext.
| t.Union[t.Any, "Undefined"] jinja2.runtime.LoopContext.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:`jinja-filters.groupby` filter avoids that issue.
Reimplemented in jinja2.runtime.AsyncLoopContext.
| t.Union[t.Any, "Undefined"] jinja2.runtime.LoopContext.previtem | ( | self | ) |
The item in the previous iteration. Undefined during the first iteration.
| int jinja2.runtime.LoopContext.revindex | ( | self | ) |
Number of iterations from the end of the loop, ending at 1. Requires calculating :attr:`length`.
Reimplemented in jinja2.runtime.AsyncLoopContext.
| int jinja2.runtime.LoopContext.revindex0 | ( | self | ) |
Number of iterations from the end of the loop, ending at 0. Requires calculating :attr:`length`.
Reimplemented in jinja2.runtime.AsyncLoopContext.