* add note on type ignore
* Update templating.py
* Update templating.py
* Update templating.py
try:
import jinja2
- # @contextfunction renamed to @pass_context in Jinja 3.0, to be removed in 3.1
+ # @contextfunction was renamed to @pass_context in Jinja 3.0, and was removed in 3.1
+ # hence we try to get pass_context (most installs will be >=3.1)
+ # and fall back to contextfunction,
+ # adding a type ignore for mypy to let us access an attribute that may not exist
if hasattr(jinja2, "pass_context"):
pass_context = jinja2.pass_context
else: # pragma: nocover