/usr/local/lib/python3.6/site-packages/jinja2/__pycache__
NameSizeModeActions
async_utils.cpython-36.pyc24350644editdlrm
bccache.cpython-36.pyc130970644editdlrm
compiler.cpython-36.pyc543690644editdlrm
constants.cpython-36.pyc14960644editdlrm
debug.cpython-36.pyc53440644editdlrm
defaults.cpython-36.pyc12410644editdlrm
environment.cpython-36.pyc523970644editdlrm
exceptions.cpython-36.pyc54980644editdlrm
ext.cpython-36.pyc262740644editdlrm
filters.cpython-36.pyc497540644editdlrm
idtracking.cpython-36.pyc111250644editdlrm
lexer.cpython-36.pyc199830644editdlrm
loaders.cpython-36.pyc202170644editdlrm
meta.cpython-36.pyc37460644editdlrm
nativetypes.cpython-36.pyc48050644editdlrm
nodes.cpython-36.pyc411930644editdlrm
optimizer.cpython-36.pyc18610644editdlrm
parser.cpython-36.pyc276350644editdlrm
runtime.cpython-36.pyc328630644editdlrm
sandbox.cpython-36.pyc116960644editdlrm
tests.cpython-36.pyc64820644editdlrm
utils.cpython-36.pyc272170644editdlrm
visitor.cpython-36.pyc38390644editdlrm
_identifier.cpython-36.pyc18500644editdlrm
__init__.cpython-36.pyc18650644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/jinja2/__pycache__/utils.cpython-36.pyc (27217B)
3 ^TBg[i@shUddlZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddl mZddlmZddlmZddlZejrddlZejd ejd ejfd Zed fd ddiZejeZejedj Z!eedddZ"eedddZ#eedddZ$Gdddej%Z&eedddZ'eedddZ(eedddZ)eedd d!Z*eje+d"d#d$Z,ej-ejdd%d&d'Z.dd(d)d*Z/d_e0e+ejd,d-d.Z1d`e0e0ej2ej3d0d1d2Z4eje0d"d3d4Z5eje0d"d5d6Z6ej7d7ej8ej9BZ:ej7d8Z;dae0ej2e<ej2e0ej2e0ej2ej-e0e0d9d:d;Z=dbedceje0e+e0dDdEdFZ?ddeje0e+e0dDdGdHZ@ejAjBGdIdJdJZCdefd=d+fejDe0ejDe0e+e+ejej2e0ge+fdNdOdPZEdfejej2ejd e0fejejFdQdRdSZGGdTdUdUZHGdVdWdWZIGdXdYdYZJGdZd[d[ejFZFeje0d\d]d^ZKdS)gN)abc)deque)choice) randrange)Lock)CodeType)quote_from_bytesF.)ZboundZ MissingType__repr__cCsdS)Nmissing)xr r ./tmp/pip-build-0s3hx122/Jinja2/jinja2/utils.pysr)freturncCs tj|_|S)aPass the :class:`~jinja2.runtime.Context` as the first argument to the decorated function when called while rendering a template. Can be used on functions, filters, and tests. If only ``Context.eval_context`` is needed, use :func:`pass_eval_context`. If only ``Context.environment`` is needed, use :func:`pass_environment`. .. versionadded:: 3.0.0 Replaces ``contextfunction`` and ``contextfilter``. )_PassArgcontextjinja_pass_arg)rr r r pass_contexts rcCs tj|_|S)aPass the :class:`~jinja2.nodes.EvalContext` as the first argument to the decorated function when called while rendering a template. See :ref:`eval-context`. Can be used on functions, filters, and tests. If only ``EvalContext.environment`` is needed, use :func:`pass_environment`. .. versionadded:: 3.0.0 Replaces ``evalcontextfunction`` and ``evalcontextfilter``. )r eval_contextr)rr r rpass_eval_context/s rcCs tj|_|S)aPass the :class:`~jinja2.Environment` as the first argument to the decorated function when called while rendering a template. Can be used on functions, filters, and tests. .. versionadded:: 3.0.0 Replaces ``environmentfunction`` and ``environmentfilter``. )r environmentr)rr r rpass_environment@s rc@s>eZdZejZejZejZee e j ddddZ dS)r)objrcCst|dr|jSxjdD]b}|jdd}xP|d|dfD]8}t||d d krrr r rconsumes r?)rcCs,ddlm}ddlm}|j|jdS)a Jinja keeps internal caches for environments and lexers. These are used so that Jinja doesn't have to recreate environments and lexers all the time. Normally you don't have to care about that but if you are measuring memory consumption you may want to clean the caches. r:)get_spontaneous_environment) _lexer_cacheN)rr@lexerrA cache_clearclear)r@rAr r r clear_cachess  rEF) import_namesilentrc CsvyRd|kr|jdd\}}n"d|kr6|jd\}}}nt|Stt|dd|g|Sttfk rp|slYnXdS)aImports an object based on a string. This is useful if you want to use import paths as endpoints or something similar. An import path can be specified either in dotted notation (``xml.sax.saxutils.escape``) or with a colon as object delimiter (``xml.sax.saxutils:escape``). If the `silent` is True the return value will be `None` if the import fails. :return: imported object :r:.N)split rpartition __import__r# ImportErrorAttributeError)rFrGmodulerrr r r import_strings rPrb)filenamemodercCstjj|sdSt||S)z\Returns a file descriptor for the filename if that file exists, otherwise ``None``. N)ospathisfileopen)rRrSr r ropen_if_existss rXcCsJ|dkr dS|tkrdSt|}|jdkr6|jdS|jd|jdS)zReturns the name of the object's type. For some recognized singletons the name of the object is returned instead. (For example for `None` and `Ellipsis`). NNoneEllipsisbuiltinsz objectrI)rZtyper,r+)rr'r r robject_type_reprs  r]cCsddlm}||S)z.Format an object using :func:`pprint.pformat`.r)pformat)pprintr^)rr^r r rr^s r^a@ ^ ( (https?://|www\.) # scheme or www (([\w%-]+\.)+)? # subdomain ( [a-z]{2,63} # basic tld | xn--[\w%]{2,59} # idna tld ) | ([\w%-]{2,63}\.)+ # basic domain (com|net|int|edu|gov|org|info|mil) # basic tld | (https?://) # scheme ( (([\d]{1,3})(\.[\d]{1,3}){3}) # IPv4 | (\[([\da-f]{0,4}:){2}([\da-f]{0,4}:?){1,6}]) # IPv6 ) ) (?::[\d]{1,5})? # port (?:[/?#]\S*)? # path, query, and fragment $ z^\S+@\w[\w.-]*\.\w+$)texttrim_url_limitreltarget extra_schemesrc sdk rttdfdd }nttddd}tjdttj|}|rZdtj|dnd }|rtd tj|dnd }xJt|D]<\} } d | d } } } tjd | }|r|j} | |jd} | j d"rtj d| }|r|j} | d|j } x~d&D]v\}}| j |}|| j |kr(qxLt t|| j |D]4}| j|t|}| | d|7} | |d} q>WqWtj| r| jds| jdrd| d||d || d} n d| d||d || d} n| jdr tj| ddr d| d| ddd} nd| krb| jd rbd | krbtj| rbd!| d| d} nL|dk rx@|D]8}| |krr| j|rrd| d||d | d} qrW| | | || <qWd j|S)'a;Convert URLs in text into clickable links. This may not recognize links in some situations. Usually, a more comprehensive formatter, such as a Markdown library, is a better choice. Works on ``http://``, ``https://``, ``www.``, ``mailto:``, and email addresses. Links with trailing punctuation (periods, commas, closing parentheses) and leading punctuation (opening parentheses) are recognized excluding the punctuation. Email addresses that include header fields are not recognized (for example, ``mailto:address@example.com?cc=copy@example.com``). :param text: Original text containing URLs to link. :param trim_url_limit: Shorten displayed URL values to this length. :param target: Add the ``target`` attribute to links. :param rel: Add the ``rel`` attribute to links. :param extra_schemes: Recognize URLs that start with these schemes in addition to the default behavior. .. versionchanged:: 3.0 The ``extra_schemes`` parameter was added. .. versionchanged:: 3.0 Generate ``https://`` links for URLs without a scheme. .. versionchanged:: 3.0 The parsing rules were updated. Recognize email addresses with or without the ``mailto:`` scheme. Validate IP addresses. Ignore parentheses and brackets in more cases. N)r rcs"t|kr|ddS|S)Nz...)len)r )rar rtrim_urlGs zurlize..trim_urlcSs|S)Nr )r r r rrfOsz(\s+)z rel=""rz target="z ^([(<]|<)+)>rI, >z([)>.,\n]|>)+$(<<zhttps://zhttp://z @zwww.rHzdj |St j dj dd|DS)z+Generate some lorem ipsum for the template.r:)LOREM_IPSUM_WORDSTrNFrrj rrI z rkcss |]}dtj|dVqdS)z

z

N)rwrx).0r r r r sz'generate_lorem_ipsum..) constantsrrJrryrr capitalizeappendrr}rwMarkup)rrrrrrresultrZnext_capitalizedZ last_commaZ last_fullstoprlastpidxZp_strr r rgenerate_lorem_ipsumsJ     rutf-8)rcharsetfor_qsrcCsPt|ts&t|tst|}|j|}|r.dnd}t||}|rL|jdd}|S)a5Quote a string for use in a URL using the given charset. :param obj: String or bytes to quote. Other types are converted to string then encoded to bytes using the given charset. :param charset: Encode text to bytes using this charset. :param for_qs: Quote "/" and use "+" for spaces. /z%20+)r<bytesruencoderr")rrrsafervr r r url_quotes      rcCs&ddl}|jdtddt|||dS)Nrz_'unicode_urlencode' has been renamed to 'url_quote'. The old name will be removed in Jinja 3.1.r)r )rr)r$r%r&r)rrrr$r r runicode_urlencodes rc@seZdZdZeddddZddddZeje ej fdd d Z eje ej fdd d d Z ej dddZddddZd1ej ej ej dddZd2ej ej ej dddZddddZej edddZedddZe dddZej ej dd d!Zej ej dd"d#d$Zej ddd%d&Zejej ej ej fdd'd(Zejej dd)d*Zejej dd+d,Zejej dd-d.Zejej dd/d0Z eZ!dS)3LRUCachez"A simple LRU Cache implementation.N)capacityrcCs ||_i|_t|_|jdS)N)r_mappingr_queue _postinit)selfrr r r__init__szLRUCache.__init__)rcCs4|jj|_|jj|_|jj|_t|_|jj |_ dS)N) rpopleft_popleftpopZ_popremove_remover_wlockr_append)rr r rrs    zLRUCache._postinitcCs|j|j|jdS)N)rrr)rrr)rr r r __getstate__szLRUCache.__getstate__)drcCs|jj||jdS)N)__dict__updater)rrr r r __setstate__s zLRUCache.__setstate__cCs|jfS)N)r)rr r r__getnewargs__szLRUCache.__getnewargs__cCs,|j|j}|jj|j|jj|j|S)z&Return a shallow copy of the instance.) __class__rrrrextend)rrr r rcopys z LRUCache.copy)keydefaultrc Cs"y||Stk r|SXdS)z/Return an item from the cache dict or `default`N)KeyError)rrrr r rgetsz LRUCache.getc Cs*y||Stk r$|||<|SXdS)zvSet `default` if the key is not in the cache otherwise leave unchanged. Return the value of this key. N)r)rrrr r r setdefault$s zLRUCache.setdefaultc Cs*|j|jj|jjWdQRXdS)zClear the cache.N)rrrDr)rr r rrD.s zLRUCache.clear)rrcCs ||jkS)z$Check if a key exists in this cache.)r)rrr r r __contains__4szLRUCache.__contains__cCs t|jS)z%Return the current size of the cache.)rer)rr r r__len__8szLRUCache.__len__cCsdt|jd|jdS)Nrnrri)r\r+r)rr r rr <szLRUCache.__repr__cCs\|jL|j|}|jd|krNy|j|Wntk rBYnX|j||SQRXdS)zGet an item from the cache. Moves the item up so that it has the highest priority then. Raise a `KeyError` if it does not exist. r:Nr)rrrr ValueErrorr)rrrr r r __getitem__?s  zLRUCache.__getitem__)rvaluerc Cs\|jL||jkr|j|nt|j|jkr:|j|j=|j|||j|<WdQRXdS)zhSets the value for an item. Moves the item up so that it has the highest priority then. N)rrrrerrr)rrrr r r __setitem__Us    zLRUCache.__setitem__cCsB|j2|j|=y|j|Wntk r2YnXWdQRXdS)z]Remove an item from the cache dict. Raise a `KeyError` if it does not exist. N)rrrr)rrr r r __delitem__bs zLRUCache.__delitem__cs$fddtjD}|j|S)zReturn a list of items.csg|]}|j|fqSr )r)rr)rr r psz"LRUCache.items..)listrreverse)rrr )rritemsnszLRUCache.itemscCsdd|jDS)zReturn a list of all values.cSsg|] }|dqS)r:r )rr r r rrvsz#LRUCache.values..)r)rr r rvaluestszLRUCache.valuescCst|S)z7Return a list of all keys ordered by most recent usage.)r)rr r rkeysxsz LRUCache.keyscCstt|jS)N)reversedtupler)rr r r__iter__|szLRUCache.__iter__cCstt|jS)zTIterate over the keys in the cache dict, oldest items coming first. )iterrr)rr r r __reversed__szLRUCache.__reversed__)N)N)"r+r,r-__doc__intrrr1MappingruAnyrrZTuplerrrrrDboolrrr rrrIterablerrrIteratorrr__copy__r r r rrs,   "rrhtmxml)enabled_extensionsdisabled_extensionsdefault_for_stringrrcsHtdd|Dtdd|Dtjttdfdd }|S)acIntelligently sets the initial value of autoescaping based on the filename of the template. This is the recommended way to configure autoescaping if you do not want to write a custom function yourself. If you want to enable it for all templates created from strings or for all templates with `.html` and `.xml` extensions:: from jinja2 import Environment, select_autoescape env = Environment(autoescape=select_autoescape( enabled_extensions=('html', 'xml'), default_for_string=True, )) Example configuration to turn it on at all times except if the template ends with `.txt`:: from jinja2 import Environment, select_autoescape env = Environment(autoescape=select_autoescape( disabled_extensions=('txt',), default_for_string=True, default=True, )) The `enabled_extensions` is an iterable of all the extensions that autoescaping should be enabled for. Likewise `disabled_extensions` is a list of all templates it should be disabled for. If a template is loaded from a string then the default from `default_for_string` is used. If nothing matches then the initial value of autoescaping is set to the value of `default`. For security reasons this function operates case insensitive. .. versionadded:: 2.9 css"|]}d|jdjVqdS)rIN)lstriplower)rr r r rrsz$select_autoescape..css"|]}d|jdjVqdS)rIN)rr)rr r r rrs) template_namercs4|dkr S|j}|jr"dS|jr0dSS)NTF)rr})r)rrdisabled_patternsenabled_patternsr r autoescapes  z%select_autoescape..autoescape)rr1r2rur)rrrrrr )rrrrrselect_autoescapes( r)rdumpskwargsrcKs@|dkrtj}tj||f|jddjddjddjdd S) aSerialize an object to a string of JSON with :func:`json.dumps`, then replace HTML-unsafe characters with Unicode escapes and mark the result safe with :class:`~markupsafe.Markup`. This is available in templates as the ``|tojson`` filter. The following characters are escaped: ``<``, ``>``, ``&``, ``'``. The returned string is safe to render in HTML documents and ``