%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f�J���UdZddlZddlmZddlmZddlmZmZddl	m
Z
ddlmZddl
mZiZeeefed	<Gd
�d�Zeej(�Gd�d
��ZGd�d�ZGd�dej.�ZGd�de�Zy)z4
Basic line editing support.

@author: Jp Calderone
�N)�Dict)�implementer)�helper�insults)�Logger)�reflect)�	iterbytes�	_countersc�H��eZdZdZd�Zdef�fd�Zdef�fd�Z�fd�Z�xZ	S)�Loggingz�
    Wrapper which logs attribute lookups.

    This was useful in debugging something, I guess.  I forget what.
    It can probably be deleted or moved somewhere more appropriate.
    Nothing special going on here, really.
    c���||_tj|j�}tj|d�}|dzt|<t
|dzt|�zd�|_y)Nr��-�w)	�originalr�qual�	__class__r
�get�open�str�_logFile)�selfr�key�counts    �8/usr/lib/python3/dist-packages/twisted/conch/recvline.py�__init__zLogging.__init__!sU�� ��
��l�l�8�-�-�.���
�
�c�1�%�����	�#���S�3�Y��U��3�S�9��
��returnc�4��tt�|�	d��S�Nr)r�super�__getattribute__�rrs �r�__str__zLogging.__str__(s����5�7�+�J�7�8�8rc�4��tt�|�	d��Sr )�reprr!r"r#s �r�__repr__zLogging.__repr__+s����E�G�,�Z�8�9�9rc���t�|�d�}t�|�d�}|j|dz�t||�S)Nrr�
)r!r"�write�getattr)r�namer�logFilers    �rr"zLogging.__getattribute__.s>����7�+�J�7���'�*�:�6���
�
�d�T�k�"��x��&�&r)
�__name__�
__module__�__qualname__�__doc__rrr$r'r"�
__classcell__�rs@rrrs/����:�9��9�:�#�:�'�'rrc���eZdZdZdD] ZedzZej
d�Zee��"dZ	dZ
d�ZejD]Zede�d	e�d
���d�Zd�Zd
�Zd�Zd�Zd:d�Zd:d�Zd:d�Zd:d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d �Z$d!�Z%d"�Z&d#�Z'd$�Z(d%�Z)d&�Z*d'�Z+d(�Z,d)�Z-d;d*�Z.d+�Z/d,�Z0d-�Z1d.�Z2d/�Z3d0�Z4d1�Z5d2�Z6d:d3�Z7d:d4�Z8d:d5�Z9d6�Z:d7�Z;d8�Z<y9)<�TransportSequencea_
    An L{ITerminalTransport} implementation which forwards calls to
    one or more other L{ITerminalTransport}s.

    This is a cheap way for servers to keep track of the state they
    expect the client to see, since all terminal manipulations can be
    send to the real client and to a terminal emulator that lives in
    the server process.
    )sUP_ARROWs
