o
    ßý°j%€  ã                   @  s,  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 "d¡Z#ej$dkr‡dZ%dZ&ndZ%dZ&G dd„ dej'e# ƒZ(G dd„ dƒZ)dQd d!„Z*	dRdSd%d&„Z+ej,dRdTd(d)„ƒZ-dUd.d/„Z.ej,	dRdVd3d4„ƒZ/ej,	dRdVd5d6„ƒZ0ej,	dRdWd9d:„ƒZ1G d;d<„ d<ƒZ2dXdYdBdC„Z3dZdFdG„Z4e
j5dHkrÿddl6Z6ej,d[dJdK„ƒZ7d\dMdN„Z8dS ddl9Z9ddl:Z:ej,d[dOdK„ƒZ7d\dPdN„Z8dS )]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ÚVÚntúÚ
z[?25lz[?25h
c                   @  sø   e Zd Z																dXdYd%d&„ZdZd(d)„Zd[d0d1„Zd\d3d4„Zd]d6d7„Zd^d8d9„Ze	d_d;d<„ƒZ
e	d_d=d>„ƒZe	d_d?d@„ƒZd`dAdB„Zd`dCdD„Zd`dEdF„Zd`dGdH„Zd`dIdJ„Zd^dKdL„ZdadNdO„ZdbdcdRdS„Zd^dTdU„Zd\dVdW„ZdS )dÚ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                 C  s>  || _ || _|| _|| _|| _|| _|	| _|
| _|| _|pd| _	|d u r.t
ƒ }|d u r.tƒ }|| _|| _|| _d| _|| _|dk| _|d u rWddlm} ||dƒ}|dkrWd }|d u rk|d u rctdƒ‚t dt|ƒ¡}t|ƒ| _|| _d| _g | _|  |  t ¡  | _| _d| _d| _ d | _!d| _"d | _#t$| jƒ| _%d | _&d S )NÚ r   )Úlength_hintéÿÿÿÿziterable or length is requiredzcabc.Iterable[V]F)'r   r!   r"   r#   r$   r&   r'   r)   r*   r,   r   r   r.   r0   r1   Ú_completed_intervalsr3   Ú	autowidthÚoperatorr7   Ú	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,   r.   r0   r1   r3   r7   © rN   ú…/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/click/_termui_impl.pyÚ__init__,   sV   




zProgressBar.__init__úProgressBar[V]c                 C  s   d| _ |  ¡  | S )NT)rI   Úrender_progress©rM   rN   rN   rO   Ú	__enter__s   s   zProgressBar.__enter__Úexc_typeútype[BaseException] | NoneÚ	exc_valueúBaseException | NoneÚtbúTracebackType | Nonec                 C  s   |   ¡  d S ©N)Úrender_finish)rM   rU   rW   rY   rN   rN   rO   Ú__exit__x   ó   zProgressBar.__exit__úcabc.Iterator[V]c                 C  s   | j stdƒ‚|  ¡  |  ¡ S )Nú.You need to use progress bars in a with block.)rI   ÚRuntimeErrorrR   Ú	generatorrS   rN   rN   rO   Ú__iter__€   s   zProgressBar.__iter__r   c                 C  s   t t| ƒƒS r[   )Únextr@   rS   rN   rN   rO   Ú__next__†   r^   zProgressBar.__next__c                 C  sJ   | j r|  | j ¡ d| _ |  ¡  | js| jsd S | j t¡ | j ¡  d S )Nr   )	r9   Ú	make_steprR   r$   rK   r.   ÚwriteÚ	AFTER_BARÚflushrS   rN   rN   rO   r\   Ž   s   zProgressBar.render_finishÚfloatc                 C  s(   | j rdS t| jt| jpdƒpd dƒS )Nç      ð?r   )rG   ÚminrA   rj   r   rS   rN   rN   rO   Úpctœ   s   zProgressBar.pctc                 C  s"   | j sdS t| j ƒtt| j ƒƒ S ©Ng        )rB   Úsumrj   ÚlenrS   rN   rN   rO   Útime_per_iteration¢   s   zProgressBar.time_per_iterationc                 C  s&   | j d ur| js| j| j | j  S dS rn   )r   rG   rq   rA   rS   rN   rN   rO   Úeta¨   s   zProgressBar.etac                 C  s~   | j r=t| jƒ}|d }|d }|d }|d }|d }|d }|dkr0dj|tdƒ|||d�S |d›d|d›d|d›�S d	S )
Né<   é   r   z#{d}{day_label} {h:02}:{m:02}:{s:02}Úd)ru   Ú	day_labelÚhÚmÚsÚ02ú:r6   )rF   r2   rr   ÚformatÚ_)rM   r=   ÚsecondsÚminutesÚhoursrN   rN   rO   Ú
format_eta®   s$   
ûzProgressBar.format_etac                 C  s(   t | jƒ}| jd ur|d| j› �7 }|S )Nú/)r    rA   r   )rM   rA   rN   rN   rO   Ú
format_posÃ   s   

zProgressBar.format_posc                 C  s   t | jd ƒd›d�dd … S )Néd   z 4ú%r   )r2   rm   rS   rN   rN   rO   Ú
format_pctÉ   s   zProgressBar.format_pctc                 C  s¨   | j d urt| j| j ƒ}| j| }|| j| j|  7 }|S | jr)| j| j }|S t| j| jp0d ƒ}| jdkrM| j|tt	 
| j| j ¡d d | j ƒ< d |¡}|S )Nr   r   g       @g      à?r6   )r   r2   rm   r3   r   r!   rG   Úlistrq   ÚmathÚcosrA   Újoin)rM   Ú
bar_lengthÚbarÚcharsrN   rN   rO   Ú
format_barÌ   s(   

ô÷
ûÿÿÿ
zProgressBar.format_barc                 C  s¶   | j }g }| jd ur|d u r| j }| jr| |  ¡ ¡ |r%| |  ¡ ¡ | jr5| jr5| js5| |  	¡ ¡ | j
d urI|  
| j¡}|d urI| |¡ | j| j|  ¡ | j |¡dœ  ¡ S )N)r,   rŒ   Úinfo)r'   r   r)   Úappendrƒ   r†   r&   rF   rG   r�   r*   rJ   r"   r,   rŽ   r#   rŠ   Úrstrip)rM   r'   Ú	info_bitsÚ	item_inforN   rN   rO   Úformat_progress_lineß   s,   


ýÿùz ProgressBar.format_progress_linec           	      C  sX  | j rd S | js| j| jkr| j| _t| j| j| jd� d S g }| jrYdd l}| j	}d| _	t
|  ¡ ƒ}td| ¡ j| ƒ}||k rV| jd urV| t¡ | d| j ¡ || _|| _	| j	}| jd urd| j}| t¡ |  ¡ }t
|ƒ}| jd u s{| j|k r~|| _| |¡ | d||  ¡ d |¡}|| jkrª|| _t|| j| jdd� | j ¡  d S d S )N)r.   r0   r   r   r6   F)r.   r0   Únl)r$   rK   rL   r,   r   r.   r0   r:   Úshutilr3   r   r”   ÚmaxÚget_terminal_sizeÚcolumnsrH   r�   Ú
BEFORE_BARrŠ   ri   )	rM   Úbufr–   Ú	old_widthÚclutter_lengthÚ	new_widthÚclear_widthÚlineÚline_lenrN   rN   rO   rR   ú   sF   





ýzProgressBar.render_progressÚn_stepsc                 C  sš   |  j |7  _ | jd ur| j | jkrd| _t ¡ | j dk r d S t ¡ | _| j r3t ¡ | j | j  }nt ¡ | j }| jdd … |g | _| jd u| _d S )NTrk   iúÿÿÿ)rA   r   rG   rC   rE   rD   rB   rF   )rM   r¢   ÚsteprN   rN   rO   rf   (  s   
zProgressBar.make_steprJ   úV | Nonec                 C  sJ   |dur|| _ |  j|7  _| j| jkr#|  | 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   )rJ   r9   r1   rf   rR   )rM   r¢   rJ   rN   rN   rO   Úupdate>  s   
ýzProgressBar.updatec                 C  s   d| _ d | _d| _d S )NFT)rF   rJ   rG   rS   rN   rN   rO   ÚfinishX  s   
zProgressBar.finishc                 c  sn   � | j stdƒ‚| js| jE dH  dS | jD ]}|| _| jdkr$|  ¡  |V  |  d¡ q|  ¡  |  ¡  dS )z¨Return a generator which yields the items added to the bar
        during construction, and updates the progress bar *after* the
        yielded block returns.
        r`   Nr   r   )	rI   ra   rK   r@   rJ   r9   rR   r¥   r¦   )rM   ÚrvrN   rN   rO   rb   ]  s   €

