Skip to content
Myr

Merge pull request #1361 from pallets/consistency

Before adoption: this commit came in with the history the project adopted, so no landing records it.

various cleanup for consistency between projects

authored by David Lord · committed by GitHub · parents e6577e9, e381730 · Browse files · 17 files+87 added−54 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

17 files+87 added−54 removed

  • other:+87 added−54 removed

17 files+87 added−54 removed

modified:.github/workflows/tests.yaml+16 added-3 removed
deleted:docs/changelog.rst-4 removed
1Changelog2=========34.. include:: ../CHANGES.rst
added:docs/changes.rst+4 added
1Changes2=======34.. include:: ../CHANGES.rst
modified:docs/conf.py+5 added-3 removed
25 unmodified lines
26html_theme = "jinja"27html_theme_options = {"index_sidebar_logo": False}28html_context = {29 "project_links": [30 ProjectLink("Donate to Pallets", "https://palletsprojects.com/donate"),31 ProjectLink("Jinja Website", "https://palletsprojects.com/p/jinja/"),32 ProjectLink("PyPI releases", "https://pypi.org/project/Jinja2/"),30 ProjectLink("Donate", "https://palletsprojects.com/donate"),31 ProjectLink("PyPI Releases", "https://pypi.org/project/Jinja2/"),32 ProjectLink("Source Code", "https://github.com/pallets/jinja/"),33 ProjectLink("Issue Tracker", "https://github.com/pallets/jinja/issues/"),34 ProjectLink("Website", "https://palletsprojects.com/p/jinja/"),35 ProjectLink("Twitter", "https://twitter.com/PalletsTeam"),36 ProjectLink("Chat", "https://discord.gg/pallets"),37 ]38}39html_sidebars = {40 "index": ["project.html", "localtoc.html", "searchbox.html"],
12 unmodified lines
modified:docs/index.rst+2 added-1 removed
23 unmodified lines
24 integration25 switching26 tricks27 faq28 license28 changelog29 changes
added:docs/license.rst+4 added
1BSD-3-Clause License2====================34.. include:: ../LICENSE.rst
modified:src/jinja2/compiler.py+2 added-1 removed
1"""Compiles nodes from the parser into Python code."""2import typing as t3from collections import namedtuple4from functools import update_wrapper5from io import StringIO6from itertools import chain
1196 unmodified lines
1203 #: The default finalize function if the environment isn't configured1204 #: with one. Or if the environment has one, this is called on that1205 #: function's output for constants.1206 _default_finalize = str1206 _finalize = None1207 _finalize: t.Optional[_FinalizeInfo] = None12081209 def _make_finalize(self):1210 """Build the finalize function to be used on constants and at1211 runtime. Cached so it's only created once for all output nodes.
553 unmodified lines
modified:src/jinja2/debug.py+1 added-1 removed
210 unmodified lines
211212elif platform.python_implementation() == "PyPy":213 # PyPy might have special support, and won't work with ctypes.214 try:215 import tputil215 import tputil # type: ignore216 except ImportError:217 # Without tproxy support, use the original traceback.218 def tb_set_next(tb, tb_next):219 return tb
43 unmodified lines
modified:src/jinja2/defaults.py+4 added-2 removed
1import typing as t23from .filters import FILTERS as DEFAULT_FILTERS # noqa: F4014from .tests import TESTS as DEFAULT_TESTS # noqa: F4015from .utils import Cycler6from .utils import generate_lorem_ipsum
6 unmodified lines
13VARIABLE_START_STRING = "{{"14VARIABLE_END_STRING = "}}"15COMMENT_START_STRING = "{#"16COMMENT_END_STRING = "#}"15LINE_STATEMENT_PREFIX = None16LINE_COMMENT_PREFIX = None17LINE_STATEMENT_PREFIX: t.Optional[str] = None18LINE_COMMENT_PREFIX: t.Optional[str] = None19TRIM_BLOCKS = False20LSTRIP_BLOCKS = False21NEWLINE_SEQUENCE = "\n"22KEEP_TRAILING_NEWLINE = False
23 unmodified lines
modified:src/jinja2/environment.py+3 added-3 removed
1 unmodified line
2options.3"""4import os5import sys6import typing as t7import weakref8from functools import partial9from functools import reduce9from typing import Any1011from markupsafe import Markup1213from . import nodes
247 unmodified lines
261 #: True if the environment is just an overlay262 overlayed = False263264 #: the environment this environment is linked to if it is an overlay265 linked_to = None265 linked_to: t.Optional["Environment"] = None266267 #: shared environments have this set to `True`. A shared environment268 #: must not be modified269 shared = False
5 unmodified lines
275 #: the context class that is used for templates. See276 #: :class:`~jinja2.runtime.Context` for more information.277 context_class = Context278279 template_class = Any279 template_class: t.Type["Template"]280281 def __init__(282 self,283 block_start_string=BLOCK_START_STRING,
1051 unmodified lines
modified:src/jinja2/runtime.py+3 added-3 removed
1"""The runtime functions and state used by compiled templates."""2import sys3import typing as t4from collections import abc5from itertools import chain6from types import MethodType7
364 unmodified lines
372373 #: Current iteration of the loop, starting at 0.374 index0 = -1375375 _length = None376 _length: t.Optional[int] = None377 _after = missing378 _current = missing379 _before = missing380 _last_changed_value = missing
381 unmodified lines
762 def __len__(self):763 return 0764765 def __iter__(self):765 if 0:766 yield None766 yield from ()767768 def __bool__(self):769 return False770
150 unmodified lines
modified:src/jinja2/utils.py+3 added-1 removed
1import json2import os3import re4import typing as t5from collections import abc6from collections import deque7from random import choice8from random import randrange9from threading import Lock10from types import CodeType11from urllib.parse import quote_from_bytes1213from markupsafe import escape14from markupsafe import Markup
1 unmodified line
16# special singleton representing missing values for the runtime17missing = type("MissingType", (), {"__repr__": lambda x: "missing"})()1819# internal code18internal_code = set()20internal_code: t.MutableSet[CodeType] = set()2122concat = "".join2324_slash_escape = "\\/" not in json.dumps("/")
724 unmodified lines
modified:.readthedocs.yaml+1 added
4 unmodified lines
5 - method: pip6 path: .7sphinx:8 builder: dirhtml9 fail_on_warning: true
modified:README.rst+18 added-6 removed
52 unmodified lines
53 </ul>54 {% endblock %}555657Donate58------5960The Pallets organization develops and supports Jinja and other popular61packages. In order to grow the community of contributors and users, and62allow the maintainers to devote more time to the projects, `please63donate today`_.6465.. _please donate today: https://palletsprojects.com/donate666768Links69-----7060- Website: https://palletsprojects.com/p/jinja/71- Documentation: https://jinja.palletsprojects.com/62- Releases: https://pypi.org/project/Jinja2/63- Code: https://github.com/pallets/jinja64- Issue tracker: https://github.com/pallets/jinja/issues65- Test status: https://dev.azure.com/pallets/jinja/_build66- Official chat: https://discord.gg/t6rrQZH72- Changes: https://jinja.palletsprojects.com/changes/73- PyPI Releases: https://pypi.org/project/Jinja2/74- Source Code: https://github.com/pallets/jinja/75- Issue Tracker: https://github.com/pallets/jinja/issues/76- Website: https://palletsprojects.com/p/jinja/77- Twitter: https://twitter.com/PalletsTeam78- Chat: https://discord.gg/pallets
modified:setup.cfg+16 added-15 removed
1[metadata]2name = Jinja23# Version needs regex in setup.py.4url = https://palletsprojects.com/p/jinja3version = attr: jinja2.__version__4url = https://palletsprojects.com/p/jinja/5project_urls =6 Donate = https://palletsprojects.com/donate7 Documentation = https://jinja.palletsprojects.com/7 Code = https://github.com/pallets/jinja8 Issue tracker = https://github.com/pallets/jinja/issues8 Changes = https://jinja.palletsprojects.com/changes/9 Source Code = https://github.com/pallets/jinja/10 Issue Tracker = https://github.com/pallets/jinja/issues/11 Twitter = https://twitter.com/PalletsTeam12 Chat = https://discord.gg/pallets13license = BSD-3-Clause14license_files = LICENSE.rst15author = Armin Ronacher16author_email = armin.ronacher@active-4.com
66 unmodified lines
83 src/jinja2/__init__.py: F4018485[mypy]86files = src/jinja283allow_redefinition = True87python_version = 3.688disallow_subclassing_any = True89# disallow_untyped_calls = True90# disallow_untyped_defs = True91disallow_incomplete_defs = True92no_implicit_optional = True93local_partial_types = True94# no_implicit_reexport = True95strict_equality = True87strict_optional = False96warn_redundant_casts = True97warn_unused_configs = True98warn_unused_ignores = True9192[mypy-_pytest.*]93ignore_missing_imports = True9495[mypy-pytest.*]96ignore_missing_imports = True9798[mypy-requests_unixsocket.*]99ignore_missing_imports = True99warn_return_any = True100warn_unreachable = True
modified:setup.py-6 removed
1import re21from setuptools import setup25with open("src/jinja2/__init__.py", encoding="utf8") as f:6 version = re.search(r'__version__ = "(.*?)"', f.read(), re.M).group(1)73# Metadata goes in setup.cfg. These are here for GitHub's dependency graph.4setup(5 name="Jinja2",11 version=version,6 install_requires=["MarkupSafe>=1.1"],7 extras_require={"i18n": ["Babel>=2.1"]},8)
modified:tox.ini+5 added-5 removed
1[tox]2envlist =3 py{39,38,37,36,py3}4 style5 docs5 typing6 docs7skip_missing_interpreters = true89[testenv]10deps = -r requirements/tests.txt
3 unmodified lines
14deps = pre-commit15skip_install = true16commands = pre-commit run --all-files --show-diff-on-failure1718[testenv:docs]19deps = -r requirements/docs.txt20commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html2118[testenv:typing]19deps = -r requirements/typing.txt20commands = mypy2122[testenv:docs]23deps = -r requirements/docs.txt24commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html