
    3jv                       S r SSKJr  SSKJr  SSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKrSSKrSSKJr  SSKJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK J!r!  \RD                  " S5      r# " S S\RH                  5      r%    S/S jr&\	RN                  S:X  a  Sr(Sr)OSr(Sr) " S S\RT                  \#   5      r+ " S S\RX                  5      r- S0   S1S jjr.\R^                  S0S2S  jj5       r0\R^                   S0     S3S! jj5       r1\R^                   S0     S3S" jj5       r2 " S# S$5      r3\R^                   S0     S4S% jj5       r4 " S& S'5      r5S5S6S( jjr6S7S) jr7\Rp                  S*:X  a  SSK9r9\R^                  S8S+ j5       r:S9S, jr;gSSK<r<SSK=r=\R^                  S8S- j5       r:S9S. jr;g):z
This module contains implementations for the termui module. To keep the
import time of Click down, some infrequently used functionality is
placed in this module and only imported as needed.
    )annotationsN)gettext)StringIO)Path)TracebackType   )_default_text_stdout)CYGWIN)get_best_encoding)isatty)
strip_ansi)term_len)WIN)ClickException)echoVc                       \ rS rSr% S\S'   Srg)_BufferedTextPagerStream$   
t.BinaryIObuffer N)__name__
__module____qualname____firstlineno____annotations____static_attributes__r       L/home/wildlama/miniconda3/lib/python3.13/site-packages/click/_termui_impl.pyr   r   $   s    r   r   c                     [        U SS 5      S L$ )Nr   )getattrstreams    r    _has_binary_bufferr%   (   s    
 68T*$66r   nt
z[?25lz[?25h
c                  h   \ rS rSr               S                                 SS jjrSS jr        SS jrSS jrSS jrSS jr	\
SS	 j5       r\
SS
 j5       r\
SS j5       rSS jrSS jrSS jrSS jrSS jrSS jrS S jrS!S"S jjrSS jrSS jrSrg)#ProgressBar8   Nc                   X0l         X@l        XPl        X`l        Xpl        Xl        Xl        Xl        Xl        U=(       d    SU l	        Uc  [        5       nUc
  [        5       nXl        Xl        Xl        SU l        UU l        US:H  U l        Uc  SSKJn  U" US5      nUS:X  a  S nUc.  Uc  [)        S5      e[*        R,                  " S[/        U5      5      n[1        U5      U l        X l        SU l        / U l        U   U   [8        R8                  " 5       =U l        U l        SU l        SU l         S U l!        SU l"        S U l#        [I        U R                  5      U l%        S U l&        g )N r   )length_hintziterable or length is requiredzcabc.Iterable[V]F)'	fill_char
empty_charbar_templateinfo_sephiddenshow_etashow_percentshow_positem_show_funclabelr	   r   filecolorupdate_min_steps_completed_intervalswidth	autowidthoperatorr.   	TypeErrortcastrangeiterlengthposavgtimestartlast_eta	eta_knownfinished	max_widthenteredcurrent_itemr   _is_atty
_last_line)selfiterablerF   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r>   r.   s                     r    __init__ProgressBar.__init__9   sC   & #$(  ( ,+2
<')D |z	
 0$%!
$z>, 2.F|~ @AAvv0%-@H&*8n	 "%)YY[0
T]$#%)"&*tyy)&*r   c                4    SU l         U R                  5         U $ )NT)rO   render_progressrS   s    r    	__enter__ProgressBar.__enter__   s    r   c                $    U R                  5         g N)render_finish)rS   exc_type	exc_valuetbs       r    __exit__ProgressBar.__exit__   s     	r   c                z    U R                   (       d  [        S5      eU R                  5         U R                  5       $ )N.You need to use progress bars in a with block.)rO   RuntimeErrorrX   	generatorrY   s    r    __iter__ProgressBar.__iter__   s.    ||OPP~~r   c                *    [        [        U 5      5      $ r]   )nextrE   rY   s    r    __next__ProgressBar.__next__   s     DJr   c                    U R                   (       d  U R                  (       d  g U R                  R                  [        5        U R                  R                  5         g r]   )r4   rQ   r:   write	AFTER_BARflushrY   s    r    r^   ProgressBar.render_finish   s0    ;;dmm			"		r   c                    U R                   (       a  g[        U R                  [        U R                  =(       d    S5      =(       d    S-  S5      $ )N      ?r   )rM   minrG   floatrF   rY   s    r    pctProgressBar.pct   s5    ==488uT[[%5A6;!<cBBr   c                    U R                   (       d  g[        U R                   5      [        [        U R                   5      5      -  $ Ng        )rH   sumrv   lenrY   s    r    time_per_iterationProgressBar.time_per_iteration   s,    xx488}uS]333r   c                    U R                   b7  U R                  (       d&  U R                  U R                   U R                  -
  -  $ grz   )rF   rM   r}   rG   rY   s    r    etaProgressBar.eta   s3    ;;"4==**dkkDHH.DEEr   c                    U R                   (       ab  [        U R                  5      nUS-  nUS-  nUS-  nUS-  nUS-  nUS-  nUS:  a  SR                  U[	        S5      UUUS9$ US SUS SUS 3$ g	)
N<      r   z#{d}{day_label} {h:02}:{m:02}:{s:02}d)r   	day_labelhms02:r-   )rL   intr   format_)rS   rB   secondsminuteshourss        r    
format_etaProgressBar.format_eta   s    >>DHHA"fG"HA"fG"HAFE"HA1u<CCf D    1WRL'">>r   c                n    [        U R                  5      nU R                  b  USU R                   3-  nU$ )N/)strrG   rF   )rS   rG   s     r    
format_posProgressBar.format_pos   s3    $((m;;"Qt{{m$$C
r   c                @    [        U R                  S-  5      S S3SS  $ )Nd   z 4%r   )r   rw   rY   s    r    
format_pctProgressBar.format_pct   s&    dhhn%b)+AB//r   c                ^   U R                   bQ  [        U R                  U R                  -  5      nU R                  U-  nX R
                  U R                  U-
  -  -  nU$ U R                  (       a  U R                  U R                  -  nU$ [        U R
                  U R                  =(       d    S-  5      nU R                  S:w  aV  U R                  U[        [        R                  " U R                  U R                  -  5      S-  S-   U R                  -  5      '   SR                  U5      nU$ )Nr   r   g       @g      ?r-   )rF   r   rw   r>   r0   r1   rM   listr}   mathcosrG   join)rS   
bar_lengthbarcharss       r    
format_barProgressBar.format_bar   s    ;;"TXX

23J..:-C??djj:&=>>C 
 ]]..4::-C 
 DJJO!<=E&&!+ NN $((T-D-D"DEKcQ**% ''%.C
r   c                   U R                   n/ nU R                  b  Uc  U R                  (       + nU R                  (       a  UR                  U R	                  5       5        U(       a  UR                  U R                  5       5        U R                  (       aA  U R                  (       a0  U R                  (       d  UR                  U R                  5       5        U R                  b/  U R                  U R                  5      nUb  UR                  U5        U R                  U R                  U R                  5       U R                  R!                  U5      S.-  R#                  5       $ )N)r9   r   info)r6   rF   r7   appendr   r   r5   rL   rM   r   r8   rP   r2   r9   r   r3   r   rstrip)rS   r6   	info_bits	item_infos       r    format_progress_line ProgressBar.format_progress_line   s   ((	;;"|';#}},L==T__./T__./==T^^DMMT__./*++D,=,=>I$  + (**95 &(	r   c                h   U R                   (       a  g U R                  (       dU  U R                  U R                  :w  a:  U R                  U l        [	        U R                  U R
                  U R                  S9  g / nU R                  (       a  SS KnU R                  nSU l	        [        U R                  5       5      n[        SUR                  5       R                  U-
  5      nXS:  aF  U R                  b9  UR!                  ["        5        UR!                  SU R                  -  5        XPl        XPl	        U R                  nU R                  b  U R                  nUR!                  ["        5        U R                  5       n[        U5      nU R                  b  U R                  U:  a  Xl        UR!                  U5        UR!                  SXh-
  -  5        SR%                  U5      nXpR                  :w  a@  Xpl        [	        XpR
                  U R                  SS9  U R
                  R'                  5         g g )N)r:   r;   r    r-   F)r:   r;   nl)r4   rQ   rR   r9   r   r:   r;   r?   shutilr>   r   r   maxget_terminal_sizecolumnsrN   r   
BEFORE_BARr   rq   )	rS   bufr   	old_widthclutter_length	new_widthclear_widthlineline_lens	            r    rX   ProgressBar.render_progress   s   ;;}}$**,"&**TZZdiitzzB>>

IDJ%d&?&?&ABNAv779AANRSI$)C

:&

3/0!*"Jjj>>%..K

:((*D>>>!T^^h%>%N

4

3+012wws| ??""OIITZZEBIIOO #r   c                (   U =R                   U-  sl         U R                  b!  U R                   U R                  :  a  SU l        [        R                  " 5       U R                  -
  S:  a  g [        R                  " 5       U l        U R                   (       a0  [        R                  " 5       U R
                  -
  U R                   -  nO"[        R                  " 5       U R
                  -
  nU R                  SS  U/-   U l        U R                  S LU l        g )NTrt   i)rG   rF   rM   rI   rK   rJ   rH   rL   )rS   n_stepssteps      r    	make_stepProgressBar.make_step-  s    G;;"txx4;;'> DMIIK$--'3.		
 88IIK$**,8D99;+D88BC=D6)D0r   c                    Ub  X l         U =R                  U-  sl        U R                  U R                  :  a3  U R                  U R                  5        U R	                  5         SU l        gg)a  Update the progress bar by advancing a specified number of
steps, and optionally set the ``current_item`` for this new
position.

:param n_steps: Number of steps to advance.
:param current_item: Optional item to set as ``current_item``
    for the updated position.

.. versionchanged:: 8.0
    Added the ``current_item`` optional parameter.

.. versionchanged:: 8.0
    Only render when the number of steps meets the
    ``update_min_steps`` threshold.
Nr   )rP   r=   r<   r   rX   )rS   r   rP   s      r    updateProgressBar.updateC  s`      # ,!!W,!$$(=(==NN4445  "()D% >r   c                .    SU l         S U l        SU l        g )NFT)rL   rP   rM   rY   s    r    finishProgressBar.finish]  s     r   c              #  p  #    U R                   (       d  [        S5      eU R                  (       d  U R                   Sh  vN   gU R                   H>  nXl        U R
                  S:X  a  U R                  5         Uv   U R                  S5        M@     U R                  5         U R                  5         g Nt7f)zReturn a generator which yields the items added to the bar
during construction, and updates the progress bar *after* the
yielded block returns.
re   Nr   r   )	rO   rf   rQ   rE   rP   r=   rX   r   r   )rS   rvs     r    rg   ProgressBar.generatorb  s      ||OPP}}yy  ii$&!
 ,,1((*A   KKM  " !s   =B6B4 A5B6)r=   rQ   rR   r?   rH   r2   r;   rP   r1   rO   rL   r:   r0   rM   r4   r3   r8   rE   r9   rK   rF   rN   rG   r5   r6   r7   rJ   r<   r>   )N#r   z%(bar)sz  FTNFNNNNr      )"rT   zcabc.Iterable[V] | NonerF   z
int | Noner0   r   r1   r   r2   r   r3   r   r4   boolr5   r   r6   bool | Noner7   r   r8   z)t.Callable[[V | None], str | None] | Noner9   
str | Noner:   zt.TextIO | Noner;   r   r<   r   r>   r   returnNone)r   zProgressBar[V])r_   ztype[BaseException] | Noner`   zBaseException | Nonera   zTracebackType | Noner   r   )r   zcabc.Iterator[V])r   r   r   r   )r   rv   r   r   )r   r   r   r   r]   )r   r   rP   zV | Noner   r   )r   r   r   r   rU   rZ   rb   rh   rl   r^   propertyrw   r}   r   r   r   r   r   r   rX   r   r   r   rg   r   r   r   r    r*   r*   8   s    "%$(DH  $! !#E+)E+ E+ 	E+
 E+ E+ E+ E+ E+ "E+ E+ BE+ E+ E+ E+  !E+" #E+$ 
%E+N
, ( !	
 
   C C
 4 4
  
*0&6,\1,*4
#r   r*   c                  <   ^  \ rS rSrSU 4S jjrSU 4S jjrSrU =r$ )MaybeStripAnsii  c               4   > [         TU ]  " U40 UD6  X l        g r]   )superrU   r;   )rS   r$   r;   kwargs	__class__s       r    rU   MaybeStripAnsi.__init__  s    *6*
r   c                Z   > U R                   (       d  [        U5      n[        TU ]  U5      $ r]   )r;   r   r   ro   )rS   textr   s     r    ro   MaybeStripAnsi.write  s#    zzd#Dw}T""r   r;   )r$   zt.IO[bytes]r;   r   r   t.Any)r   r   r   r   )r   r   r   r   rU   ro   r   __classcell__)r   s   @r    r   r     s    # #r   r   c                H   [        5       nUc
  [        5       n[        [        R                  5      (       a  [        U5      (       d  [        X5      $ [        R                  " [        R                  R                  SS5      5      nU(       a!  [        (       a  [        X 5      $ [        X 5      $ [        R                  R                  S5      S;   a  [        X5      $ [        (       d$  [        R                  R                  S5      (       a  [        S/U 5      $ [        S/U 5      $ )z2Decide what method to use for paging through text.PAGERr-   TERM)dumbemacsos2moreless)r	   r   r   sysstdin
_nullpagershlexsplitosenvirongetr   _tempfilepager
_pipepagerplatform
startswith)r;   stdoutpager_cmd_partss      r    _pager_contextmanagerr     s     "#F ~#))F6NN&(( kk"**..""=>O3!/99/11	zz~~f!22&((
scll%%e,,vh..vh&&r   c              #  J  #    [        U S9 u  pn [        U5      (       a  [        UR                  XS9nO)[	        U[
        R                  5      (       a
  [        XUS9n Uv   UR                  5          SSS5        g! UR                  5         f = f! , (       d  f       g= f7f)zContext manager.
Yields a writable file-like object which can be used as an output pager.
.. versionadded:: 8.4
:param color: controls if the pager supports ANSI colors or not.  The
              default is autodetection.
r   )r;   encodingN)r   r%   r   r   
isinstancerB   BinaryIOrq   )r;   r$   r   s      r    get_pager_filer     s      
U	+/H% f%%#FMMRF

++#F(KF	LLLN 
,	+ LLN 
,	+s5   
B#ABA=#B4	B#=BB
B B#c           	   #    #    U (       d#  [        5       =(       d
    [        5       nUSS4v   gSSKnU S   nU SS nUR                  U5      nU(       d#  [        5       =(       d
    [        5       nUSS4v   g[	        U5      R                  5       nUR                  nSSKn	[        [        R                  5      n
UcV  US:X  aP  [        R                  R                  SS5       S	R                  U5       3nU(       d  S
U
S'   SnOSU;   d  SU;   a  SnUc  SnU	R                  [        U5      /U-   SU	R                  U
SSS9n[         R"                  " [         R$                  UR&                  5      n[)        U5      n XU4v    UR1                  5           UR3                  5         g! [*         a     N0[,         a  nUR/                  5         UeSnAff = f! [*         a     NNf = f! [4         a     Of = fMc  !  UR1                  5         O! [*         a     Of = f  UR3                  5         f ! [4         a     Of = fM$  = f7f)a  Page through text by feeding it to another program.

Invokes the pager via :class:`subprocess.Popen` with an ``argv`` list
produced by :func:`shlex.split`. The command is resolved to an absolute
path with :func:`shutil.which` as recommended by the
:mod:`subprocess` docs for Windows compatibility.

Invoking a pager through this might support colors: if piping to
``less`` and the user hasn't decided on colors, ``LESS=-R`` is set
automatically.
utf-8FNr   r   r   LESSr-   r   -RTrRreplace)shellr   enverrorsr   )r	   r   r   whichr   absolutename
subprocessdictr   r   r   r   Popenr   PIPErB   rC   r   r   r   BrokenPipeError	Exception	terminateclosewaitKeyboardInterrupt)	cmd_partsr;   r   r   cmd
cmd_paramscmd_filepathcmd_pathcmd_namer  r	  
less_flagscr   r   es                   r    r   r     sC      %'58:gu$$
A,C12J<<$L%'58:gu$$
 L!**,H}}H rzz
C }V+

vr23CHHZ4H3IJ
CKEJ#"3E}	X*$oo 	 	A FF1::qww'E 'H#u$$	KKM  C   
 	
  		 %  	KKM  		   %  s   E9I<F& G IG% %I&
G0G7 2	G;GGG7 
G"I!G""I%
G2/I1G22I7H?9H
	H?

HH?HH?H-,H?-
H:7H?9H::H??Ic              #    #    U (       d#  [        5       =(       d
    [        5       nUSS4v   gSSKnSSKnU S   nUR	                  U5      nU(       d#  [        5       =(       d
    [        5       nUSS4v   g[        U5      R                  5       nSSKn[        [        R                  5      n	Uc  SnUR                  SSS9n
 [        R                  " [        R                  U
5      X4v   U
R                  5         U
R!                  5         UR#                  [%        U5      U
R&                  /5        [(        R*                  " U
R&                  5        g! [(        R*                  " U
R&                  5        f = f7f)a  Page through text by invoking a program on a temporary file.

Used as the primary pager strategy on Windows (where piping to
``more`` adds spurious ``\r\n``), and as a fallback on other
platforms. The command is resolved to an absolute path with
:func:`shutil.which`.
r  FNr   wb)modedelete)r	   r   r   r  r  r   r  tempfiler   r   r   NamedTemporaryFilerB   rC   r   rq   r  callr   r  r   unlink)r  r;   r   r   r  r  r  r  r%  r   fs              r    r   r   .  s     %'58:gu$$
A,C<<$L%'58:gu$$
 L!**,H ,H} 	##e#<AffQZZ#X44				X/0
		!&&		!&&s   B>E6A/E 0!E6"E33E6c                  F    \ rS rSrSS jrS	S jr\S
S j5       rSS jrSr	g)
_SkipCloseia  c                    Xl         g r]   r#   )rS   r$   s     r    rU   _SkipClose.__init__b  s    r   c                .    [        U R                  U5      $ r]   )r"   r$   )rS   r  s     r    __getattr___SkipClose.__getattr__e  s    t{{D))r   c                @    [        U R                  R                  5      $ r]   )r+  r$   r   rY   s    r    r   _SkipClose.bufferh  s    $++,,--r   c                    g r]   r   rY   s    r    r  _SkipClose.closel  s    r   r#   N)r$   zt.IO[t.Any]r   r   )r  r   r   r   )r   r   r   )
r   r   r   r   rU   r/  r   r   r  r   r   r   r    r+  r+  a  s%    * . .r   r+  c              #  J   #    [        U 5      nUc  Sn[        U 5      X!4v   g7f)zSimply print unformatted text. This is the ultimate fallback. Don't close the
output stream in this case, since it's coming from elsewhere rather than our
internal helpers.
NF)r   r+  )r$   r;   r   s      r    r   r   p  s+      !(H}
V
h
--s   !#c                      \ rS rSr    S
         SS jjrSS jrSS jr\R                  SS j5       r	\R                  SS j5       r	SS jr	S	r
g)Editori  Nc                4    Xl         X l        X0l        X@l        g r]   )editorr	  require_save	extension)rS   r9  r	  r:  r;  s        r    rU   Editor.__init__  s     ("r   c                    U R                   b  U R                   $ S H-  n[        R                  R                  U5      nU(       d  M+  Us  $    [        (       a  gSSKJn  S H  nU" U5      c  M  Us  $    g)N)VISUALEDITORnotepadr   )r  )zsensible-editorvimnanovi)r9  r   r   r   r   r   r  )rS   keyr   r  r9  s        r    
get_editorEditor.get_editor  sg    ;;";;%C$Br	 & 3 6FV}( 7 r   c                   SSK nSSKnU R                  5       nSnU R                  (       a9  [        R
                  R                  5       nUR                  U R                  5         UR                  UR                  " U5      [        U5      -   US9nUR                  5       nUS:w  a!  [        [        S5      R                  US95      eg! [         a'  n[        [        S5      R                  XHS95      UeSnAff = f)z Open files in the user's editor.r   N)argsr	  z{editor}: Editing failed)r9  z{editor}: Editing failed: {e})r9  r   )r   r  rE  r	  r   r   copyr   r  r   r   r  r   r   r   OSError)	rS   	filenamesr   r  r9  r   r  	exit_coder   s	            r    
edit_filesEditor.edit_files  s    ")-88jjoo'GNN488$	   [[(4	?: ! A IA~$01888G    	 12999M	s   &A#C
 

C;"C66C;c                    g r]   r   rS   r   s     r    editEditor.edit  s    =@r   c                    g r]   r   rP  s     r    rQ  rR    s    47r   c                   SS K nUc  SnO~[        U[        [        45      (       a  UnO`U(       a  UR	                  S5      (       d  US-  n[
        (       a"  UR                  SS5      R                  S5      nOUR                  S5      nUR                  SU R                  S9u  pE [        R                  " US	5       nUR                  U5        S S S 5        [        R                  " U[        R                  R                  U5      [        R                  R!                  U5      S
-
  45        [        R                  R!                  U5      nU R#                  U45        U R$                  (       a;  [        R                  R!                  U5      U:X  a   [        R&                  " U5        g [)        US5       nUR+                  5       nS S S 5        [        U[        [        45      (       a  W[        R&                  " U5        $ WR-                  S5      R                  SS5      [        R&                  " U5        $ ! , (       d  f       GNq= f! , (       d  f       N= f! [        R&                  " U5        f = f)Nr   r   r(   z
z	utf-8-sigr  zeditor-)prefixsuffixr"     rb)r%  r   bytes	bytearrayendswithr   r  encodemkstempr;  r   fdopenro   utimepathgetatimegetmtimerM  r:  r(  openreaddecode)	rS   r   r%  datafdr  r)  	timestampr   s	            r    rQ  rR    s   <&)Dui011DDMM$//s||D&188E{{7+##9T^^#L	2t$ % HHTBGG,,T2BGG4D4DT4JQ4NOP ((.IOOTG$  RWW%5%5d%;y%H IIdO dD!QVVX " $	 233 IIdO 99[)11&$?IIdO3 %$" "! IIdOsI   &I =H9CI *I 6I$I  I 9
II 
II I4)r9  r	  r;  r:  )NNTz.txt)
r9  r   r	  zcabc.Mapping[str, str] | Noner:  r   r;  r   r   r   r   )rK  zcabc.Iterable[str]r   r   )r   zbytes | bytearrayr   zbytes | None)r   r   r   r   )r   zstr | bytes | bytearray | Noner   zstr | bytes | None)r   r   r   r   rU   rE  rM  rB   overloadrQ  r   r   r   r    r7  r7    s|     "-1!
#
# +
# 	
#
 
# 

#"< ZZ@ @ ZZ7 7-r   r7  c                   SS K nSS jn[        R                  S:X  a  S/nU(       a  UR                  S5        U(       a  UR                  S5        UR                  U" U 5      5        [	        SS5      n UR                  XVS	9R                  5       UR                  5         $ [        (       a>  U(       a  U" U 5      n S
SU /n UR                  U5      $  [        R                  " U 5        g[        (       ao  U(       a*  U" U 5      n S[        R                  R                  U 5      /nO,S/nU(       a  UR                  S5        UR                  U 5         UR                  U5      $  U(       a/  [        R                  R                  U" U 5      5      =(       d    Sn OU" U 5      n UR                  SU /5      nU(       a  UR                  5       $ g! UR                  5         f = f! [         a     gf = f! [         a     gf = f! [         a     gf = f! [         a>    U R!                  S5      (       a%  U(       d  U(       d  SS KnUR	                  U 5         g gf = f)Nr   c                T    SSK Jn  U R                  S5      (       a  U" U SS  5      n U $ )Nr   )unquotezfile://   )urllib.parserl  r   )urlrl  s     r    _unquote_fileopen_url.<locals>._unquote_file  s)    (>>)$$#ab'"C
r   darwinrc  z-Wr  z	/dev/nullw)stderrexplorerz/select,   cygstartz-w.zxdg-open)zhttp://zhttps://r   )ro  r   r   r   )r  r   r   r   rc  r  r  r  r   r'  rJ  r   	startfiler
   r`  dirnamer   
webbrowser)	ro  r  locater  rp  rH  nullr  r{  s	            r    open_urlr~    s    ||xxKKKKM#&'K%	##D#6;;=JJL	$C
C0D!t,,S! 	$C 45D<DD!KK	??4((
''//-"45<C$Cj#./668OM JJL  
    		  >>1226$OOC sV   5G G$ G4 H &A'H G!$
G10G14
H H
HHAIIc                    U S:X  a
  [        5       eU S:X  a  [        (       d
  [        5       eU S:X  a  [        (       a
  [        5       eg g )N)r  r   EOFError)chs    r    _translate_ch_to_excr  :  s?    	V|!!	V|CCj	V|j |r   win32c               #     #    Sv   g 7f)Nr/   r   r   r   r    raw_terminalr  H  s
     s   c                H   U (       a=  [         R                  " [         R                  / [        4   [        R
                  5      nO<[         R                  " [         R                  / [        4   [        R                  5      nU" 5       nUS;   a	  X!" 5       -  n[        U5        U$ )N)    à)rB   rC   Callabler   msvcrtgetwchegetwchr  )r   funcr   s      r    getcharr  L  ss    > 66!**RW-v~~>D66!**RW-v}}=DV!! $&LBR 	r   c               #    #    [        [        R                  5      (       d  [        S5      n U R	                  5       nO [        R                  R	                  5       nS n  [
        R                  " U5      n [        R                  " U5        Uv   [
        R                  " U[
        R                  U5        [        R                  R                  5         U b  U R                  5         g g ! [
        R                  " U[
        R                  U5        [        R                  R                  5         U b  U R                  5         f f = f! [
        R                   a     g f = f7f)Nz/dev/tty)r   r   r   rc  filenotermios	tcgetattrttysetraw	tcsetattr	TCSADRAINr   rq   r  error)r)  rg  old_settingss      r    r  r  ~  s     
 cii  Z AB!!#BA	",,R0L

2!!"g&7&7F

  "=GGI ! !!"g&7&7F

  "=GGI !}} 		sD   AEE 5C( AE &E(AEE EEEEc                j   [        5        n[        R                  " US5      R                  [	        [
        R                  5      S5      nU (       a=  [        [
        R                  5      (       a  [
        R                  R                  U5        [        U5        UsS S S 5        $ ! , (       d  f       g = f)N    r  )r  r   rd  re  r   r   r   r   r   ro   r  )r   rg  r  s      r    r  r    sg    ^rR''(9#))(DiPBszz**

  $ $ ^^s   BB$$
B2)r$   zt.BinaryIO | t.TextIOr   z%t.TypeGuard[_BufferedTextPagerStream]r]   )r;   r   r   z9t.ContextManager[tuple[t.BinaryIO | t.TextIO, str, bool]])r;   r   r   z!t.Generator[t.TextIO, None, None])r  z	list[str]r;   r   r   z3t.Iterator[tuple[t.BinaryIO | t.TextIO, str, bool]])r$   zt.TextIOr;   r   r   z&t.Iterator[tuple[t.TextIO, str, bool]])FF)ro  r   r  r   r|  r   r   r   )r  r   r   r   )r   zcabc.Iterator[int])r   r   r   r   )>__doc__
__future__r   collections.abcabccabc
contextlibior   r   r   r   rI   typingrB   r   r   r   pathlibr   typesr   _compatr	   r
   r   r   r   r   r   
exceptionsr   utilsr   TypeVarr   Protocolr   r%   r  r   rp   Genericr*   TextIOWrapperr   r   contextmanagerr   r   r   r+  r   r7  r~  r  r   r  r  r  r  r  r   r   r    <module>r     s   #   	  	  
        )  &     & IIcNqzz 7!7*7 77d?JIJII#!))A, I#X
#R%% # ''>'>  . /3dd!,d8d dN /3//!,/8/ /d  +/..(.+. .q qhCL <<7 ,^  4r   