zProgressBar.generator)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-   r.   r/   r0   r(   r1   r2   r3   r2   r4   r5   )r4   rQ   )rU   rV   rW   rX   rY   rZ   r4   r5   )r4   r_   )r4   r   ©r4   r5   )r4   rj   ©r4   r    )r¢   r2   r4   r5   r[   )r¢   r2   rJ   r¤   r4   r5   )Ú__name__Ú
__module__Ú__qualname__rP   rT   r]   rc   re   r\   Úpropertyrm   rq   rr   r�   rƒ   r†   rŽ   r”   rR   rf   r¥   r¦   rb   rN   rN   rN   rO   r   +   sL    ï
G










.
r   c                   @  sL   e Zd ZdZddd	„Zddd„Zddd„Zddd„Zddd„Zd 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.TextIOr0   r%   r4   r5   c                 C  s   || _ || _d S r[   )Ú_streamr0   )rM   r¯   r0   rN   rN   rO   rP   �  s   
z_PagerWriter.__init__Útextr    r2   c                 C  s   | j st|ƒ}| j |¡S r[   )r0   r   r±   rg   ©rM   r²   rN   rN   rO   rg   ‘  s   z_PagerWriter.writeÚlinesúcabc.Iterable[str]c                 C  s   |D ]}|   |¡ qd S r[   )rg   )rM   r´   r    rN   rN   rO   Ú
writelines—  s   ÿz_PagerWriter.writelinesc                 C  ó   | j  ¡  d S r[   ©r±   ri   rS   rN   rN   rO   ri   ›  s   z_PagerWriter.flushc                 C  r·   r[   r¸   rS   rN   rN   rO   Úclosež  s   z_PagerWriter.closeÚnameút.Anyc                 C  s   t | j|ƒS r[   )Úgetattrr±   )rM   rº   rN   rN   rO   Ú__getattr__£  s   z_PagerWriter.__getattr__N)r¯   r°   r0   r%   r4   r5   )r²   r    r4   r2   )r´   rµ   r4   r5   r¨   )rº   r    r4   r»   )
rª   r«   r¬   Ú__doc__rP   rg   r¶   ri   r¹   r½   rN   rN   rN   rO   r®     s    




