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 Oct 13, 2022
2 parents e740cc6 + bf25151 commit 5d9ece6
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 43 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ ci:
autoupdate_schedule: monthly
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0
rev: v3.1.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.3.0
rev: v3.8.4
hooks:
- id: reorder-python-imports
args: ["--application-directories", "src"]
additional_dependencies: ["setuptools>60.9"]
- repo: https://github.com/psf/black
rev: 22.6.0
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear]
- repo: https://github.com/peterdemin/pip-compile-multi
rev: v2.4.5
rev: v2.4.6
hooks:
- id: pip-compile-multi-verify
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
4 changes: 2 additions & 2 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,8 @@ Now it can be used in templates:
{% endif %}

Some decorators are available to tell Jinja to pass extra information to
the filter. The object is passed as the first argument, making the value
being filtered the second argument.
the test. The object is passed as the first argument, making the value
being tested the second argument.

- :func:`pass_environment` passes the :class:`Environment`.
- :func:`pass_eval_context` passes the :ref:`eval-context`.
Expand Down
2 changes: 1 addition & 1 deletion docs/integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ this add this to ``config/environment.py``:
config['pylons.strict_c'] = True
.. _Pylons: https://pylonshq.com/
.. _Pylons: https://pylonsproject.org/
4 changes: 2 additions & 2 deletions docs/switching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ In Django, the special variable for the loop context is called
.. code-block:: django
{% for item in items %}
{{ item }}
{{ forloop.counter }}. {{ item }}
{% empty %}
No items!
{% endfor %}
Expand All @@ -95,7 +95,7 @@ and the ``else`` block is used for no loop items.
.. code-block:: jinja
{% for item in items %}
{{ loop.index}}. {{ item }}
{{ loop.index }}. {{ item }}
{% else %}
No items!
{% endfor %}
Expand Down
6 changes: 4 additions & 2 deletions docs/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,9 @@ template data. Just wrap the code in the special `filter` section::
This text becomes uppercase
{% endfilter %}

Filters that accept arguments can be called like this::

{% filter center(100) %}Center this{% endfilter %}

.. _assignments:

Expand Down Expand Up @@ -1608,8 +1611,7 @@ The following functions are available in the global scope by default:

.. versionadded:: 2.1

.. method:: current
:property:
.. property:: current

Return the current item. Equivalent to the item that will be
returned next time :meth:`next` is called.
Expand Down
26 changes: 11 additions & 15 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,37 @@ click==8.1.3
# via
# pip-compile-multi
# pip-tools
distlib==0.3.4
distlib==0.3.6
# via virtualenv
filelock==3.7.1
filelock==3.8.0
# via
# tox
# virtualenv
identify==2.5.1
identify==2.5.6
# via pre-commit
nodeenv==1.7.0
# via pre-commit
pep517==0.12.0
pep517==0.13.0
# via build
pip-compile-multi==2.4.5
pip-compile-multi==2.4.6
# via -r requirements/dev.in
pip-tools==6.8.0
pip-tools==6.9.0
# via pip-compile-multi
platformdirs==2.5.2
# via virtualenv
pre-commit==2.19.0
pre-commit==2.20.0
# via -r requirements/dev.in
pyyaml==6.0
# via pre-commit
six==1.16.0
# via
# tox
# virtualenv
# via tox
toml==0.10.2
# via
# pre-commit
# tox
# via pre-commit
toposort==1.7
# via pip-compile-multi
tox==3.25.1
tox==3.26.0
# via -r requirements/dev.in
virtualenv==20.15.1
virtualenv==20.16.5
# via
# pre-commit
# tox
Expand Down
16 changes: 8 additions & 8 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ alabaster==0.7.12
# via sphinx
babel==2.10.3
# via sphinx
certifi==2022.6.15
certifi==2022.9.24
# via requests
charset-normalizer==2.1.0
charset-normalizer==2.1.1
# via requests
docutils==0.18.1
docutils==0.19
# via sphinx
idna==3.3
idna==3.4
# via requests
imagesize==1.4.1
# via sphinx
Expand All @@ -29,17 +29,17 @@ packaging==21.3
# sphinx
pallets-sphinx-themes==2.0.2
# via -r requirements/docs.in
pygments==2.12.0
pygments==2.13.0
# via sphinx
pyparsing==3.0.9
# via packaging
pytz==2022.1
pytz==2022.4
# via babel
requests==2.28.1
# via sphinx
snowballstemmer==2.2.0
# via sphinx
sphinx==5.0.2
sphinx==5.2.3
# via
# -r requirements/docs.in
# pallets-sphinx-themes
Expand All @@ -61,5 +61,5 @@ sphinxcontrib-qthelp==1.0.3
# via sphinx
sphinxcontrib-serializinghtml==1.1.5
# via sphinx
urllib3==1.26.9
urllib3==1.26.12
# via requests
4 changes: 2 additions & 2 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# pip-compile-multi
#
attrs==21.4.0
attrs==22.1.0
# via pytest
iniconfig==1.1.1
# via pytest
Expand All @@ -17,7 +17,7 @@ py==1.11.0
# via pytest
pyparsing==3.0.9
# via packaging
pytest==7.1.2
pytest==7.1.3
# via -r requirements/tests.in
tomli==2.0.1
# via pytest
4 changes: 2 additions & 2 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.961
mypy==0.982
# via -r requirements/typing.in
mypy-extensions==0.4.3
# via mypy
tomli==2.0.1
# via mypy
typing-extensions==4.3.0
typing-extensions==4.4.0
# via mypy
8 changes: 4 additions & 4 deletions src/jinja2/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@ def _from_namespace(
t.blocks = namespace["blocks"]

# render function and module
t.root_render_func = namespace["root"] # type: ignore
t.root_render_func = namespace["root"]
t._module = None

# debug and loader helpers
Expand Down Expand Up @@ -1349,7 +1349,7 @@ async def to_list() -> t.List[str]:
ctx = self.new_context(dict(*args, **kwargs))

try:
yield from self.root_render_func(ctx) # type: ignore
yield from self.root_render_func(ctx)
except Exception:
yield self.environment.handle_exception()

Expand Down Expand Up @@ -1532,7 +1532,7 @@ def __init__(
" API you are using."
)

body_stream = list(template.root_render_func(context)) # type: ignore
body_stream = list(template.root_render_func(context))

self._body_stream = body_stream
self.__dict__.update(context.get_exported())
Expand Down Expand Up @@ -1564,7 +1564,7 @@ def __init__(self, template: Template, undefined_to_none: bool) -> None:

def __call__(self, *args: t.Any, **kwargs: t.Any) -> t.Optional[t.Any]:
context = self._template.new_context(dict(*args, **kwargs))
consume(self._template.root_render_func(context)) # type: ignore
consume(self._template.root_render_func(context))
rv = context.vars["result"]
if self._undefined_to_none and isinstance(rv, Undefined):
rv = None
Expand Down

0 comments on commit 5d9ece6

Please sign in to comment.