DOWN_ARROWsRIGHT_ARROWs
LEFT_ARROWsHOMEsINSERTsDELETEsENDsPGUPsPGDNsF1sF2sF3sF4sF5sF6sF7sF8sF9sF10sF11sF12s = object()�ascii�	�c�$�|sJd��||_y)Nz7Cannot construct a TransportSequence with no transports)�
transports)rr:s  rrzTransportSequence.__init__`s���T�T�T�z�$��rzdef zG(self, *a, **kw):
    for tpt in self.transports:
        result = tpt.z(*a, **kw)
    return result
c��td��)Nz(Unimplemented: TransportSequence.getHost��NotImplementedError�rs r�getHostzTransportSequence.getHosto���!�"L�M�Mrc��td��)Nz(Unimplemented: TransportSequence.getPeerr<r>s r�getPeerzTransportSequence.getPeersr@rc��td��)Nz/Unimplemented: TransportSequence.loseConnectionr<r>s r�loseConnectionz TransportSequence.loseConnectionw���!�"S�T�Trc��td��)Nz&Unimplemented: TransportSequence.writer<�r�datas  rr*zTransportSequence.write{���!�"J�K�Krc��td��)Nz.Unimplemented: TransportSequence.writeSequencer<rGs  r�
writeSequencezTransportSequence.writeSequence���!�"R�S�Src��td��)Nz)Unimplemented: TransportSequence.cursorUpr<�r�ns  r�cursorUpzTransportSequence.cursorUp����!�"M�N�Nrc��td��)Nz+Unimplemented: TransportSequence.cursorDownr<rNs  r�
cursorDownzTransportSequence.cursorDown����!�"O�P�Prc��td��)Nz.Unimplemented: TransportSequence.cursorForwardr<rNs  r�
cursorForwardzTransportSequence.cursorForward�rLrc��td��)Nz/Unimplemented: TransportSequence.cursorBackwardr<rNs  r�cursorBackwardz TransportSequence.cursorBackward�rErc��td��)Nz/Unimplemented: TransportSequence.cursorPositionr<)r�column�lines   r�cursorPositionz TransportSequence.cursorPosition�rErc��td��)Nz+Unimplemented: TransportSequence.cursorHomer<r>s r�
cursorHomezTransportSequence.cursorHome�rTrc��td��)Nz&Unimplemented: TransportSequence.indexr<r>s r�indexzTransportSequence.index�rIrc��td��)Nz-Unimplemented: TransportSequence.reverseIndexr<r>s r�reverseIndexzTransportSequence.reverseIndex����!�"Q�R�Rrc��td��)Nz)Unimplemented: TransportSequence.nextLiner<r>s r�nextLinezTransportSequence.nextLine�rQrc��td��)Nz+Unimplemented: TransportSequence.saveCursorr<r>s r�
saveCursorzTransportSequence.saveCursor�rTrc��td��)Nz.Unimplemented: TransportSequence.restoreCursorr<r>s r�
restoreCursorzTransportSequence.restoreCursor�rLrc��td��)Nz)Unimplemented: TransportSequence.setModesr<�r�modess  r�setModeszTransportSequence.setModes�rQrc��td��)Nz+Unimplemented: TransportSequence.resetModesr<)r�modes  r�
resetModeszTransportSequence.resetModes�rTrc��td��)Nz0Unimplemented: TransportSequence.setPrivateModesr<rks  r�setPrivateModesz!TransportSequence.setPrivateModes����!�"T�U�Urc��td��)Nz2Unimplemented: TransportSequence.resetPrivateModesr<rks  r�resetPrivateModesz#TransportSequence.resetPrivateModes����!�"V�W�Wrc��td��)Nz6Unimplemented: TransportSequence.applicationKeypadModer<r>s r�applicationKeypadModez'TransportSequence.applicationKeypadMode�s��!�D�
�	
rc��td��)Nz2Unimplemented: TransportSequence.numericKeypadModer<r>s r�numericKeypadModez#TransportSequence.numericKeypadMode�rvrc��td��)Nz3Unimplemented: TransportSequence.selectCharacterSetr<)r�charSet�whichs   r�selectCharacterSetz$TransportSequence.selectCharacterSet����!�"W�X�Xrc��td��)Nz(Unimplemented: TransportSequence.shiftInr<r>s r�shiftInzTransportSequence.shiftIn�r@rc��td��)Nz)Unimplemented: TransportSequence.shiftOutr<r>s r�shiftOutzTransportSequence.shiftOut�rQrc��td��)Nz-Unimplemented: TransportSequence.singleShift2r<r>s r�singleShift2zTransportSequence.singleShift2�rcrc��td��)Nz-Unimplemented: TransportSequence.singleShift3r<r>s r�singleShift3zTransportSequence.singleShift3�rcrc��td��)Nz7Unimplemented: TransportSequence.selectGraphicRenditionr<)r�
attributess  r�selectGraphicRenditionz(TransportSequence.selectGraphicRendition�s��!�E�
�	
rc��td��)Nz8Unimplemented: TransportSequence.horizontalTabulationSetr<r>s r�horizontalTabulationSetz)TransportSequence.horizontalTabulationSet����!�F�
�	
rc��td��)Nz0Unimplemented: TransportSequence.tabulationClearr<r>s r�tabulationClearz!TransportSequence.tabulationClear�rsrc��td��)Nz3Unimplemented: TransportSequence.tabulationClearAllr<r>s r�tabulationClearAllz$TransportSequence.tabulationClearAll�rrc��td��)Nz1Unimplemented: TransportSequence.doubleHeightLiner<)r�tops  r�doubleHeightLinez"TransportSequence.doubleHeightLine�s��!�"U�V�Vrc��td��)Nz0Unimplemented: TransportSequence.singleWidthLiner<r>s r�singleWidthLinez!TransportSequence.singleWidthLine�rsrc��td��)Nz0Unimplemented: TransportSequence.doubleWidthLiner<r>s r�doubleWidthLinez!TransportSequence.doubleWidthLine�rsrc��td��)Nz/Unimplemented: TransportSequence.eraseToLineEndr<r>s r�eraseToLineEndz TransportSequence.eraseToLineEnd�rErc��td��)Nz5Unimplemented: TransportSequence.eraseToLineBeginningr<r>s r�eraseToLineBeginningz&TransportSequence.eraseToLineBeginning���!�C�
�	
rc��td��)Nz*Unimplemented: TransportSequence.eraseLiner<r>s r�	eraseLinezTransportSequence.eraseLines��!�"N�O�Orc��td��)Nz2Unimplemented: TransportSequence.eraseToDisplayEndr<r>s r�eraseToDisplayEndz#TransportSequence.eraseToDisplayEndrvrc��td��)Nz8Unimplemented: TransportSequence.eraseToDisplayBeginningr<r>s r�eraseToDisplayBeginningz)TransportSequence.eraseToDisplayBeginningr�rc��td��)Nz-Unimplemented: TransportSequence.eraseDisplayr<r>s r�eraseDisplayzTransportSequence.eraseDisplayrcrc��td��)Nz0Unimplemented: TransportSequence.deleteCharacterr<rNs  r�deleteCharacterz!TransportSequence.deleteCharacterrsrc��td��)Nz+Unimplemented: TransportSequence.insertLiner<rNs  r�
insertLinezTransportSequence.insertLinerTrc��td��)Nz+Unimplemented: TransportSequence.deleteLiner<rNs  r�
deleteLinezTransportSequence.deleteLine!rTrc��td��)Nz5Unimplemented: TransportSequence.reportCursorPositionr<r>s r�reportCursorPositionz&TransportSequence.reportCursorPosition%r�rc��td��)Nz&Unimplemented: TransportSequence.resetr<r>s r�resetzTransportSequence.reset+rIrc��td��)Nz9Unimplemented: TransportSequence.unhandledControlSequencer<�r�seqs  r�unhandledControlSequencez*TransportSequence.unhandledControlSequence/s��!�G�
�	
rN)r)T)=r.r/r0r1�keyID�	execBytes�decode�execStr�exec�TAB�	BACKSPACErr�ITerminalTransport�methodr?rBrDr*rKrPrSrVrXr\r^r`rbrergrirmrprrrurxrzr~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��rrr5r55s�������0�N�*�	��"�"�7�+���W�
�5�8�C��I�%��,�,�	
����v�

�	
�	
�N�N�U�L�T�O�Q�T�U�U�Q�L�S�O�Q�T�O�Q�V�X�
�X�Y�N�O�S�S�
�
�V�Y�W�V�V�U�
�P�X�
�S�V�Q�Q�
�L�
rr5c�.��eZdZdZ�fd�Zdefd�Z�xZS)�LocalTerminalBufferMixina�
    A mixin for RecvLine subclasses which records the state of the terminal.

    This is accomplished by performing all L{ITerminalTransport} operations on both
    the transport passed to makeConnection and an instance of helper.TerminalBuffer.

    @ivar terminalCopy: A L{helper.TerminalBuffer} instance which efforts
    will be made to keep up to date with the actual terminal
    associated with this protocol instance.
    c���tj�|_|jj�t�|�t
||j��S�N)r�TerminalBuffer�terminalCopy�connectionMader!�makeConnectionr5)r�	transportrs  �rr�z'LocalTerminalBufferMixin.makeConnectionBsD���"�1�1�3������(�(�*��w�%�&7�	�4�CT�CT�&U�V�Vrrc�,�t|j�Sr�)rr�r>s rr$z LocalTerminalBufferMixin.__str__Gs���4�$�$�%�%r)r.r/r0r1r�rr$r2r3s@rr�r�6s���	�W�
&��&rr�c���eZdZdZdZdZdZdZdZe	jjd�Ze
�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"y)�RecvLinea�
    L{TerminalProtocol} which adds line editing features.

    Clients will be prompted for lines of input with all the usual
    features: character echoing, left and right arrow support for
    moving the cursor to different areas of the line buffer, backspace
    and delete for removing characters, and insert for toggling
    between typeover and insert mode.  Tabs will be expanded to enough
    spaces to move the cursor to the next tabstop (every four
    characters by default).  Enter causes the line buffer to be
    cleared and the line to be passed to the lineReceived() method
    which, by default, does nothing.  Subclasses are responsible for
    redrawing the input prompt (this will probably change).
    �P��)s>>> s... rr6c��g|_d|_|j}|j|j|j