r®   Ú	cmd_partsú	list[str]r4   útuple[Path, list[str]] | Nonec                 C  s>   | 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_filepathrN   rN   rO   Ú_resolve_pager_command§  s   
rÅ   r0   r(   ú.t.ContextManager[tuple[t.TextIO, bool | None]]c                 C  sÆ   t ƒ }|du r
tƒ }ttjƒrt|ƒst|| ƒS t tj	 
dd¡¡}|r't}ntj	 
d¡dv r4t|| ƒS tp;tj d¡}|rAdgndg}t|ƒ}|du rQt|| ƒS |\}}|r]t||| ƒS t||| ƒS )	z2Decide what method to use for paging through text.NÚPAGERr6   ÚTERM)ÚdumbÚemacsÚos2ÚmoreÚless)r   r   r   ÚsysÚstdinÚ
_nullpagerÚshlexÚsplitÚosÚenvironÚgetr   ÚplatformÚ
startswithrÅ   Ú_tempfilepagerÚ
_pipepager)r0   ÚstdoutÚpager_cmd_partsÚuse_tempfileÚresolvedÚcmd_pathÚ
cmd_paramsrN   rN   rO   Ú_pager_contextmanagerÃ  s&   


rà   ú!t.Generator[t.TextIO, None, None]c              	   c  sn   � t | d��'\}} t|t| ƒd�}zt tj|¡V  W | ¡  n| ¡  w W d  ƒ dS 1 s0w   Y  dS )z÷Context 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.
    )r0   N)rà   r®   r%   r=   r>   ÚTextIOri   )r0   r¯   ÚwriterrN   rN   rO   Úget_pager_fileð  s   €"örä   Úless_envr    rß   r%   c                 C  sŽ   zt  | ¡}W n ty   |  ¡ }Y nw || }|D ])}| d¡r,| ¡ dkr+ dS q| d¡rDt|ƒdkrDd|dd…  ¡ v rD dS q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×   Úcasefoldrp   )rå   rß   Ú
