Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
jinja2.runtime.LoopContext Class Reference
Inheritance diagram for jinja2.runtime.LoopContext:
Inheritance graph
[legend]

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)
 
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

_length = None
 
_after = missing
 
_current = missing
 
_before = missing
 
_last_changed_value = missing
 

Detailed Description

A wrapper iterable for dynamic ``for`` loops, with information
about the loop and iteration.

Constructor & Destructor Documentation

◆ __init__()

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.

Member Function Documentation

◆ __call__()

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.

◆ _peek_next()

t.Any jinja2.runtime.LoopContext._peek_next (   self)
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.

◆ changed()

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.

◆ cycle()

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.

◆ depth()

int jinja2.runtime.LoopContext.depth (   self)
How many levels deep a recursive loop currently is, starting at 1.

◆ first()

bool jinja2.runtime.LoopContext.first (   self)
Whether this is the first iteration of the loop.

◆ index()

int jinja2.runtime.LoopContext.index (   self)
Current iteration of the loop, starting at 1.

◆ last()

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.

◆ length()

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.

◆ nextitem()

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.

◆ previtem()

t.Union[t.Any, "Undefined"] jinja2.runtime.LoopContext.previtem (   self)
The item in the previous iteration. Undefined during the
first iteration.

◆ revindex()

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.

◆ revindex0()

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.


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