Skip to content

Commit

Permalink
Merge branch '3.1.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
davidism committed Jun 1, 2023
2 parents 953acd6 + ae312b3 commit 81a2384
Show file tree
Hide file tree
Showing 17 changed files with 98 additions and 82 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ci:
autoupdate_schedule: monthly
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.4.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]
Expand All @@ -14,7 +14,7 @@ repos:
args: ["--application-directories", "src"]
additional_dependencies: ["setuptools>60.9"]
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
Expand All @@ -23,7 +23,7 @@ repos:
- id: flake8
additional_dependencies: [flake8-bugbear]
- repo: https://github.com/peterdemin/pip-compile-multi
rev: v2.6.1
rev: v2.6.3
hooks:
- id: pip-compile-multi-verify
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ Unreleased
:pr:`1793`


Version 3.1.3
-------------

Unreleased

- Fix compiler error when checking if required blocks in parent templates are
empty. :pr:`1858`


Version 3.1.2
-------------

Expand Down
2 changes: 0 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,4 @@ Links
- PyPI Releases: https://pypi.org/project/Jinja2/
- Source Code: https://github.com/pallets/jinja/
- Issue Tracker: https://github.com/pallets/jinja/issues/
- Website: https://palletsprojects.com/p/jinja/
- Twitter: https://twitter.com/PalletsTeam
- Chat: https://discord.gg/pallets
2 changes: 0 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
ProjectLink("PyPI Releases", "https://pypi.org/project/Jinja2/"),
ProjectLink("Source Code", "https://github.com/pallets/jinja/"),
ProjectLink("Issue Tracker", "https://github.com/pallets/jinja/issues/"),
ProjectLink("Website", "https://palletsprojects.com/p/jinja/"),
ProjectLink("Twitter", "https://twitter.com/PalletsTeam"),
ProjectLink("Chat", "https://discord.gg/pallets"),
]
}
Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ description = "A very fast and expressive template engine."
readme = "README.rst"
license = {text = "BSD-3-Clause"}
maintainers = [{name = "Pallets", email = "contact@palletsprojects.com"}]
authors = [{name = "Armin Ronacher", email = "armin.ronacher@active-4.com"}]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
Expand All @@ -25,7 +24,6 @@ Documentation = "https://jinja.palletsprojects.com/"
Changes = "https://jinja.palletsprojects.com/changes/"
"Source Code" = "https://github.com/pallets/jinja/"
"Issue Tracker" = "https://github.com/pallets/jinja/issues/"
Twitter = "https://twitter.com/PalletsTeam"
Chat = "https://discord.gg/pallets"

[project.optional-dependencies]
Expand All @@ -42,7 +40,11 @@ version = {attr = "jinja2.__version__"}

[tool.pytest.ini_options]
testpaths = ["tests"]
filterwarnings = ["error"]
filterwarnings = [
"error",
# change in Python 3.12 beta causes warning from inside pytest
"ignore:ast:DeprecationWarning",
]

