
    ybj%                    ^   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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#\RH                  S:X  a  Sr%Sr&OSr%Sr& " S S\RN                  \#   5      r( " S S5      r)S,S jr* S-   S.S jjr+\RX                  S-S/S jj5       r-S0S jr.\RX                   S-       S1S  jj5       r/\RX                   S-       S1S! jj5       r0\RX                   S-     S2S" jj5       r1 " S# S$5      r2S3S4S% jjr3S5S& jr4\
Rj                  S':X  a  SSK6r6\RX                  S6S( j5       r7S7S) jr8gSSK9r9SSK:r:\RX                  S6S* j5       r7S7S+ jr8g)8z
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V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)#ProgressBar+   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iterabler3   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r+   r   s                     ڎ/tmp/claude-0/-home-danvics-docker-quiz/c1e0577a-e42c-4a3d-b1ea-3edd61103a4e/scratchpad/stt/lib/python3.13/site-packages/click/_termui_impl.py__init__ProgressBar.__init__,   sC   & #$(  ( ,+2
<')D |z	
 0$%!
$z>, 2.F|~ @AAvv0%-@H&*8n	 "%)YY[0
T]$#%)"&*tyy)&*    c                4    SU l         U R                  5         U $ )NT)r<   render_progressr@   s    rB   	__enter__ProgressBar.__enter__s   s    rE   c                $    U R                  5         g N)render_finish)r@   exc_type	exc_valuetbs       rB   __exit__ProgressBar.__exit__x   s     	rE   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.)r<   RuntimeErrorrG   	generatorrH   s    rB   __iter__ProgressBar.__iter__   s.    ||OPP~~rE   c                *    [        [        U 5      5      $ rL   )nextr2   rH   s    rB   __next__ProgressBar.__next__   s     DJrE   c                B   U R                   (       a2  U R                  U R                   5        SU l         U R                  5         U R                  (       d  U R                  (       d  g U R
                  R                  [        5        U R
                  R                  5         g )Nr   )	r*   	make_steprG   r!   r>   r'   write	AFTER_BARflushrH   s    rB   rM   ProgressBar.render_finish   sa     $$NN4445()D%  ";;dmm			"		rE   c                    U R                   (       a  g[        U R                  [        U R                  =(       d    S5      =(       d    S-  S5      $ )N      ?r   )r:   minr4   floatr3   rH   s    rB   pctProgressBar.pct   s5    ==488uT[[%5A6;!<cBBrE   c                    U R                   (       d  g[        U R                   5      [        [        U R                   5      5      -  $ Ng        )r5   sumrf   lenrH   s    rB   time_per_iterationProgressBar.time_per_iteration   s,    xx488}uS]333rE   c                    U R                   b7  U R                  (       d&  U R                  U R                   U R                  -
  -  $ grj   )r3   r:   rm   r4   rH   s    rB   etaProgressBar.eta   s3    ;;"4==**dkkDHH.DEErE   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)ru   	day_labelhms02:r   )r9   intrp   format_)r@   r/   secondsminuteshourss        rB   
