o
    ß’Ojò{  ã                   @  sN  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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! ddl m"Z" e #d¡Z$G dd„ dej%ƒZ&dPd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$ej-ƒZ.	dQdRd(d)„Z/ej0dQdSd+d,„ƒZ1ej0	dQdTd0d1„ƒZ2ej0	dQdTd2d3„ƒZ3ej0	dQdUd6d7„ƒZ4G d8d9„ d9ƒZ5dVdWdAdB„Z6dXdEdF„Z7ej8dGk�rddl9Z9ej0dYdIdJ„ƒZ:dZdLdM„Z;dS ddl<Z<ddl=Z=ej0dYdNdJ„ƒZ:dZdOdM„Z;d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)ÚKeepOpenFileÚVc                   @  s   e Zd ZU ded< dS )Ú_BufferedTextPagerStreamz
t.BinaryIOÚbufferN)Ú__name__Ú
__module__Ú__qualname__Ú__annotations__© r   r   úX/var/www/html/pharmsmart-cdr-gen/venv/lib/python3.10/site-packages/click/_termui_impl.pyr   %   s   
 r   Ústreamút.BinaryIO | t.TextIOÚreturnú%t.TypeGuard[_BufferedTextPagerStream]c                 C  s   t | dd ƒd uS )Nr   )Úgetattr)r   r   r   r   Ú_has_binary_buffer)   s   r    Ú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Úwidthr   Ú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.   r0   r1   r2   r3   r5   r6   r8   r9   r;   r   r   r=   r?   r@   Ú_completed_intervalsrB   Ú	autowidthÚoperatorrE   Ú	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.   r0   r1   r2   r3   r5   r6   r8   r9   r;   r=   r?   r@   rB   rE   r   r   r   Ú__init__:   sV   




