|
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/ext/__pycache__/ |
U
O��g3 � @ sJ d dl mZ d dl mZ d dlZd dlmZ d dlmZ G dd� d�ZdS )� )�BytesIO)�StringION)�lexer)� parsetreec @ s, e Zd ZdZdd� Zdd� Zedd� �ZdS ) �MessageExtractorTc c s4 t j|�� | jd d��� }| �|�� �E d H d S )N�encoding)�input_encoding)r �Lexer�read�config�parse�
extract_nodesZget_children)�self�fileobjZ
template_node� r �=/opt/cppython/lib/python3.8/site-packages/mako/ext/extract.py�process_file s
�
zMessageExtractor.process_filec c s` g }d}| j d pd}ttd t�d| j d ���}|D �]"}d }|r\t|tj�r\|j� � s\q6t|tj
�r�|j� � }|r�|�| �
|j|�� q6|D ]&} |�| �r�d}|�| �
|j|�� q�q6t|tj�r�|jj}
|j}n�t|tj�r�|jj}
|j}n�t|tj��r|jj}
|j}n�t|tj��r(|jj}
ntt|tj��rD|j}
|j}nXt|tj��rh|j�r`d}q6|j}
n4t|tj��r�d}|jj}
nt|tj�r6|jj}
nq6|�r�|d d |jd k �r�g }d
d� |D �}t|
t��r�| j�r�|
� |d�}
d}| j�rt!d
|
�}
nt"d|
�}
| �#|
|jd |�D ]}
|
V d}�q&|�rBg }d}|r6| �$|�E d H q6d S )NFr �asciiz\s+zcomment-tagsT���r � c S s g | ]}|d �qS )r r )�.0�commentr r r �
<listcomp>[ s z2MessageExtractor.extract_nodes.<locals>.<listcomp>�backslashreplace�
�
)%r �list�filter�re�split�
isinstancer �Text�content�strip�Comment�text�extend�_split_comment�lineno�
startswithZDefTagZ
function_decl�code�nodesZBlockTagZ body_declZCallTagZPageTagZCallNamespaceTag�
expressionZControlLineZisendZCode�
Expression�str� use_bytes�encoder r Zprocess_pythonr
)r r+ Ztranslator_commentsZin_translator_commentsr Zcomment_tags�nodeZchild_nodes�valueZcomment_tagr* Ztranslator_stringsZused_translator_comments�messager r r r
s� �
�
��
�
�
��� �zMessageExtractor.extract_nodesc s � fdd�t |�� �D �S )zzReturn the multiline comment at lineno split into a list of
comment line numbers and the accompanying comment linec s g | ]\}}� | |f�qS r r )r �index�line�r( r r r ~ s �z3MessageExtractor._split_comment.<locals>.<listcomp>)� enumerate�
splitlines)r( r r r6 r r'