|j|j|jd|jd|j|j|j|j|j|j|j|j |j"|j$|j&i
|_|j+�y)Nr�
�
)�
lineBuffer�lineBufferIndex�terminal�
LEFT_ARROW�handle_LEFT�RIGHT_ARROW�handle_RIGHTr��
handle_TAB�
handle_RETURNr��handle_BACKSPACE�DELETE�
handle_DELETE�INSERT�
handle_INSERT�HOME�handle_HOME�END�
handle_END�keyHandlers�initializeScreen�r�ts  rr�zRecvLine.connectionMadefs������ !����M�M��
�L�L�$�*�*�
�M�M�4�,�,�
�E�E�4�?�?�
�4�%�%��4�%�%�
�K�K��.�.�
�H�H�d�(�(�
�H�H�d�(�(�
�F�F�D�$�$�
�E�E�4�?�?�

���	
���rc��|jj�|jj|j|j�|j�yr�)r�r�r*�ps�pn�
setInsertModer>s rr�zRecvLine.initializeScreen�sA��	
�
�
�����
�
���D�G�G�D�G�G�,�-�	
���rc�t�dj|j�}|d|j||jdfS�Nr)�joinr�r�)r�ss  r�currentLineBufferzRecvLine.currentLineBuffer�s;���H�H�T�_�_�%���'�4�'�'�(�!�D�,@�,@�,B�*C�C�Crc�z�d|_|jjtjj
g�y)N�insert)ror�rmrrl�IRMr>s rr�zRecvLine.setInsertMode�s(����	��
�
����
�
� 1� 1�2�3rc�z�d|_|jjtjj
g�y)N�typeover)ror�rprrlr�r>s r�setTypeoverModezRecvLine.setTypeoverMode�s(����	��
�
� � �'�-�-�"3�"3�!4�5rc��|jj|j|jdj	|j
�z�y)z�
        Write a line containing the current input prompt and the current line
        buffer at the current cursor position.
        rN)r�r*r�r�r�r�r>s r�
drawInputLinezRecvLine.drawInputLine�s5��
	
