%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/pexpect/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/pexpect/__pycache__/expect.cpython-312.pyc

�

��e6��^�ddlZddlmZmZGd�de�ZGd�de�ZGd�d	e�Zy)
�N�)�EOF�TIMEOUTc�D�eZdZd
d�Zd�Zd�Zd�Zdd�Zdd�Zd�Z	d
d	�Z
y)�Expecterc��||_||_|dk(r|j}||_d|_t	|d�r|j
|_yy)N����longest_string)�spawn�searcher�searchwindowsize�lookback�hasattrr
)�selfrrr
s    �0/usr/lib/python3/dist-packages/pexpect/expect.py�__init__zExpecter.__init__sR����
� ��
��r�!�$�5�5�� 0�����
��8�-�.�$�3�3�D�M�/�c��|j}|j}|t|�kDrt|�}|j|||j�}|dk\r�|j�|_|jj||jd�|jj�dt|�|jz
|_|j�|_	|jj||jd�||j|j|_
|j|_||_|S|js|j rm|jxs|j }|jj#�|kDr5|j�|_|jj||d�yyy�Nr)rr�len�searchr
�buffer_type�_buffer�write�end�_before�getvalue�start�before�after�match�match_indexr�tell)r�window�freshlenrr�index�maintains       r�	do_searchzExpecter.do_searchsk���
�
���=�=���c�&�k�!��6�{�H������$�2G�2G�H���A�:�!�-�-�/�E�M��M�M����x�|�|�}� 5�6� �=�=�1�1�3��C��K�(�.�.�0�1�3�E�L�!�-�-�/�E�M��M�M����x�|�|�}� 5�6� �������=�E�K�"�.�.�E�K� %�E���L�
�
"�
"�d�m�m��,�,�=��
�
�H��}�}�!�!�#�h�.� %� 1� 1� 3��
��
�
�#�#�F�H�9�:�$6�7�/�'4rc��|j}|jj�}|jj�}|}||kD�r1|jsL|j�|_|jj
�}|jj|��nL||jkr}|j�|_|jjtd||jz
��|jj�}|jj|�n�|jjtd||jz
��|jj�}ns|jrM|jjtd||jz
��|jj�}n|jj
�}|j||�Sr)rrr#rr
rrr�seek�max�readr()rr�
before_len�buf_lenr%r$s      r�
existing_datazExpecter.existing_data*s}���
�
���]�]�'�'�)�
��-�-�$�$�&��������(�(� %� 1� 1� 3��
����/�/�1���
�
�#�#�F�+��4�0�0�0� %� 1� 1� 3��
��
�
�"�"���:��(=�(=�=�>�@����+�+�-���
�
�#�#�F�+��
�
�"�"�3�q�'�D�4I�4I�*I�#J�K����+�+�-���$�$��
�
�"�"�3�q�'�D�4I�4I�*I�#J�K����+�+�-�����/�/�1���~�~�f�h�/�/rc��|j}t|�}|jj|�|js�|j
r�|jj�}|jj|�|jjtd||j
z
��|jj�}�n+|jj|�|j}�nt|�|jk\s|jj�sO||jd}|j�|_|jj||jd�n�|jj|�|jj�}|jjtd||jz
��|jj�}|j||�Sr)rrrrr
rrr#r*r+r,�bufferrr()r�datarr%�old_lenr$�new_lens       r�new_datazExpecter.new_dataHs����
�
���t�9��
�
�
���D�!��$�$��}�}��-�-�,�,�.���
�
�#�#�D�)��
�
�"�"�3�q�'�D�M�M�*A�#B�C����+�+�-���
�
�#�#�D�)������4�y�D�1�1�1����9K�9K�9M��t�4�4�4�5�6�� %� 1� 1� 3��
��
�
�#�#�F�D�,A�,A�+A�+B�$C�D��
�
�#�#�D�)��-�-�,�,�.���
�
�"�"�3�q�'�D�4I�4I�*I�#J�K����+�+�-���~�~�f�h�/�/rNc���|j}|jj�|_|j	�|_|j	�|_t|_|jj}|dk\rt|_
||_|Sd|_
d|_t|�}|d|jzz
}|�t|�dz|z}t
|�}d|_
|��Nrz
searcher: %s�
)rrrrrrrr r�	eof_indexr!r"�str�	__cause__�r�errrr&�msg�excs      r�eofzExpecter.eofds����
�
���}�}�-�-�/����)�)�+��
��)�)�+��
�����
�
�'�'���A�:��E�K� %�E���L��E�K� $�E���e�*�C��#�d�m�m�3�3�C����#�h��o��+���c�(�C� �C�M��Irc�p�|j}|jj�|_t|_|jj}|dk\rt|_||_	|Sd|_d|_	t|�}|d|jzz
}|�t|�dz|z}t	|�}d|_|�r7)rrrrrr r�
timeout_indexr!r"r:r;r<s      r�timeoutzExpecter.timeout|s����
�
���}�}�-�-�/�������
�
�+�+���A�:�!�E�K� %�E���L��E�K� $�E���e�*�C��#�d�m�m�3�3�C����#�h��o��+���#�,�C� �C�M��Irc��|j}|jj�|_d|_d|_d|_y�N)rrrrr r!r")rrs  r�erroredzExpecter.errored�s5���
�
���}�}�-�-�/��������� ��rc�n�|j}|�tj�|z}	|j�}|�|S	|�|dkr|j�S|j	|j
|�}|jj�)tj|jj�|j|�}|�|S|�tj�z
}��#t$r}|j|�cYd}~Sd}~wt$r}|j|�cYd}~Sd}~w|j��xYw)zBlocking expectNr)
r�timer/rC�read_nonblocking�maxread�delayafterread�sleepr5rr@rrF)rrCr�end_time�idx�incoming�es       r�expect_loopzExpecter.expect_loop�s���
�
�����y�y�{�W�,�H�	��$�$�&�C����
���'�g��k��<�<�>�)� �1�1�%�-�-��I���:�:�,�,�8��J�J�t�z�z�8�8�9��m�m�H�-���?��J��&�&�����4�G����	��8�8�A�;����	#��<�<��?�"��	��L�L�N��sA�C�C�A/C�C�	D4�&C<�6D4�<D4�D�D4�D4)r	rE)�__name__�
__module__�__qualname__rr(r/r5r@rCrFrQ�rrrrs*��
4�8�00�<0�8�0�,!�rrc�$�eZdZdZd�Zd�Zdd�Zy)�searcher_stringa-This is a plain string search helper for the spawn.expect_any() method.
    This helper class is for speed. For more powerful regex patterns
    see the helper class, searcher_re.

    Attributes:

        eof_index     - index of EOF, or -1
        timeout_index - index of TIMEOUT, or -1

    After a successful match by the search() method the following attributes
    are available:

        start - index into the buffer, first byte of match
        end   - index into the buffer, first byte after match
        match - the matching string itself

    c�.�d|_d|_g|_d|_t	|�D]k\}}|t
