bgO PdZddlZddlmZmZmZmZddlZddlm Z ddl m Z ej dkrddlm Z Gdd e d Zn eeefZej dd ed edeeeefdeeefde f dZejd ededefdZeeeZdS)z[ useful context functions, see http://jinja.pocoo.org/docs/dev/api/#jinja2.contextfunction N)AnyDictOptionalUnion)web)URL)) TypedDictc$eZdZUejed<dS)_ContextappN)__name__ __module__ __qualname__r Application__annotations__g/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/aiohttp_jinja2/helpers.pyr r s _rr F)totalcontext __route_namequery_partsreturnc |d}i}|D]}||}t|trt|}nWt|turt|}n1t d|t|||||<|j|jdi|}|r||}|S)zFilter for generating urls. Usage: {{ url('the-view-name') }} might become "/path/to/view" or {{ url('item-details', id=123, query_={'active': 'true'}) }} might become "/items/1?active=true". rz8argument value should be str or int, got {} -> [{}] {!r}r) isinstancestrtypeint TypeErrorformatrouterurl_for with_query) rrrrr parts_cleankeyvalurls rr%r%s %.C"$KCj c3   c((CC #YY#  c((CC&&,fS$s))S&A&A  C *#*\ " * 9 9[ 9 9C %nnV$$ Jrstatic_file_pathc|d} |d}n#t$rtddwxYwd|d|dS)aFilter for generating urls for static files. NOTE: you'll need to set app['static_root_url'] to be used as the root for the urls returned. Usage: {{ static('styles.css') }} might become "/static/styles.css" or "http://mycdn.example.com/styles.css" rstatic_root_urlzapp does not define a static root url 'static_root_url', you need to set the url root with app['static_root_url'] = ''.Nz{}/{}/)KeyError RuntimeErrorr#rstriplstrip)rr+r static_urls rr3r3=s %.C*+  =     >>*++C002B2I2I#2N2N O OOs.)r*static)N)__doc__systypingrrrrjinja2aiohttpryarlr version_infor r r pass_contextr!r%r3dictGLOBAL_HELPERSrrrr?s ------------ v      9E CH~H(,"" "" T#s(^ $"38_ "  """"JPPCPCPPPP* r