zProgressBar.__init__úProgressBar[V]c                 C  s   d| _ |  ¡  | S )NT)rW   Úrender_progress©r[   r   r   r   Ú	__enter__�   s   zProgressBar.__enter__Úexc_typeútype[BaseException] | NoneÚ	exc_valueúBaseException | NoneÚtbúTracebackType | Nonec                 C  s   |   ¡  d S ©N)Úrender_finish)r[   ra   rc   re   r   r   r   Ú__exit__†   ó   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.)rW   ÚRuntimeErrorr^   Ú	generatorr_   r   r   r   Ú__iter__Ž   s   zProgressBar.__iter__r   c                 C  s   t t| ƒƒS rg   )ÚnextrN   r_   r   r   r   Ú__next__”   rj   zProgressBar.__next__c                 C  s*   | j s| jsd S | j t¡ | j ¡  d S rg   )r3   rY   r=   ÚwriteÚ	AFTER_BARÚflushr_   r   r   r   rh   œ   s   zProgressBar.render_finishÚfloatc                 C  s(   | j rdS t| jt| jpdƒpd dƒS )Nç      ð?r   )rU   ÚminrO   ru   r,   r_   r   r   r   Úpct¢   s   zProgressBar.pctc                 C  s"   | j sdS t| j ƒtt| j ƒƒ S ©Ng        )rP   Úsumru   Úlenr_   r   r   r   Útime_per_iteration¨   s   zProgressBar.time_per_iterationc                 C  s&   | j d ur| js| j| j | j  S dS ry   )r,   rU   r|   rO   r_   r   r   r   Ú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)r€   Ú	day_labelÚhÚmÚsÚ02ú:rD   )rT   rA   r}   ÚformatÚ_)r[   rK   ÚsecondsÚminutesÚhoursr   r   r   Ú
format_eta´   s$   
ûzProgressBar.format_etac                 C  s(   t | jƒ}| jd ur|d| j› �7 }|S )Nú/)r/   rO   r,   )r[   rO   r   r   r   Ú
format_posÉ   s   

zProgressBar.format_posc                 C  s   t | jd ƒd›d�dd … S )Néd   z 4ú%r   )rA   rx   r_   r   r   r   Ú
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      à?rD   )r,   rA   rx   rB   r.   r0   rU   Úlistr|   ÚmathÚcosrO   Újoin)r[   Ú
bar_lengthÚbarÚcharsr   r   r   Ú
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)r6   r,   r8   ÚappendrŽ   r‘   r5   rT   rU   rŒ   r9   rX   r1   r;   r™   r2   r•   Úrstrip)r[   r6   Ú	info_bitsÚ	item_infor   r   r   Ú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=   r?   r   r&   rD   F)r=   r?   Únl)r3   rY   rZ   r;   r   r=   r?   rH   ÚshutilrB   r   rŸ   ÚmaxÚget_terminal_sizeÚcolumnsrV   r›   Ú
BEFORE_BARr•   rt   )	r[   Úbufr¡   Ú	old_widthÚclutter_lengthÚ	new_widthÚclear_widthÚlineÚline_lenr   r   r   r^      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 )NTrv   iúÿÿÿ)rO   r,   rU   rQ   rS   rR   rP   rT   )r[   r­   Ústepr   r   r   Ú	make_step.  s   
zProgressBar.make_steprX   ú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   )rX   rG   r@   r¯   r^   )r[   r­   rX   r   r   r   ÚupdateD  s   
ýzProgressBar.updatec                 C  s   d| _ d | _d| _d S )NFT)rT   rX   rU   r_   r   r   r   Úfinish^  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.
        rl   Nr   r   )	rW   rm   rY   rN   rX   rG   r^   r±   r²   )r[   Úrvr   r   r   rn   c  s   €

zProgressBar.generator)Nr%   r&   r'   r(   FTNFNNNNr   r)   )"r*   r+   r,   r-   r.   r/   r0   r/   r1   r/   r2   r/   r3   r4   r5   r4   r6   r7   r8   r4   r9   r:   r;   r<   r=   r>   r?   r7   r@   rA   rB   rA   r   rC   )r   r]   )ra   rb   rc   rd   re   rf   r   rC   )r   rk   )r   r   )r   rC   )r   ru   ©r   r/   )r­   rA   r   rC   rg   )r­   rA   rX   r°   r   rC   )r   r   r   r\   r`   ri   ro   rq   rh   Úpropertyrx   r|   r}   rŒ   rŽ   r‘   r™   rŸ   r^   r¯   r±   r²   rn   r   r   r   r   r$   9   sL    ï
G










.
r$   c                      s,   e Zd Zd‡ fdd„Zd‡ fdd„Z‡  ZS )ÚMaybeStripAnsir   út.IO[bytes]r?   r4   Úkwargsút.Anyc                  s   t ƒ j|fi |¤Ž || _d S rg   )Úsuperr\   r?   )r[   r   r?   r¸   ©Ú	__class__r   r   r\   †  s   
zMaybeStripAnsi.__init__Útextr/   r   rA   c                   s   | j st|ƒ}tƒ  |¡S rg   )r?   r   rº   rr   ©r[   r½   r»   r   r   rr   Š  s   zMaybeStripAnsi.write)r   r·   r?   r4   r¸   r¹   )r½   r/   r   rA   )r   r   r   r\   rr   Ú__classcell__r   r   r»   r   r¶   …  s    r¶   r?   r7   ú9t.ContextManager[tuple[t.BinaryIO | t.TextIO, str, bool]]c                 C  s¢   t ƒ }|du r
tƒ }ttjƒrt|ƒst|| ƒS t tj	 
dd¡¡}|r0tr+t|| ƒS t|| ƒS tj	 
d¡dv r=t|| ƒS tsEtj d¡rKtdg| ƒS tdg| ƒS )	z2Decide what method to use for paging through text.NÚPAGERrD   Ú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_partsr   r   r   Ú_pager_contextmanager�  s   



rÖ   ú!t.Generator[t.TextIO, None, None]c                 c  sÒ   � t | d��Y\}}} d}t|ƒrt|j| |d�}|}z"t tj|¡V  W z| ¡  W |dur2| ¡  n$|dur<| ¡  w w z| ¡  W |durL| ¡  w w |durV| ¡  w w W d  ƒ dS 1 sbw   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.
    )r?   N)r?   Úencoding)	rÖ   r    r¶   r   rK   rL   ÚTextIOrt   Údetach)r?   r   rØ   Úwrapperr   r   r   Úget_pager_file¯  s2   €
