HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/mako/ext/__pycache__/extract.cpython-310.pyc
o

%we3�@sJddlmZddlmZddlZddlmZddlmZGdd�d�ZdS)�)�BytesIO)�StringION)�lexer)�	parsetreec@s,eZdZdZdd�Zdd�Zedd��ZdS)	�MessageExtractorTccs6�tj|��|jdd���}|�|���EdHdS)N�encoding)�input_encoding)r�Lexer�read�config�parse�
extract_nodes�get_children)�self�fileobj�
template_node�r�I/home/arjun/projects/env/lib/python3.10/site-packages/mako/ext/extract.py�process_files���zMessageExtractor.process_fileccsN�g}d}|jdpd}ttdt�d|jd���}|D�]}d}|r/t|tj�r/|j�	�s/qt|tj
�r^|j�	�}|rG|�|�
|j|��q|D]}	|�|	�r\d}|�|�
|j|��qIqt|tj�rl|jj}
|j}n]t|tj�rz|jj}
|j}nOt|tj�r�|jj}
|j}nAt|tj�r�|jj}
n6t|tj�r�|j}
|j}n)t|tj�r�|jr�d}q|j}
nt|tj�r�d}|jj}
nt|tj�r�|jj}
nq|r�|dd|jd	kr�g}d
d�|D�}t|
t�r�|jr�|
� |d�}
d}|jr�t!d
|
�}
nt"d|
�}
|�#|
|jd	|�D]}
|
Vd}�q	|�rg}d}|�r$|�$|�EdHqdS)NFr�asciiz\s+zcomment-tagsT���r�cSsg|]}|d�qS)rr)�.0�commentrrr�
<listcomp>[s�z2MessageExtractor.extract_nodes.<locals>.<listcomp>�backslashreplace�
�
)%r�list�filter�re�split�
isinstancer�Text�content�strip�Comment�text�extend�_split_comment�lineno�
startswith�DefTag�
function_decl�code�nodes�BlockTag�	body_decl�CallTag�PageTag�CallNamespaceTag�
expression�ControlLine�isend�Code�
Expression�str�	use_bytes�encoderr�process_pythonr
)rr/�translator_comments�in_translator_commentsr�comment_tags�node�child_nodes�value�comment_tagr.�translator_strings�used_translator_comments�messagerrrr
s���
�
��
�
��


�����zMessageExtractor.extract_nodescs�fdd�t|���D�S)zzReturn the multiline comment at lineno split into a list of
        comment line numbers and the accompanying comment linecsg|]
\}}�||f�qSrr)r�index�line�r*rrr~s
��z3MessageExtractor._split_comment.<locals>.<listcomp>)�	enumerate�
splitlines)r*rrrJrr)zs

�zMessageExtractor._split_commentN)�__name__�
__module__�__qualname__r;rr
�staticmethodr)rrrrrsbr)�iorrr �makorrrrrrr�<module>s