env_tokensÚtokensÚtokenrN   rN   rO   Ú_less_uses_raw_mode  s    	ý
ÿ€rí   rÞ   r   ú(t.Iterator[tuple[t.TextIO, bool | None]]c           
      c  sn  � ddl }ttjƒ}| j}tr| ¡ }|du r4|dkr4tj dd¡}t||ƒr*d}n
|s4|s4d|d< d}|j	t
| ƒg| d|j|d	dd
�}t tj|j¡}zFz||fV  W n ty^   Y n tyo }	 z| ¡  |	‚d}	~	ww W z| ¡  W n	 ty€   Y nw 	 z| ¡  W dS  ty’   Y nw q‚z| ¡  W n	 ty£   Y nw 	 z| ¡  W 	 w  tyµ   Y nw q¥)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Í   ÚLESSr6   Tú-RFÚreplace)ÚshellrÏ   ÚenvÚerrorsr²   )Ú
subprocessÚdictrÓ   rÔ   Ústemr   ré   rÕ   rí   ÚPopenr    ÚPIPEr=   r>   râ   rÏ   ÚBrokenPipeErrorÚ	ExceptionÚ	terminater¹   ÚwaitÚKeyboardInterrupt)
rÞ   rß   r0   rõ   ró   Úcmd_namerå   ÚcrÏ   ÚerN   rN   rO   rÙ   $  sv   €

ú
€ú€	ÿ
ýÿýñÿ
úÿýrÙ   c              	   c  sž   � ddl }ddl}ttjƒ}|jd|ddd�}z,t tj|¡|fV  | 	¡  | 
¡  | t| ƒg|¢|j‘¡ W | 
¡  t |j¡ dS | 
¡  t |j¡ 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=   r>   râ   ri   r¹   Úcallr    rº   rÓ   Úunlink)rÞ   rß   r0   rõ   r  r  ÚfrN   rN   rO   rØ   {  s    €
ÿÿrØ   r¯   r°   c                 c  s   � | |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.
    NrN   )r¯   r0   rN   rN   rO   rÐ   ž  s   €
