summaryrefslogtreecommitdiff
path: root/src/jinja2
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2020-01-10 13:42:02 -0800
committerDavid Lord <davidism@gmail.com>2020-01-10 13:42:02 -0800
commit51c1c8efa6f4cd3d4eff270f8c3ceb20362af7bb (patch)
tree136e569e5ebbba2d43485aca181b07438eac6412 /src/jinja2
parente492255f270add52d051ef4f8e87899f40e57687 (diff)
downloadjinja2-51c1c8efa6f4cd3d4eff270f8c3ceb20362af7bb.tar.gz
simplify module docstringsstyle
Diffstat (limited to 'src/jinja2')
-rw-r--r--src/jinja2/__init__.py29
-rw-r--r--src/jinja2/_compat.py11
-rw-r--r--src/jinja2/asyncsupport.py11
-rw-r--r--src/jinja2/bccache.py18
-rw-r--r--src/jinja2/compiler.py10
-rw-r--r--src/jinja2/constants.py9
-rw-r--r--src/jinja2/defaults.py9
-rw-r--r--src/jinja2/environment.py10
-rw-r--r--src/jinja2/exceptions.py9
-rw-r--r--src/jinja2/ext.py16
-rw-r--r--src/jinja2/filters.py10
-rw-r--r--src/jinja2/lexer.py18
-rw-r--r--src/jinja2/loaders.py10
-rw-r--r--src/jinja2/meta.py11
-rw-r--r--src/jinja2/nodes.py15
-rw-r--r--src/jinja2/optimizer.py24
-rw-r--r--src/jinja2/parser.py10
-rw-r--r--src/jinja2/runtime.py10
-rw-r--r--src/jinja2/sandbox.py14
-rw-r--r--src/jinja2/tests.py10
-rw-r--r--src/jinja2/utils.py9
-rw-r--r--src/jinja2/visitor.py10
22 files changed, 41 insertions, 242 deletions
diff --git a/src/jinja2/__init__.py b/src/jinja2/__init__.py
index dcd2835..9c4c9cf 100644
--- a/src/jinja2/__init__.py
+++ b/src/jinja2/__init__.py
@@ -1,30 +1,7 @@
# -*- coding: utf-8 -*-
-"""
- jinja2
- ~~~~~~
-
- Jinja is a template engine written in pure Python. It provides a
- Django inspired non-XML syntax but supports inline expressions and
- an optional sandboxed environment.
-
- Nutshell
- --------
-
- Here a small example of a Jinja template::
-
- {% extends 'base.html' %}
- {% block title %}Memberlist{% endblock %}
- {% block content %}
- <ul>
- {% for user in users %}
- <li><a href="{{ user.url }}">{{ user.username }}</a></li>
- {% endfor %}
- </ul>
- {% endblock %}
-
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD, see LICENSE for more details.
+"""Jinja is a template engine written in pure Python. It provides a
+non-XML syntax that supports inline expressions and an optional
+sandboxed environment.
"""
from .bccache import BytecodeCache
from .bccache import FileSystemBytecodeCache
diff --git a/src/jinja2/_compat.py b/src/jinja2/_compat.py
index aa21641..1f04495 100644
--- a/src/jinja2/_compat.py
+++ b/src/jinja2/_compat.py
@@ -1,16 +1,5 @@
# -*- coding: utf-8 -*-
# flake8: noqa
-"""
- jinja2._compat
- ~~~~~~~~~~~~~~
-
- Some py2/py3 compatibility support based on a stripped down
- version of six so we don't have to depend on a specific version
- of it.
-
- :copyright: Copyright 2013 by the Jinja team, see AUTHORS.
- :license: BSD, see LICENSE for details.
-"""
import marshal
import sys
diff --git a/src/jinja2/asyncsupport.py b/src/jinja2/asyncsupport.py
index 7a0c2ea..d97e46f 100644
--- a/src/jinja2/asyncsupport.py
+++ b/src/jinja2/asyncsupport.py
@@ -1,13 +1,6 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.asyncsupport
- ~~~~~~~~~~~~~~~~~~~
-
- Has all the code for async support which is implemented as a patch
- for supported Python versions.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD, see LICENSE for more details.
+"""The code for async support. Importing this patches Jinja on supported
+Python versions.
"""
import asyncio
import inspect
diff --git a/src/jinja2/bccache.py b/src/jinja2/bccache.py
index 75419d1..6f89745 100644
--- a/src/jinja2/bccache.py
+++ b/src/jinja2/bccache.py
@@ -1,18 +1,10 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.bccache
- ~~~~~~~~~~~~~~
-
- This module implements the bytecode cache system that Jinja optionally uses.
- This is useful if you have very complex template situations and
- the compilation of all those templates slows down your application too
- much.
-
- Situations where this is useful are often forking web applications that
- are initialized on the first request.
+"""The optional bytecode cache system. This is useful if you have very
+complex template situations and the compilation of all those templates
+slows down your application too much.
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD.
+Situations where this is useful are often forking web applications that
+are initialized on the first request.
"""
import errno
import fnmatch
diff --git a/src/jinja2/compiler.py b/src/jinja2/compiler.py
index 169687a..32dac88 100644
--- a/src/jinja2/compiler.py
+++ b/src/jinja2/compiler.py
@@ -1,13 +1,5 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.compiler
- ~~~~~~~~~~~~~~~
-
- Compiles nodes into python code.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD, see LICENSE for more details.
-"""
+"""Compiles nodes from the parser into Python code."""
from collections import namedtuple
from functools import update_wrapper
from itertools import chain
diff --git a/src/jinja2/constants.py b/src/jinja2/constants.py
index 36da88b..bf7f2ca 100644
--- a/src/jinja2/constants.py
+++ b/src/jinja2/constants.py
@@ -1,13 +1,4 @@
# -*- coding: utf-8 -*-
-"""
- jinja.constants
- ~~~~~~~~~~~~~~~
-
- Various constants.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD, see LICENSE for more details.
-"""
#: list of lorem ipsum words used by the lipsum() helper function
LOREM_IPSUM_WORDS = u"""\
a ac accumsan ad adipiscing aenean aliquam aliquet amet ante aptent arcu at
diff --git a/src/jinja2/defaults.py b/src/jinja2/defaults.py
index 0af8c54..b5d5f4e 100644
--- a/src/jinja2/defaults.py
+++ b/src/jinja2/defaults.py
@@ -1,13 +1,4 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.defaults
- ~~~~~~~~~~~~~~~
-
- Jinja default filters and tags.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD, see LICENSE for more details.
-"""
from ._compat import range_type
from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401
from .tests import TESTS as DEFAULT_TESTS # noqa: F401
diff --git a/src/jinja2/environment.py b/src/jinja2/environment.py
index a50a6a8..08c5e6a 100644
--- a/src/jinja2/environment.py
+++ b/src/jinja2/environment.py
@@ -1,12 +1,6 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.environment
- ~~~~~~~~~~~~~~~~~~
-
- Provides a class that holds runtime and parsing time options.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD, see LICENSE for more details.
+"""Classes for managing templates and their runtime and compile time
+options.
"""
import os
import sys
diff --git a/src/jinja2/exceptions.py b/src/jinja2/exceptions.py
index 8fa45c4..0bf2003 100644
--- a/src/jinja2/exceptions.py
+++ b/src/jinja2/exceptions.py
@@ -1,13 +1,4 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.exceptions
- ~~~~~~~~~~~~~~~~~
-
- Jinja exceptions.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD, see LICENSE for more details.
-"""
from ._compat import imap
from ._compat import implements_to_string
from ._compat import PY2
diff --git a/src/jinja2/ext.py b/src/jinja2/ext.py
index d4dda0b..01aab74 100644
--- a/src/jinja2/ext.py
+++ b/src/jinja2/ext.py
@@ -1,19 +1,5 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.ext
- ~~~~~~~~~~
-
- Jinja extensions allow adding custom tags and behavior. The
- following extensions are included:
-
- - An 18n support ``{% trans %}`` tag.
- - A ``{% do %}`` tag.
- - Loop control ``{% break %}`` and ``{% continue %}`` tags.
- - A ``{% debug %}`` tag.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD.
-"""
+"""Extension API for adding custom tags and behavior."""
import pprint
import re
from sys import version_info
diff --git a/src/jinja2/filters.py b/src/jinja2/filters.py
index 456a6d4..1af7ac8 100644
--- a/src/jinja2/filters.py
+++ b/src/jinja2/filters.py
@@ -1,13 +1,5 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.filters
- ~~~~~~~~~~~~~~
-
- Bundled jinja filters.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD, see LICENSE for more details.
-"""
+"""Built-in template filters used with the ``|`` operator."""
import math
import random
import re
diff --git a/src/jinja2/lexer.py b/src/jinja2/lexer.py
index 7c53d5d..a2b44e9 100644
--- a/src/jinja2/lexer.py
+++ b/src/jinja2/lexer.py
@@ -1,18 +1,8 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.lexer
- ~~~~~~~~~~~~
-
- This module implements a Jinja / Python combination lexer. The
- `Lexer` class provided by this module is used to do some preprocessing
- for Jinja.
-
- On the one hand it filters out invalid operators like the bitshift
- operators we don't allow in templates. On the other hand it separates
- template code and python code in expressions.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD, see LICENSE for more details.
+"""Implements a Jinja / Python combination lexer. The ``Lexer`` class
+is used to do some preprocessing. It filters out invalid operators like
+the bitshift operators we don't allow in templates. It separates
+template code and python code in expressions.
"""
import re
from ast import literal_eval
diff --git a/src/jinja2/loaders.py b/src/jinja2/loaders.py
index 99798fd..ce5537a 100644
--- a/src/jinja2/loaders.py
+++ b/src/jinja2/loaders.py
@@ -1,12 +1,6 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.loaders
- ~~~~~~~~~~~~~~
-
- Jinja loader classes.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD, see LICENSE for more details.
+"""API and implementations for loading templates from different data
+sources.
"""
import os
import pkgutil
diff --git a/src/jinja2/meta.py b/src/jinja2/meta.py
index 3c7917e..3795aac 100644
--- a/src/jinja2/meta.py
+++ b/src/jinja2/meta.py
@@ -1,13 +1,6 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.meta
- ~~~~~~~~~~~
-
- This module implements various functions that exposes information about
- templates that might be interesting for various kinds of applications.
-
- :copyright: (c) 2017 by the Jinja Team, see AUTHORS for more details.
- :license: BSD, see LICENSE for more details.
+"""Functions that expose information about templates that might be
+interesting for introspection.
"""
from . import nodes
from ._compat import iteritems
diff --git a/src/jinja2/nodes.py b/src/jinja2/nodes.py
index 8026543..f0e9e03 100644
--- a/src/jinja2/nodes.py
+++ b/src/jinja2/nodes.py
@@ -1,16 +1,7 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.nodes
- ~~~~~~~~~~~~
-
- This module implements additional nodes derived from the ast base node.
-
- It also provides some node tree helper functions like `in_lineno` and
- `get_nodes` used by the parser and translator in order to normalize
- python and jinja nodes.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD, see LICENSE for more details.
+"""AST nodes generated by the parser for the compiler. Also provides
+some node tree helper functions used by the parser and compiler in order
+to normalize nodes.
"""
import operator
from collections import deque
diff --git a/src/jinja2/optimizer.py b/src/jinja2/optimizer.py
index e262727..7bc78c4 100644
--- a/src/jinja2/optimizer.py
+++ b/src/jinja2/optimizer.py
@@ -1,20 +1,12 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.optimizer
- ~~~~~~~~~~~~~~~~
-
- The jinja optimizer is currently trying to constant fold a few expressions
- and modify the AST in place so that it should be easier to evaluate it.
-
- Because the AST does not contain all the scoping information and the
- compiler has to find that out, we cannot do all the optimizations we
- want. For example loop unrolling doesn't work because unrolled loops would
- have a different scoping.
-
- The solution would be a second syntax tree that has the scoping rules stored.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD.
+"""The optimizer tries to constant fold expressions and modify the AST
+in place so that it should be faster to evaluate.
+
+Because the AST does not contain all the scoping information and the
+compiler has to find that out, we cannot do all the optimizations we
+want. For example, loop unrolling doesn't work because unrolled loops
+would have a different scope. The solution would be a second syntax tree
+that stored the scoping rules.
"""
from . import nodes
from .visitor import NodeTransformer
diff --git a/src/jinja2/parser.py b/src/jinja2/parser.py
index 1d9fd91..d588106 100644
--- a/src/jinja2/parser.py
+++ b/src/jinja2/parser.py
@@ -1,13 +1,5 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.parser
- ~~~~~~~~~~~~~
-
- Implements the template parser.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD, see LICENSE for more details.
-"""
+"""Parse tokens from the lexer into nodes for the compiler."""
from . import nodes
from ._compat import imap
from .exceptions import TemplateAssertionError
diff --git a/src/jinja2/runtime.py b/src/jinja2/runtime.py
index 365c1f7..d356b07 100644
--- a/src/jinja2/runtime.py
+++ b/src/jinja2/runtime.py
@@ -1,13 +1,5 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.runtime
- ~~~~~~~~~~~~~~
-
- Runtime helpers.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD.
-"""
+"""The runtime functions and state used by compiled templates."""
import sys
from itertools import chain
from types import MethodType
diff --git a/src/jinja2/sandbox.py b/src/jinja2/sandbox.py
index d806b63..af4a96e 100644
--- a/src/jinja2/sandbox.py
+++ b/src/jinja2/sandbox.py
@@ -1,16 +1,6 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.sandbox
- ~~~~~~~~~~~~~~
-
- Adds a sandbox layer to Jinja as it was the default behavior in the old
- Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the
- default behavior is easier to use.
-
- The behavior can be changed by subclassing the environment.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD.
+"""A sandbox layer that ensures unsafe operations cannot be performed.
+Useful when the template itself comes from an untrusted source.
"""
import operator
import types
diff --git a/src/jinja2/tests.py b/src/jinja2/tests.py
index 8c4d466..fabd4ce 100644
--- a/src/jinja2/tests.py
+++ b/src/jinja2/tests.py
@@ -1,13 +1,5 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.tests
- ~~~~~~~~~~~~
-
- Jinja test functions. Used with the "is" operator.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD, see LICENSE for more details.
-"""
+"""Built-in template tests used with the ``is`` operator."""
import decimal
import operator
import re
diff --git a/src/jinja2/utils.py b/src/jinja2/utils.py
index 3d0051b..e3285e8 100644
--- a/src/jinja2/utils.py
+++ b/src/jinja2/utils.py
@@ -1,13 +1,4 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.utils
- ~~~~~~~~~~~~
-
- Utility functions.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD, see LICENSE for more details.
-"""
import json
import os
import re
diff --git a/src/jinja2/visitor.py b/src/jinja2/visitor.py
index a803ade..d1365bf 100644
--- a/src/jinja2/visitor.py
+++ b/src/jinja2/visitor.py
@@ -1,12 +1,6 @@
# -*- coding: utf-8 -*-
-"""
- jinja2.visitor
- ~~~~~~~~~~~~~~
-
- This module implements a visitor for the nodes.
-
- :copyright: (c) 2017 by the Jinja Team.
- :license: BSD.
+"""API for traversing the AST nodes. Implemented by the compiler and
+meta introspection.
"""
from .nodes import Node