HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib64/python3.10/site-packages/click/__pycache__/_compat.cpython-310.pyc
o

!we8I�@sUddlZddlZddlZddlZddlZddlZddlmZej	�
d�Zej	�
d�ZdZ
ejejejgejfed<e�d�Z		dodejd	ejed
ejededed
ejfdd�Zd	ed
efdd�Zdejejd
efdd�ZGdd�dej�ZGdd�d�Zdpdejejded
efdd�Zdpdejejded
efdd�Z dejejd
ejejfdd�Z!dejejd
ejejfdd �Z"dejd
efd!d"�Z#dejd#ed$ejed
efd%d&�Z$dejd	ejed
ejed
efd'd(�Z%		dod)ejejd	ejed
ejed*ejejejegefd+ejejejgejejfdeded
ejfd,d-�Z&	dpd.ejejd	ejed
ejeded
ejf
d/d0�Z'	dpd1ejejd	ejed
ejeded
ejf
d2d3�Z(d
ejfd4d5�Z)d
ejfd6d7�Z*d
ejfd8d9�Z+	dqd	ejed
ejed
ejfd:d;�Z,	dqd	ejed
ejed
ejfd<d=�Z-	dqd	ejed
ejed
ejfd>d?�Z.d@ej/edAe0fdBed	ejed
ejed
ejejf
dCdD�Z1	E		F	drdGdHdBed	ejed
ejedIed
ej2ejejeffdJdK�Z3GdLdM�dM�Z4d$ed
efdNdO�Z5dejejd
efdPdQ�Z6	dqdejejejdRejed
efdSdT�Z7ej	�
d��rle�rldUdVl8m9Z9d
efdWdX�Z:e�Z;ej<ejejfedY<	dsdejdRejed
ejfdZd�Z
nd
efd[dX�Z:d\ejd	ejed
ejed
ejejfd]d^�Z9d_ed
e0fd`da�Z=dejejd
efdbdc�Z>ddejgejejfdeejgejfd
ejgejejffdfdg�Z?e?dhdi�e,�Z@e?djdi�e-�ZAe?dkdi�e.�ZBe)e*e+dl�ZCejDeejgejffedm<e,e-e.dl�ZEejDeejejeejegejffedn<dS)t�N)�WeakKeyDictionary�cygwin�win�auto_wrap_for_ansiz\033\[[;?0-9]*[a-zA-Z]F�stream�encoding�errors�force_readable�force_writable�returncCs0|durt|�}|durd}t|||d||d�S)N�replaceT)�line_bufferingr	r
)�get_best_encoding�_NonClosingTextIOWrapper)rrrr	r
�r�F/home/arjun/projects/env/lib/python3.10/site-packages/click/_compat.py�_make_text_streams�rcCs(z	t�|�jdkWStyYdSw)z$Checks if a given encoding is ascii.�asciiF)�codecs�lookup�name�LookupError)rrrr�is_ascii_encoding$s
�rcCs$t|dd�p	t��}t|�rdS|S)z1Returns the default stream encoding if not found.rNzutf-8)�getattr�sys�getdefaultencodingr�r�rvrrrr,srcsheZdZ		ddejdejedejedededejdd	f�fd
d�
Z	ddd
�Z
defdd�Z�ZS)rFrrrr	r
�extrarNcs8t�tjt|||��|_}t�j|||fi|��dS�N)�t�cast�BinaryIO�_FixupStream�_stream�super�__init__)�selfrrrr	r
r��	__class__rrr&5s	
�z!_NonClosingTextIOWrapper.__init__cCs$z|��WdStyYdSwr)�detach�	Exception�r'rrr�__del__Cs
�z _NonClosingTextIOWrapper.__del__cCs
|j��Sr)r$�isattyr,rrrr.Is
z_NonClosingTextIOWrapper.isatty�FF)rN)
�__name__�
__module__�__qualname__r r"�Optional�str�bool�Anyr&r-r.�
__classcell__rrr(rr4s(��������
rc@s~eZdZdZ		ddejdedefdd�Zded	ej	fd
d�Z
ded	efd
d�Z
d	efdd�Zd	efdd�Zd	efdd�ZdS)r#aQThe new io interface needs more from streams than streams
    traditionally implement.  As such, this fix-up code is necessary in
    some circumstances.

    The forcing of readable and writable flags are there because some tools
    put badly patched objects on sys (one such offender are certain version
    of jupyter notebook).
    Frr	r
cCs||_||_||_dSr)r$�_force_readable�_force_writable)r'rr	r
rrrr&Xs
z_FixupStream.__init__rrcC�t|j|�Sr)rr$�r'rrrr�__getattr__b�z_FixupStream.__getattr__�sizecCs2t|jdd�}|durt�t||��S|j�|�S)N�read1)rr$r r!�bytes�read)r'r>�frrrr?esz_FixupStream.read1cCsV|jrdSt|jdd�}|durt�t|��Sz	|j�d�WdSty*YdSw)NT�readablerF)r8rr$r r!r5rAr+�r'�xrrrrCms��z_FixupStream.readablecCs||jrdSt|jdd�}|durt�t|��Sz	|j�d�WdSty=z
|j�d�WYdSty<YYdSww)NT�writable��F)r9rr$r r!r5�writer+rDrrrrFys ����z_FixupStream.writablecCsRt|jdd�}|durt�t|��Sz|j�|j���WdSty(YdSw)N�seekableFT)rr$r r!r5�seek�tellr+rDrrrrJ�s��z_FixupStream.seekableNr/)r0r1r2�__doc__r r"r5r&r4r6r<�intr@r?rCrFrJrrrrr#Ns ���
�
r#�defaultcCs*z	t|�d�t�WSty|YSw�Nr)�
isinstancerAr@r+�rrOrrr�_is_binary_reader�s
�rScCsLz|�d�WdSty%z	|�d�WYdSty$Y|YSww)NrHrGFT)rIr+rRrrr�_is_binary_writer�s�
��rTcC�Ht|d�rt�tj|�St|dd�}|dur"t|d�r"t�tj|�SdS�NF�bufferT)rSr r!r"r�r�bufrrr�_find_binary_reader��
rZcCrUrV)rTr r!r"rrXrrr�_find_binary_writer�r[r\cCstt|dd�pd�S)z3A stream is misconfigured if its encoding is ASCII.rNr)rr�rrrr�_stream_is_misconfigured�sr^�attr�valuecCs$t||d�}||kp|duo|duS)z�A stream attribute is compatible if it is equal to the
    desired value or the desired value is unset and the attribute
    has a value.
    N)r)rr_r`�stream_valuerrr�_is_compat_stream_attr�srbcCst|d|�ot|d|�S)zcCheck if a stream's encoding and errors attributes are
    compatible with the desired values.
    rr)rb)rrrrrr�_is_compatible_text_stream�s