rÐ   c                   @  s^   e Zd Z				dd dd„Zd!dd„Zd"dd„Zejd#dd„ƒZejd$dd„ƒZd%dd„ZdS )&ÚEditorNTú.txtÚeditorr-   ró   úcabc.Mapping[str, str] | NoneÚrequire_saver%   Ú	extensionr    r4   r5   c                 C  s   || _ || _|| _|| _d S r[   )r  ró   r  r  )rM   r  ró   r  r  rN   rN   rO   rP   ¬  s   
zEditor.__init__c                 C  sh   | j d ur| j S dD ]}tj |¡}|r|  S q
trdS ddlm} dD ]}||ƒd ur1|  S q%dS )N)ÚVISUALÚEDITORÚnotepadr   )rÂ   )zsensible-editorÚvimÚnanoÚvi)r  rÓ   rÔ   rÕ   r   r–   rÂ   )rM   Úkeyr§   rÂ   r  rN   rN   rO   Ú
get_editor¸  s   
ÿÿzEditor.get_editorÚ	filenamesú%cabc.Iterable[str | os.PathLike[str]]c           	   
   C  s°   ddl }ddl}|  ¡ }d}| jrtj ¡ }| | j¡ z#|j| 	|¡t
|ƒ |d�}| ¡ }|dkr=ttdƒj|d�ƒ‚W dS  tyW } zttdƒj||d�ƒ|‚d}~ww )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õ   r  ró   rÓ   rÔ   Úcopyr¥   rø   rÒ   r‡   rý   r   r}   r|   ÚOSError)	rM   r  rÑ   rõ   r  rÔ   r   Ú	exit_coder  rN   rN   rO   Ú
edit_filesÉ  s4   
þÿÿÿþ€ÿzEditor.edit_filesr²   úbytes | bytearrayúbytes | Nonec                 C  ó   d S r[   rN   r³   rN   rN   rO   Úeditç  ó   zEditor.editc                 C  r"  r[   rN   r³   rN   rN   rO   r#  ì  r$  ústr | bytes | bytearray | Noneústr | bytes | Nonec           	   	   C  sŠ  dd l }|d u rd}n&t|ttfƒr|}n|r | d¡s |d7 }tr,| dd¡ d¡}n| d¡}|jd| j	d�\}}zƒt
 |d	¡�}| |¡ W d   ƒ n1 sRw   Y  t
 |t
j |¡t
j |¡d
 f¡ t
j |¡}|  |f¡ | jrˆt
j |¡|krˆW t
 |¡ d S t|dƒ�}| ¡ }W d   ƒ n1 sœw   Y  t|ttfƒr°|W t
 |¡ S | d¡ dd¡W t
 |¡ S t
 |¡ w )Nr   ó    r   z
z	utf-8-sigzutf-8zeditor-)ÚprefixÚsuffixÚwbé   Úrb)r  Ú
isinstanceÚbytesÚ	bytearrayÚendswithr   rñ   ÚencodeÚmkstempr  rÓ   Úfdopenrg   ÚutimeÚpathÚgetatimeÚgetmtimer  r  r	  ÚopenÚreadÚdecode)	rM   r²   r  ÚdataÚfdrº   r
  Ú	timestampr§   rN   rN   rO   r#  ï  s:   
ÿ$
ø
ÿþ)NNTr  )
r  r-   ró   r  r  r%   r  r    r4   r5   r©   )r  r  r4   r5   )r²   r   r4   r!  )r²   r-   r4   r-   )r²   r%  r4   r&  )	rª   r«   r¬   rP   r  r  r=   Úoverloadr#  rN   rN   rN   rO   r  «  s    û