�
�
���D�G�G�D�G�G�,�s�x�x����/H�H�Irc��|jj�|jj�||_||_|j�yr�)r�r�r^�width�heightr�)rr�r�s   r�terminalSizezRecvLine.terminalSize�s>��	
�
�
�"�"�$��
�
� � �"���
�������rc��yr�r�r�s  rr�z!RecvLine.unhandledControlSequence����rc���|jj|�}|�|�y||jvr|j|d�y|jjd|��y)NFz#Received unhandled keyID: {keyID!r})r�)r�r�_printableChars�characterReceived�_log�warn)rr��modifier�ms    r�keystrokeReceivedzRecvLine.keystrokeReceived�sU����� � ��'���=�
�C�
�d�*�*�
*��"�"�5�%�0��I�I�N�N�@��N�Nrc��|jdk(r'|jj|j|�n'|g|j|j|jdz|xjdz
c_|jj|�y)Nr�r)ror�r�r�r�r*)r�ch�moreCharactersComings   rr�zRecvLine.characterReceived�sn���9�9�� ��O�O�"�"�4�#7�#7��<�PR�t�D�O�O�D�0�0�4�3G�3G�!�3K�L�����!���
�
���B�rc��|jt|j�|jzz
}|jj	|�|xj
|z
c_|jj
td|z��y)N� )�TABSTOP�lenr�r�rVr��extendr	rNs  rr�zRecvLine.handle_TAB�s`���L�L�C����0�4�<�<�?�@���
�
�#�#�A�&�����!�������y����2�3rc��|jdkDr0|xjdzc_|jj�yy�Nrr�r�r�rXr>s rr�zRecvLine.handle_LEFT�s6�����!�#�� � �A�%� ��M�M�(�(�*�$rc��|jt|j�kr0|xjdz
c_|jj	�yy)Nr)r�rr�r�rVr>s rr�zRecvLine.handle_RIGHT�s?�����#�d�o�o�"6�6�� � �A�%� ��M�M�'�'�)�7rc�v�|jr-|jj|j�d|_yy�Nrrr>s rr�zRecvLine.handle_HOME�s0������M�M�(�(��)=�)=�>�#$�D� � rc��t|j�|jz
}|r6|jj	|�t|j�|_yyr�)rr�r�r�rV)r�offsets  rr�zRecvLine.handle_END�sF���T�_�_�%��(<�(<�<����M�M�'�'��/�#&�t���#7�D� �rc���|jdkDra|xjdzc_|j|j=|jj�|jj	�yyr)r�r�r�rXr�r>s rr�zRecvLine.handle_BACKSPACE�sX�����!�#�� � �A�%� ����� 4� 4�5��M�M�(�(�*��M�M�)�)�+�	$rc��|jt|j�kr2|j|j=|jj	�yyr�)r�rr�r�r�r>s rr�zRecvLine.handle_DELETE�s@�����#�d�o�o�"6�6����� 4� 4�5��M�M�)�)�+�7rc��dj|j�}g|_d|_|jj	�|j|�y)Nrr)r�r�r�r�re�lineReceived�rr[s  rr�zRecvLine.handle_RETURN�sA���x�x����(����� ����
�
��� ����$�rc��|jdvsJ�|jdk(r|j�y|j�y)N)r�r�r�)ror�r�r>s rr�zRecvLine.handle_INSERT�s9���y�y�2�2�2�2��9�9�
�"���� �� � �"rc��yr�r�rs  rrzRecvLine.lineReceived�r�rN)#r.r/r0r1r�r�r
r�r��string�	printable�encoder�rrr�r�r�r�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�rr�rrr�r�Ks���
�
�E�
�F��G�	�B�	
�B��&�&�-�-�g�6�O��8�D� �6� D�4�6�J��
�O� �4�+�
*�
%�
8�,�,�
 �#�
rr�c�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�HistoricRecvLinea;
    L{TerminalProtocol} which adds both basic line-editing features and input history.

    Everything supported by L{RecvLine} is also supported by this class.  In addition, the
    up and down arrows traverse the input history.  Each received line is automatically
    added to the end of the input history.
    c���tj|�g|_d|_|j}|j
j
|j|j|j|ji�yr)r�r��historyLines�historyPositionr�r��update�UP_ARROW�	handle_UP�
DOWN_ARROW�handle_DOWNr�s  rr�zHistoricRecvLine.connectionMades[������%���� ����M�M�������
�Z�Z�������t�7G�7G�H�	
rc�h�t|j�}|d|j||jdfSr�)�tupler"r#)r�bs  r�currentHistoryBufferz%HistoricRecvLine.currentHistoryBuffers9���$�#�#�$���'�4�'�'�(�!�D�,@�,@�,B�*C�C�Crc�~�|r;t|dd�D]}|j|d��|j|ddd�yy)N���TF)r	r�)r�bufrs   r�_deliverBufferzHistoricRecvLine._deliverBuffersJ�����C�R��)�
1���&�&�r�4�0�
1��"�"�3�r�s�8�U�3�rc���|jrV|jt|j�k(r4|jj	dj|j��|jdkDro|j
�|jj�|xjdzc_g|_|j|j|j�yy)Nrrr)
r�r#rr"�appendr�r�r�r�r0r>s rr&zHistoricRecvLine.handle_UPs����?�?�t�3�3�s�4�;L�;L�7M�M����$�$�S�X�X�d�o�o�%>�?����!�#������M�M�(�(�*�� � �A�%� � �D�O����� 1� 1�$�2F�2F� G�H�$rc���|jt|j�dz
kro|j�|jj�|xjdz
c_g|_|j|j|j�y|j�|jj�t|j�|_g|_d|_y)Nrr)	r#rr"r�r�r�r�r0r�r>s rr(zHistoricRecvLine.handle_DOWN$s������#�d�&7�&7�"8�1�"<�<������M�M�(�(�*�� � �A�%� � �D�O����� 1� 1�$�2F�2F� G�H������M�M�(�(�*�#&�t�'8�'8�#9�D� � �D�O�#$�D� rc���|jr4|jjdj|j��t	|j�|_tj|�Sr�)r�r"r2r�rr#r�r�r>s rr�zHistoricRecvLine.handle_RETURN5sN���?�?����$�$�S�X�X�d�o�o�%>�?�"�4�#4�#4�5����%�%�d�+�+rN)
r.r/r0r1r�r,r0r&r(r�r�rrr r �s'���	
�D�4�
I�%�",rr )r1r�typingr�zope.interfacer�twisted.conch.insultsrr�twisted.loggerr�twisted.pythonr�twisted.python.compatr	r
r�int�__annotations__rr�r5r��TerminalProtocolr�r r�rr�<module>r>s���
���&�1�!�"�+��	�4��S��>��'�'�:
�W�
'�
'�(�}
�}
�)�}
�@&�&�*l
�w�'�'�l
�^?,�x�?,r

Zerion Mini Shell 1.0