Skip to content
Myr

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

38 files+40 added−386 removed

modified:docs/examples/inline_gettext_extension.py-10 removed
1# -*- coding: utf-8 -*-2"""3 Inline Gettext4 ~~~~~~~~~~~~~~56 An example extension for Jinja that supports inline gettext calls.7 Requires the i18n extension to be loaded.89 :copyright: (c) 2009 by the Jinja Team.10 :license: BSD.11"""2import re34from jinja2.exceptions import TemplateSyntaxError5from jinja2.ext import Extension
68 unmodified lines
modified:src/jinja2/__init__.py+3 added-26 removed
1# -*- coding: utf-8 -*-2"""Jinja is a template engine written in pure Python. It provides a3non-XML syntax that supports inline expressions and an optional4sandboxed environment.5"""3 jinja24 ~~~~~~56 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.910 Nutshell11 --------1213 Here a small example of a Jinja template::1415 {% 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 %}242526 :copyright: (c) 2017 by the Jinja Team.27 :license: BSD, see LICENSE for more details.28"""6from .bccache import BytecodeCache7from .bccache import FileSystemBytecodeCache8from .bccache import MemcachedBytecodeCache9from .environment import Environment
34 unmodified lines
modified:src/jinja2/_compat.py-11 removed
1# -*- coding: utf-8 -*-2# flake8: noqa3"""4 jinja2._compat5 ~~~~~~~~~~~~~~67 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.1011 :copyright: Copyright 2013 by the Jinja team, see AUTHORS.12 :license: BSD, see LICENSE for details.13"""3import marshal4import sys56PY2 = sys.version_info[0] == 2
126 unmodified lines
modified:src/jinja2/asyncsupport.py+2 added-9 removed
1# -*- coding: utf-8 -*-2"""The code for async support. Importing this patches Jinja on supported3Python versions.4"""3 jinja2.asyncsupport4 ~~~~~~~~~~~~~~~~~~~56 Has all the code for async support which is implemented as a patch7 for supported Python versions.89 :copyright: (c) 2017 by the Jinja Team.10 :license: BSD, see LICENSE for more details.11"""5import asyncio6import inspect7from functools import update_wrapper8
255 unmodified lines
modified: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 very3complex template situations and the compilation of all those templates4slows down your application too much.56 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.1011 Situations where this is useful are often forking web applications that12 are initialized on the first request.6Situations where this is useful are often forking web applications that7are initialized on the first request.1314 :copyright: (c) 2017 by the Jinja Team.15 :license: BSD.8"""9import errno10import fnmatch11import os
342 unmodified lines
modified:src/jinja2/compiler.py+1 added-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.compiler4 ~~~~~~~~~~~~~~~56 Compiles nodes into python code.78 :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."""3from collections import namedtuple4from functools import update_wrapper5from itertools import chain6from keyword import iskeyword as is_python_keyword
1836 unmodified lines
modified:src/jinja2/constants.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja.constants4 ~~~~~~~~~~~~~~~56 Various constants.78 :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 function3LOREM_IPSUM_WORDS = u"""\4a ac accumsan ad adipiscing aenean aliquam aliquet amet ante aptent arcu at5auctor augue bibendum blandit class commodo condimentum congue consectetuer
16 unmodified lines
modified:src/jinja2/defaults.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.defaults4 ~~~~~~~~~~~~~~~56 Jinja default filters and tags.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2from ._compat import range_type3from .filters import FILTERS as DEFAULT_FILTERS # noqa: F4014from .tests import TESTS as DEFAULT_TESTS # noqa: F4015from .utils import Cycler
42 unmodified lines
modified:src/jinja2/environment.py+2 added-8 removed
1# -*- coding: utf-8 -*-2"""Classes for managing templates and their runtime and compile time3options.4"""3 jinja2.environment4 ~~~~~~~~~~~~~~~~~~56 Provides a class that holds runtime and parsing time options.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""5import os6import sys7import weakref8from functools import partial
1353 unmodified lines
modified:src/jinja2/exceptions.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.exceptions4 ~~~~~~~~~~~~~~~~~56 Jinja exceptions.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2from ._compat import imap3from ._compat import implements_to_string4from ._compat import PY25from ._compat import text_type
172 unmodified lines
modified:src/jinja2/ext.py+1 added-15 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.ext4 ~~~~~~~~~~56 Jinja extensions allow adding custom tags and behavior. The7 following extensions are included:89 - An 18n support ``{% trans %}`` tag.10 - A ``{% do %}`` tag.11 - Loop control ``{% break %}`` and ``{% continue %}`` tags.12 - A ``{% debug %}`` tag.1314 :copyright: (c) 2017 by the Jinja Team.15 :license: BSD.16"""2"""Extension API for adding custom tags and behavior."""3import pprint4import re5from sys import version_info6
697 unmodified lines
modified:src/jinja2/filters.py+1 added-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.filters4 ~~~~~~~~~~~~~~56 Bundled jinja filters.78 :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."""3import math4import random5import re6import warnings
1376 unmodified lines
modified:src/jinja2/lexer.py+4 added-14 removed
1# -*- coding: utf-8 -*-2"""Implements a Jinja / Python combination lexer. The ``Lexer`` class3is used to do some preprocessing. It filters out invalid operators like4the bitshift operators we don't allow in templates. It separates5template code and python code in expressions.6"""3 jinja2.lexer4 ~~~~~~~~~~~~56 This module implements a Jinja / Python combination lexer. The7 `Lexer` class provided by this module is used to do some preprocessing8 for Jinja.910 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.1314 :copyright: (c) 2017 by the Jinja Team.15 :license: BSD, see LICENSE for more details.16"""7import re8from ast import literal_eval9from collections import deque10from operator import itemgetter
831 unmodified lines
modified:src/jinja2/loaders.py+2 added-8 removed
1# -*- coding: utf-8 -*-2"""API and implementations for loading templates from different data3sources.4"""3 jinja2.loaders4 ~~~~~~~~~~~~~~56 Jinja loader classes.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""5import os6import pkgutil7import sys8import weakref
564 unmodified lines
modified:src/jinja2/meta.py+2 added-9 removed
1# -*- coding: utf-8 -*-2"""Functions that expose information about templates that might be3interesting for introspection.4"""3 jinja2.meta4 ~~~~~~~~~~~56 This module implements various functions that exposes information about7 templates that might be interesting for various kinds of applications.89 :copyright: (c) 2017 by the Jinja Team, see AUTHORS for more details.10 :license: BSD, see LICENSE for more details.11"""5from . import nodes6from ._compat import iteritems7from ._compat import string_types8from .compiler import CodeGenerator
93 unmodified lines
modified:src/jinja2/nodes.py+3 added-12 removed
1# -*- coding: utf-8 -*-2"""AST nodes generated by the parser for the compiler. Also provides3some node tree helper functions used by the parser and compiler in order4to normalize nodes.5"""3 jinja2.nodes4 ~~~~~~~~~~~~56 This module implements additional nodes derived from the ast base node.78 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.1112 :copyright: (c) 2017 by the Jinja Team.13 :license: BSD, see LICENSE for more details.14"""6import operator7from collections import deque89from ._compat import izip
1078 unmodified lines
modified: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 AST3in place so that it should be faster to evaluate.46 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.89 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.1314 The solution would be a second syntax tree that has the scoping rules stored.1516 :copyright: (c) 2017 by the Jinja Team.17 :license: BSD.5Because the AST does not contain all the scoping information and the6compiler has to find that out, we cannot do all the optimizations we7want. For example, loop unrolling doesn't work because unrolled loops8would have a different scope. The solution would be a second syntax tree9that stored the scoping rules.10"""11from . import nodes12from .visitor import NodeTransformer13
28 unmodified lines
modified:src/jinja2/parser.py+1 added-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.parser4 ~~~~~~~~~~~~~56 Implements the template parser.78 :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."""3from . import nodes4from ._compat import imap5from .exceptions import TemplateAssertionError6from .exceptions import TemplateSyntaxError
933 unmodified lines
modified:src/jinja2/runtime.py+1 added-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.runtime4 ~~~~~~~~~~~~~~56 Runtime helpers.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD.10"""2"""The runtime functions and state used by compiled templates."""3import sys4from itertools import chain5from types import MethodType6
1005 unmodified lines
modified:src/jinja2/sandbox.py+2 added-12 removed
1# -*- coding: utf-8 -*-2"""A sandbox layer that ensures unsafe operations cannot be performed.3Useful when the template itself comes from an untrusted source.4"""3 jinja2.sandbox4 ~~~~~~~~~~~~~~56 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.910 The behavior can be changed by subclassing the environment.1112 :copyright: (c) 2017 by the Jinja Team.13 :license: BSD.14"""5import operator6import types7import warnings8from collections import deque
502 unmodified lines
modified:src/jinja2/tests.py+1 added-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.tests4 ~~~~~~~~~~~~56 Jinja test functions. Used with the "is" operator.78 :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."""3import decimal4import operator5import re6
209 unmodified lines
modified:src/jinja2/utils.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.utils4 ~~~~~~~~~~~~56 Utility functions.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import json3import os4import re5import warnings
722 unmodified lines
modified:src/jinja2/visitor.py+2 added-8 removed
1# -*- coding: utf-8 -*-2"""API for traversing the AST nodes. Implemented by the compiler and3meta introspection.4"""3 jinja2.visitor4 ~~~~~~~~~~~~~~56 This module implements a visitor for the nodes.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD.10"""5from .nodes import Node678class NodeVisitor(object):
73 unmodified lines
modified:tests/conftest.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.conftest4 ~~~~~~~~~~~~~~~~~~~~~~~~~56 Configuration and Fixtures for the tests78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import os34import pytest5
96 unmodified lines
modified:tests/test_api.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.api4 ~~~~~~~~~~~~~~~~~~~~56 Tests the public API and related stuff.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import os3import shutil4import tempfile5
427 unmodified lines
modified:tests/test_bytecode_cache.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.bytecode_cache4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~56 Test bytecode caching78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import pytest34from jinja2 import Environment5from jinja2.bccache import Bucket
74 unmodified lines
modified:tests/test_core_tags.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.core_tags4 ~~~~~~~~~~~~~~~~~~~~~~~~~~56 Test the core tags like for and if.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import pytest34from jinja2 import DictLoader5from jinja2 import Environment
607 unmodified lines
modified:tests/test_debug.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.debug4 ~~~~~~~~~~~~~~~~~~~~~~56 Tests the debug system.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import pickle3import re4from traceback import format_exception5
112 unmodified lines
modified:tests/test_ext.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.ext4 ~~~~~~~~~~~~~~~~~~~~56 Tests for the extensions.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import re34import pytest5
655 unmodified lines
modified:tests/test_filters.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.filters4 ~~~~~~~~~~~~~~~~~~~~~~~~56 Tests for the jinja filters.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import random3from collections import namedtuple45import pytest
740 unmodified lines
modified:tests/test_imports.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.imports4 ~~~~~~~~~~~~~~~~~~~~~~~~56 Tests the import features (with includes).78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import pytest34from jinja2 import DictLoader5from jinja2 import Environment
174 unmodified lines
modified:tests/test_inheritance.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.inheritance4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~56 Tests the template inheritance feature.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import pytest34from jinja2 import DictLoader5from jinja2 import Environment
282 unmodified lines
modified:tests/test_lexnparse.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.lexnparse4 ~~~~~~~~~~~~~~~~~~~~~~~~~~56 All the unittests regarding lexing, parsing and syntax.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import pytest34from jinja2 import Environment5from jinja2 import nodes
825 unmodified lines
modified:tests/test_loader.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.loader4 ~~~~~~~~~~~~~~~~~~~~~~~56 Test the loaders.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import os3import shutil4import sys5import tempfile
372 unmodified lines
modified:tests/test_regression.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.regression4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~56 Tests corner cases and bugs.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import sys34import pytest5
621 unmodified lines
modified:tests/test_security.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.security4 ~~~~~~~~~~~~~~~~~~~~~~~~~56 Checks the sandbox and other security features.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import pytest34from jinja2 import Environment5from jinja2 import escape
208 unmodified lines
modified:tests/test_tests.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.tests4 ~~~~~~~~~~~~~~~~~~~~~~56 Who tests the tests?78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import pytest34from jinja2 import Environment5from jinja2 import Markup
205 unmodified lines
modified:tests/test_utils.py-9 removed
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.utils4 ~~~~~~~~~~~~~~~~~~~~~~56 Tests utilities jinja uses.78 :copyright: (c) 2017 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""2import pickle3import random4from collections import deque5from copy import copy as shallow_copy
203 unmodified lines