€ÿ
ÿ÷


ÿ
ÿ€"érÜ   Ú	cmd_partsú	list[str]ú3t.Iterator[tuple[t.BinaryIO | t.TextIO, str, bool]]c                 c  sL  � | s$t ƒ ptƒ }t||ƒ�}|V  W d  ƒ dS 1 sw   Y  dS ddl}| d }| dd… }| |¡}|sZt ƒ p>tƒ }t||ƒ�}|V  W d  ƒ dS 1 sSw   Y  dS t|ƒ ¡ }|j}	ddl}
t	t
jƒ}|du r•|	dkr•t
j dd¡› d |¡› �}|s‹d|d< d	}n
d
|v s“d|v r•d	}|du r›d}|
jt|ƒg| d|
j|dd	d�}t tj|j¡}t|ƒ}zGz|||fV  W n tyÊ   Y n tyÛ } 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
    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.
    Nr   r   rÇ   ÚLESSrD   r&   ú-RTÚrÚRFÚreplace)ÚshellrÉ   ÚenvÚerrorsr½   )r   r   rÊ   r¡   Úwhichr   ÚabsoluteÚnameÚ
subprocessÚdictrÍ   rÎ   rÏ   r•   ÚPopenr/   ÚPIPErK   rL   ÚBinaryIOrÉ   r
   ÚBrokenPipeErrorÚ	ExceptionÚ	terminateÚcloseÚwaitÚKeyboardInterrupt)rÝ   r?   rÔ   r³   r¡   ÚcmdÚ
cmd_paramsÚcmd_filepathÚcmd_pathÚcmd_namerë   ræ   Ú
less_flagsÚcrÉ   rØ   Úer   r   r   rÑ   Õ  s¢   €
ÿþ

