
    ֝j%                       d Z ddlmZ ddlmZ ddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z!  ej"        d          Z#ej$        dk    rdZ%dZ&ndZ%dZ& G d dej'        e#                   Z( G d d          Z)dFd Z*	 dGdHd$Z+ej,        dGdId&            Z-dJd+Z.ej,        	 dGdKd/            Z/ej,        	 dGdKd0            Z0ej,        	 dGdLd3            Z1 G d4 d5          Z2dMdNd;Z3dOd>Z4e
j5        d?k    rddl6Z6ej,        dPdA            Z7dQdCZ8dS ddl9Z9ddl:Z:ej,        dPdD            Z7dQdEZ8dS )Rz
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                      e Zd Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dEdFd%ZdGd'ZdHd.ZdId0ZdJd2ZdKd3Ze	dLd5            Z
e	dLd6            Ze	dLd7            ZdMd8ZdMd9ZdMd:ZdMd;ZdMd<ZdKd=ZdNd?ZdOdPdBZdKdCZdIdDZdS )QProgressBarN# %(bar)s  FTr      iterablecabc.Iterable[V] | Nonelength
int | None	fill_charstr
empty_charbar_templateinfo_sephiddenboolshow_etashow_percentbool | Noneshow_positem_show_func)t.Callable[[V | None], str | None] | Nonelabel
str | Nonefilet.TextIO | Nonecolorupdate_min_stepsintwidthreturnNonec                   || _         || _        || _        || _        || _        || _        |	| _        |
| _        || _        |pd| _	        |t                      }|t                      }|| _        || _        || _        d| _        || _        |dk    | _        |ddlm}  ||d          }|dk    rd }|3|t)          d          t+          j        dt/          |                    }t1          |          | _        || _        d| _        g | _        |  |  t9          j                    x| _        | _        d| _        d| _         d | _!        d| _"        d | _#        tI          | j                  | _%        d | _&        d S )N r   )length_hintziterable or length is requiredzcabc.Iterable[V]F)'r!   r#   r$   r%   r&   r(   r)   r+   r,   r.   r	   r   r0   r2   r3   _completed_intervalsr5   	autowidthoperatorr:   	TypeErrortcastrangeiterr   posavgtimestartlast_eta	eta_knownfinished	max_widthenteredcurrent_itemr   _is_atty
_last_line)selfr   r   r!   r#   r$   r%   r&   r(   r)   r+   r,   r.   r0   r2   r3   r5   r:   s                     Q/var/www/html/python-test/venv/lib/python3.11/site-packages/click/_termui_impl.py__init__zProgressBar.__init__,   s   & #$(  ( ,+2
<'))D |zz	
 0$%!
$z>,,,,,, [2..F||~ @AAAv0%--@@H&*8nn	 "%)Y[[0
T]$#%)"&*ty))&*    ProgressBar[V]c                <    d| _         |                                  | S )NT)rL   render_progressrP   s    rQ   	__enter__zProgressBar.__enter__s   s     rS   exc_typetype[BaseException] | None	exc_valueBaseException | NonetbTracebackType | Nonec                .    |                                   d S N)render_finish)rP   rY   r[   r]   s       rQ   __exit__zProgressBar.__exit__x   s     	rS   cabc.Iterator[V]c                ~    | j         st          d          |                                  |                                 S )N.You need to use progress bars in a with block.)rL   RuntimeErrorrV   	generatorrW   s    rQ   __iter__zProgressBar.__iter__   s>    | 	QOPPP~~rS   r   c                :    t          t          |                     S r`   )nextrC   rW   s    rQ   __next__zProgressBar.__next__   s     DJJrS   c                   | j         r5|                     | j                    d| _         |                                  | j        s| j        sd S | j                            t                     | j                                         d S )Nr   )	r<   	make_steprV   r&   rN   r0   write	AFTER_BARflushrW   s    rQ   ra   zProgressBar.render_finish   s     $ 	#NN44555()D%  """; 	dm 	F		"""	rS   floatc                p    | j         rdS t          | j        t          | j        pd          pdz  d          S )N      ?r   )rJ   minrD   rq   r   rW   s    rQ   pctzProgressBar.pct   s<    = 	348uT[%5A66;!<cBBBrS   c                    | j         sdS t          | j                   t          t          | j                             z  S Ng        )rE   sumrq   lenrW   s    rQ   time_per_iterationzProgressBar.time_per_iteration   s4    x 	348}}uS]]3333rS   c                P    | j         | j        s| j        | j         | j        z
  z  S dS rw   )r   rJ   rz   rD   rW   s    rQ   etazProgressBar.eta   s-    ;"4="*dkDH.DEEsrS   c                    | j         rlt          | j                  }|dz  }|dz  }|dz  }|dz  }|dz  }|dz  }|dk    r'd                    |t	          d          |||          S |dd|dd|dS d	S )
