simplify module docstrings
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parent e492255 · Browse files · 38 files·+40 added−386 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
38 files+40 added−386 removed
- tests:+0 added−135 removed
- other:+40 added−251 removed
Provenance
- Commit
51c1c8e- Tree
136e569- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
e492255
38 files changed+40 added−386 removed
modified:docs/examples/inline_gettext_extension.py-10 removed
1 # -*- coding: utf-8 -*-2-"""3- Inline Gettext4- ~~~~~~~~~~~~~~5-6- An example extension for Jinja that supports inline gettext calls.7- Requires the i18n extension to be loaded.8-9- :copyright: (c) 2009 by the Jinja Team.10- :license: BSD.11-"""2 import re3 4 from jinja2.exceptions import TemplateSyntaxError5 from jinja2.ext import Extension68 unmodified linesmodified:src/jinja2/__init__.py+3 added-26 removed
1 # -*- coding: utf-8 -*-2+"""Jinja is a template engine written in pure Python. It provides a3+non-XML syntax that supports inline expressions and an optional4+sandboxed environment.5 """3- jinja24- ~~~~~~5-6- Jinja is a template engine written in pure Python. It provides a7- Django inspired non-XML syntax but supports inline expressions and8- an optional sandboxed environment.9-10- Nutshell11- --------12-13- Here a small example of a Jinja template::14-15- {% extends 'base.html' %}16- {% block title %}Memberlist{% endblock %}17- {% block content %}18- <ul>19- {% for user in users %}20- <li><a href="{{ user.url }}">{{ user.username }}</a></li>21- {% endfor %}22- </ul>23- {% endblock %}24-25-26- :copyright: (c) 2017 by the Jinja Team.27- :license: BSD, see LICENSE for more details.28-"""6 from .bccache import BytecodeCache7 from .bccache import FileSystemBytecodeCache8 from .bccache import MemcachedBytecodeCache9 from .environment import Environment34 unmodified linesmodified:src/jinja2/_compat.py-11 removed
1 # -*- coding: utf-8 -*-2 # flake8: noqa3-"""4- jinja2._compat5- ~~~~~~~~~~~~~~6-7- Some py2/py3 compatibility support based on a stripped down8- version of six so we don't have to depend on a specific version9- of it.10-11- :copyright: Copyright 2013 by the Jinja team, see AUTHORS.12- :license: BSD, see LICENSE for details.13-"""3 import marshal4 import sys5 6 PY2 = sys.version_info[0] == 2126 unmodified linesmodified:src/jinja2/asyncsupport.py+2 added-9 removed
1 # -*- coding: utf-8 -*-2+"""The code for async support. Importing this patches Jinja on supported3+Python versions.4 """3- jinja2.asyncsupport4- ~~~~~~~~~~~~~~~~~~~5-6- Has all the code for async support which is implemented as a patch7- for supported Python versions.8-9- :copyright: (c) 2017 by the Jinja Team.10- :license: BSD, see LICENSE for more details.11-"""5 import asyncio6 import inspect7 from functools import update_wrapper8 255 unmodified linesmodified:src/jinja2/bccache.py+5 added-13 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.bccache4- ~~~~~~~~~~~~~~2+"""The optional bytecode cache system. This is useful if you have very3+complex template situations and the compilation of all those templates4+slows down your application too much.5 6- This module implements the bytecode cache system that Jinja optionally uses.7- This is useful if you have very complex template situations and8- the compilation of all those templates slows down your application too9- much.10-11- Situations where this is useful are often forking web applications that12- are initialized on the first request.6+Situations where this is useful are often forking web applications that7+are initialized on the first request.13-14- :copyright: (c) 2017 by the Jinja Team.15- :license: BSD.8 """9 import errno10 import fnmatch11 import os342 unmodified linesmodified:src/jinja2/compiler.py+1 added-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.compiler4- ~~~~~~~~~~~~~~~5-6- Compiles nodes into python code.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2+"""Compiles nodes from the parser into Python code."""3 from collections import namedtuple4 from functools import update_wrapper5 from itertools import chain6 from keyword import iskeyword as is_python_keyword1836 unmodified linesmodified:src/jinja2/constants.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja.constants4- ~~~~~~~~~~~~~~~5-6- Various constants.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 #: list of lorem ipsum words used by the lipsum() helper function3 LOREM_IPSUM_WORDS = u"""\4 a ac accumsan ad adipiscing aenean aliquam aliquet amet ante aptent arcu at5 auctor augue bibendum blandit class commodo condimentum congue consectetuer16 unmodified linesmodified:src/jinja2/defaults.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.defaults4- ~~~~~~~~~~~~~~~5-6- Jinja default filters and tags.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 from ._compat import range_type3 from .filters import FILTERS as DEFAULT_FILTERS # noqa: F4014 from .tests import TESTS as DEFAULT_TESTS # noqa: F4015 from .utils import Cycler42 unmodified linesmodified:src/jinja2/environment.py+2 added-8 removed
1 # -*- coding: utf-8 -*-2+"""Classes for managing templates and their runtime and compile time3+options.4 """3- jinja2.environment4- ~~~~~~~~~~~~~~~~~~5-6- Provides a class that holds runtime and parsing time options.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""5 import os6 import sys7 import weakref8 from functools import partial1353 unmodified linesmodified:src/jinja2/exceptions.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.exceptions4- ~~~~~~~~~~~~~~~~~5-6- Jinja exceptions.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 from ._compat import imap3 from ._compat import implements_to_string4 from ._compat import PY25 from ._compat import text_type172 unmodified linesmodified:src/jinja2/ext.py+1 added-15 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.ext4- ~~~~~~~~~~5-6- Jinja extensions allow adding custom tags and behavior. The7- following extensions are included:8-9- - An 18n support ``{% trans %}`` tag.10- - A ``{% do %}`` tag.11- - Loop control ``{% break %}`` and ``{% continue %}`` tags.12- - A ``{% debug %}`` tag.13-14- :copyright: (c) 2017 by the Jinja Team.15- :license: BSD.16-"""2+"""Extension API for adding custom tags and behavior."""3 import pprint4 import re5 from sys import version_info6 697 unmodified linesmodified:src/jinja2/filters.py+1 added-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.filters4- ~~~~~~~~~~~~~~5-6- Bundled jinja filters.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2+"""Built-in template filters used with the ``|`` operator."""3 import math4 import random5 import re6 import warnings1376 unmodified linesmodified:src/jinja2/lexer.py+4 added-14 removed
1 # -*- coding: utf-8 -*-2+"""Implements a Jinja / Python combination lexer. The ``Lexer`` class3+is used to do some preprocessing. It filters out invalid operators like4+the bitshift operators we don't allow in templates. It separates5+template code and python code in expressions.6 """3- jinja2.lexer4- ~~~~~~~~~~~~5-6- This module implements a Jinja / Python combination lexer. The7- `Lexer` class provided by this module is used to do some preprocessing8- for Jinja.9-10- On the one hand it filters out invalid operators like the bitshift11- operators we don't allow in templates. On the other hand it separates12- template code and python code in expressions.13-14- :copyright: (c) 2017 by the Jinja Team.15- :license: BSD, see LICENSE for more details.16-"""7 import re8 from ast import literal_eval9 from collections import deque10 from operator import itemgetter831 unmodified linesmodified:src/jinja2/loaders.py+2 added-8 removed
1 # -*- coding: utf-8 -*-2+"""API and implementations for loading templates from different data3+sources.4 """3- jinja2.loaders4- ~~~~~~~~~~~~~~5-6- Jinja loader classes.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""5 import os6 import pkgutil7 import sys8 import weakref564 unmodified linesmodified:src/jinja2/meta.py+2 added-9 removed
1 # -*- coding: utf-8 -*-2+"""Functions that expose information about templates that might be3+interesting for introspection.4 """3- jinja2.meta4- ~~~~~~~~~~~5-6- This module implements various functions that exposes information about7- templates that might be interesting for various kinds of applications.8-9- :copyright: (c) 2017 by the Jinja Team, see AUTHORS for more details.10- :license: BSD, see LICENSE for more details.11-"""5 from . import nodes6 from ._compat import iteritems7 from ._compat import string_types8 from .compiler import CodeGenerator93 unmodified linesmodified:src/jinja2/nodes.py+3 added-12 removed
1 # -*- coding: utf-8 -*-2+"""AST nodes generated by the parser for the compiler. Also provides3+some node tree helper functions used by the parser and compiler in order4+to normalize nodes.5 """3- jinja2.nodes4- ~~~~~~~~~~~~5-6- This module implements additional nodes derived from the ast base node.7-8- It also provides some node tree helper functions like `in_lineno` and9- `get_nodes` used by the parser and translator in order to normalize10- python and jinja nodes.11-12- :copyright: (c) 2017 by the Jinja Team.13- :license: BSD, see LICENSE for more details.14-"""6 import operator7 from collections import deque8 9 from ._compat import izip1078 unmodified linesmodified:src/jinja2/optimizer.py+7 added-15 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.optimizer4- ~~~~~~~~~~~~~~~~2+"""The optimizer tries to constant fold expressions and modify the AST3+in place so that it should be faster to evaluate.4 6- The jinja optimizer is currently trying to constant fold a few expressions7- and modify the AST in place so that it should be easier to evaluate it.8-9- Because the AST does not contain all the scoping information and the10- compiler has to find that out, we cannot do all the optimizations we11- want. For example loop unrolling doesn't work because unrolled loops would12- have a different scoping.13-14- The solution would be a second syntax tree that has the scoping rules stored.15-16- :copyright: (c) 2017 by the Jinja Team.17- :license: BSD.5+Because the AST does not contain all the scoping information and the6+compiler has to find that out, we cannot do all the optimizations we7+want. For example, loop unrolling doesn't work because unrolled loops8+would have a different scope. The solution would be a second syntax tree9+that stored the scoping rules.10 """11 from . import nodes12 from .visitor import NodeTransformer13 28 unmodified linesmodified:src/jinja2/parser.py+1 added-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.parser4- ~~~~~~~~~~~~~5-6- Implements the template parser.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2+"""Parse tokens from the lexer into nodes for the compiler."""3 from . import nodes4 from ._compat import imap5 from .exceptions import TemplateAssertionError6 from .exceptions import TemplateSyntaxError933 unmodified linesmodified:src/jinja2/runtime.py+1 added-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.runtime4- ~~~~~~~~~~~~~~5-6- Runtime helpers.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD.10-"""2+"""The runtime functions and state used by compiled templates."""3 import sys4 from itertools import chain5 from types import MethodType6 1005 unmodified linesmodified:src/jinja2/sandbox.py+2 added-12 removed
1 # -*- coding: utf-8 -*-2+"""A sandbox layer that ensures unsafe operations cannot be performed.3+Useful when the template itself comes from an untrusted source.4 """3- jinja2.sandbox4- ~~~~~~~~~~~~~~5-6- Adds a sandbox layer to Jinja as it was the default behavior in the old7- Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the8- default behavior is easier to use.9-10- The behavior can be changed by subclassing the environment.11-12- :copyright: (c) 2017 by the Jinja Team.13- :license: BSD.14-"""5 import operator6 import types7 import warnings8 from collections import deque502 unmodified linesmodified:src/jinja2/tests.py+1 added-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.tests4- ~~~~~~~~~~~~5-6- Jinja test functions. Used with the "is" operator.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2+"""Built-in template tests used with the ``is`` operator."""3 import decimal4 import operator5 import re6 209 unmodified linesmodified:src/jinja2/utils.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.utils4- ~~~~~~~~~~~~5-6- Utility functions.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import json3 import os4 import re5 import warnings722 unmodified linesmodified:src/jinja2/visitor.py+2 added-8 removed
1 # -*- coding: utf-8 -*-2+"""API for traversing the AST nodes. Implemented by the compiler and3+meta introspection.4 """3- jinja2.visitor4- ~~~~~~~~~~~~~~5-6- This module implements a visitor for the nodes.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD.10-"""5 from .nodes import Node6 7 8 class NodeVisitor(object):73 unmodified linesmodified:tests/conftest.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.conftest4- ~~~~~~~~~~~~~~~~~~~~~~~~~5-6- Configuration and Fixtures for the tests7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import os3 4 import pytest5 96 unmodified linesmodified:tests/test_api.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.api4- ~~~~~~~~~~~~~~~~~~~~5-6- Tests the public API and related stuff.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import os3 import shutil4 import tempfile5 427 unmodified linesmodified:tests/test_bytecode_cache.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.bytecode_cache4- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~5-6- Test bytecode caching7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import pytest3 4 from jinja2 import Environment5 from jinja2.bccache import Bucket74 unmodified linesmodified:tests/test_core_tags.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.core_tags4- ~~~~~~~~~~~~~~~~~~~~~~~~~~5-6- Test the core tags like for and if.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import pytest3 4 from jinja2 import DictLoader5 from jinja2 import Environment607 unmodified linesmodified:tests/test_debug.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.debug4- ~~~~~~~~~~~~~~~~~~~~~~5-6- Tests the debug system.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import pickle3 import re4 from traceback import format_exception5 112 unmodified linesmodified:tests/test_ext.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.ext4- ~~~~~~~~~~~~~~~~~~~~5-6- Tests for the extensions.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import re3 4 import pytest5 655 unmodified linesmodified:tests/test_filters.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.filters4- ~~~~~~~~~~~~~~~~~~~~~~~~5-6- Tests for the jinja filters.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import random3 from collections import namedtuple4 5 import pytest740 unmodified linesmodified:tests/test_imports.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.imports4- ~~~~~~~~~~~~~~~~~~~~~~~~5-6- Tests the import features (with includes).7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import pytest3 4 from jinja2 import DictLoader5 from jinja2 import Environment174 unmodified linesmodified:tests/test_inheritance.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.inheritance4- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~5-6- Tests the template inheritance feature.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import pytest3 4 from jinja2 import DictLoader5 from jinja2 import Environment282 unmodified linesmodified:tests/test_lexnparse.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.lexnparse4- ~~~~~~~~~~~~~~~~~~~~~~~~~~5-6- All the unittests regarding lexing, parsing and syntax.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import pytest3 4 from jinja2 import Environment5 from jinja2 import nodes825 unmodified linesmodified:tests/test_loader.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.loader4- ~~~~~~~~~~~~~~~~~~~~~~~5-6- Test the loaders.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import os3 import shutil4 import sys5 import tempfile372 unmodified linesmodified:tests/test_regression.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.regression4- ~~~~~~~~~~~~~~~~~~~~~~~~~~~5-6- Tests corner cases and bugs.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import sys3 4 import pytest5 621 unmodified linesmodified:tests/test_security.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.security4- ~~~~~~~~~~~~~~~~~~~~~~~~~5-6- Checks the sandbox and other security features.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import pytest3 4 from jinja2 import Environment5 from jinja2 import escape208 unmodified linesmodified:tests/test_tests.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.tests4- ~~~~~~~~~~~~~~~~~~~~~~5-6- Who tests the tests?7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import pytest3 4 from jinja2 import Environment5 from jinja2 import Markup205 unmodified linesmodified:tests/test_utils.py-9 removed
1 # -*- coding: utf-8 -*-2-"""3- jinja2.testsuite.utils4- ~~~~~~~~~~~~~~~~~~~~~~5-6- Tests utilities jinja uses.7-8- :copyright: (c) 2017 by the Jinja Team.9- :license: BSD, see LICENSE for more details.10-"""2 import pickle3 import random4 from collections import deque5 from copy import copy as shallow_copy203 unmodified lines