HEX
Server: nginx/1.24.0
System: Linux localhost 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64
User: www (1000)
PHP: 8.3.27
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: //usr/lib/python3/dist-packages/twisted/python/__pycache__/htmlizer.cpython-310.pyc
o

�b*�@s�dZddlZddlZddlmZddlmZddlmZGdd�d�Z	Gd	d
�d
�Z
Gdd�de
�Ze
fd
d�Zdd�Z
edkrEe
�dSdS)z"
HTML rendering of Python source.
�N)�escape)�List�)�reflectc@s4eZdZdZd\ZZdZZdZdd�Z	dd�Z
d	S)
�TokenPrinterzU
    Format a stream of tokens and intermediate whitespace, for pretty-printing.
    )rrr�utf-8cCs
||_dS)zJ
        @param writer: A file-like object, opened in bytes mode.
        N)�writer)�selfr�r
�9/usr/lib/python3/dist-packages/twisted/python/htmlizer.py�__init__s
zTokenPrinter.__init__c
Cs8ttd�r|tjkr||_dSt|t�s|�|j�}|\}}|\}}	|j|kr8|�d||j�|d|_|_	|�d||j	�|j
rKd}d|_n&|tjkrat
�|�rXd}n|jr^d}nd	}ntj�|�}|dusmJ�|��}|�||�|	|_	|j|�d�7_|j|kr�d|_	|d
v|_
|dkr�d|_dSdS)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�ecolr
r
r�
printtoken s@






�zTokenPrinter.printtokenN)�__name__�
__module__�__qualname__�__doc__rrrrrrr.r
r
r
rrsrc@s4eZdZUdZgZeeed<dd�Zddd�Z	dS)	�
HTMLWriterzm
    Write the stream of tokens and whitespace from L{TokenPrinter}, formating
    tokens as HTML spans.
    �noSpancCs$||_g}t�|jd|�||_dS)Nr4)rr�accumulateClassList�	__class__r4)r	rr4r
r
rrOs
zHTMLWriter.__init__NcCsjt|t�r
|�d�}t|�}|�d�}|dus||jvr#|�|�dS|�d|�d�d|d�dS)Nrs<span class="py-src-s">s</span>)rr�decoderrr4r)r	r&r%r
r
r�writeUs"


�����zHTMLWriter.write)N)
r/r0r1r2r4r�str�__annotations__rr8r
r
r
rr3Gs

r3c@seZdZdZgd�ZdS)�SmallerHTMLWriterzi
    HTMLWriter that doesn't generate spans for some junk.

    Results in much smaller HTML output.
    )�	endmarker�indent�dedent�op�newline�nlN)r/r0r1r2r4r
r
r
rr;fsr;c
Cst|�d�t||j�j�j}zt�|j�D]}|\}}}}}	||||||	�qWn
tjy2Ynw|�d�dS)Ns<pre>s</pre>
)r8rr.r�readline�
TokenError)
�inp�outr�printerr&�	tokenType�string�start�endr)r
r
r�filterps
��rKcCsXddl}t|jd|j�}t|jdd��}t||�Wd�dS1s%wYdS)Nr�bufferr�rb)�sys�getattr�stdout�open�argvrK)rNrP�fr
r
r�main|s
"�rT�__main__)r2rr�htmlr�typingr�rrr3r;rKrTr/r
r
r
r�<module>s6

