ó
    ý¸e6  ã                   ó^   • S SK r SSKJrJr   " S S\5      r " S S\5      r " S S	\5      rg)
é    Né   )ÚEOFÚTIMEOUTc                   óT   • \ rS rSrSS jrS rS rS rSS jrSS jr	S	 r
SS
 jrSrg)ÚExpecteré   c                 ó    • Xl         X l        US:X  a  UR                  nX0l        S U l        [	        US5      (       a  UR
                  U l        g g )NéÿÿÿÿÚlongest_string)ÚspawnÚsearcherÚsearchwindowsizeÚlookbackÚhasattrr   )Úselfr   r   r   s       Ú0/usr/lib/python3/dist-packages/pexpect/expect.pyÚ__init__ÚExpecter.__init__   sO   € ØŒ
Ø Œð ˜rÓ!Ø$×5Ñ5ÐØ 0ÔØˆŒÜ�8Ð-×.Ñ.Ø$×3Ñ3ˆD�Mð /ó    c                 ó¢  • U R                   nU R                  nU[        U5      :”  a  [        U5      nUR                  XU R                  5      nUS:¼  aç  UR                  5       Ul        UR                  R                  XR                  S  5        UR                  R                  5       S[        U5      UR                  -
  *  Ul        UR                  5       Ul	        UR                  R                  XR                  S  5        XR                  UR                   Ul        UR                  Ul        XSl        U$ U R                  (       d  U R                   (       ar  U R                  =(       d    U R                   nUR                  R#                  5       U:”  a4  UR                  5       Ul        UR                  R                  X* S  5        g g g ©Nr   )r   r   ÚlenÚsearchr   Úbuffer_typeÚ_bufferÚwriteÚendÚ_beforeÚgetvalueÚstartÚbeforeÚafterÚmatchÚmatch_indexr   Útell)r   ÚwindowÚfreshlenr   r   ÚindexÚmaintains          r   Ú	do_searchÚExpecter.do_search   s_  € Ø—
‘
ˆØ—=‘=ˆØ”c˜&“kÓ!Ü˜6“{ˆHØ—‘ °$×2GÑ2GÓHˆØ�A‹:Ø!×-Ñ-Ó/ˆEŒMØ�M‰M×Ñ §|¡| }Ð 5Ô6Ø Ÿ=™=×1Ñ1Ó3Ø”C˜“K (§.¡.Ñ0Ð1ð3ˆEŒLà!×-Ñ-Ó/ˆEŒMØ�M‰M×Ñ §|¡| }Ð 5Ô6Ø §¡°·±Ð=ˆEŒKØ"Ÿ.™.ˆEŒKØ %ÔàˆLØ×"×" d§m§mØ×,Ñ,×=°·±ˆHØ�}‰}×!Ñ!Ó# hÓ.Ø %× 1Ñ 1Ó 3�”Ø—‘×#Ñ# F¨9¨:Ð$6Õ7ð /ð '4r   c                 ó
  • U R                   nUR                  R                  5       nUR                  R                  5       nUnX#:”  Ga4  U R                  (       dL  UR                  5       Ul        UR                  R                  5       nUR                  R                  U5        GONX0R                  :  a|  UR                  5       Ul        UR                  R                  [        SX R                  -
  5      5        UR                  R                  5       nUR                  R                  U5        OÃUR                  R                  [        SX0R                  -
  5      5        UR                  R                  5       nOwU R                  (       aL  UR                  R                  [        SX0R                  -
  5      5        UR                  R                  5       nOUR                  R                  5       nU R                  XT5      $ r   )r   r   r%   r   r   r   r   r   ÚseekÚmaxÚreadr*   )r   r   Ú
before_lenÚbuf_lenr'   r&   s         r   Úexisting_dataÚExpecter.existing_data*   sq  € ð —
‘
ˆØ—]‘]×'Ñ'Ó)ˆ
Ø—-‘-×$Ñ$Ó&ˆØˆØÔØ×(×(Ø %× 1Ñ 1Ó 3�”ØŸ™×/Ñ/Ó1�Ø—‘×#Ñ# FÖ+Ø×0Ñ0Ó0Ø %× 1Ñ 1Ó 3�”Ø—‘×"Ñ"Ü˜˜:×(=Ñ(=Ñ=Ó>ô@àŸ™×+Ñ+Ó-�Ø—‘×#Ñ# FÕ+à—‘×"Ñ"¤3 q¨'×4IÑ4IÑ*IÓ#JÔKØŸ™×+Ñ+Ó-‘à×$×$Ø—‘×"Ñ"¤3 q¨'×4IÑ4IÑ*IÓ#JÔKØŸ™×+Ñ+Ó-‘àŸ™×/Ñ/Ó1�Ø�~‰~˜fÓ/Ð/r   c                 ó,  • U R                   n[        U5      nUR                  R                  U5        U R                  (       d¼  U R
                  (       a‚  UR                  R                  5       nUR                  R                  U5        UR                  R                  [        SX@R
                  -
  5      5        UR                  R                  5       nGO.UR                  R                  U5        UR                  nGO[        U5      U R                  :¼  d  UR                  R                  5       (       dM  XR                  * S  nUR                  5       Ul        UR                  R                  XPR                  * S  5        O€UR                  R                  U5        UR                  R                  5       nUR                  R                  [        SX`R                  -
  5      5        UR                  R                  5       nU R                  XS5      $ r   )r   r   r   r   r   r   r   r%   r-   r.   r/   Úbufferr   r*   )r   Údatar   r'   Úold_lenr&   Únew_lens          r   Únew_dataÚExpecter.new_dataH   sy  € à—
‘
ˆÜ�t“9ˆØ�‰×Ñ˜DÔ!Ø×$×$Ø�}�}àŸ-™-×,Ñ,Ó.�Ø—‘×#Ñ# DÔ)Ø—‘×"Ñ"¤3 q¨'·M±MÑ*AÓ#BÔCØŸ™×+Ñ+Ó-’ð —‘×#Ñ# DÔ)ØŸ™’ä�4‹y˜D×1Ñ1Ó1¸¿¹×9KÑ9K×9MÑ9MØ×4Ñ4Ð4Ð5Ð6�Ø %× 1Ñ 1Ó 3�”Ø—‘×#Ñ# F×,AÑ,AÐ+AÐ+BÐ$CÕDà—‘×#Ñ# DÔ)ØŸ-™-×,Ñ,Ó.�Ø—‘×"Ñ"¤3 q¨'×4IÑ4IÑ*IÓ#JÔKØŸ™×+Ñ+Ó-�Ø�~‰~˜fÓ/Ð/r   Nc                 óÆ  • U R                   nUR                  R                  5       Ul        UR	                  5       Ul        UR	                  5       Ul        [        Ul        U R                  R                  nUS:¼  a  [        Ul
        X2l        U$ S Ul
        S Ul        [        U5      nUSU R                  -  -  nUb  [        U5      S-   U-   n[        U5      nS Ul        Ue©Nr   z
searcher: %sÚ
)r   r   r   r!   r   r   r   r"   r   Ú	eof_indexr#   r$   ÚstrÚ	__cause__©r   Úerrr   r(   ÚmsgÚexcs         r   ÚeofÚExpecter.eofd   sÆ   € Ø—
‘
ˆà—}‘}×-Ñ-Ó/ˆŒØ×)Ñ)Ó+ˆŒØ×)Ñ)Ó+ˆŒÜˆŒØ—‘×'Ñ'ˆØ�A‹:ÜˆEŒKØ %ÔØˆLàˆEŒKØ $ˆEÔÜ�e“*ˆCØÐ# d§m¡mÑ3Ñ3ˆCØ‰Ü˜#“h ‘o¨Ñ+�ä�c“(ˆCØ ˆCŒMØˆIr   c                 ór  • U R                   nUR                  R                  5       Ul        [        Ul        U R                  R                  nUS:¼  a  [        Ul        X2l	        U$ S Ul        S Ul	        [        U5      nUSU R                  -  -  nUb  [        U5      S-   U-   n[	        U5      nS Ul        Uer<   )r   r   r   r!   r   r"   r   Útimeout_indexr#   r$   r?   r@   rA   s         r   ÚtimeoutÚExpecter.timeout|   s¦   € Ø—
‘
ˆà—}‘}×-Ñ-Ó/ˆŒÜˆŒØ—‘×+Ñ+ˆØ�A‹:Ü!ˆEŒKØ %ÔØˆLàˆEŒKØ $ˆEÔÜ�e“*ˆCØÐ# d§m¡mÑ3Ñ3ˆCØ‰Ü˜#“h ‘o¨Ñ+�ä˜#“,ˆCØ ˆCŒMØˆIr   c                 ó„   • U R                   nUR                  R                  5       Ul        S Ul        S Ul        S Ul        g ©N)r   r   r   r!   r"   r#   r$   )r   r   s     r   ÚerroredÚExpecter.errored’   s5   € Ø—
‘
ˆØ—}‘}×-Ñ-Ó/ˆŒØˆŒØˆŒØ ˆÕr   c                 óˆ  • U R                   nUb  [        R                  " 5       U-   n U R                  5       nUb  U$  Ub  US:  a  U R                  5       $ UR	                  UR
                  U5      nU R                   R                  b*  [        R                  " U R                   R                  5        U R                  U5      nUb  U$ Ub  W[        R                  " 5       -
  nM©  ! [         a  nU R                  U5      s SnA$ SnAf[         a  nU R                  U5      s SnA$ SnAf  U R                  5         e = f)zBlocking expectNr   )r   Útimer2   rI   Úread_nonblockingÚmaxreadÚdelayafterreadÚsleepr9   r   rE   r   rM   )r   rI   r   Úend_timeÚidxÚincomingÚes          r   Úexpect_loopÚExpecter.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( ÁA2C( ÃC( Ã(
EÃ2DÄEÄEÄD+Ä%EÄ+E)r   r   r   r   )r
   rL   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r*   r2   r9   rE   rI   rM   rY   Ú__static_attributes__© r   r   r   r      s*   † ô
4ò8ò00ò<0ô8ô0ò,!÷r   r   c                   ó.   • \ rS rSrSrS rS rSS jrSrg)	Úsearcher_stringé»   a  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                 ó6  • SU l         SU l        / U l        SU l        [	        U5       Hn  u  p#U[
        L a  X l         M  U[        L a  X l        M'  U R                  R                  X#45        [        U5      U R                  :”  d  M^  [        U5      U l        Mp     g)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
   r   N)	r>   rH   Ú_stringsr   Ú	enumerater   r   Úappendr   )r   ÚstringsÚnÚss       r   r   Úsearcher_string.__init__Î   s„   € ð ˆŒØˆÔØˆŒØˆÔÜ˜gÖ&‰DˆAØ”CŠxØ!"”ÙØ”GŠ|Ø%&Ô"ÙØ�M‰M× Ñ  ! Ô(Ü�1‹v˜×+Ñ+Õ+Ü&)¨!£f�Ö#ò 'r   c                 óÆ  • U R                    Vs/ s H  oS   SU-  4PM     nnUR                  S5        U R                  S:¼  a*  UR                  U R                  SU R                  -  45        U R                  S:¼  a*  UR                  U R                  SU R                  -  45        UR	                  5         [        [        U6 5      S   nSR                  U5      $ s  snf )úMThis returns a human-readable string that represents the state of
the object.r   z
    %d: %r)r
   zsearcher_string:ú    %d: EOFú    %d: TIMEOUTr   r=   )re   rg   r>   rH   ÚsortÚlistÚzipÚjoin)r   ÚnsÚsss      r   Ú__str__Úsearcher_string.__str__á   sÃ   € ð 48·=²=ÓA²=¨R�!‰u�l RÑ'Ó(±=ˆÐAØ
�	‰	Ð*Ô+Ø�>‰>˜QÓØ�I‰I�t—~‘~ }°t·~±~Ñ'EÐFÔGØ×Ñ Ó"Ø�I‰I�t×)Ñ)Ø! D×$6Ñ$6Ñ6ð8ô 9à
�‰Œ	Ü”#�r�(‹^˜AÑˆØ�y‰y˜‹}Ðùò Bs   �CNc                 ó  • SnU R                    HB  u  pVUc  U[        U5      -   * nOU* nUR                  Xg5      nUS:¼  d  M4  Ub  X„:  d  M>  UnXVp©MD     Uc  gW
U l        X@l        U R                  [        U R                  5      -   U l        W	$ )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. Nr   r
   )re   r   Úfindr#   r    r   )r   r5   r'   r   Úfirst_matchr(   rj   Úoffsetri   Ú
best_indexÚ
best_matchs              r   r   Úsearcher_string.searchð   s›   € ð ˆð Ÿœ‰HˆEØÑ'ð $¤c¨!£fÑ,Ð-‘ð +Ð*�Ø—‘˜AÓ&ˆAØ�A�v˜;Ñ.°!µ/Ø�Ø).šJñ &ð ÑØØˆŒ
Ø Œ
Ø—:‘:¤ D§J¡J£Ñ/ˆŒØÐr   )re   r   r>   r   r#   r    rH   rL   ©	r[   r\   r]   r^   Ú__doc__r   rv   r   r_   r`   r   r   rb   rb   »   s   † ñò$-ò&÷*r   rb   c                   ó.   • \ rS rSrSrS rS rSS jrSrg)	Úsearcher_rei  a*  This 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                 óÒ   • SU l         SU l        / U l        [        U5       HC  u  p#U[        L a  X l         M  U[
        L a  X l        M'  U R                  R                  X#45        ME     g)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)r>   rH   Ú	_searchesrf   r   r   rg   )r   Úpatternsri   rj   s       r   r   Úsearcher_re.__init__0  s^   € ð
 ˆŒØˆÔØˆŒÜ˜hÖ'‰DˆAØ”CŠxØ!"”ÙØ”GŠ|Ø%&Ô"ÙØ�N‰N×!Ñ! 1 &Ö)ò (r   c                 óö  • [        5       nU R                   H&  u  p#UR                  USX#R                  4-  45        M(     UR                  S5        U R                  S:¼  a*  UR                  U R                  SU R                  -  45        U R
                  S:¼  a*  UR                  U R
                  SU R
                  -  45        UR                  5         [        [        U6 5      S   nSR                  U5      $ )rm   z    %d: re.compile(%r))r
   zsearcher_re:r   rn   ro   r   r=   )	rq   r„   rg   Úpatternr>   rH   rp   rr   rs   )r   ru   ri   rj   s       r   rv   Úsearcher_re.__str__A  sÐ   € ô ‹VˆØ—N”N‰DˆAØ�I‰I�qÐ2°a¿¹°^ÑCÐDÖEñ #à
�	‰	Ð&Ô'Ø�>‰>˜QÓØ�I‰I�t—~‘~ }°t·~±~Ñ'EÐFÔGØ×Ñ Ó"Ø�I‰I�t×)Ñ)Ð+<Ø×"Ñ"ñ,#ð $ô %à
�‰Œ	Ü”#�r�(‹^˜AÑˆØ�y‰y˜‹}Ðr   Nc                 ó<  • SnUc  SnO[        S[        U5      U-
  5      nU R                   H;  u  pgUR                  X5      nUc  M  UR	                  5       n	Ub  X”:  d  M5  U	nUn
UnM=     Uc  gX@l        W
U l        U R
                  R                  5       U l        W$ )ai  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.Nr   r
   )r.   r   r„   r   r    r#   r   )r   r5   r'   r   rz   Úsearchstartr(   rj   r#   ri   Ú	the_matchr|   s               r   r   Úsearcher_re.searchT  s¥   € ð ˆð Ñ#Ø‰Kä˜a¤ V£Ð/?Ñ!?Ó@ˆKØŸœ‰HˆEØ—H‘H˜VÓ1ˆEØ‰}ÙØ—‘“ˆAØÑ" a¥oØ�Ø!�	Ø"’
ñ 'ð ÑØØ Œ
ØˆŒ
Ø—:‘:—>‘>Ó#ˆŒØÐr   )r„   r   r>   r#   r    rH   rL   r   r`   r   r   r‚   r‚     s   † ñò$*ò"÷&r   r‚   )rP   Ú
exceptionsr   r   Úobjectr   rb   r‚   r`   r   r   Ú<module>r�      s7   ðÛ ç $ôsˆvô sôl_�fô _ôDV�&õ Vr   