r  FÚurlrý   Úlocater2   c           	      C  sÆ  dd l }ddd„}tjdkr?dg}|r| d	¡ |r| d
¡ | || ƒ¡ tddƒ}z|j||d� ¡ W | ¡  S | ¡  w trp|r]|| ƒ} dd| g}z| 	|¡W S  t
y\   Y dS w zt | ¡ W dS  t
yo   Y dS w tr¡|r�|| ƒ} dtj | ¡g}ndg}|r‹| d¡ | | ¡ z| 	|¡W S  t
y    Y dS w z"|r¯tj || ƒ¡p­d} n|| ƒ} | d| g¡}|rÁ| ¡ W S W dS  t
yâ   |  d¡rß|sß|sßdd l}| | ¡ Y dS Y dS w )Nr   r?  r    r4   c                 S  s*   ddl m} |  d¡r|| dd … ƒ} | S )Nr   )Úunquotezfile://é   )Úurllib.parserA  r×   )r?  rA  rN   rN   rO   Ú_unquote_file"  s   
zopen_url.<locals>._unquote_fileÚdarwinr8  z-Wrð   z	/dev/nullr  )ÚstderrÚexplorerz/select,é   Úcygstartz-wÚ.zxdg-open)zhttp://zhttps://r   )r?  r    r4   r    )rõ   rÎ   rÖ   r�   r8  rø   rý   r¹   r   r  r  rÓ   Ú	startfiler	   r5  Údirnamer×   Ú
webbrowser)	r?  rý   r@  rõ   rD  r  Únullr   rM  rN   rN   rO   Úopen_url  sp   





ÿþÿ

þ

úrO  Úchr5   c                 C  s:   | dkrt ƒ ‚| dkrtstƒ ‚| dkrtrtƒ ‚d S d S )Núúú)rþ   r   ÚEOFError)rP  rN   rN   rO   Ú_translate_ch_to_exce  s   ÿrU  Úwin32úcabc.Iterator[int]c                   c  s   � dV  d S )Nr8   rN   rN   rN   rN   rO   Úraw_terminals  s   €
rX  r   c                 C  sZ   | rt  t jg tf tj¡}nt  t jg tf tj¡}|ƒ }|dv r'||ƒ 7 }t|ƒ |S )N)ú õ   Ã )r=   r>   ÚCallabler    ÚmsvcrtÚgetwcheÚgetwchrU  )r   Úfuncr§   rN   rN   rO   Úgetcharw  s   
r`  c                  c  sÆ   � t tjƒstdƒ} |  ¡ }ntj ¡ }d } zAt |¡}z$t |¡ |V  W t 	|tj
|¡ tj ¡  | d ur>|  ¡  W d S W d S t 	|tj
|¡ tj ¡  | d urW|  ¡  w w  tjyb   Y d S w )Nz/dev/tty)r   rÎ   rÏ   r8  ÚfilenoÚtermiosÚ	tcgetattrÚttyÚsetrawÚ	tcsetattrÚ	TCSADRAINrÚ   ri   r¹   Úerror)r
  r<  Úold_settingsrN   rN   rO   rX  ©  s0   €





ÿý

ÿÿc                 C  sj   t ƒ �(}t |d¡ ttjƒd¡}| rttjƒrtj 	|¡ t
|ƒ |W  d   ƒ S 1 s.w   Y  d S )Né    rñ   )rX  rÓ   r9  r:  r
   rÎ   rÏ   r   rÚ   rg   rU  )r   r<  rP  rN   rN   rO   r`  Ä  s   $ù)r¿   rÀ   r4   rÁ   r[   )r0   r(   r4   rÆ   )r0   r(   r4   rá   )rå   r    rß   rÀ   r4   r%   )rÞ   r   rß   rÀ   r0   r(   r4   rî   )r¯   r°   r0   r(   r4   rî   )FF)r?  r    rý   r%   r@  r%   r4   r2   )rP  r    r4   r5   )r4   rW  )r   r%   r4   r    );r¾   Ú
__future__r   Úcollections.abcÚabcÚcabcÚ
contextlibrˆ   rÓ   rÑ   rÎ   rC   Útypingr=   r   r}   Úior   Úpathlibr   Útypesr   Ú_compatr   r	   r
   r   r   r   r   Ú
exceptionsr   Úutilsr   ÚTypeVarr   rº   rš   rh   ÚGenericr   r®   rÅ   rà   Úcontextmanagerrä   rí   rÙ   rØ   rÐ   r  rO  rU  rÖ   r\  rX  r`  rb  rd  rN   rN   rN   rO   Ú<module>   sz    

  V
(ÿ-
ÿVÿ"ÿt
F
/