Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
jinja2.environment.TemplateStream Class Reference

Public Member Functions

None __init__ (self, t.Iterator[str] gen)
 
None dump (self, t.Union[str, t.IO[bytes]] fp, t.Optional[str] encoding=None, t.Optional[str] errors="strict")
 
None disable_buffering (self)
 
None enable_buffering (self, int size=5)
 
"TemplateStream" __iter__ (self)
 
str __next__ (self)
 

Public Attributes

 buffered
 

Static Public Attributes

 template_class
 

Protected Member Functions

t.Iterator[str] _buffered_generator (self, int size)
 

Protected Attributes

 _gen
 
 _next
 

Detailed Description

A template stream works pretty much like an ordinary python generator
but it can buffer multiple items to reduce the number of total iterations.
Per default the output is unbuffered which means that for every unbuffered
instruction in the template one string is yielded.

If buffering is enabled with a buffer size of 5, five items are combined
into a new string.  This is mainly useful if you are streaming
big templates to a client via WSGI which flushes after each iteration.

Member Function Documentation

◆ disable_buffering()

None jinja2.environment.TemplateStream.disable_buffering (   self)
Disable the output buffering.

◆ dump()

None jinja2.environment.TemplateStream.dump (   self,
t.Union[str, t.IO[bytes]]  fp,
t.Optional[str]   encoding = None,
t.Optional[str]   errors = "strict" 
)
Dump the complete stream into a file or file-like object.
Per default strings are written, if you want to encode
before writing specify an `encoding`.

Example usage::

    Template('Hello {{ name }}!').stream(name='foo').dump('hello.html')

◆ enable_buffering()

None jinja2.environment.TemplateStream.enable_buffering (   self,
int   size = 5 
)
Enable buffering.  Buffer `size` items before yielding them.

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