-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
OpenXR SDK 1.0.34 (2024-02-16)
This release features a number of new multi-vendor and vendor extensions, additional functionality in the reflection header, as well as compatibility improvements for the loader on Android. - Registry - Extension reservation: Register author ID and reserve extensions for Leia. (internal MR 3203) - Fix: Remove erroneous interaction profile component additions from extensions. (internal MR 3223) - New multi-vendor extension: XR_EXT_user_presence (internal MR 2706, internal issue 1585) - New vendor extension: XR_META_recommended_layer_resolution (internal MR 2570) - New vendor extension: XR_META_automatic_layer_filter (internal MR 2696) - New vendor extension: XR_META_spatial_entity_mesh (internal MR 2773) - New vendor extension: XR_FB_face_tracking2 (internal MR 2811) - New vendor extension: XR_VARJO_xr4_controller_interaction (internal MR 3078) - XR_FB_scene: Update to spec version 4. (internal MR 2774) - XR_META_headset_id and XR_FB_spatial_entity: Drop XR_EXT_uuid dependency, they use the data structure but do not require any runtime support specific to XR_EXT_uuid (internal MR 2577) - SDK - API Layers: Add version-script for linking API Layers on Linux and Android. (internal MR 3112) - Fix typo in gfxwrapper_opengl that did not affect the use in this repository directly, but may affect downstream users of this code. (internal MR 3215) - Loader: fix to Android Loader so that the /<path_to_apk>/my_apk_file.apk!/libs/libstuff.so will not get blocked (internal MR 3054) - Loader: Add missing ifdef guards for XR_KHR_LOADER_INIT_SUPPORT. (internal MR 3152, internal MR 3159) - Loader: Fix crash in case of calling xrEnumerateInstanceExtensionProperties before calling xrInitializeLoaderKHR on Android. (internal MR 3159) - Loader design: Add a note about environment variables being ignored when run on Windows as admin. (internal MR 3214) - openxr_reflection.h: Add macros to list functions provided by each feature / extension. (internal MR 3129) - external: Update Jinja2 Python module shipped with repository (for source code generation) to 2.11.3. (internal MR 3221, internal MR 3237) GitOrigin-RevId: 8e65355a94a5d1b834ba438571cd5cd88c030b22
Showing
66 changed files
with
5,098 additions
and
3,747 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Jinja2-2.11.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 | ||
Jinja2-2.11.3.dist-info/LICENSE.rst,sha256=O0nc7kEF6ze6wQ-vG-JgQI_oXSUrjp3y4JefweCUQ3s,1475 | ||
Jinja2-2.11.3.dist-info/METADATA,sha256=PscpJ1C3RSp8xcjV3fAuTz13rKbGxmzJXnMQFH-WKhs,3535 | ||
Jinja2-2.11.3.dist-info/RECORD,, | ||
Jinja2-2.11.3.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 | ||
Jinja2-2.11.3.dist-info/WHEEL,sha256=Z-nyYpwrcSqxfdux5Mbn_DQ525iP7J2DG3JgGvOYyTQ,110 | ||
Jinja2-2.11.3.dist-info/entry_points.txt,sha256=Qy_DkVo6Xj_zzOtmErrATe8lHZhOqdjpt3e4JJAGyi8,61 | ||
Jinja2-2.11.3.dist-info/top_level.txt,sha256=PkeVWtLb3-CqjWi1fO29OCbj55EhX_chhKrCdrVe_zs,7 | ||
jinja2/__init__.py,sha256=LZUXmxJc2GIchfSAeMWsxCWiQYO-w1-736f2Q3I8ms8,1549 | ||
jinja2/_compat.py,sha256=B6Se8HjnXVpzz9-vfHejn-DV2NjaVK-Iewupc5kKlu8,3191 | ||
jinja2/_identifier.py,sha256=EdgGJKi7O1yvr4yFlvqPNEqV6M1qHyQr8Gt8GmVTKVM,1775 | ||
jinja2/asyncfilters.py,sha256=XJtYXTxFvcJ5xwk6SaDL4S0oNnT0wPYvXBCSzc482fI,4250 | ||
jinja2/asyncsupport.py,sha256=ZBFsDLuq3Gtji3Ia87lcyuDbqaHZJRdtShZcqwpFnSQ,7209 | ||
jinja2/bccache.py,sha256=3Pmp4jo65M9FQuIxdxoDBbEDFwe4acDMQf77nEJfrHA,12139 | ||
jinja2/compiler.py,sha256=Ta9W1Lit542wItAHXlDcg0sEOsFDMirCdlFPHAurg4o,66284 | ||
jinja2/constants.py,sha256=RR1sTzNzUmKco6aZicw4JpQpJGCuPuqm1h1YmCNUEFY,1458 | ||
jinja2/debug.py,sha256=neR7GIGGjZH3_ILJGVUYy3eLQCCaWJMXOb7o0kGInWc,8529 | ||
jinja2/defaults.py,sha256=85B6YUUCyWPSdrSeVhcqFVuu_bHUAQXeey--FIwSeVQ,1126 | ||
jinja2/environment.py,sha256=XDSLKc4SqNLMOwTSq3TbWEyA5WyXfuLuVD0wAVjEFwM,50629 | ||
jinja2/exceptions.py,sha256=VjNLawcmf2ODffqVMCQK1cRmvFaUfQWF4u8ouP3QPcE,5425 | ||
jinja2/ext.py,sha256=AtwL5O5enT_L3HR9-oBvhGyUTdGoyaqG_ICtnR_EVd4,26441 | ||
jinja2/filters.py,sha256=9ORilsZrUoydSI9upz8_qGy7gozDWLYoFmlIBFSVRnQ,41439 | ||
jinja2/idtracking.py,sha256=J3O4VHsrbf3wzwiBc7Cro26kHb6_5kbULeIOzocchIU,9211 | ||
jinja2/lexer.py,sha256=nUFLRKhhKmmEWkLI65nQePgcQs7qsRdjVYZETMt_v0g,30331 | ||
jinja2/loaders.py,sha256=C-fST_dmFjgWkp0ZuCkrgICAoOsoSIF28wfAFink0oU,17666 | ||
jinja2/meta.py,sha256=QjyYhfNRD3QCXjBJpiPl9KgkEkGXJbAkCUq4-Ur10EQ,4131 | ||
jinja2/nativetypes.py,sha256=Ul__gtVw4xH-0qvUvnCNHedQeNDwmEuyLJztzzSPeRg,2753 | ||
jinja2/nodes.py,sha256=Mk1oJPVgIjnQw9WOqILvcu3rLepcFZ0ahxQm2mbwDwc,31095 | ||
jinja2/optimizer.py,sha256=gQLlMYzvQhluhzmAIFA1tXS0cwgWYOjprN-gTRcHVsc,1457 | ||
jinja2/parser.py,sha256=fcfdqePNTNyvosIvczbytVA332qpsURvYnCGcjDHSkA,35660 | ||
jinja2/runtime.py,sha256=0y-BRyIEZ9ltByL2Id6GpHe1oDRQAwNeQvI0SKobNMw,30618 | ||
jinja2/sandbox.py,sha256=knayyUvXsZ-F0mk15mO2-ehK9gsw04UhB8td-iUOtLc,17127 | ||
jinja2/tests.py,sha256=iO_Y-9Vo60zrVe1lMpSl5sKHqAxe2leZHC08OoZ8K24,4799 | ||
jinja2/utils.py,sha256=Wy4yC3IByqUWwnKln6SdaixdzgK74P6F5nf-gQZrYnU,22436 | ||
jinja2/visitor.py,sha256=DUHupl0a4PGp7nxRtZFttUzAi1ccxzqc2hzetPYUz8U,3240 |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...rnal/python/Jinja2-2.10.3.dist-info/WHEEL → ...rnal/python/Jinja2-2.11.3.dist-info/WHEEL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,44 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Jinja is a template engine written in pure Python. It provides a | ||
non-XML syntax that supports inline expressions and an optional | ||
sandboxed environment. | ||
""" | ||
jinja2 | ||
~~~~~~ | ||
Jinja2 is a template engine written in pure Python. It provides a | ||
Django inspired non-XML syntax but supports inline expressions and | ||
an optional sandboxed environment. | ||
Nutshell | ||
-------- | ||
Here a small example of a Jinja2 template:: | ||
{% extends 'base.html' %} | ||
{% block title %}Memberlist{% endblock %} | ||
{% block content %} | ||
<ul> | ||
{% for user in users %} | ||
<li><a href="{{ user.url }}">{{ user.username }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
{% endblock %} | ||
:copyright: (c) 2017 by the Jinja Team. | ||
:license: BSD, see LICENSE for more details. | ||
""" | ||
__docformat__ = 'restructuredtext en' | ||
__version__ = "2.10.3" | ||
|
||
# high level interface | ||
from jinja2.environment import Environment, Template | ||
|
||
# loaders | ||
from jinja2.loaders import BaseLoader, FileSystemLoader, PackageLoader, \ | ||
DictLoader, FunctionLoader, PrefixLoader, ChoiceLoader, \ | ||
ModuleLoader | ||
|
||
# bytecode caches | ||
from jinja2.bccache import BytecodeCache, FileSystemBytecodeCache, \ | ||
MemcachedBytecodeCache | ||
|
||
# undefined types | ||
from jinja2.runtime import Undefined, DebugUndefined, StrictUndefined, \ | ||
make_logging_undefined | ||
|
||
# exceptions | ||
from jinja2.exceptions import TemplateError, UndefinedError, \ | ||
TemplateNotFound, TemplatesNotFound, TemplateSyntaxError, \ | ||
TemplateAssertionError, TemplateRuntimeError | ||
|
||
# decorators and public utilities | ||
from jinja2.filters import environmentfilter, contextfilter, \ | ||
evalcontextfilter | ||
from jinja2.utils import Markup, escape, clear_caches, \ | ||
environmentfunction, evalcontextfunction, contextfunction, \ | ||
is_undefined, select_autoescape | ||
|
||
__all__ = [ | ||
'Environment', 'Template', 'BaseLoader', 'FileSystemLoader', | ||
'PackageLoader', 'DictLoader', 'FunctionLoader', 'PrefixLoader', | ||
'ChoiceLoader', 'BytecodeCache', 'FileSystemBytecodeCache', | ||
'MemcachedBytecodeCache', 'Undefined', 'DebugUndefined', | ||
'StrictUndefined', 'TemplateError', 'UndefinedError', 'TemplateNotFound', | ||
'TemplatesNotFound', 'TemplateSyntaxError', 'TemplateAssertionError', | ||
'TemplateRuntimeError', | ||
'ModuleLoader', 'environmentfilter', 'contextfilter', 'Markup', 'escape', | ||
'environmentfunction', 'contextfunction', 'clear_caches', 'is_undefined', | ||
'evalcontextfilter', 'evalcontextfunction', 'make_logging_undefined', | ||
'select_autoescape', | ||
] | ||
|
||
|
||
def _patch_async(): | ||
from jinja2.utils import have_async_gen | ||
if have_async_gen: | ||
from jinja2.asyncsupport import patch_all | ||
patch_all() | ||
|
||
|
||
_patch_async() | ||
del _patch_async | ||
from markupsafe import escape | ||
from markupsafe import Markup | ||
|
||
from .bccache import BytecodeCache | ||
from .bccache import FileSystemBytecodeCache | ||
from .bccache import MemcachedBytecodeCache | ||
from .environment import Environment | ||
from .environment import Template | ||
from .exceptions import TemplateAssertionError | ||
from .exceptions import TemplateError | ||
from .exceptions import TemplateNotFound | ||
from .exceptions import TemplateRuntimeError | ||
from .exceptions import TemplatesNotFound | ||
from .exceptions import TemplateSyntaxError | ||
from .exceptions import UndefinedError | ||
from .filters import contextfilter | ||
from .filters import environmentfilter | ||
from .filters import evalcontextfilter | ||
from .loaders import BaseLoader | ||
from .loaders import ChoiceLoader | ||
from .loaders import DictLoader | ||
from .loaders import FileSystemLoader | ||
from .loaders import FunctionLoader | ||
from .loaders import ModuleLoader | ||
from .loaders import PackageLoader | ||
from .loaders import PrefixLoader | ||
from .runtime import ChainableUndefined | ||
from .runtime import DebugUndefined | ||
from .runtime import make_logging_undefined | ||
from .runtime import StrictUndefined | ||
from .runtime import Undefined | ||
from .utils import clear_caches | ||
from .utils import contextfunction | ||
from .utils import environmentfunction | ||
from .utils import evalcontextfunction | ||
from .utils import is_undefined | ||
from .utils import select_autoescape | ||
|
||
__version__ = "2.11.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
import re | ||
|
||
# generated by scripts/generate_identifier_pattern.py | ||
pattern = '·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣔ-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣঁ-ঃ়া-ৄেৈো-্ৗৢৣਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑੰੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣஂா-ூெ-ைொ-்ௗఀ-ఃా-ౄె-ైొ-్ౕౖౢౣಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣංඃ්ා-ුූෘ-ෟෲෳัิ-ฺ็-๎ັິ-ູົຼ່-ໍ༹༘༙༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝᠋-᠍ᢅᢆᢩᤠ-ᤫᤰ-᤻ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼᪰-᪽ᬀ-ᬄ᬴-᭄᭫-᭳ᮀ-ᮂᮡ-ᮭ᯦-᯳ᰤ-᰷᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰℘℮⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣠-꣱ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀ꧥꨩ-ꨶꩃꩌꩍꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭ﬞ︀-️︠-︯︳︴﹍-﹏_𐇽𐋠𐍶-𐍺𐨁-𐨃𐨅𐨆𐨌-𐨏𐨸-𐨿𐨺𐫦𐫥𑀀-𑀂𑀸-𑁆𑁿-𑂂𑂰-𑂺𑄀-𑄂𑄧-𑅳𑄴𑆀-𑆂𑆳-𑇊𑇀-𑇌𑈬-𑈷𑈾𑋟-𑋪𑌀-𑌃𑌼𑌾-𑍄𑍇𑍈𑍋-𑍍𑍗𑍢𑍣𑍦-𑍬𑍰-𑍴𑐵-𑑆𑒰-𑓃𑖯-𑖵𑖸-𑗀𑗜𑗝𑘰-𑙀𑚫-𑚷𑜝-𑜫𑰯-𑰶𑰸-𑰿𑲒-𑲧𑲩-𑲶𖫰-𖫴𖬰-𖬶𖽑-𖽾𖾏-𖾒𛲝𛲞𝅥-𝅩𝅭-𝅲𝅻-𝆂𝆅-𝆋𝆪-𝆭𝉂-𝉄𝨀-𝨶𝨻-𝩬𝩵𝪄𝪛-𝪟𝪡-𝪯𞀀-𞀆𞀈-𞀘𞀛-𞀡𞀣𞀤𞀦-𞣐𞀪-𞣖𞥄-𞥊󠄀-󠇯' | ||
pattern = re.compile( | ||
r"[\w·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣔ-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣঁ-ঃ়া-ৄেৈো-্ৗৢৣਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑੰੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣஂா-ூெ-ைொ-்ௗఀ-ఃా-ౄె-ైొ-్ౕౖౢౣಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣංඃ්ා-ුූෘ-ෟෲෳัิ-ฺ็-๎ັິ-ູົຼ່-ໍ༹༘༙༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝᠋-᠍ᢅᢆᢩᤠ-ᤫᤰ-᤻ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼᪰-᪽ᬀ-ᬄ᬴-᭄᭫-᭳ᮀ-ᮂᮡ-ᮭ᯦-᯳ᰤ-᰷᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰℘℮⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣠-꣱ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀ꧥꨩ-ꨶꩃꩌꩍꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭ﬞ︀-️︠-︯︳︴﹍-﹏_𐇽𐋠𐍶-𐍺𐨁-𐨃𐨅𐨆𐨌-𐨏𐨸-𐨿𐨺𐫦𐫥𑀀-𑀂𑀸-𑁆𑁿-𑂂𑂰-𑂺𑄀-𑄂𑄧-𑅳𑄴𑆀-𑆂𑆳-𑇊𑇀-𑇌𑈬-𑈷𑈾𑋟-𑋪𑌀-𑌃𑌼𑌾-𑍄𑍇𑍈𑍋-𑍍𑍗𑍢𑍣𑍦-𑍬𑍰-𑍴𑐵-𑑆𑒰-𑓃𑖯-𑖵𑖸-𑗀𑗜𑗝𑘰-𑙀𑚫-𑚷𑜝-𑜫𑰯-𑰶𑰸-𑰿𑲒-𑲧𑲩-𑲶𖫰-𖫴𖬰-𖬶𖽑-𖽾𖾏-𖾒𛲝𛲞𝅥-𝅩𝅭-𝅲𝅻-𝆂𝆅-𝆋𝆪-𝆭𝉂-𝉄𝨀-𝨶𝨻-𝩬𝩵𝪄𝪛-𝪟𝪡-𝪯𞀀-𞀆𞀈-𞀘𞀛-𞀡𞀣𞀤𞀦-𞣐𞀪-𞣖𞥄-𞥊󠄀-󠇯]+" # noqa: B950 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,44 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
jinja2.defaults | ||
~~~~~~~~~~~~~~~ | ||
Jinja default filters and tags. | ||
:copyright: (c) 2017 by the Jinja Team. | ||
:license: BSD, see LICENSE for more details. | ||
""" | ||
from jinja2._compat import range_type | ||
from jinja2.utils import generate_lorem_ipsum, Cycler, Joiner, Namespace | ||
|
||
from ._compat import range_type | ||
from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401 | ||
from .tests import TESTS as DEFAULT_TESTS # noqa: F401 | ||
from .utils import Cycler | ||
from .utils import generate_lorem_ipsum | ||
from .utils import Joiner | ||
from .utils import Namespace | ||
|
||
# defaults for the parser / lexer | ||
BLOCK_START_STRING = '{%' | ||
BLOCK_END_STRING = '%}' | ||
VARIABLE_START_STRING = '{{' | ||
VARIABLE_END_STRING = '}}' | ||
COMMENT_START_STRING = '{#' | ||
COMMENT_END_STRING = '#}' | ||
BLOCK_START_STRING = "{%" | ||
BLOCK_END_STRING = "%}" | ||
VARIABLE_START_STRING = "{{" | ||
VARIABLE_END_STRING = "}}" | ||
COMMENT_START_STRING = "{#" | ||
COMMENT_END_STRING = "#}" | ||
LINE_STATEMENT_PREFIX = None | ||
LINE_COMMENT_PREFIX = None | ||
TRIM_BLOCKS = False | ||
LSTRIP_BLOCKS = False | ||
NEWLINE_SEQUENCE = '\n' | ||
NEWLINE_SEQUENCE = "\n" | ||
KEEP_TRAILING_NEWLINE = False | ||
|
||
|
||
# default filters, tests and namespace | ||
from jinja2.filters import FILTERS as DEFAULT_FILTERS | ||
from jinja2.tests import TESTS as DEFAULT_TESTS | ||
|
||
DEFAULT_NAMESPACE = { | ||
'range': range_type, | ||
'dict': dict, | ||
'lipsum': generate_lorem_ipsum, | ||
'cycler': Cycler, | ||
'joiner': Joiner, | ||
'namespace': Namespace | ||
"range": range_type, | ||
"dict": dict, | ||
"lipsum": generate_lorem_ipsum, | ||
"cycler": Cycler, | ||
"joiner": Joiner, | ||
"namespace": Namespace, | ||
} | ||
|
||
|
||
# default policies | ||
DEFAULT_POLICIES = { | ||
'compiler.ascii_str': True, | ||
'urlize.rel': 'noopener', | ||
'urlize.target': None, | ||
'truncate.leeway': 5, | ||
'json.dumps_function': None, | ||
'json.dumps_kwargs': {'sort_keys': True}, | ||
'ext.i18n.trimmed': False, | ||
"compiler.ascii_str": True, | ||
"urlize.rel": "noopener", | ||
"urlize.target": None, | ||
"truncate.leeway": 5, | ||
"json.dumps_function": None, | ||
"json.dumps_kwargs": {"sort_keys": True}, | ||
"ext.i18n.trimmed": False, | ||
} | ||
|
||
|
||
# export all constants | ||
__all__ = tuple(x for x in locals().keys() if x.isupper()) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,220 +1,94 @@ | ||
import sys | ||
from ast import literal_eval | ||
from itertools import islice, chain | ||
from jinja2 import nodes | ||
from jinja2._compat import text_type | ||
from jinja2.compiler import CodeGenerator, has_safe_repr | ||
from jinja2.environment import Environment, Template | ||
from jinja2.utils import concat, escape | ||
from itertools import chain | ||
from itertools import islice | ||
|
||
from . import nodes | ||
from ._compat import text_type | ||
from .compiler import CodeGenerator | ||
from .compiler import has_safe_repr | ||
from .environment import Environment | ||
from .environment import Template | ||
|
||
|
||
def native_concat(nodes): | ||
"""Return a native Python type from the list of compiled nodes. If the | ||
result is a single node, its value is returned. Otherwise, the nodes are | ||
concatenated as strings. If the result can be parsed with | ||
:func:`ast.literal_eval`, the parsed value is returned. Otherwise, the | ||
string is returned. | ||
"""Return a native Python type from the list of compiled nodes. If | ||
the result is a single node, its value is returned. Otherwise, the | ||
nodes are concatenated as strings. If the result can be parsed with | ||
:func:`ast.literal_eval`, the parsed value is returned. Otherwise, | ||
the string is returned. | ||
:param nodes: Iterable of nodes to concatenate. | ||
""" | ||
head = list(islice(nodes, 2)) | ||
|
||
if not head: | ||
return None | ||
|
||
if len(head) == 1: | ||
out = head[0] | ||
raw = head[0] | ||
else: | ||
out = u''.join([text_type(v) for v in chain(head, nodes)]) | ||
raw = u"".join([text_type(v) for v in chain(head, nodes)]) | ||
|
||
try: | ||
return literal_eval(out) | ||
return literal_eval(raw) | ||
except (ValueError, SyntaxError, MemoryError): | ||
return out | ||
return raw | ||
|
||
|
||
class NativeCodeGenerator(CodeGenerator): | ||
"""A code generator which avoids injecting ``to_string()`` calls around the | ||
internal code Jinja uses to render templates. | ||
"""A code generator which renders Python types by not adding | ||
``to_string()`` around output nodes. | ||
""" | ||
|
||
def visit_Output(self, node, frame): | ||
"""Same as :meth:`CodeGenerator.visit_Output`, but do not call | ||
``to_string`` on output nodes in generated code. | ||
""" | ||
if self.has_known_extends and frame.require_output_check: | ||
return | ||
|
||
finalize = self.environment.finalize | ||
finalize_context = getattr(finalize, 'contextfunction', False) | ||
finalize_eval = getattr(finalize, 'evalcontextfunction', False) | ||
finalize_env = getattr(finalize, 'environmentfunction', False) | ||
|
||
if finalize is not None: | ||
if finalize_context or finalize_eval: | ||
const_finalize = None | ||
elif finalize_env: | ||
def const_finalize(x): | ||
return finalize(self.environment, x) | ||
else: | ||
const_finalize = finalize | ||
else: | ||
def const_finalize(x): | ||
return x | ||
|
||
# If we are inside a frame that requires output checking, we do so. | ||
outdent_later = False | ||
|
||
if frame.require_output_check: | ||
self.writeline('if parent_template is None:') | ||
self.indent() | ||
outdent_later = True | ||
|
||
# Try to evaluate as many chunks as possible into a static string at | ||
# compile time. | ||
body = [] | ||
|
||
for child in node.nodes: | ||
try: | ||
if const_finalize is None: | ||
raise nodes.Impossible() | ||
|
||
const = child.as_const(frame.eval_ctx) | ||
if not has_safe_repr(const): | ||
raise nodes.Impossible() | ||
except nodes.Impossible: | ||
body.append(child) | ||
continue | ||
|
||
# the frame can't be volatile here, because otherwise the as_const | ||
# function would raise an Impossible exception at that point | ||
try: | ||
if frame.eval_ctx.autoescape: | ||
if hasattr(const, '__html__'): | ||
const = const.__html__() | ||
else: | ||
const = escape(const) | ||
|
||
const = const_finalize(const) | ||
except Exception: | ||
# if something goes wrong here we evaluate the node at runtime | ||
# for easier debugging | ||
body.append(child) | ||
continue | ||
|
||
if body and isinstance(body[-1], list): | ||
body[-1].append(const) | ||
else: | ||
body.append([const]) | ||
|
||
# if we have less than 3 nodes or a buffer we yield or extend/append | ||
if len(body) < 3 or frame.buffer is not None: | ||
if frame.buffer is not None: | ||
# for one item we append, for more we extend | ||
if len(body) == 1: | ||
self.writeline('%s.append(' % frame.buffer) | ||
else: | ||
self.writeline('%s.extend((' % frame.buffer) | ||
|
||
self.indent() | ||
|
||
for item in body: | ||
if isinstance(item, list): | ||
val = repr(native_concat(item)) | ||
|
||
if frame.buffer is None: | ||
self.writeline('yield ' + val) | ||
else: | ||
self.writeline(val + ',') | ||
else: | ||
if frame.buffer is None: | ||
self.writeline('yield ', item) | ||
else: | ||
self.newline(item) | ||
|
||
close = 0 | ||
|
||
if finalize is not None: | ||
self.write('environment.finalize(') | ||
|
||
if finalize_context: | ||
self.write('context, ') | ||
|
||
close += 1 | ||
|
||
self.visit(item, frame) | ||
|
||
if close > 0: | ||
self.write(')' * close) | ||
|
||
if frame.buffer is not None: | ||
self.write(',') | ||
|
||
if frame.buffer is not None: | ||
# close the open parentheses | ||
self.outdent() | ||
self.writeline(len(body) == 1 and ')' or '))') | ||
|
||
# otherwise we create a format string as this is faster in that case | ||
else: | ||
format = [] | ||
arguments = [] | ||
|
||
for item in body: | ||
if isinstance(item, list): | ||
format.append(native_concat(item).replace('%', '%%')) | ||
else: | ||
format.append('%s') | ||
arguments.append(item) | ||
|
||
self.writeline('yield ') | ||
self.write(repr(concat(format)) + ' % (') | ||
self.indent() | ||
|
||
for argument in arguments: | ||
self.newline(argument) | ||
close = 0 | ||
|
||
if finalize is not None: | ||
self.write('environment.finalize(') | ||
|
||
if finalize_context: | ||
self.write('context, ') | ||
elif finalize_eval: | ||
self.write('context.eval_ctx, ') | ||
elif finalize_env: | ||
self.write('environment, ') | ||
|
||
close += 1 | ||
|
||
self.visit(argument, frame) | ||
self.write(')' * close + ', ') | ||
|
||
self.outdent() | ||
self.writeline(')') | ||
@staticmethod | ||
def _default_finalize(value): | ||
return value | ||
|
||
def _output_const_repr(self, group): | ||
return repr(u"".join([text_type(v) for v in group])) | ||
|
||
def _output_child_to_const(self, node, frame, finalize): | ||
const = node.as_const(frame.eval_ctx) | ||
|
||
if not has_safe_repr(const): | ||
raise nodes.Impossible() | ||
|
||
if outdent_later: | ||
self.outdent() | ||
if isinstance(node, nodes.TemplateData): | ||
return const | ||
|
||
return finalize.const(const) | ||
|
||
def _output_child_pre(self, node, frame, finalize): | ||
if finalize.src is not None: | ||
self.write(finalize.src) | ||
|
||
def _output_child_post(self, node, frame, finalize): | ||
if finalize.src is not None: | ||
self.write(")") | ||
|
||
|
||
class NativeEnvironment(Environment): | ||
"""An environment that renders templates to native Python types.""" | ||
|
||
code_generator_class = NativeCodeGenerator | ||
|
||
|
||
class NativeTemplate(Template): | ||
environment_class = NativeEnvironment | ||
|
||
def render(self, *args, **kwargs): | ||
"""Render the template to produce a native Python type. If the result | ||
is a single node, its value is returned. Otherwise, the nodes are | ||
concatenated as strings. If the result can be parsed with | ||
:func:`ast.literal_eval`, the parsed value is returned. Otherwise, the | ||
string is returned. | ||
"""Render the template to produce a native Python type. If the | ||
result is a single node, its value is returned. Otherwise, the | ||
nodes are concatenated as strings. If the result can be parsed | ||
with :func:`ast.literal_eval`, the parsed value is returned. | ||
Otherwise, the string is returned. | ||
""" | ||
vars = dict(*args, **kwargs) | ||
|
||
try: | ||
return native_concat(self.root_render_func(self.new_context(vars))) | ||
except Exception: | ||
exc_info = sys.exc_info() | ||
return self.environment.handle_exception() | ||
|
||
return self.environment.handle_exception(exc_info, True) | ||
|
||
|
||
class NativeEnvironment(Environment): | ||
"""An environment that renders templates to native Python types.""" | ||
|
||
code_generator_class = NativeCodeGenerator | ||
template_class = NativeTemplate | ||
NativeEnvironment.template_class = NativeTemplate |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.