N<      r   z#{d}{day_label} {h:02}:{m:02}:{s:02}d)r   	day_labelhms02:r9   )rI   r4   r|   format_)rP   r@   secondsminuteshourss        rQ   
format_etazProgressBar.format_eta   s    > 	?DHA"fG"HA"fG"HAFE"HA1uu<CCff D     >>>W>>>'>>>>rrS   c                V    t          | j                  }| j        |d| j         z  }|S )N/)r"   rD   r   )rP   rD   s     rQ   
format_poszProgressBar.format_pos   s1    $(mm;"$t{$$$C
rS   c                H    t          | j        dz            dddd          S )Nd   z 4%r   )r4   ru   rW   s    rQ   
format_pctzProgressBar.format_pct   s+    dhn%%++++ABB//rS   c                   | j         <t          | j        | j        z            }| j        |z  }|| j        | j        |z
  z  z  }n| j        r| j        | j        z  }nt          | j        | j        pdz            }| j        dk    rD| j        |t          t          j
        | j        | j        z            dz  dz   | j        z            <   d                    |          }|S )Nr   r   g       @g      ?r9   )r   r4   ru   r5   r!   r#   rJ   listrz   mathcosrD   join)rP   
bar_lengthbarcharss       rQ   
format_barzProgressBar.format_bar   s    ;"TX
233J.:-C4?dj:&=>>CC] 	!.4:-CCDJO!<==E&!++ N $(T-D"DEEKcQ*%  ''%..C
rS   c                j   | j         }g }| j        
|| j         }| j        r'|                    |                                            |r'|                    |                                            | j        r5| j        r.| j        s'|                    | 	                                           | j
        1| 
                    | j                  }||                    |           | j        | j        |                                 | j                            |          dz                                  S )N)r.   r   info)r)   r   r+   appendr   r   r(   rI   rJ   r   r,   rM   r$   r.   r   r%   r   rstrip)rP   r)   	info_bits	item_infos       rQ   format_progress_linez ProgressBar.format_progress_line   s3   (	;"|';#},L= 	0T__../// 	0T__..///= 	0T^ 	0DM 	0T__..///*++D,=>>I$  +++ ((**955  &((	rS   c                   | j         rd S | j        s?| j        | j        k    r-| j        | _        t	          | j        | j        | j                   d S g }| j        rdd l}| j	        }d| _	        t          |                                           }t          d|                                j        |z
            }||k     rE| j        >|                    t"                     |                    d| j        z             || _        || _	        | j	        }| j        | j        }|                    t"                     |                                 }t          |          }| j        | j        |k     r|| _        |                    |           |                    d||z
  z             d                    |          }|| j        k    r?|| _        t	          || j        | j        d           | j                                         d S d S )N)r0   r2   r   r   r9   F)r0   r2   nl)r&   rN   rO   r.   r   r0   r2   r=   shutilr5   r   r   maxget_terminal_sizecolumnsrK   r   
BEFORE_BARr   rp   )	rP   bufr   	old_widthclutter_length	new_widthclear_widthlineline_lens	            rQ   rV   zProgressBar.render_progress   s   ; 	F} 	$*,,"&*TZditzBBBBF> 	#MMM
IDJ%d&?&?&A&ABBNAv7799ANRSSI9$$)C

:&&&

3/000!*"DJj>%.K

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

4

