aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2020-01-27 14:12:52 -0800
committerDavid Lord <davidism@gmail.com>2020-02-05 08:37:40 -0800
commitf28b25ea623fdc08dcdf573af837048314360bb7 (patch)
tree72273fad1c243ffdba59811cdaca5a082f783eb2 /src
parent0c75d4805889ca97948d727917dbf8f301981956 (diff)
downloadjinja-f28b25ea623fdc08dcdf573af837048314360bb7.tar.gz
remove Python 2 from docs
Diffstat (limited to 'src')
-rw-r--r--src/jinja2/bccache.py2
-rw-r--r--src/jinja2/environment.py12
-rw-r--r--src/jinja2/ext.py4
-rw-r--r--src/jinja2/lexer.py4
-rw-r--r--src/jinja2/loaders.py12
-rw-r--r--src/jinja2/nodes.py4
-rw-r--r--src/jinja2/runtime.py4
-rw-r--r--src/jinja2/sandbox.py3
8 files changed, 23 insertions, 22 deletions
diff --git a/src/jinja2/bccache.py b/src/jinja2/bccache.py
index 9c066103..ff4d606f 100644
--- a/src/jinja2/bccache.py
+++ b/src/jinja2/bccache.py
@@ -284,7 +284,7 @@ class MemcachedBytecodeCache(BytecodeCache):
- `python-memcached <https://pypi.org/project/python-memcached/>`_
(Unfortunately the django cache interface is not compatible because it
- does not support storing binary data, only unicode. You can however pass
+ does not support storing binary data, only text. You can however pass
the underlying cache client to the bytecode cache which is available
as `django.core.cache.cache._client`.)
diff --git a/src/jinja2/environment.py b/src/jinja2/environment.py
index 8430390e..3f75816c 100644
--- a/src/jinja2/environment.py
+++ b/src/jinja2/environment.py
@@ -1081,7 +1081,7 @@ class Template(object):
template.render(knights='that say nih')
template.render({'knights': 'that say nih'})
- This will return the rendered template as unicode string.
+ This will return the rendered template as a string.
"""
vars = dict(*args, **kwargs)
try:
@@ -1113,7 +1113,7 @@ class Template(object):
"""For very large templates it can be useful to not render the whole
template at once but evaluate each statement after another and yield
piece for piece. This method basically does exactly that and returns
- a generator that yields one item after another as unicode strings.
+ a generator that yields one item after another as strings.
It accepts the same arguments as :meth:`render`.
"""
@@ -1223,7 +1223,7 @@ class Template(object):
class TemplateModule(object):
"""Represents an imported template. All the exported names of the
template are available as attributes on this object. Additionally
- converting it into an unicode- or bytestrings renders the contents.
+ converting it into a string renders the contents.
"""
def __init__(self, template, context, body_stream=None):
@@ -1278,10 +1278,10 @@ class TemplateStream(object):
"""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 unicode string is yielded.
+ 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 unicode string. This is mainly useful if you are streaming
+ into a new string. This is mainly useful if you are streaming
big templates to a client via WSGI which flushes after each iteration.
"""
@@ -1291,7 +1291,7 @@ class TemplateStream(object):
def dump(self, fp, encoding=None, errors="strict"):
"""Dump the complete stream into a file or file-like object.
- Per default unicode strings are written, if you want to encode
+ Per default strings are written, if you want to encode
before writing specify an `encoding`.
Example usage::
diff --git a/src/jinja2/ext.py b/src/jinja2/ext.py
index 9141be4d..99ecb34f 100644
--- a/src/jinja2/ext.py
+++ b/src/jinja2/ext.py
@@ -538,8 +538,8 @@ def extract_from_ast(node, gettext_functions=GETTEXT_FUNCTIONS, babel_style=True
* ``lineno`` is the number of the line on which the string was found,
* ``function`` is the name of the ``gettext`` function used (if the
string was extracted from embedded Python code), and
- * ``message`` is the string itself (a ``unicode`` object, or a tuple
- of ``unicode`` objects for functions with multiple string arguments).
+ * ``message`` is the string, or a tuple of strings for functions
+ with multiple string arguments.
This extraction function operates on the AST and is because of that unable
to extract any comments. For comment support you have to use the babel
diff --git a/src/jinja2/lexer.py b/src/jinja2/lexer.py
index a2b44e92..8e73be82 100644
--- a/src/jinja2/lexer.py
+++ b/src/jinja2/lexer.py
@@ -607,7 +607,9 @@ class Lexer(object):
}
def _normalize_newlines(self, value):
- """Called for strings and template data to normalize it to unicode."""
+ """Replace all newlines with the configured sequence in strings
+ and template data.
+ """
return newline_re.sub(self.newline_sequence, value)
def tokenize(self, source, name=None, filename=None, state=None):
diff --git a/src/jinja2/loaders.py b/src/jinja2/loaders.py
index ce5537a0..0a5538ad 100644
--- a/src/jinja2/loaders.py
+++ b/src/jinja2/loaders.py
@@ -77,9 +77,9 @@ class BaseLoader(object):
`TemplateNotFound` error if it can't locate the template.
The source part of the returned tuple must be the source of the
- template as unicode string or a ASCII bytestring. The filename should
- be the name of the file on the filesystem if it was loaded from there,
- otherwise `None`. The filename is used by python for the tracebacks
+ template as a string. The filename should be the name of the
+ file on the filesystem if it was loaded from there, otherwise
+ ``None``. The filename is used by Python for the tracebacks
if no loader extension is used.
The last item in the tuple is the `uptodate` function. If auto
@@ -357,8 +357,8 @@ class PackageLoader(BaseLoader):
class DictLoader(BaseLoader):
- """Loads a template from a python dict. It's passed a dict of unicode
- strings bound to template names. This loader is useful for unittesting:
+ """Loads a template from a Python dict mapping template names to
+ template source. This loader is useful for unittesting:
>>> loader = DictLoader({'index.html': 'source here'})
@@ -381,7 +381,7 @@ class DictLoader(BaseLoader):
class FunctionLoader(BaseLoader):
"""A loader that is passed a function which does the loading. The
function receives the name of the template and has to return either
- an unicode string with the template source, a tuple in the form ``(source,
+ a string with the template source, a tuple in the form ``(source,
filename, uptodatefunc)`` or `None` if the template does not exist.
>>> def load_template(name):
diff --git a/src/jinja2/nodes.py b/src/jinja2/nodes.py
index 95bd614a..c0b6d77e 100644
--- a/src/jinja2/nodes.py
+++ b/src/jinja2/nodes.py
@@ -788,8 +788,8 @@ class Slice(Expr):
class Concat(Expr):
- """Concatenates the list of expressions provided after converting them to
- unicode.
+ """Concatenates the list of expressions provided after converting
+ them to strings.
"""
fields = ("nodes",)
diff --git a/src/jinja2/runtime.py b/src/jinja2/runtime.py
index 3ad79686..8df42c59 100644
--- a/src/jinja2/runtime.py
+++ b/src/jinja2/runtime.py
@@ -60,7 +60,7 @@ def identity(x):
def markup_join(seq):
- """Concatenation that escapes if necessary and converts to unicode."""
+ """Concatenation that escapes if necessary and converts to string."""
buf = []
iterator = imap(soft_unicode, seq)
for arg in iterator:
@@ -71,7 +71,7 @@ def markup_join(seq):
def unicode_join(seq):
- """Simple args to unicode conversion and concatenation."""
+ """Simple args to string conversion and concatenation."""
return concat(imap(text_type, seq))
diff --git a/src/jinja2/sandbox.py b/src/jinja2/sandbox.py
index cfd7993a..3bb01455 100644
--- a/src/jinja2/sandbox.py
+++ b/src/jinja2/sandbox.py
@@ -244,8 +244,7 @@ def modifies_known_mutable(obj, attr):
>>> modifies_known_mutable([], "index")
False
- If called with an unsupported object (such as unicode) `False` is
- returned.
+ If called with an unsupported object, ``False`` is returned.
>>> modifies_known_mutable("foo", "upper")
False