https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/genshi/template/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/genshi/template/__pycache__/interpolation.cpython-310.pyc
o

!�b6�@s�dZddlmZddlZddlmZddlmZddlm	Z	m
Z
ddlmZdgZ
d	Zd
ZedZdZe�d
def�Zddd�Zdd�ZdS)z�String interpolation routines, i.e. the splitting up a given text into some
parts that are literal strings, and others that are Python expressions.
�)�chainN)�PseudoToken)�TEXT)�TemplateSyntaxError�EXPR)�
Expression�interpolatezrestructuredtext en�5abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_z.0123456789�$z	%s|%s(?s)z)[uU]?[rR]?("""|\'\'\')((?<!\\)\\\1|.)*?\1����strictc
cs>�|||g}g}d}tt|||�dg�D]�\}}	|rd|r,td�|�|fV|dd�=d}|	rczt|	��|d|d|d�}
t|
t|�fVWn*tyb}zt	|||d|d|j
p[d��d}~wwn
|�|	�|durqt|�}d|	vr�|	��}|dt
|�d7<|dt
|d	�7<q|dt
|	�7<qdS)
a�Parse the given string and extract expressions.
    
    This function is a generator that yields `TEXT` events for literal strings,
    and `EXPR` events for expressions, depending on the results of parsing the
    string.
    
    >>> for kind, data, pos in interpolate("hey ${foo}bar"):
    ...     print('%s %r' % (kind, data))
    TEXT 'hey '
    EXPR Expression('foo')
    TEXT 'bar'
    
    :param text: the text to parse
    :param filepath: absolute path to the file in which the text was found
                     (optional)
    :param lineno: the line number at which the text was found (optional)
    :param offset: the column number at which the text starts in the source
                   (optional)
    :param lookup: the variable lookup mechanism; either "lenient" (the
                   default), "strict", or a custom lookup class
    :return: a list of `TEXT` and `EXPR` events
    :raise TemplateSyntaxError: when a syntax error in an expression is
                                encountered
    N)T�r
r�)�lookup��
r)r�lexr�joinr�stripr�tuple�SyntaxErrorr�offset�append�
splitlines�len)
�text�filepath�linenorr�pos�textbuf�textpos�is_expr�chunk�expr�err�lines�r&�?/usr/lib/python3/dist-packages/genshi/template/interpolation.pyr's@�

�����
	�ccs�d}}t|�}d}	|r|�t|d�}d}n|�t|�}|dks)||dkr*n�||d}|dkr�||krAd|||�fV|d}d}|r�t�||�}	|	dusW|	��sdtd|g|dd��R��|	��}|	jd\}
}||
|�}|dkr~|d7}n|dkr�|d8}|sId	||d|d�fVnc|t	vr�||kr�d|||�fV|}|d7}||kr�||}
|
t
vr�n|d7}||ks�d	||d|���fVn)|s�|tkr�||kr�d|||�fVd	}|d}nd|||d�fV|d}q||k�r
d||d�fVdSdS)
NrFrr�{zinvalid syntax��}T)r�find�PREFIX�token_re�match�groupr�end�regs�	NAMESTART�	NAMECHARSr)rr rrrr0�escaped�next�levelr.�tstart�tend�token�charr&r&r'r_sn�
�
��
�
5�r)Nrrr)�__doc__�	itertoolsr�re�tokenizer�genshi.corer�genshi.template.baserr�genshi.template.evalr�__all__�
__docformat__r2r3r,�compiler-rrr&r&r&r'�<module>s$
�
8

https://t.me/RX1948 - 2025