�
�rc�text_stream�	is_binary�find_binaryc	Cs~||d�r
t�tj|�}n#t�tj|�}t|||�r$|dur"t|�s$|S||�}|dur.|S|}|dur6d}t|||||d�S)NFr)r	r
)r r!r"�TextIOrcr^r)	rdrrrerfr	r
�
binary_reader�possible_binary_readerrrr�_force_correct_text_stream�s&
	�rj�text_readercC�t|||tt|d�S)N�r	)rjrSrZ)rkrrr	rrr�_force_correct_text_reader��rn�text_writercCrl)N�r
)rjrTr\)rprrr
rrr�_force_correct_text_writer(rorrcC�ttj�}|dur
td��|S)Nz6Was not able to determine binary stream for sys.stdin.)rZr�stdin�RuntimeError)�readerrrr�get_binary_stdin8�
rwcCrs)Nz7Was not able to determine binary stream for sys.stdout.)r\r�stdoutru��writerrrr�get_binary_stdout?rxr|cCrs)Nz7Was not able to determine binary stream for sys.stderr.)r\r�stderrrurzrrr�get_binary_stderrFrxr~cC�,ttj||�}|dur
|Sttj||dd�S)NTrm)�_get_windows_console_streamrrtrn�rrrrrr�get_text_stdinM�r�cCr�NTrq)r�rryrrr�rrr�get_text_stdoutVr�r�cCrr�)r�rr}rrr�rrr�get_text_stderr_r�r��filezos.PathLike[str]�modecCs"d|vr	t||�St||||d�S)z?Handles not passing ``encoding`` and ``errors`` in binary mode.�b�rr)�open)r�r�rrrrr�
_wrap_io_openhs
r��r�strict�filenamezt.Union[str, os.PathLike[str]]�atomicc
sd�v}t�|�}t�|�dkr9t�fdd�dD��r*|r"t�dfSt||d�dfS|r1t�dfSt||d�dfS|sDt|�||�dfSd	�vrLt	d
��d�vrTt	d��d
�vr\t	d��ddl
}ddl}zt�|�j
}Wntywd}YnwtjtjBtjB}	|r�|	ttdd�O}		tj�tj�|�d|�d�d���}
zt�|
|	|dur�dn|�}Wn3ty�}z'|j
|jks�tjdkr�|j
|jkr�tj�|j�r�t�|jtj�r�WYd}~q��d}~ww|dur�t�|
|�t|�||�}
t |
|
tj�!|��}t"�#t"j$t"j%|�dfS)Nr��-c3s�|]}|�vVqdSrr)�.0�m�r�rr�	<genexpr>�s�zopen_stream.<locals>.<genexpr>)�w�arEFr�Tr�z�Appending to an existing file is not supported, because that would involve an expensive `copy`-operation to a temporary file. Open the file in normal `w`-mode and copy explicitly if that's what you're after.rEz&Use the `overwrite`-parameter instead.r�z,Atomic writes only make sense with `w`-mode.r�O_BINARYz.__atomic-writel�08xi��nt)&�os�fspath�fsdecode�anyr|r�rwr�r��
ValueError�errno�random�stat�st_mode�OSError�O_RDWR�O_CREAT�O_EXCLr�path�join�dirname�	randranger��EEXISTr�EACCES�isdirr��access�W_OK�chmod�_AtomicFile�realpathr r!�IOr6)r�r�rrr��binaryr�r��perm�flags�tmp_filename�fd�erB�afrr�r�open_streamusn