3+01222wws|| 4?"""DODITZEBBBBIOO #"rS   n_stepsc                   | xj         |z  c_         | j        | j         | j        k    rd| _        t          j                    | j        z
  dk     rd S t          j                    | _        | j         r$t          j                    | j        z
  | j         z  }nt          j                    | j        z
  }| j        dd          |gz   | _        | j        d u| _        d S )NTrs   i)rD   r   rJ   rF   rH   rG   rE   rI   )rP   r   steps      rQ   rm   zProgressBar.make_step(  s    G;"tx4;'>'> DMIKK$-'3..F	
 8 	,IKK$*,8DD9;;+D8BCC=D6)D0rS   rM   V | Nonec                    ||| _         | xj        |z  c_        | j        | j        k    r7|                     | j                   |                                  d| _        dS dS )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   )rM   r<   r3   rm   rV   )rP   r   rM   s      rQ   updatezProgressBar.update>  st      # ,D!!W,!!$(===NN44555  """()D%%% >=rS   c                0    d| _         d | _        d| _        d S )NFT)rI   rM   rJ   rW   s    rQ   finishzProgressBar.finishX  s     rS   c              #  D  K   | j         st          d          | j        s| j        E d{V  dS | j        D ]A}|| _        | j        dk    r|                                  |V  |                     d           B|                                  |                                  dS )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   )	rL   rf   rN   rC   rM   r<   rV   r   r   )rP   rvs     rQ   rg   zProgressBar.generator]  s       | 	QOPPP} 	#y         i 
 