ÿþ
ú€ú€	ÿ
ýÿýñÿ
úÿýrÑ   c              	   c  sD  � | s$t ƒ ptƒ }t||ƒ�}|V  W d  ƒ dS 1 sw   Y  dS ddl}ddl}| d }| |¡}|sXt ƒ p<tƒ }t||ƒ�}|V  W d  ƒ dS 1 sQw   Y  dS t|ƒ ¡ }ddl}	t	t
jƒ}
|du rmd}|	jddd�}z&t tj|¡|
|fV  | ¡  | ¡  | t|ƒ|jg¡ W t |j¡ dS t |j¡ w )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`.
    Nr   FÚwb)ÚmodeÚdelete)r   r   rÊ   r¡   rë   rè   r   ré   Útempfiler
   rÈ   rÔ   ÚNamedTemporaryFilerK   rL   rï   rt   ró   Úcallr/   rê   rÍ   Úunlink)rÝ   r?   rÔ   r³   r¡   rë   rö   rø   rù   r  rØ   Úfr   r   r   rÐ   C  sB   €
ÿþ

ÿþ
rÐ   út.TextIOú&t.Iterator[tuple[t.TextIO, str, bool]]c                 c  s*   � t | ƒ}|du rd}t| ƒ||fV  dS )a   Simply 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.

    The stream is wrapped in :class:`~click.utils.KeepOpenFile` so that, as a
    borrowed stream, it is not closed by a ``with`` block. The wrapper that
    :func:`get_pager_file` builds around it is detached rather than closed.
    NF)r
   r   )r   r?   rØ   r   r   r   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_saver4   Ú	extensionr/   r   rC   c                 C  s   || _ || _|| _|| _d S rg   )r
  ræ   r  r  )r[   r
  ræ   r  r  r   r   r   r\   ‘  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è   )r[   Úkeyr³   rè   r
  r   r   r   Ú
get_editor�  s   
ÿÿzEditor.get_editorÚ	filenamesúcabc.Iterable[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)	r[   r  rË   rë   r
  rÎ   rü   Ú	exit_coderý   r   r   r   Ú
edit_files®  s4   
þÿÿÿþ€ÿzEditor.edit_filesr½   úbytes | bytearrayúbytes | Nonec                 C  ó   d S rg   r   r¾   r   r   r   ÚeditÌ  ó   zEditor.editc                 C  r  rg   r   r¾   r   r   r   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Úsuffixrþ   é   Úrb)r  Ú
isinstanceÚbytesÚ	bytearrayÚendswithr   rä   ÚencodeÚmkstempr  rÍ   Úfdopenrr   ÚutimeÚpathÚgetatimeÚgetmtimer  r  r  ÚopenÚreadÚdecode)	r[   r½   r  ÚdataÚfdrê   r  Ú	timestampr³   r   r   r   r   Ô  s:   
ÿ$
ø
ÿþ)NNTr	  )
r
  r<   ræ   r  r  r4   r  r/   r   rC   r´   )r  r  r   rC   )r½   r  r   r  )r½   r<   r   r<   )r½   r"  r   r#  )	r   r   r   r\   r  r  rK   Úoverloadr   r   r   r   r   r  �  s    û

r  FÚurlr/   rô   r4   ÚlocaterA   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/   r   c                 S  s*   ddl m} |  d¡r|| dd … ƒ} | S )Nr   )Úunquotezfile://é   )Úurllib.parser=  rÓ   )r;  r=  r   r   r   Ú_unquote_file  s   
zopen_url.<locals>._unquote_fileÚdarwinr4  z-Wrá   z	/dev/nullÚw)ÚstderrÚexplorerz/select,é   Úcygstartz-wÚ.zxdg-open)zhttp://zhttps://r   )r;  r/   r   r/   )rë   rÈ   rÒ   r›   r4  rí   rô   ró   r   r  r  rÍ   Ú	startfiler	   r1  ÚdirnamerÓ   Ú
webbrowser)	r;  rô   r<  rë   r@  r  Únullrü   rJ  r   r   r   Úopen_url  sp   





ÿþÿ

þ

úrL  ÚchrC   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)rM  r   r   r   Ú_translate_ch_to_excJ  s   ÿrR  Úwin32úcabc.Iterator[int]c                   c  s   � dV  d S )NrF   r   r   r   r   r   Úraw_terminalX  s   €
rU  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)ú õ   Ã )rK   rL   ÚCallabler/   ÚmsvcrtÚgetwcheÚgetwchrR  )r   Úfuncr³   r   r   r   Úgetchar\  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É   r4  ÚfilenoÚtermiosÚ	tcgetattrÚttyÚsetrawÚ	tcsetattrÚ	TCSADRAINrÔ   rt   ró   Úerror)r  r8  Úold_settingsr   r   r   rU  Ž  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ä   )rU  rÍ   r5  r6  r
   rÈ   rÉ   r   rÔ   rr   rR  )r   r8  rM  r   r   r   r]  ©  s   $ù)r   r   r   r   rg   )r?   r7   r   rÀ   )r?   r7   r   r×   )rÝ   rÞ   r?   r7   r   rß   )r   r  r?   r7   r   r  )FF)r;  r/   rô   r4   r<  r4   r   rA   )rM  r/   r   rC   )r   rT  )r   r4   r   r/   )>Ú__doc__Ú
__future__r   Úcollections.abcÚabcÚcabcÚ
contextlibÚior“   rÍ   rË   rÈ   rQ   ÚtypingrK   r   rˆ   r   Úpathlibr   Útypesr   Ú_compatr   r	   r
   r   r   r   r   Ú
exceptionsr   Úutilsr   r   ÚTypeVarr   ÚProtocolr   r    rê   r¥   rs   ÚGenericr$   ÚTextIOWrapperr¶   rÖ   ÚcontextmanagerrÜ   rÑ   rÐ   rÊ   r  rL  rR  rÒ   rY  rU  r]  r_  ra  r   r   r   r   Ú<module>   s~    


  Nÿ%ÿmÿ8ÿt
F/