��
�
����
r�c@s�eZdZdejejdededdfdd�Zedefdd	��Z	dde
ddfdd
�Zdedejfdd�Zddd�Z
dejejedejddfdd�Zdefdd�ZdS)r�rBr��
real_filenamerNcCs||_||_||_d|_dS�NF)�_f�
_tmp_filename�_real_filename�closed)r'rBr�r�rrrr&�s
z_AtomicFile.__init__cCs|jSr)r�r,rrrr�sz_AtomicFile.nameF�deletecCs.|jrdS|j��t�|j|j�d|_dS)NT)r�r��closer�rr�r�)r'r�rrrr��s


z_AtomicFile.closercCr:r)rr�r;rrrr<�r=z_AtomicFile.__getattr__cCs|Srrr,rrr�	__enter__�sz_AtomicFile.__enter__�exc_type�_cGs|j|dud�dS)N)r�)r�)r'r�r�rrr�__exit__�sz_AtomicFile.__exit__cCs
t|j�Sr)�reprr�r,rrr�__repr__�s
z_AtomicFile.__repr__�F)rr�)r0r1r2r r�r6r4r&�propertyrr5r�r<r�r3�Type�
BaseExceptionr�r�rrrrr��s"
$r�cCst�d|�S)NrG)�_ansi_re�sub)r`rrr�
strip_ansi�r=r�cCs0t|ttf�r|j}t|ttf�s|jj�d�S)Nz
ipykernel.)rQr#rr$r)r1�
startswithr]rrr�_is_jupyter_kernel_output�s�r��colorcCs0|dur|durtj}t|�ot|�S|Sr)rrtr.r�)rr�rrr�should_strip_ansi�s
r��)r�cCsddl}|��SrP)�locale�getpreferredencoding)r�rrr�_get_argv_encodingsr��_ansi_stream_wrapperscs�zt�|�}Wntyd}Ynw|dur|Sddl}t||�}|j||d��t�tj�j	�}|j
���fdd�}||_
z|t|<W|StyOY|Sw)zbSupport ANSI color and style codes on Windows by wrapping a
        stream with colorama.
        Nr)�stripcs$z�|�WSty����wr)r��	reset_all)�s��_write�ansi_wrapperrr�_safe_writes
�z'auto_wrap_for_ansi.<locals>._safe_write)r��getr+�coloramar��AnsiToWin32r r!rgrrI)rr��cachedr�r�rr�rr�rrs*�

��cCsttjdd�p
t��S)Nr)rrrt�getfilesystemencodingrrrrr�.srBcCsdSrr)rBrrrrrr�1sr�rEcCstt|��Sr)�lenr�)rErrr�term_len7r=r�cCs z|��WStyYdSwr�)r.r+r]rrrr.;s

�r.�src_func�wrapper_funccs(t��dtjtjf���fdd�}|S)Nrcsn��}|dur	dSz��|�}Wntyd}Ynw|dur"|S��}z|�|<W|Sty6Y|Swr)r�r+r��cacher�r�rr�funcHs$�
��z&_make_cached_stream_func.<locals>.func)rr r3rg)r�r�r�rr�r�_make_cached_stream_funcBsr�cC�tjSr)rrtrrrr�<lambda>^�r�cCr�r)rryrrrrr�_r�cCr�r)rr}rrrrr�`r�)rtryr}�binary_streams�text_streamsr/r�)NN)r�Nr�Fr)Fr�ior��rer�typingr �weakrefr�platformr��CYGWIN�WINrr3�Callablerg�__annotations__�compiler�r"r4r5rrr�r6r�
TextIOWrapperrr#rSrTrZr\r^rbrcrjrnrrrwr|r~r�r�r��UnionrNr��Tupler�r�r�r�r��_winconsoler�r�r��MutableMappingr�r.r��_default_text_stdin�_default_text_stdout�_default_text_stderrr��Mappingr�rrrr�<module>s�
"
������
� E 	"
""		���
��
�������
�2�
����
��
����
����
�
���
�
���
�	����

�������
�Q���
�
����'���

���
�$�	��"