ur||_�|tur||_�&|jj||f�t|�|jkDs�\t|�|_�my)z�This creates an instance of searcher_string. This argument 'strings'
        may be a list; a sequence of strings; or the EOF or TIMEOUT types. r	rN)	r9rB�_stringsr
�	enumeraterr�appendr)r�strings�n�ss    rrzsearcher_string.__init__�s�����������
�����g�&�		-�D�A�q��C�x�!"�����G�|�%&��"���M�M� � �!�Q��(��1�v��+�+�+�&)�!�f��#�		-rc��|jD�cgc]}|dd|zf��}}|jd�|jdk\r*|j|jd|jzf�|jdk\r*|j|jd|jzf�|j	�tt
|��d}dj|�Scc}w)�UThis returns a human-readable string that represents the state of
        the object.rz
    %d: %r)r	zsearcher_string:�    %d: EOF�    %d: TIMEOUTrr8)rYr[r9rB�sort�list�zip�join)r�ns�sss   r�__str__zsearcher_string.__str__�s���48�=�=�
A�R�r�!�u�l�R�'�(�
A��
A�
�	�	�*�+��>�>�Q���I�I�t�~�~�}�t�~�~�'E�F�G�����"��I�I�t�)�)�!�D�$6�$6�6�8�
9�
���	�
�#�r�(�^�A�
���y�y��}���Bs�CNc��d}|jD]@\}}|�|t|�z}n|}|j||�}|dk\s�3|�||ks�;|}||}
}	�B|�y
|_||_|jt|j�z|_	S)a�This searches 'buffer' for the first occurrence of one of the search
        strings.  'freshlen' must indicate the number of bytes at the end of
        'buffer' which have not been searched before. It helps to avoid
        searching the same, possibly big, buffer over and over again.

        See class spawn for the 'searchwindowsize' argument.

        If there is a match this returns the index of that string, and sets
        'start', 'end' and 'match'. Otherwise, this returns -1. Nrr	)rYr�findr!rr)rr1r%r
