Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/site-packages/mako/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/site-packages/mako/__pycache__/util.cpython-38.pyc
U

O��g�)�@s�ddlmZddlZddlZddlZddlZddlZddlZddlm	Z	dd�Z
Gdd�d�Zd	d
�Zd#dd�Z
Gd
d�d�ZGdd�d�ZGdd�de�ZGdd�d�ZGdd�de�Ze�dej�Zdd�Zdd�Zdd�Zd$dd �Zd!d"�ZdS)%�)�parseN�)�importlib_metadata_getcCs||_|j|_|S�N)�__wrapped__�__name__)Z	decorated�fn�r	�6/opt/cppython/lib/python3.8/site-packages/mako/util.py�update_wrappersrc@s$eZdZdd�Zdd�Zdd�ZdS)�PluginLoadercCs||_i|_dSr)�group�impls)�selfr
r	r	r
�__init__szPluginLoader.__init__cCsl||jkr|j|�St|j�D]&}|j|kr |j|j|<|��Sq ddlm}|�d|j|f��dS)Nr)�
exceptionszCan't load plugin %s %s)rrr
�name�load�makorZRuntimeException)rr�implrr	r	r
rs

�zPluginLoader.loadcs��fdd�}||j|<dS)Ncs4t��}��d�dd�D]}t||�}qt|��S)N�.r)�
__import__�split�getattr)�mod�token��
modulepath�objnamer	r
r,sz#PluginLoader.register.<locals>.load)r)rrrrrr	rr
�register+szPluginLoader.registerN)r�
__module__�__qualname__rrrr	r	r	r
rsrcCsFd}tj�|�sBz|d7}t�|d�Wq|dkr:�YqXqdS)z,create and/or verify a filesystem directory.rri��N)�os�path�exists�makedirs)Zdir_�triesr	r	r
�verify_directory5sr(cCs(|dkr|St|ttf�s |gS|SdSr)�
isinstance�list�tuple)�x�defaultr	r	r
�to_listCs
r.c@s"eZdZdZddd�Zdd�ZdS)�memoized_propertyz2A read-only @property that is only evaluated once.NcCs||_|p|j|_|j|_dSr��fget�__doc__r�rr1�docr	r	r
rPszmemoized_property.__init__cCs&|dkr|S|�|�|j|j<}|Sr)r1�__dict__r)r�obj�cls�resultr	r	r
�__get__Uszmemoized_property.__get__)N�rr r!r2rr9r	r	r	r
r/Ls
r/c@s"eZdZdZddd�Zdd�ZdS)�memoized_instancemethodz�Decorate a method memoize its return value.

    Best applied to no-arg methods: memoization is not sensitive to
    argument values, and will always return the same value even when
    called with different arguments.

    NcCs||_|p|j|_|j|_dSrr0r3r	r	r
rfsz memoized_instancemethod.__init__cs.�dkr�S��fdd�}�j|_�j|_|S)Ncs>�j�f|�|���fdd�}�j|_�j|_|�j�j<�S)Ncs�Srr	)�a�kw�r8r	r
�memorsz>memoized_instancemethod.__get__.<locals>.oneshot.<locals>.memo)r1rr2r5)�argsr=r?�r6rr>r
�oneshotosz0memoized_instancemethod.__get__.<locals>.oneshot)rr2)rr6r7rBr	rAr
r9kszmemoized_instancemethod.__get__)Nr:r	r	r	r
r;\s
r;c@seZdZdZdd�ZdS)�SetLikeDictz0a dictionary that has some setlike methods on itcCstf|�}|�|�|S)z�produce a 'union' of this dict and another (at the key level).

        values in the second dict take precedence over that of the first)rC�update)r�otherr,r	r	r
�union�s

zSetLikeDict.unionN)rr r!r2rFr	r	r	r
rCsrCc@s*eZdZdZd
dd�Zdd�Zdd	�ZdS)�FastEncodingBufferzVa very rudimentary buffer that is faster than StringIO,
    and supports unicode data.N�strictcCs*t��|_||_d|_||_|jj|_dS)N�)�collections�deque�data�encoding�delim�errors�append�write)rrMrOr	r	r
r�s

zFastEncodingBuffer.__init__cCst��|_|jj|_dSr)rJrKrLrPrQ�rr	r	r
�truncate�s
zFastEncodingBuffer.truncatecCs2|jr |j�|j��|j|j�S|j�|j�SdSr)rMrN�joinrL�encoderOrRr	r	r
�getvalue�s�zFastEncodingBuffer.getvalue)NrH)rr r!r2rrSrVr	r	r	r
rG�s
rGc@sPeZdZdZGdd�d�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�LRUCachea$A dictionary-like object that stores a limited number of items,
    discarding lesser used items periodically.

    this is a rewrite of LRUCache from Myghty to use a periodic timestamp-based
    paradigm so that synchronization is not really needed.  the size management
    is inexact.
    c@seZdZdd�Zdd�ZdS)zLRUCache._ItemcCs||_||_t��|_dSr)�key�value�timeit�
