%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/python/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/python/__pycache__/htmlizer.cpython-312.pyc

�

Ϫ�f*���dZddlZddlZddlmZddlmZddlmZGd�d�Z	Gd	�d
�Z
Gd�de
�Ze
fd
�Zd�Z
edk(re
�yy)z"
HTML rendering of Python source.
�N)�escape)�List�)�reflectc�2�eZdZdZd\ZZdxZZdZd�Z	d�Z
y)�TokenPrinterzU
    Format a stream of tokens and intermediate whitespace, for pretty-printing.
    )rrr�utf-8c��||_y)zJ
        @param writer: A file-like object, opened in bytes mode.
        N)�writer)�selfrs  �9/usr/lib/python3/dist-packages/twisted/python/htmlizer.py�__init__zTokenPrinter.__init__s�����c�b�ttd�r|tjk(r||_yt	|t
�s|j
|j�}|\}}|\}}	|j|kr0|jd||jz
z�|dc|_|_	|jd||jz
z�|jr
d}d|_np|tjk(r*tj|�rd}nE|jrd}n6d	}n3tjj!|�}|�J�|j#�}|j||�|	|_	|xj|j%d�z
c_|j|k7rd|_	|d
v|_
|dk(rd|_yy)N�ENCODING�
r� �
identifierr�keyword�	parameter�variable)sdefsclass�:)�hasattr�tokenizer�encoding�
isinstance�bytes�encode�currentLiner�
currentCol�lastIdentifier�
parameters�NAMEr�	iskeyword�tok_name�get�lower�count)
r�type�token�sCoordinates�eCoordinates�line�srow�scol�erow�ecols
          r
�
printtokenzTokenPrinter.printtoken s}���8�Z�(�T�X�5F�5F�-F�!�D�M���%��'��L�L����/�E�#���t�#���t����d�"��K�K����(8�(8�!8�9�:�04�a�-�D��d�o����D�D�4�?�?�2�3�4�����D��D�O�
�X�]�]�
"�� � ��'� ���?�?�&�D�%�D��$�$�(�(��.�D��#�#�#��:�:�<�D����E�4� �������E�K�K��.�.�����t�#��D�O�#�'9�9����D�=��D�O�rN)�__name__�
__module__�__qualname__�__doc__r rr!r"rrr2�rr
rrs,���#��J��"#�#�N�Z��H��$ rrc�4�eZdZUdZgZeeed<d�Zdd�Z	y)�
HTMLWriterzm
    Write the stream of tokens and whitespace from L{TokenPrinter}, formating
    tokens as HTML spans.
    �noSpanc�f�||_g}tj|jd|�||_y)Nr:)rr�accumulateClassList�	__class__r:)rrr:s   r
rzHTMLWriter.__init__Os+��������#�#�D�N�N�H�f�E���rNc��t|t�r|jd�}t|�}|j	d�}|�||j
vr|j
|�y|j
d|j	d�zdz|zdz�y)Nr	s<span class="py-src-s">s</span>)rr�decoderrr:r)rr*r)s   r
�writezHTMLWriter.writeUs����e�U�#��L�L��)�E��u�
�����W�%���L�d�d�k�k�1��K�K����K�K�'��+�+�g�&�'������	�
r)N)
r3r4r5r6r:r�str�__annotations__rr@r7rr
r9r9Gs!���
�F�D��I���rr9c��eZdZdZgd�Zy)�SmallerHTMLWriterzi
    HTMLWriter that doesn't generate spans for some junk.

    Results in much smaller HTML output.
    )�	endmarker�indent�dedent�op�newline�nlN)r3r4r5r6r:r7rr
rDrDfs���F�FrrDc�L�|jd�t||j�j�j}	tj|j�D]}|\}}}}}	||||||	��	|jd�y#tj
$rY�'wxYw)Ns<pre>s</pre>
)r@rr2r�readline�
TokenError)
�inp�outr�printerr*�	tokenType�string�start�endr-s
          r
�filterrUps����I�I�h���6�#�)�)�,�2�2�3�>�>�G�
��&�&�s�|�|�4�	9�E�49�1�Y���s�D��I�v�u�c�4�8�	9�
�I�I�k������
��
�s�8B
�
B#�"B#c���ddl}t|jd|j�}t|jdd�5}t||�ddd�y#1swYyxYw)Nr�bufferr�rb)�sys�getattr�stdout�open�argvrU)rYr[�fs   r
�mainr_|sN���
�S�Z�Z��3�:�:�
6�F�	
�c�h�h�q�k�4�	 ��A��q�&�����s�
A�A�__main__)r6rr�htmlr�typingr�rrr9rDrUr_r3r7rr
�<module>rdsa��
������3 �3 �l��>F�
�F�'�	���z���F�r

Zerion Mini Shell 1.0