format_etaProgressBar.format_eta   s    >>DHHA"fG"HA"fG"HAFE"HA1u<CCf D    1WRL'">>rE   c                n    [        U R                  5      nU R                  b  USU R                   3-  nU$ )N/)strr4   r3   )r@   r4   s     rB   
format_posProgressBar.format_pos   s3    $((m;;"Qt{{m$$C
rE   c                @    [        U R                  S-  5      S S3SS  $ )Nd   z 4%r   )r|   rg   rH   s    rB   
format_pctProgressBar.format_pct   s&    dhhn%b)+AB//rE   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   )r3   r|   rg   r+   r   r   r:   listrm   mathcosr4   join)r@   
bar_lengthbarcharss       rB   
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
rE   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)r&   r   info)r#   r3   r$   appendr   r   r"   r9   r:   r   r%   r=   r   r&   r   r    r   rstrip)r@   r#   	info_bits	item_infos       rB   format_progress_line ProgressBar.format_progress_line   s   ((	;;"|';#}},L==T__./T__./==T^^DMMT__./*++D,=,=>I$  + (**95 &(	rE   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)r!   r>   r?   r&   r   r'   r(   r,   shutilr+   r   r   maxget_terminal_sizecolumnsr;   r   
BEFORE_BARr   ra   )	r@   bufr   	old_widthclutter_length	new_widthclear_widthlineline_lens	            rB   rG   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 #rE   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 )NTrd   i)r4   r3   r:   r6   r8   r7   r5   r9   )r@   n_stepssteps      rB   r^   ProgressBar.make_step(  s    G;;"txx4;;'> DMIIK$--'3.		
 88IIK$**,8D99;+D88BC=D6)D0rE   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   )r=   r*   r)   r^   rG   )r@   r   r=   s      rB   updateProgressBar.update>  s`      # ,!!W,!$$(=(==NN4445  "()D% >rE   c                .    SU l         S U l        SU l        g )NFT)r9   r=   r:   rH   s    rB   finishProgressBar.finishX  s     rE   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.
rT   Nr   r   )	r<   rU   r>   r2   r=   r*   rG   r   r   )r@   rvs     rB   rV   ProgressBar.generator]  s      ||OPP}}yy  ii$&!
 ,,1((*A   KKM  " !s   =B6B4 A5B6)r*   r>   r?   r,   r5   r   r(   r=   r   r<   r9   r'   r   r:   r!   r    r%   r2   r&   r8   r3   r;   r4   r"   r#   r$   r7   r)   r+   )N#r   z%(bar)sz  FTNFNNNNr      )"rA   zcabc.Iterable[V] | Noner3   z
int | Noner   r   r   r   r   r   r    r   r!   boolr"   r   r#   bool | Noner$   r   r%   z)t.Callable[[V | None], str | None] | Noner&   
str | Noner'   zt.TextIO | Noner(   r   r)   r|   r+   r|   returnNone)r   zProgressBar[V])rN   ztype[BaseException] | NonerO   zBaseException | NonerP   zTracebackType | Noner   r   )r   zcabc.Iterator[V])r   r   r   r   )r   rf   r   r   )r   r|   r   r   rL   )r   r|   r=   zV | Noner   r   )__name__
__module____qualname____firstlineno__rC   rI   rQ   rW   r[   rM   propertyrg   rm   rp   r   r   r   r   r   rG   r^   r   r   rV   __static_attributes__ rE   rB   r   r   +   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
#rE   r   c                  T    \ rS rSrS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	rg
)_PagerWriteri  a(  Wrap a pager's output stream to strip ANSI styling when colors are
disabled.

The wrapped stream is owned by the pager strategy that produced it, so this
wrapper never closes it: ``_pipepager`` closes its pipe to signal EOF to the
pager process, ``_tempfilepager`` closes and removes its temporary file, and
``_nullpager`` leaves an external stream such as ``sys.stdout`` untouched.

The ``color`` attribute lets :func:`click.echo` detect that ANSI stripping
is handled here, so it doesn't strip a second time (see
:func:`._compat.should_strip_ansi`).
c                    Xl         X l        g rL   _streamr(   )r@   streamr(   s      rB   rC   _PagerWriter.__init__  s    
rE   c                p    U R                   (       d  [        U5      nU R                  R                  U5      $ rL   )r(   r   r   r_   r@   texts     rB   r_   _PagerWriter.write  s(    zzd#D||!!$''rE   c                8    U H  nU R                  U5        M     g rL   )r_   )r@   linesr   s      rB   
writelines_PagerWriter.writelines  s    DJJt rE   c                8    U R                   R                  5         g rL   r   ra   rH   s    rB   ra   _PagerWriter.flush  s    rE   c                8    U R                   R                  5         g rL   r   rH   s    rB   close_PagerWriter.close  s     	rE   c                .    [        U R                  U5      $ rL   )getattrr   )r@   names     rB   __getattr___PagerWriter.__getattr__  s    t||T**rE   r   N)r   t.TextIOr(   r   r   r   )r   r   r   r|   )r   zcabc.Iterable[str]r   r   r   )r   r   r   zt.Any)r   r   r   r   __doc__rC   r_   r   ra   r   r   r   r   rE   rB   r   r     s%    (
+rE   r   c                    U (       d  gSSK nUR                  U S   5      nU(       d  g[        U5      R                  5       U SS 4$ )a  Resolve a pager ``argv`` to an absolute command path and its parameters.

The command is looked up with :func:`shutil.which`, which the
:mod:`subprocess` docs recommend on every platform for an unqualified name:
https://docs.python.org/3/library/subprocess.html#popen-constructor

Returns ``None`` when there is no command to run or it is not on the path,
leaving the caller to pick a fallback.
Nr   r   )r   whichr   absolute)	cmd_partsr   cmd_filepaths      rB   _resolve_pager_commandr     sF     <<	!-L &&()AB-77rE   c                l   [        5       nUc
  [        5       n[        [        R                  5      (       a  [        U5      (       d  [        X5      $ [        R                  " [        R                  R                  SS5      5      nU(       a  [        nOg[        R                  R                  S5      S;   a  [        X5      $ [        =(       d    [        R                  R                  S5      nU(       a  S/OS/n[        U5      nUc  [        X5      $ Uu  pVU(       a  [        XVU 5      $ [!        XVU 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   platform
startswithr   _tempfilepager
_pipepager)r(   stdoutpager_cmd_partsuse_tempfileresolvedcmd_path
cmd_paramss          rB   _pager_contextmanagerr	    s     "#F ~#))F6NN&(( kk"**..""=>O ::>>&!%66f,,<cll55e<&26(%o6H&((#HhE::hE22rE   c              #    #    [        U S9 u  p[        U[        U 5      S9n [        R                  " [        R
                  U5      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.0

:param color: controls if the pager supports ANSI colors or not.  The
              default is autodetection.
)r(   N)r	  r   r   r/   r0   TextIOra   )r(   r   writers      rB   get_pager_filer    se      
U	+ fDK8	&&6**LLN 
,	+ LLN 
,	+s3   
B
A9'A$
A9	B
$A66A99
BB
c                l    [         R                  " U 5      nX!-   nU Hs  nUR                  S5      (       a  UR	                  5       S:X  a    gM1  UR                  S5      (       d  MI  [        U5      S:  d  MZ  SUSS R	                  5       ;   d  Ms    g   g! [         a    U R                  5       n Nf = f)	a_  Detect a raw-control-characters request in a ``less`` invocation.

Parses the tokens of the ``LESS`` environment variable and the command
line: only short-option clusters (``-R``, ``-rX``, ``-XrY``) and the
``--raw-control-chars`` long option request raw mode. Filenames and
long-option values may carry the letter ``r`` without being such a
request.
z--z--raw-control-charsT-r   rNF)r   r   
ValueErrorr   casefoldrl   )less_envr  
env_tokenstokenstokens        rB   _less_uses_raw_moder    s    &[[*

 $FD!!~~#88 9c""s5zA~eABi((**    & ^^%
&s   B B32B3c           	   #  t  #    SSK n[        [        R                  5      nU R                  n[
        (       a  UR                  5       nUcN  US:X  aH  [        R                  R                  SS5      n[        Xa5      (       a  SnOU(       d  U(       d  SUS'   SnUR                  [        U 5      /U-   SUR                  US	SS
9n[        R                  " [        R                  UR                  5      n X4v    UR'                  5           UR)                  5         g! [          a     N0["         a  n	UR%                  5         U	eSn	A	ff = f! [          a     NNf = f! [*         a     Of = fMc  !  UR'                  5         O! [          a     Of = f  UR)                  5         f ! [*         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.

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.
r   Nr   LESSr   T-RFreplace)shellr   enverrorsr   )
subprocessdictr   r   stemr   r  r   r  Popenr   PIPEr/   r0   r  r   BrokenPipeError	Exception	terminater   waitKeyboardInterrupt)
r  r  r(   r  r  cmd_namer  cr   es
             rB   r  r  $  s      rzz
C }}H
s
 $$&}V+::>>&"-x44E*CKE	X*$oo 	 	A FF188QWW%E#l	KKM  C   
 	
  		 %  	KKM  		   %  s   C0F83D 9E 	F8E F8
E&E- (	E1EEE- 
EF8EF8
E(%F8'E((F8-F5/F ?F5 
F
F5FF5F#"F5#
F0-F5/F00F55F8c              #  "  #    SSK nSSKn[        [        R                  5      nUR                  SUSSS9n [        R                  " [        R                  U5      U4v   UR                  5         UR                  5         UR                  [        U 5      /UQUR                  P5        UR                  5         [        R                  " UR                  5        g! UR                  5         [        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 invoked with any parameters from ``PAGER``
followed by the temporary file name.
r   Nwr  F)modeencodingr  delete)r  tempfiler   r   r  NamedTemporaryFiler/   r0   r  ra   r   callr   r   r   unlink)r  r  r(   r  r1  r/  fs          rB   r  r  {  s       ,H 	##8Ie 	$ 	AffQXXq!5((				X<<QVV<= 	
	
		!&& 	
	
		!&&s   4DA2C )1D2DDc              #     #    X4v   g7f)a  Simply print unformatted text. This is the ultimate fallback.

The stream comes from elsewhere (typically ``sys.stdout``), so its lifecycle
is left untouched: :class:`_PagerWriter` never closes what it wraps, and it
is the only thing :func:`get_pager_file` hands to the caller.
Nr   )r   r(   s     rB   r   r     s      -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 rL   )editorr  require_save	extension)r@   r:  r  r;  r<  s        rB   rC   Editor.__init__  s     ("rE   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)r:  r   r   r   r   r   r   )r@   keyr   r   r:  s        rB   
get_editorEditor.get_editor  sg    ;;";;%C$Br	 & 3 6FV}( 7 rE   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)r:  z{editor}: Editing failed: {e})r:  r+  )r   r  rF  r  r   r   copyr   r"  r   r   r'  r   r~   r}   OSError)	r@   	filenamesr   r  r:  r   r*  	exit_coder+  s	            rB   
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 rL   r   r   s     rB   editEditor.edit  s    =@rE   c                    g rL   r   r   s     rB   rQ  rR    s    47rE   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   rE   r   z
z	utf-8-sigzutf-8zeditor-)prefixsuffixwb   rb)r1  
isinstancebytes	bytearrayendswithr   r  encodemkstempr<  r   fdopenr_   utimepathgetatimegetmtimerN  r;  r4  openreaddecode)	r@   r   r1  datafdr   r5  	timestampr   s	            rB   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)r:  r  r<  r;  )NNTz.txt)
r:  r   r  zcabc.Mapping[str, str] | Noner;  r   r<  r   r   r   r   )rL  z%cabc.Iterable[str | os.PathLike[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   rC   rF  rN  r/   overloadrQ  r   r   rE   rB   r8  r8    s|     "-1!
#
# +
# 	
#
 
# 

#"< ZZ@ @ ZZ7 7-rE   r8  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.parsern  r   )urlrn  s     rB   _unquote_fileopen_url.<locals>._unquote_file"  s)    (>>)$$#ab'"C
rE   darwinre  z-Wr  z	/dev/nullr-  )stderrexplorerz/select,   cygstartz-w.zxdg-open)zhttp://zhttps://r   )rq  r   r   r   )r  r   r   r   re  r"  r'  r   r   r3  rK  r   	startfiler
   rb  dirnamer   
webbrowser)	rq  r'  locater  rr  rI  nullr*  r|  s	            rB   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    rB   _translate_ch_to_excr  e  s?    	V|!!	V|CCj	V|j |rE   win32c               #     #    Sv   g 7f)Nr   r   r   rE   rB   raw_terminalr  s  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)    à)r/   r0   Callabler   msvcrtgetwchegetwchr  )r   funcr   s      rB   getcharr  w  ss    > 66!**RW-v~~>D66!**RW-v}}=DV!! $&LBR 	rE   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   re  filenotermios	tcgetattrttysetraw	tcsetattr	TCSADRAINr  ra   r   error)r5  ri  old_settingss      rB   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   rf  rg  r   r   r   r   r  r_   r  )r   ri  r  s      rB   r  r    sg    ^rR''(9#))(DiPBszz**

  $ $ ^^s   BB$$
B2)r   	list[str]r   ztuple[Path, list[str]] | NonerL   )r(   r   r   z.t.ContextManager[tuple[t.TextIO, bool | None]])r(   r   r   z!t.Generator[t.TextIO, None, None])r  r   r  r  r   r   )r  r   r  r  r(   r   r   (t.Iterator[tuple[t.TextIO, bool | None]])r   r   r(   r   r   r  )FF)rq  r   r'  r   r}  r   r   r|   )r  r   r   r   )r   zcabc.Iterator[int])r   r   r   r   );r   
__future__r   collections.abcabccabc
contextlibr   r   r   r   r6   typingr/   r   r~   ior   pathlibr   typesr   _compatr	   r
   r   r   r   r   r   
exceptionsr   utilsr   TypeVarr   r   r   r`   Genericr   r   r   r	  contextmanagerr  r  r  r  r   r8  r  r  r   r  r  r  r  r  r   rE   rB   <module>r     s   #    	  
        )  &     & IIcN 77d?JIJIQ#!))A, Q#h
%+ %+P8: *3*33*3Z  .8 @DSS )S2=S-S Sl @D )2=- D +/		(	-	 	q qhCL <<7 ,^  4rE   