default_timer�	timestamp�rrXrYr	r	r
r�szLRUCache._Item.__init__cCs
t|j�Sr)�reprrYrRr	r	r
�__repr__�szLRUCache._Item.__repr__N)rr r!rr_r	r	r	r
�_Item�sr`��?cCs||_||_dSr)�capacity�	threshold)rrbrcr	r	r
r�szLRUCache.__init__cCst�||�}t��|_|jSr)�dict�__getitem__rZr[r\rY)rrX�itemr	r	r
re�s
zLRUCache.__getitem__cCsdd�t�|�D�S)NcSsg|]
}|j�qSr	)rY)�.0�ir	r	r
�
<listcomp>�sz#LRUCache.values.<locals>.<listcomp>)rd�valuesrRr	r	r
rj�szLRUCache.valuescCs||kr||S|||<|Srr	r]r	r	r
�
setdefault�szLRUCache.setdefaultcCsBt�||�}|dkr0|�||�}t�|||�n||_|��dSr)rd�getr`�__setitem__rY�_manage_size)rrXrYrfr	r	r
rm�szLRUCache.__setitem__c	Csvt|�|j|j|jkrrtt�|�t�d�dd�}||jd�D],}z||j=WqBt	k
rlYqYqBXqBqdS)Nr\T)rX�reverse)
�lenrbrc�sortedrdrj�operator�
attrgetterrX�KeyError)rZbytimerfr	r	r
rn�s�zLRUCache._manage_sizeN)ra)rr r!r2r`rrerjrkrmrnr	r	r	r
rW�s	
	rWz([ \t\f]* \# .* coding[=:][ \t]*([-\w.]+)c	Cs�|��}|�d�z�|��}|�tj�}|r>|ttj�d�}t�|�	dd��}|s�zt
|�	dd��Wnttfk
r�YnX|��}t�|�	dd��}|r�|r�td��W�"dS|r�|�
d�W�SW�dSW5|�|�XdS)aDeduce the encoding of a Python source file (binary mode) from magic
    comment.

    It does this in the same way as the `Python interpreter`__

    .. __: http://docs.python.org/ref/encodings.html

    The ``fp`` argument should be a seekable file object in binary mode.
    rN�ascii�ignorez\python refuses to compile code with both a UTF8 byte-order-mark and a magic encoding comment�utf_8r)�tell�seek�readline�
startswith�codecs�BOM_UTF8rp�_PYTHON_MAGIC_COMMENT_re�match�decoder�ImportError�SyntaxErrorr
)�fp�pos�line1Zhas_bom�m�line2r	r	r
�parse_encoding�s6


��r�cs4t����}|��dd��fdd�|D��dS)z{repr() a dictionary with the keys in order.

    Used by the lexer unit test to compare parse trees based on strings.

    �{z, c3s|]}d|�|fVqdS)z%r: %rNr	)rg�k��dr	r
�	<genexpr>"sz#sorted_dict_repr.<locals>.<genexpr>�})r*�keys�sortrT)r�r�r	r�r
�sorted_dict_reprsr�cCsxt|d�rdSd|_tddd|j�}t|�|_|jjD]&}|jdkrL||_q6|jdkr6||_q6t|j	d�|_
t|j	d	�|_t|j	d
�|_t|j	dj
d�|_t|j	dj
dj�|_t|j	dj�|_t|j	djj�|_t|j	djjj�|_t|j	djjj�|_t|j	djjjj�|_t|j	d
jj�|_t|j	d
jjj�|_t|j	d
jjjj�|_t|j	d
jjjjj�|_t|j	djj�|_t|j	djjj�|_t|j	djjjj�|_ t|j	djj�|_!t|j	djj"dj�|_#t|j	djjj�|_$t|j	djjjj�|_%t|j	djjjj&j�|_'t|j	djjjj�|_(t|j	djj�|_!t|j	djj"dj�|_#t|j	djj)d�|_*t|j	djj)d	�|_+t|j	djjj)d�|_,t|j	djjj)d	�|_-t|j	djj)d�|_.t|j	djj)d	�|_/t|j	djj)d
�|_0t|j	djj)d�|_1t|j	djj)d�|_2t|j	djj)d	�|_3dS)zdAttempt to restore the required classes to the _ast module if it
    appears to be missing them
    �ASTNiadef foo(): pass
class Bar: pass
if False: pass
baz = 'mako'
1 + 2 - 3 * 4 / 5
6 // 7 % 8 << 9 >> 10
11 & 12 ^ 13 | 14
15 and 16 or 17
-baz + (not +18) - ~17
baz and 'foo' or 'bar'
(mako is baz == baz) is not baz != mako
mako > baz < mako >= baz <= mako
mako in baz not in makoz	<unknown>�execrrr���r"����	�
��)4�hasattr�
PyCF_ONLY_AST�compile�type�Module�__mro__rrr��body�FunctionDef�ClassDef�If�targets�Name�ctx�StorerY�Str�op�Sub�left�Add�right�Div�Mult�RShift�LShift�Mod�FloorDiv�BitOr�BitXor�BitAnd�Orrj�And�Invert�Not�operand�UAdd�USubZops�IsNot�NotEq�Is�Eq�Gt�Lt�GtE�LtE�In�NotIn)�_astr�r7r	r	r
�restore__ast%sd
�


r��rbc
Cs*t||��}|��W5QR�SQRXdSr)�open�read)r$�moder�r	r	r
�	read_filevsr�cCs@t|d�}z&t|�}|��}|r*|�|�}|W�S|��XdS)Nr�)r��closer�r�r�)r$r�rMrLr	r	r
�read_python_file{s

r�)N)r�)�astrr|rJrrr#�rerZ�compatrrrr(r.r/r;rdrCrGrWr��VERBOSEr~r�r�r�r�r�r	r	r	r
�<module>s2
	#
?�1Q


F1le Man4ger