§
    ÈtºfÕ
  ã                   óþ   — d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl	m
Z
mZmZmZ ddlmZmZmZ  G d„ de¦  «        Z G d	„ d
ej        ¦  «        Z G d„ de¦  «        Zd„ Zdd„Zedk    r e¦   «          dS dS )zC
Asynchronous local terminal input handling

@author: Jp Calderone
é    N)ÚServerProtocol)ÚColoredManhole)ÚdeferÚprotocolÚreactorÚstdio)ÚfailureÚlogÚreflectc                   ó   — e Zd ZdS )ÚUnexpectedOutputErrorN)Ú__name__Ú
__module__Ú__qualname__© ó    úR/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/conch/stdio.pyr   r      s   € € € € € Ø€Dr   r   c                   ó8   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dS )	ÚTerminalProcessProtocolc                 óD   — || _         t          j        ¦   «         | _        d S ©N)Úprotor   ÚDeferredÚonConnection)Úselfr   s     r   Ú__init__z TerminalProcessProtocol.__init__   s   € ØˆŒ
Ý!œNÑ,Ô,ˆÔÐÐr   c                 ó|   — | j                              | ¦  «         | j                             d ¦  «         d | _        d S r   )r   ÚmakeConnectionr   Úcallback)r   s    r   ÚconnectionMadez&TerminalProcessProtocol.connectionMade   s=   € ØŒ
×!Ò! $Ñ'Ô'Ð'ØÔ×"Ò" 4Ñ(Ô(Ð(Ø ˆÔÐÐr   c                 ó:   — | j                              |¦  «         dS )zj
        Write to the terminal.

        @param data: Data to write.
        @type data: L{bytes}
        N)Ú	transportÚwrite©r   Údatas     r   r#   zTerminalProcessProtocol.write$   s    € ð 	Œ×Ò˜TÑ"Ô"Ð"Ð"Ð"r   c                 ó:   — | j                              |¦  «         dS )zs
        Receive data from the terminal.

        @param data: Data received.
        @type data: L{bytes}
        N)r   ÚdataReceivedr$   s     r   ÚoutReceivedz#TerminalProcessProtocol.outReceived-   s    € ð 	Œ
×Ò Ñ%Ô%Ð%Ð%Ð%r   c                 óÊ   — | j                              ¦   «          | j        �B| j                             t	          j        t          |¦  «        ¦  «        ¦  «         d| _        dS dS )zt
        Report an error.

        @param data: Data to include in L{Failure}.
        @type data: L{bytes}
        N)r"   ÚloseConnectionr   ÚconnectionLostr	   ÚFailurer   r$   s     r   ÚerrReceivedz#TerminalProcessProtocol.errReceived6   s\   € ð 	Œ×%Ò%Ñ'Ô'Ð'ØŒ:Ð!ØŒJ×%Ò%¥g¤oÕ6KÈDÑ6QÔ6QÑ&RÔ&RÑSÔSÐSØˆDŒJˆJˆJð "Ð!r   c                 óL   — | j         �| j                              |¦  «         d S d S r   )r   ÚchildConnectionLost)r   ÚchildFDs     r   r/   z+TerminalProcessProtocol.childConnectionLostB   s.   € ØŒ:Ð!ØŒJ×*Ò*¨7Ñ3Ô3Ð3Ð3Ð3ð "Ð!r   c                 óZ   — | j         �#| j                              |¦  «         d | _         d S d S r   )r   r+   ©r   Úreasons     r   ÚprocessEndedz$TerminalProcessProtocol.processEndedF   s3   € ØŒ:Ð!ØŒJ×%Ò% fÑ-Ô-Ð-ØˆDŒJˆJˆJð "Ð!r   N)
r   r   r   r   r    r#   r(   r-   r/   r4   r   r   r   r   r      s}   € € € € € ð-ð -ð -ð!ð !ð !ð
#ð #ð #ð&ð &ð &ð
ð 
ð 
ð4ð 4ð 4ðð ð ð ð r   r   c                   ó   — e Zd ZdZd„ ZdS )ÚConsoleManholezK
    A manhole protocol specifically for use with L{stdio.StandardIO}.
    c                 ó,   — t          j        ¦   «          dS )zƒ
        When the connection is lost, there is nothing more to do.  Stop the
        reactor so that the process can exit.
        N)r   Ústopr2   s     r   r+   zConsoleManhole.connectionLostQ   s   € õ
 	Œ‰Œˆˆˆr   N)r   r   r   Ú__doc__r+   r   r   r   r6   r6   L   s-   € € € € € ðð ðð ð ð ð r   r6   c                 óÚ  — t           j                             ¦   «         }t          j        |¦  «        }t          j        |¦  «         	 t          j        t          | ¦  «        ¦  «         t          j        ¦   «          t          j        |t          j        |¦  «         t          j        |d¦  «         d S # t          j        |t          j        |¦  «         t          j        |d¦  «         w xY w)Ns   c)ÚsysÚ	__stdin__ÚfilenoÚtermiosÚ	tcgetattrÚttyÚsetrawr   Ú
StandardIOr   r   ÚrunÚ	tcsetattrÚTCSANOWÚosr#   )ÚklassÚfdÚoldSettingss      r   ÚrunWithProtocolrJ   Y   s¼   € Ý	Œ×	Ò	Ñ	Ô	€BÝÔ# BÑ'Ô'€KÝ„Jˆr�N„N€Nð#ÝÔ�¨Ñ.Ô.Ñ/Ô/Ð/ÝŒ‰ŒˆåÔ˜"�gœo¨{Ñ;Ô;Ð;Ý
Œ��\Ñ"Ô"Ð"Ð"Ð"øõ 	Ô˜"�gœo¨{Ñ;Ô;Ð;Ý
Œ��\Ñ"Ô"Ð"Ð"øøøs   Á4B3 Â37C*c                 óÜ   — t          j        t          dd¦  «        ¦  «         | €t          j        dd …         } | rt          j        | d         ¦  «        }nt          }t          |¦  «         d S )Nz	child.logÚwé   r   )	r
   ÚstartLoggingÚopenr;   Úargvr   Ú
namedClassr6   rJ   )rP   rG   s     r   ÚmainrR   e   sh   € ÝÔ•T˜+ sÑ+Ô+Ñ,Ô,Ð,à€|ÝŒx˜˜˜Œ|ˆØð ÝÔ" 4¨¤7Ñ+Ô+ˆˆåˆÝ�EÑÔÐÐÐr   Ú__main__r   )r9   rF   r;   r>   r@   Útwisted.conch.insults.insultsr   Útwisted.conch.manholer   Útwisted.internetr   r   r   r   Útwisted.pythonr	   r
   r   Ú	Exceptionr   ÚProcessProtocolr   r6   rJ   rR   r   r   r   r   ú<module>rZ      sd  ðð
ð ð 
€	€	€	Ø 
€
€
€
Ø €€€Ø 
€
€
€
à 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0ð	ð 	ð 	ð 	ð 	˜Iñ 	ô 	ð 	ð/ð /ð /ð /ð /˜hÔ6ñ /ô /ð /ðd
ð 
ð 
ð 
ð 
�^ñ 
ô 
ð 
ð	#ð 	#ð 	#ð	ð 	ð 	ð 	ð ˆzÒÐØ€D�F„F€F€F€Fð Ðr   