Merge branch '3.1.x'
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 · parents 0d17780, e9cb0a5 · Browse files · 7 files·+46 added−43 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+46 added−43 removed
- other:+46 added−43 removed
Provenance
- Commit
94fd2d9- Tree
3cc7744- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent 1
0d17780- Parent 2
e9cb0a5
7 files changed+46 added−43 removed
modified:docs/templates.rst+2 added-1 removed
597 unmodified lines598 layout = env.get_template("debug_layout.html")599 else:600 layout = env.get_template("layout.html")601 602- user_detail = env.get_template("user/detail.html", layout=layout)602+ user_detail = env.get_template("user/detail.html")603+ return user_detail.render(layout=layout)604 605 .. code-block:: jinja606 607 {% extends layout %}1343 unmodified linesmodified:requirements/dev.txt+11 added-9 removed
6 unmodified lines7 #8 -r docs.txt9 -r tests.txt10 -r typing.txt11+build==0.8.012+ # via pip-tools13 cfgv==3.3.114 # via pre-commit13-click==8.1.215+click==8.1.316 # via17 # pip-compile-multi18 # pip-tools19 distlib==0.3.420 # via virtualenv19-filelock==3.6.021+filelock==3.7.122 # via23 # tox24 # virtualenv23-identify==2.5.025+identify==2.5.126 # via pre-commit25-nodeenv==1.6.027+nodeenv==1.7.028 # via pre-commit29 pep517==0.12.028- # via pip-tools30+ # via build31 pip-compile-multi==2.4.532 # via -r requirements/dev.in31-pip-tools==6.6.033+pip-tools==6.8.034 # via pip-compile-multi35 platformdirs==2.5.236 # via virtualenv35-pre-commit==2.18.137+pre-commit==2.19.038 # via -r requirements/dev.in39 pyyaml==6.040 # via pre-commit41 six==1.16.05 unmodified lines47 # pre-commit48 # tox49 toposort==1.750 # via pip-compile-multi49-tox==3.25.051+tox==3.25.152 # via -r requirements/dev.in51-virtualenv==20.14.153+virtualenv==20.15.154 # via55 # pre-commit56 # tox57 wheel==0.37.15 unmodified linesmodified:requirements/docs.txt+9 added-9 removed
5 unmodified lines6 # pip-compile-multi7 #8 alabaster==0.7.129 # via sphinx10-babel==2.10.110+babel==2.10.311 # via sphinx12-certifi==2021.10.812+certifi==2022.6.1513 # via requests14-charset-normalizer==2.0.1214+charset-normalizer==2.1.015 # via requests16-docutils==0.17.116+docutils==0.18.117 # via sphinx18 idna==3.319 # via requests20-imagesize==1.3.020+imagesize==1.4.121 # via sphinx22-jinja2==3.1.122+jinja2==3.1.223 # via sphinx24 markupsafe==2.1.125 # via jinja226 packaging==21.33 unmodified lines30 pallets-sphinx-themes==2.0.231 # via -r requirements/docs.in32 pygments==2.12.033 # via sphinx34-pyparsing==3.0.834+pyparsing==3.0.935 # via packaging36 pytz==2022.137 # via babel38-requests==2.27.138+requests==2.28.139 # via sphinx40 snowballstemmer==2.2.041 # via sphinx42-sphinx==4.5.042+sphinx==5.0.243 # via44 # -r requirements/docs.in45 # pallets-sphinx-themes46 # sphinx-issues19 unmodified linesmodified:requirements/tests.txt+1 added-1 removed
13 unmodified lines14 pluggy==1.0.015 # via pytest16 py==1.11.017 # via pytest18-pyparsing==3.0.818+pyparsing==3.0.919 # via packaging20 pytest==7.1.221 # via -r requirements/tests.in22 tomli==2.0.11 unmodified linemodified:requirements/typing.txt+2 added-2 removed
3 unmodified lines4 # To update, run:5 #6 # pip-compile-multi7 #8-mypy==0.9508+mypy==0.9619 # via -r requirements/typing.in10 mypy-extensions==0.4.311 # via mypy12 tomli==2.0.113 # via mypy14-typing-extensions==4.2.014+typing-extensions==4.3.015 # via mypymodified:src/jinja2/loaders.py+17 added-17 removed
13 unmodified lines14 from types import ModuleType15 16 from .exceptions import TemplateNotFound17 from .utils import internalcode18-from .utils import open_if_exists18 19 if t.TYPE_CHECKING:20 from .environment import Environment21 from .environment import Template169 unmodified lines191 def get_source(192 self, environment: "Environment", template: str193 ) -> t.Tuple[str, str, t.Callable[[], bool]]:194 pieces = split_template_path(template)195+196 for searchpath in self.searchpath:197 # Use posixpath even on Windows to avoid "drive:" or UNC198 # segments breaking out of the search directory.199 filename = posixpath.join(searchpath, *pieces)200- f = open_if_exists(filename)201- if f is None:202- continue203- try:204- contents = f.read().decode(self.encoding)205- finally:206- f.close()200 208- mtime = os.path.getmtime(filename)201+ if os.path.isfile(filename):202+ break203+ else:204+ raise TemplateNotFound(template)205 210- def uptodate() -> bool:211- try:212- return os.path.getmtime(filename) == mtime213- except OSError:214- return False206+ with open(filename, encoding=self.encoding) as f:207+ contents = f.read()208 216- # Use normpath to convert Windows altsep to sep.217- return contents, os.path.normpath(filename), uptodate218- raise TemplateNotFound(template)209+ mtime = os.path.getmtime(filename)210 211+ def uptodate() -> bool:212+ try:213+ return os.path.getmtime(filename) == mtime214+ except OSError:215+ return False216+217+ # Use normpath to convert Windows altsep to sep.218+ return contents, os.path.normpath(filename), uptodate219+220 def list_templates(self) -> t.List[str]:221 found = set()222 for searchpath in self.searchpath:223 walk_dir = os.walk(searchpath, followlinks=self.followlinks)438 unmodified linesmodified:.pre-commit-config.yaml+4 added-4 removed
123456678910111112131415161717181920214 unmodified lines26272829303031323334ci: autoupdate_branch: "3.1.x" autoupdate_schedule: monthlyrepos: - repo: https://github.com/asottile/pyupgrade rev: v2.32.0 rev: v2.34.0 hooks: - id: pyupgrade args: ["--py37-plus"] - repo: https://github.com/asottile/reorder_python_imports rev: v3.1.0 rev: v3.3.0 hooks: - id: reorder-python-imports args: ["--application-directories", "src"] additional_dependencies: ["setuptools>60.9"] - repo: https://github.com/psf/black rev: 22.3.0 rev: 22.6.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 rev: 4.0.14 unmodified lines rev: v2.4.5 hooks: - id: pip-compile-multi-verify - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.2.0 rev: v4.3.0 hooks: - id: fix-byte-order-marker - id: trailing-whitespace - id: end-of-file-fixer