$&!
 ,11((***AKKMMM  """""rS   )Nr   r   r   r   FTNFNNNNr   r   )"r   r   r   r    r!   r"   r#   r"   r$   r"   r%   r"   r&   r'   r(   r'   r)   r*   r+   r'   r,   r-   r.   r/   r0   r1   r2   r*   r3   r4   r5   r4   r6   r7   )r6   rT   )rY   rZ   r[   r\   r]   r^   r6   r7   )r6   rc   )r6   r   r6   r7   )r6   rq   r6   r"   )r   r4   r6   r7   r`   )r   r4   rM   r   r6   r7   )__name__
__module____qualname__rR   rX   rb   rh   rk   ra   propertyru   rz   r|   r   r   r   r   r   rV   rm   r   r   rg    rS   rQ   r   r   +   s        "%$(DH  $! !#E+ E+ E+ E+ E+N   
                     C C C XC
 4 4 4 X4
    X
   *   0 0 0 0   &   6, , , ,\1 1 1 1,* * * * *4   
# # # # # #rS   r   c                  B    e Zd ZdZddZddZddZddZddZddZ	dS )_PagerWriteraL  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`).
    streamt.TextIOr2   r'   r6   r7   c                "    || _         || _        d S r`   )_streamr2   )rP   r   r2   s      rQ   rR   z_PagerWriter.__init__  s    


rS   textr"   r4   c                b    | j         st          |          }| j                            |          S r`   )r2   r   r   rn   rP   r   s     rQ   rn   z_PagerWriter.write  s/    z 	$d##D|!!$'''rS   linescabc.Iterable[str]c                :    |D ]}|                      |           d S r`   )rn   )rP   r   r   s      rQ   
writelinesz_PagerWriter.writelines  s0     	 	DJJt	 	rS   c                8    | j                                          d S r`   r   rp   rW   s    rQ   rp   z_PagerWriter.flush  s    rS   c                8    | j                                          d S r`   r   rW   s    rQ   closez_PagerWriter.close  s     	rS   namet.Anyc                ,    t          | j        |          S r`   )getattrr   )rP   r   s     rQ   __getattr__z_PagerWriter.__getattr__  s    t|T***rS   N)r   r   r2   r'   r6   r7   )r   r"   r6   r4   )r   r   r6   r7   r   )r   r"   r6   r   )
r   r   r   __doc__rR   rn   r   rp   r   r   r   rS   rQ   r   r     s            ( ( ( (         
+ + + + + +rS   r   	cmd_parts	list[str]r6   tuple[Path, list[str]] | Nonec                    | sdS ddl }|                    | d                   }|sdS t          |                                          | dd         fS )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)r   r   cmd_filepaths      rQ   _resolve_pager_commandr     se      tMMM<<	!--L t &&(()ABB-77rS   r2   r*   .t.ContextManager[tuple[t.TextIO, bool | None]]c                x   t                      }|t                      }t          t          j                  rt          |          st          ||           S t          j        t          j	        
                    dd                    }|rt          }n_t          j	        
                    d          dv rt          ||           S t          pt          j                            d          }|rdgndg}t          |          }|t          ||           S |\  }}|rt          |||           S t!          |||           S )	z2Decide what method to use for paging through text.NPAGERr9   TERM)dumbemacsos2moreless)r	   r   r   sysstdin
_nullpagershlexsplitosenvirongetr   platform
startswithr   _tempfilepager
_pipepager)r2   stdoutpager_cmd_partsuse_tempfileresolvedcmd_path
cmd_paramss          rQ   _pager_contextmanagerr     s0    "##F ~#) )F6NN )&%((( k"*..""="=>>O 	A :>>&!!%666fe,,,<cl55e<<&2@6((%o66H&%(((#Hj ;h
E:::h
E222rS   !t.Generator[t.TextIO, None, None]c              #  @  K   t          |           5 \  }} t          |t          |                     }	 t          j        t          j        |          V  |                                 n# |                                 w xY w	 ddd           dS # 1 swxY w Y   dS )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.
    )r2   N)r   r   r'   r@   rA   TextIOrp   )r2   r   writers      rQ   get_pager_filer    s       
U	+	+	+ 
 fDKK888	&6*****LLNNNNFLLNNNNN
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
s(   "B!A,B,BBBBless_envr"   r   r'   c                   	 t          j        |           }n$# t          $ r |                                 }Y nw xY w||z   }|D ]|}|                    d          r|                                dk    r dS 3|                    d          r4t          |          dk    r!d|dd                                         v r dS }dS )	aw  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   casefoldry   )r  r   
env_tokenstokenstokens        rQ   _less_uses_raw_moder    s    &[**

 & & & ^^%%


& *$F  D!! 	~~#888tt 9c"" 	s5zzA~~eABBi((****tt5s    88r   r   (t.Iterator[tuple[t.TextIO, bool | None]]c              #  t  K   ddl }t          t          j                  }| j        }t
          r|                                }|D|dk    r>t          j                            dd          }t          ||          rd}n|s	|sd|d<   d}|	                    t          |           g|z   d|j        |d	d
          }t          j        t          j        |j                  }	 ||fV  n3# t           $ r Y n't"          $ r}	|                                 |	d}	~	ww xY w	 |                                 n# t           $ r Y nw xY w	 	 |                                 dS # t*          $ r Y nw xY w(# 	 |                                 n# t           $ r Y nw xY w	 	 |                                 n# t*          $ r Y nw xY w'w xY w)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   LESSr9   T-RFreplace)shellr   enverrorsr   )
subprocessdictr   r   stemr   r  r   r  Popenr"   PIPEr@   rA   r   r   BrokenPipeError	Exception	terminater   waitKeyboardInterrupt)
r   r   r2   r  r  cmd_namer  cr   es
             rQ   r   r   $  s`       rz

C }H
 '
 $$&&}V++:>>&"--x44 	EE 	* 	CKE	X*$o 	 	 	A F18QW%%E#Ul      
 	
	KKMMMM  	 	 	D		  %   		KKMMMM  	 	 	D		  %   	 	 	 	 	s   C% $E' %
D/E' 1	D:DDE' D. .
D;:D; E 
E#"E#'F7)E>=F7>
FF7
FF7F%$F7%
F2/F71F22F7c              #  ,  K   ddl }ddl}t          t          j                  }|                    d|dd          }	 t          j        t          j        |          |fV  |	                                 |
                                 |                    t          |           g||j                   |
                                 t          j        |j                   dS # |
                                 t          j        |j                   w xY w)a8  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@   rA   r   rp   r   callr"   r   r   unlink)r   r   r2   r  r'  r%  fs          rQ   r   r   {  s      OOO ,,H 	##8Ie 	$ 	 	AfQXq!!5((((								X<<QV<=== 	
			
	!& 	
			
	!&s   A7C$ $/Dr   r   c              #     K   | |fV  dS )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   r2   s     rQ   r   r     s       %-rS   c                  |    e Zd Z	 	 	 	 dddZddZddZej        dd            Zej        d d            Zd!dZdS )"EditorNT.txteditorr/   r  cabc.Mapping[str, str] | Nonerequire_saver'   	extensionr"   r6   r7   c                >    || _         || _        || _        || _        d S r`   )r0  r  r2  r3  )rP   r0  r  r2  r3  s        rQ   rR   zEditor.__init__  s%     ("rS   c                    | j         | j         S dD ]'}t          j                            |          }|r|c S (t          rdS ddlm} dD ]} ||          |c S dS )N)VISUALEDITORnotepadr   )r   )zsensible-editorvimnanovi)r0  r   r   r   r   r   r   )rP   keyr   r   r0  s        rQ   
get_editorzEditor.get_editor  s    ;";% 	 	C$$B 			 	9      6 	 	FuV}}( )trS   	filenames%cabc.Iterable[str | os.PathLike[str]]c                H   ddl }ddl}|                                 }d}| j        r8t          j                                        }|                    | j                   	 |                     |j	        |          t          |          z   |          }|                                }|dk    r0t          t          d                              |                    dS # t          $ r7}t          t          d                              ||                    |d}~ww xY w)z Open files in the user's editor.r   N)argsr  z{editor}: Editing failed)r0  z{editor}: Editing failed: {e})r0  r!  )r   r  r=  r  r   r   copyr   r  r   r   r  r   r   r   OSError)	rP   r>  r   r  r0  r   r   	exit_coder!  s	            rQ   
edit_fileszEditor.edit_files  s;   "")-8 	%joo''GNN48$$$	    U[((4	??: !  A IA~~$011888GG   ~  	 	 	 1229919MM 	s   A?C   
D!*2DD!r   bytes | bytearraybytes | Nonec                    d S r`   r   r   s     rQ   editzEditor.edit  s    =@SrS   c                    d S r`   r   r   s     rQ   rI  zEditor.edit  s    47CrS   str | bytes | bytearray | Nonestr | bytes | Nonec                   dd l }|d}nt          |t          t          f          r|}nb|r|                    d          s|dz  }t
          r*|                    dd                              d          }n|                    d          }|                    d| j	                  \  }}	 t          j        |d	          5 }|                    |           d d d            n# 1 swxY w Y   t          j        |t          j                            |          t          j                            |          d
z
  f           t          j                            |          }|                     |f           | j        r:t          j                            |          |k    r	 t          j        |           d S t)          |d          5 }|                                }d d d            n# 1 swxY w Y   t          |t          t          f          r|t          j        |           S |                    d                              dd          t          j        |           S # t          j        |           w xY w)Nr   rS   r   z
z	utf-8-sigzutf-8zeditor-)prefixsuffixwb   rb)r'  
isinstancebytes	bytearrayendswithr   r  encodemkstempr3  r   fdopenrn   utimepathgetatimegetmtimerE  r2  r*  openreaddecode)	rP   r   r'  datafdr   r+  	timestampr   s	            rQ   rI  zEditor.edit  s   <&)DDui011 		,DD DMM$//  ,||D&1188EE{{7++##9T^#LLD	2t$$                HTBG,,T22BG4D4DT4J4JQ4NOPPP ((..IOOTG$$$  RW%5%5d%;%;y%H%H IdOOOOO dD!! QVVXX               $	 233  IdOOOO 99[))11&$??IdOOOOBIdOOOOsa   +I"  C"I" "C&&I" )C&*B6I" 7I" G(I" (G,,I" /G,0 I" %(I" "I8)NNTr/  )
r0  r/   r  r1  r2  r'   r3  r"   r6   r7   r   )r>  r?  r6   r7   )r   rF  r6   rG  )r   r/   r6   r/   )r   rK  r6   rL  )	r   r   r   rR   r=  rE  r@   overloadrI  r   rS   rQ   r.  r.    s         "-1!
# 
# 
# 
# 
#   "   < Z@@@ Z@ Z777 Z7- - - - - -rS   r.  Furlr  locater4   c                   dd l }dd}t          j        dk    rdg}|r|                    d           |r|                    d	           |                     ||                      t	          d
d          }	 |                    ||                                          |                                 S # |                                 w xY wt          rb|r7 ||           } dd| g}	 |	                    |          S # t          $ r Y dS w xY w	 t          j        |            n# t          $ r Y dS w xY wdS t          r|r- ||           } dt          j                            |           g}n/dg}|r|                    d           |                    |            	 |	                    |          S # t          $ r Y dS w xY w	 |r+t          j                             ||                     pd} n ||           } |                    d| g          }|r|                                S dS # t          $ r9 |                     d          r |s|sdd l}|                    |            Y dS Y dS w xY w)Nr   re  r"   r6   c                b    ddl m} |                     d          r || dd                    } | S )Nr   )unquotezfile://   )urllib.parseri  r   )re  ri  s     rQ   _unquote_filezopen_url.<locals>._unquote_file"  sD    ((((((>>)$$ 	#'#abb'""C
rS   darwinr^  z-Wr  z	/dev/nullr#  )stderrexplorerz/select,   cygstartz-w.zxdg-open)zhttp://zhttps://r   )re  r"   r6   r"   )r  r   r   r   r^  r  r  r   r   r)  rC  r   	startfiler
   r[  dirnamer   
webbrowser)	re  r  rf  r  rl  rA  nullr   ru  s	            rQ   open_urlrw    s       |xx 	KK 	KKMM#&&'''K%%	##D#66;;==JJLLLLDJJLLLL	  	-$$C
C0D!t,,,   ssS!!!!   ss1	  	-$$C 4 45DD<D "D!!!KK	??4((( 	 	 	33	 	%'//--"4"455<CC-$$Cj#.// 	6688Oq   >>122 	6 	$ 	OOC   11qqsU   9(B6 6C)C> >
DDD% %
D32D3F3 3
G GA$H, ,<I/.I/chr7   c                    | dk    rt                      | dk    rt          st                      | dk    rt          rt                      d S d S )N)r  r   EOFError)rx  s    rQ   _translate_ch_to_excr~  e  sP    	V||!!!	V||C|jj	V|||jj |||rS   win32cabc.Iterator[int]c               #     K   dV  d S )Nr;   r   r   rS   rQ   raw_terminalr  s  s      rS   r   c                8   | r7t          j        t           j        g t          f         t          j                  }n6t          j        t           j        g t          f         t          j                  } |            }|dv r| |            z  }t          |           |S )N)    à)r@   rA   Callabler"   msvcrtgetwchegetwchr~  )r   funcr   s      rQ   getcharr  w  s    >  	>6!*RW-v~>>DD6!*RW-v}==DTVV!!! $$&&LBR   	rS   c               #    K   t          t          j                  s$t          d          } |                                 }n t          j                                        }d } 	 t          j        |          }	 t          j        |           |V  t          j	        |t
          j
        |           t          j                                         | |                                  d S d S # t          j	        |t
          j
        |           t          j                                         | |                                  w w xY w# t
          j        $ r Y d S w xY w)Nz/dev/tty)r   r   r   r^  filenotermios	tcgetattrttysetraw	tcsetattr	TCSADRAINr   rp   r   error)r+  rb  old_settingss      rQ   r  r    s6     
 ci   	Z  ABB!!##BA	",R00L
2!"g&7FFF
  """=GGIIIII != !"g&7FFF
  """=GGIIII !} 	 	 	DD	s,   !E  6C& AE  &AD==E   EEc                h   t                      5 }t          j        |d                              t	          t
          j                  d          }| r8t          t
          j                  rt
          j        	                    |           t          |           |cd d d            S # 1 swxY w Y   d S )N    r  )r  r   r_  r`  r   r   r   r   r   rn   r~  )r   rb  rx  s      rQ   r  r    s    ^^ 	rR''(9#)(D(DiPPB %sz** %
  $$$ $$$	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   BB''B+.B+)r   r   r6   r   r`   )r2   r*   r6   r   )r2   r*   r6   r   )r  r"   r   r   r6   r'   )r   r   r   r   r2   r*   r6   r  )r   r   r2   r*   r6   r  )FF)re  r"   r  r'   rf  r'   r6   r4   )rx  r"   r6   r7   )r6   r  )r   r'   r6   r"   );r   
__future__r   collections.abcabccabc
contextlibr   r   r   r   rF   typingr@   r   r   ior   pathlibr   typesr   _compatr	   r
   r   r   r   r   r   
exceptionsr   utilsr   TypeVarr   r   r   ro   Genericr   r   r   r   contextmanagerr  r  r   r   r   r.  rw  r~  r   r  r  r  r  r  r   rS   rQ   <module>r     s    # " " " " "            				  



                                    ) ) ) ) ) )       & & & & & &                         & & & & & &      AIcNN 7d??JIIJIQ# Q# Q# Q# Q#!)A, Q# Q# Q#h
%+ %+ %+ %+ %+ %+ %+ %+P8 8 8 8: *3 *3 *3 *3 *3Z     .   8 @DS S S S Sl @D    D +/	 	 	 	 	q q q q q q q qhC C C C CL    <7MMM   , , , , , ,^ NNNJJJ   4     rS   