[tool.coverage.run]
branch = true
Expand Down
10 changes: 4 additions & 6 deletions requirements/build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
#
# pip-compile-multi
#
build==0.9.0
build==0.10.0
# via -r requirements/build.in
packaging==23.0
packaging==23.1
# via build
pep517==0.13.0
pyproject-hooks==1.0.0
# via build
tomli==2.0.1
# via
# build
# pep517
# via build
32 changes: 16 additions & 16 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
-r docs.txt
-r tests.txt
-r typing.txt
build==0.9.0
build==0.10.0
# via pip-tools
cachetools==5.2.0
cachetools==5.3.1
# via tox
cfgv==3.3.1
# via pre-commit
Expand All @@ -24,39 +24,39 @@ colorama==0.4.6
# via tox
distlib==0.3.6
# via virtualenv
filelock==3.9.0
filelock==3.12.0
# via
# tox
# virtualenv
identify==2.5.11
identify==2.5.24
# via pre-commit
nodeenv==1.7.0
nodeenv==1.8.0
# via pre-commit
pep517==0.13.0
# via build
pip-compile-multi==2.6.1
pip-compile-multi==2.6.3
# via -r requirements/dev.in
pip-tools==6.12.1
pip-tools==6.13.0
# via pip-compile-multi
platformdirs==2.6.2
platformdirs==3.5.1
# via
# tox
# virtualenv
pre-commit==2.21.0
pre-commit==3.3.2
# via -r requirements/dev.in
pyproject-api==1.2.1
pyproject-api==1.5.1
# via tox
pyproject-hooks==1.0.0
# via build
pyyaml==6.0
# via pre-commit
toposort==1.7
toposort==1.10
# via pip-compile-multi
tox==4.1.0
tox==4.5.2
# via -r requirements/dev.in
virtualenv==20.17.1
virtualenv==20.23.0
# via
# pre-commit
# tox
wheel==0.38.4
wheel==0.40.0
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
Expand Down
30 changes: 14 additions & 16 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,49 @@
#
# pip-compile-multi
#
alabaster==0.7.12
alabaster==0.7.13
# via sphinx
babel==2.11.0
babel==2.12.1
# via sphinx
certifi==2022.12.7
certifi==2023.5.7
# via requests
charset-normalizer==2.1.1
charset-normalizer==3.1.0
# via requests
docutils==0.19
docutils==0.20.1
# via sphinx
idna==3.4
# via requests
imagesize==1.4.1
# via sphinx
jinja2==3.1.2
# via sphinx
markupsafe==2.1.1
markupsafe==2.1.2
# via jinja2
packaging==22.0
packaging==23.1
# via
# pallets-sphinx-themes
# sphinx
pallets-sphinx-themes==2.0.3
pallets-sphinx-themes==2.1.0
# via -r requirements/docs.in
pygments==2.13.0
pygments==2.15.1
# via sphinx
pytz==2022.7
# via babel
requests==2.28.1
requests==2.31.0
# via sphinx
snowballstemmer==2.2.0
# via sphinx
sphinx==6.0.0
sphinx==7.0.1
# via
# -r requirements/docs.in
# pallets-sphinx-themes
# sphinx-issues
# sphinxcontrib-log-cabinet
sphinx-issues==3.0.1
# via -r requirements/docs.in
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-applehelp==1.0.4
# via sphinx
sphinxcontrib-devhelp==1.0.2
# via sphinx
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-htmlhelp==2.0.1
# via sphinx
sphinxcontrib-jsmath==1.0.1
# via sphinx
Expand All @@ -59,5 +57,5 @@ sphinxcontrib-qthelp==1.0.3
# via sphinx
sphinxcontrib-serializinghtml==1.1.5
# via sphinx
urllib3==1.26.13
urllib3==2.0.2
# via requests
10 changes: 4 additions & 6 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
#
# pip-compile-multi
#
attrs==22.2.0
exceptiongroup==1.1.1
# via pytest
exceptiongroup==1.1.0
iniconfig==2.0.0
# via pytest
iniconfig==1.1.1
# via pytest
packaging==22.0
packaging==23.1
# via pytest
pluggy==1.0.0
# via pytest
pytest==7.2.0
pytest==7.3.1
# via -r requirements/tests.in
tomli==2.0.1
# via pytest
6 changes: 3 additions & 3 deletions requirements/typing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#
# pip-compile-multi
#
mypy==0.991
mypy==1.3.0
# via -r requirements/typing.in
mypy-extensions==0.4.3
mypy-extensions==1.0.0
# via mypy
tomli==2.0.1
# via mypy
typing-extensions==4.4.0
typing-extensions==4.6.2
# via mypy
4 changes: 2 additions & 2 deletions scripts/generate_identifier_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def collapse_ranges(data):
Source: https://stackoverflow.com/a/4629241/400617
"""
for _, b in itertools.groupby(enumerate(data), lambda x: ord(x[1]) - x[0]):
lb = list(b)
for _, g in itertools.groupby(enumerate(data), lambda x: ord(x[1]) - x[0]):
lb = list(g)
yield lb[0][1], lb[-1][1]


Expand Down
2 changes: 1 addition & 1 deletion src/jinja2/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ def _compile(self, source: str, filename: str) -> CodeType:
.. versionadded:: 2.5
"""
return compile(source, filename, "exec") # type: ignore
return compile(source, filename, "exec")

@typing.overload
def compile( # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion src/jinja2/nativetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def render(self, *args: t.Any, **kwargs: t.Any) -> t.Any:

try:
return self.environment_class.concat( # type: ignore
self.root_render_func(ctx) # type: ignore
self.root_render_func(ctx)
)
except Exception:
return self.environment.handle_exception()
Expand Down
14 changes: 8 additions & 6 deletions src/jinja2/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,14 @@ def parse_block(self) -> nodes.Block:
# enforce that required blocks only contain whitespace or comments
# by asserting that the body, if not empty, is just TemplateData nodes
# with whitespace data
if node.required and not all(
isinstance(child, nodes.TemplateData) and child.data.isspace()
for body in node.body
for child in body.nodes # type: ignore
):
self.fail("Required blocks can only contain comments or whitespace")
if node.required:
for body_node in node.body:
if not isinstance(body_node, nodes.Output) or any(
not isinstance(output_node, nodes.TemplateData)
or not output_node.data.isspace()
for output_node in body_node.nodes
):
self.fail("Required blocks can only contain comments or whitespace")

self.stream.skip_if("name:" + node.name)
return node
Expand Down
2 changes: 1 addition & 1 deletion src/jinja2/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def object_type_repr(obj: t.Any) -> str:

def pformat(obj: t.Any) -> str:
"""Format an object using :func:`pprint.pformat`."""
from pprint import pformat # type: ignore
from pprint import pformat

return pformat(obj)

Expand Down
2 changes: 2 additions & 0 deletions tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,4 +870,6 @@ def test_filter_undefined_in_condexpr(self, env):

with pytest.raises(TemplateRuntimeError, match="No filter named 'f'"):
t1.render(x=42)

with pytest.raises(TemplateRuntimeError, match="No filter named 'f'"):
t2.render(x=42)
Loading

0 comments on commit 81a2384

Please sign in to comment.