�first_matchr&r^�offsetr]�
best_index�
best_matchs           rrzsearcher_string.search�s������
�
�	2�H�E�1��'�$�c�!�f�,�-��+�*�����A�v�&�A��A�v�;�.�!�k�/���).��J�
�	2������
� ��
��:�:��D�J�J��/����rrE�rRrSrT�__doc__rrirrUrrrWrW�s���$-�&
�*rrWc�$�eZdZdZd�Zd�Zdd�Zy)�searcher_reaVThis is regular expression string search helper for the
    spawn.expect_any() method. This helper class is for powerful
    pattern matching. For speed, see the helper class, searcher_string.

    Attributes:

        eof_index     - index of EOF, or -1
        timeout_index - index of TIMEOUT, or -1

    After a successful match by the search() method the following attributes
    are available:

        start - index into the buffer, first byte of match
        end   - index into the buffer, first byte after match
        match - the re.match object returned by a successful re.search

    c���d|_d|_g|_t|�D]B\}}|tur||_�|t
ur||_�&|jj
||f��Dy)z�This creates an instance that searches for 'patterns' Where
        'patterns' may be a list or other sequence of compiled regular
        expressions, or the EOF or TIMEOUT types.r	N)r9rB�	_searchesrZrrr[)r�patternsr]r^s    rrzsearcher_re.__init__0sk��
����������h�'�	*�D�A�q��C�x�!"�����G�|�%&��"���N�N�!�!�1�a�&�)�	*rc���t�}|jD]'\}}|j|d||jfzf��)|jd�|jdk\r*|j|jd|jzf�|j
dk\r*|j|j
d|j
zf�|j
�tt|��d}dj|�S)r`z    %d: re.compile(%r))r	zsearcher_re:rrarbrr8)	rdrur[�patternr9rBrcrerf)rrhr]r^s    rrizsearcher_re.__str__As����V���N�N�	F�D�A�q��I�I�q�2�a����^�C�D�E�	F�
�	�	�&�'��>�>�Q���I�I�t�~�~�}�t�~�~�'E�F�G�����"��I�I�t�)�)�+<��"�"�,#�$�
%�
���	�
�#�r�(�^�A�
���y�y��}�rNc�2�d}|�d}ntdt|�|z
�}|jD]8\}}|j||�}|��|j	�}	|�|	|ks�3|	}|}
|}�:|�y||_
|_|j
j
�|_S)a�This searches 'buffer' for the first occurrence of one of the regular
        expressions. 'freshlen' must indicate the number of bytes at the end of
        'buffer' which have not been searched before.

        See class spawn for the 'searchwindowsize' argument.

        If there is a match this returns the index of that string, and sets
        'start', 'end' and 'match'. Otherwise, returns -1.Nrr	)r+rrurrr!r)rr1r%r
rl�searchstartr&r^r!r]�	the_matchrns            rrzsearcher_re.searchTs������#��K��a��V��/?�!?�@�K����	#�H�E�1��H�H�V�[�1�E��}�����
�A��"�a�+�o���!�	�"�
�	#���� ��
���
��:�:�>�>�#����rrErprUrrrsrss���$*�"�&rrs)rH�
exceptionsrr�objectrrWrsrUrr�<module>r~s7���$�s�v�s�l_�f�_�DV�&�Vr

Zerion Mini Shell 1.0