o
    Õ­j*I  ã                   @   s  U 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 ej	 
d¡Zej	 
d¡ZdZejejejgejf  ed< e d¡Z		dodejd	eje d
eje dededejfdd„Zd	edefdd„Zdejej defdd„ZG dd„ dejƒZG dd„ dƒZdpdejej dedefdd„Zdpdejej dedefdd„Z dejej dejej fdd„Z!dejej dejej fdd „Z"dejdefd!d"„Z#dejd#ed$eje defd%d&„Z$dejd	eje d
eje defd'd(„Z%		dod)ejej d	eje d
eje d*ejejej egef d+ejejej gejej f dededejfd,d-„Z&	dpd.ejej d	eje d
eje dedejf
d/d0„Z'	dpd1ejej d	eje d
eje dedejf
d2d3„Z(dejfd4d5„Z)dejfd6d7„Z*dejfd8d9„Z+	dqd	eje d
eje dejfd:d;„Z,	dqd	eje d
eje dejfd<d=„Z-	dqd	eje d
eje dejfd>d?„Z.d@ej/edAe0f dBed	eje d
eje dejej f
dCdD„Z1	E		F	drdGdHdBed	eje d
eje dIedej2ejej ef fdJdK„Z3G dLdM„ dMƒZ4d$edefdNdO„Z5dejej defdPdQ„Z6	dqdejejej  dReje defdSdT„Z7ej	 
d¡�rle�rldUdVl8m9Z9 defdWdX„Z:eƒ Z;ej<ejejf edY< 	dsdejdReje dejfdZd„Zndefd[dX„Z:d\ejd	eje d
eje dejej fd]d^„Z9d_ede0fd`da„Z=dejej defdbdc„Z>ddejg ejej f deejg ejf dejg ejej f fdfdg„Z?e?dhdi„ e,ƒZ@e?djdi„ e-ƒZAe?dkdi„ e.ƒZBe)e*e+dlœZCejDeejg ejf f edm< e,e-e.dlœZEejDeejeje eje gejf f edn< dS )té    N)ÚWeakKeyDictionaryÚcygwinÚwinÚauto_wrap_for_ansiz\033\[[;?0-9]*[a-zA-Z]FÚstreamÚencodingÚerrorsÚforce_readableÚforce_writableÚreturnc                 C   s0   |d u rt | ƒ}|d u rd}t| ||d||d�S )NÚreplaceT)Úline_bufferingr	   r
   )Úget_best_encodingÚ_NonClosingTextIOWrapper)r   r   r   r	   r
   © r   úJ/var/www/html/CropPilot/venv/lib/python3.10/site-packages/click/_compat.pyÚ_make_text_stream   s   úr   c                 C   s(   z	t  | ¡jdkW S  ty   Y dS w )z$Checks if a given encoding is ascii.ÚasciiF)ÚcodecsÚlookupÚnameÚLookupError)r   r   r   r   Úis_ascii_encoding$   s
   ÿr   c                 C   s$   t | ddƒp	t ¡ }t|ƒrdS |S )z1Returns the default stream encoding if not found.r   Nzutf-8)ÚgetattrÚsysÚgetdefaultencodingr   ©r   Úrvr   r   r   r   ,   s   r   c                       sh   e Zd Z		ddejdeje deje dededejdd	f‡ fd
d„Z	ddd„Z
defdd„Z‡  ZS )r   Fr   r   r   r	   r
   Úextrar   Nc                    s8   t  t jt|||ƒ¡ | _}tƒ j|||fi |¤Ž d S ©N)ÚtÚcastÚBinaryIOÚ_FixupStreamÚ_streamÚsuperÚ__init__)Úselfr   r   r   r	   r
   r   ©Ú	__class__r   r   r&   5   s   	
ÿz!_NonClosingTextIOWrapper.__init__c                 C   s$   z|   ¡  W d S  ty   Y d S w r   )ÚdetachÚ	Exception©r'   r   r   r   Ú__del__C   s
   ÿz _NonClosingTextIOWrapper.__del__c                 C   s
   | j  ¡ S r   )r$   Úisattyr,   r   r   r   r.   I   s   
z_NonClosingTextIOWrapper.isatty©FF)r   N)Ú__name__Ú
__module__Ú__qualname__r    r"   ÚOptionalÚstrÚboolÚAnyr&   r-   r.   Ú__classcell__r   r   r(   r   r   4   s(    úþýüûúùø
r   c                   @   s~   e Zd ZdZ		ddejdedefdd„Zded	ej	fd
d„Z
ded	efdd„Zd	efdd„Zd	efdd„Zd	efdd„ZdS )r#   aQ  The 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).
    Fr   r	   r
   c                 C   s   || _ || _|| _d S r   )r$   Ú_force_readableÚ_force_writable)r'   r   r	   r
   r   r   r   r&   X   s   
z_FixupStream.__init__r   r   c                 C   ó   t | j|ƒS r   )r   r$   ©r'   r   r   r   r   Ú__getattr__b   ó   z_FixupStream.__getattr__Úsizec                 C   s2   t | jdd ƒ}|d urt t||ƒ¡S | j |¡S )NÚread1)r   r$   r    r!   ÚbytesÚread)r'   r>   Úfr   r   r   r?   e   s   z_FixupStream.read1c                 C   sV   | j rdS t| jdd ƒ}|d urt t|ƒ ¡S z	| j d¡ W dS  ty*   Y dS w )NTÚreadabler   F)r8   r   r$   r    r!   r5   rA   r+   ©r'   Úxr   r   r   rC   m   s   þÿz_FixupStream.readablec                 C   s|   | j rdS t| jdd ƒ}|d urt t|ƒ ¡S z	| j d¡ W dS  ty=   z
| j d¡ W Y dS  ty<   Y Y dS w w )NTÚwritableÚ ó    F)r9   r   r$   r    r!   r5   Úwriter+   rD   r   r   r   rF   y   s    ûþÿýz_FixupStream.writablec                 C   sR   t | jdd ƒ}|d urt t|ƒ ¡S z| j | j ¡ ¡ W dS  ty(   Y dS w )NÚseekableFT)r   r$   r    r!   r5   ÚseekÚtellr+   rD   r   r   r   rJ   ˆ   s   þÿz_FixupStream.seekableNr/   )r0   r1   r2   Ú__doc__r    r"   r5   r&   r4   r6   r<   Úintr@   r?   rC   rF   rJ   r   r   r   r   r#   N   s     üþý
ü
r#   Údefaultc                 C   s*   z	t |  d¡tƒW S  ty   | Y S w ©Nr   )Ú
isinstancerA   r@   r+   ©r   rO   r   r   r   Ú_is_binary_reader“   s
   ÿrS   c                 C   sL   z|   d¡ W dS  ty%   z	|   d¡ W Y dS  ty$   Y | Y S w w )NrH   rG   FT)rI   r+   rR   r   r   r   Ú_is_binary_writerœ   s   ù
þürT   c                 C   óH   t | dƒrt tj| ¡S t| dd ƒ}|d ur"t |dƒr"t tj|¡S d S ©NFÚbufferT)rS   r    r!   r"   r   ©r   Úbufr   r   r   Ú_find_binary_reader©   ó   
rZ   c                 C   rU   rV   )rT   r    r!   r"   r   rX   r   r   r   Ú_find_binary_writer»   r[   r\   c                 C   s   t t| ddƒpdƒS )z3A stream is misconfigured if its encoding is ASCII.r   Nr   )r   r   ©r   r   r   r   Ú_stream_is_misconfiguredÍ   s   r^   ÚattrÚvaluec                 C   s$   t | |dƒ}||kp|du o|duS )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   )r   r_   r`   Ústream_valuer   r   r   Ú_is_compat_stream_attrÖ   s   rb   c                 C   s   t | d|ƒot | d|ƒS )zcCheck if a stream's encoding and errors attributes are
    compatible with the desired values.
    r   r   )rb   )r   r   r   r   r   r   Ú_is_compatible_text_streamß   s
   ÿ
þrc   Útext_streamÚ	is_binaryÚfind_binaryc           	      C   s~   || dƒrt  t j| ¡}n#t  t j| ¡} t| ||ƒr$|d u r"t| ƒs$| S || ƒ}|d u r.| S |}|d u r6d}t|||||d�S )NFr   )r	   r
   )r    r!   r"   ÚTextIOrc   r^   r   )	rd   r   r   re   rf   r	   r
   Úbinary_readerÚpossible_binary_readerr   r   r   Ú_force_correct_text_streamê   s&   
	ûrj   Útext_readerc                 C   ó   t | ||tt|d�S )N©r	   )rj   rS   rZ   )rk   r   r   r	   r   r   r   Ú_force_correct_text_reader  ó   úrn   Útext_writerc                 C   rl   )N©r
   )rj   rT   r\   )rp   r   r   r
   r   r   r   Ú_force_correct_text_writer(  ro   rr   c                  C   ó   t tjƒ} | d u rtdƒ‚| S )Nz6Was not able to determine binary stream for sys.stdin.)rZ   r   ÚstdinÚRuntimeError)Úreaderr   r   r   Úget_binary_stdin8  ó   
rw   c                  C   rs   )Nz7Was not able to determine binary stream for sys.stdout.)r\   r   Ústdoutru   ©Úwriterr   r   r   Úget_binary_stdout?  rx   r|   c                  C   rs   )Nz7Was not able to determine binary stream for sys.stderr.)r\   r   Ústderrru   rz   r   r   r   Úget_binary_stderrF  rx   r~   c                 C   ó,   t tj| |ƒ}|d ur|S ttj| |dd�S )NTrm   )Ú_get_windows_console_streamr   rt   rn   ©r   r   r   r   r   r   Úget_text_stdinM  ó   r‚   c                 C   r   ©NTrq   )r€   r   ry   rr   r�   r   r   r   Úget_text_stdoutV  rƒ   r…   c                 C   r   r„   )r€   r   r}   rr   r�   r   r   r   Úget_text_stderr_  rƒ   r†   Úfilezos.PathLike[str]Úmodec                 C   s"   d|v r	t | |ƒS t | |||d�S )z?Handles not passing ``encoding`` and ``errors`` in binary mode.Úb©r   r   )Úopen)r‡   rˆ   r   r   r   r   r   Ú_wrap_io_openh  s   
rŒ   ÚrÚstrictÚfilenamezt.Union[str, os.PathLike[str]]Úatomicc              
      s  dˆ v }t  | ¡} t  | ¡dkr9t‡ fdd„dD ƒƒr*|r"tƒ dfS t||d�dfS |r1tƒ dfS t||d�dfS |sDt| ˆ ||ƒdfS d	ˆ v rLt	d
ƒ‚dˆ v rTt	dƒ‚dˆ vr\t	dƒ‚dd l
}dd l}zt  | ¡j}W n tyw   d }Y nw t jt jB t jB }	|r‹|	tt ddƒO }		 t j t j | ¡d| d¡d›�¡}
zt  |
|	|d u r©dn|¡}W n3 tyà } z'|j
|jksÕt jdkrÛ|j
|jkrÛt j |j¡rÛt  |jt j¡rÛW Y d }~q‹‚ d }~ww |d urët  |
|¡ t|ˆ ||ƒ}t ||
t j !| ¡ƒ}t" #t"j$t"j% |¡dfS )Nr‰   ú-c                 3   s   � | ]}|ˆ v V  qd S r   r   )Ú.0Úm©rˆ   r   r   Ú	<genexpr>‚  s   € zopen_stream.<locals>.<genexpr>)ÚwÚarE   FrŠ   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.rE   z&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…   rw   r‚   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ˆ   r   r   r�   Úbinaryr    r¡   ÚpermÚflagsÚtmp_filenameÚfdÚerB   Úafr   r”   r   Úopen_streamu  sn   


ÿÿ
þ
ÿþ€ø
r¼   c                   @   s¤   e Zd Zdejej dededdfdd„Zedefdd	„ƒZ	dde
ddfdd„Zdedejfdd„Zddd„Zdejeje  dejddfdd„Zdefdd„ZdS )r²   rB   r¸   Úreal_filenamer   Nc                 C   s   || _ || _|| _d| _d S ©NF)Ú_fÚ_tmp_filenameÚ_real_filenameÚclosed)r'   rB   r¸   r½   r   r   r   r&   Ç  s   
z_AtomicFile.__init__c                 C   s   | j S r   )rÁ   r,   r   r   r   r   Í  s   z_AtomicFile.nameFÚdeletec                 C   s.   | j rd S | j ¡  t | j| j¡ d| _ d S )NT)rÂ   r¿   Úcloser›   r   rÀ   rÁ   )r'   rÃ   r   r   r   rÄ   Ñ  s
   

z_AtomicFile.closer   c                 C   r:   r   )r   r¿   r;   r   r   r   r<   Ø  r=   z_AtomicFile.__getattr__c                 C   s   | S r   r   r,   r   r   r   Ú	__enter__Û  s   z_AtomicFile.__enter__Úexc_typeÚ_c                 G   s   | j |d ud� d S )N)rÃ   )rÄ   )r'   rÆ   rÇ   r   r   r   Ú__exit__Þ  s   z_AtomicFile.__exit__c                 C   s
   t | jƒS r   )Úreprr¿   r,   r   r   r   Ú__repr__á  s   
z_AtomicFile.__repr__©F)r   r²   )r0   r1   r2   r    r´   r6   r4   r&   Úpropertyr   r5   rÄ   r<   rÅ   r3   ÚTypeÚBaseExceptionrÈ   rÊ   r   r   r   r   r²   Æ  s    "
$r²   c                 C   s   t  d| ¡S )NrG   )Ú_ansi_reÚsub)r`   r   r   r   Ú
strip_ansiå  r=   rÑ   c                 C   s0   t | ttfƒr| j} t | ttfƒs| jj d¡S )Nz
ipykernel.)rQ   r#   r   r$   r)   r1   Ú
startswithr]   r   r   r   Ú_is_jupyter_kernel_outputé  s   ÿrÓ   Úcolorc                 C   s0   |d u r| d u rt j} t| ƒ ot| ƒ S | S r   )r   rt   r.   rÓ   )r   rÔ   r   r   r   Úshould_strip_ansið  s
   rÕ   é   )r€   c                  C   s   dd l } |  ¡ S rP   )ÚlocaleÚgetpreferredencoding)r×   r   r   r   Ú_get_argv_encoding   s   rÙ   Ú_ansi_stream_wrappersc                    s    zt  | ¡}W n ty   d}Y nw |dur|S ddl}t| |ƒ}|j| |d�‰t tjˆj	¡}|j
‰ ‡ ‡fdd„}||_
z|t | < W |S  tyO   Y |S w )zbSupport ANSI color and style codes on Windows by wrapping a
        stream with colorama.
        Nr   )Ústripc                    s$   zˆ | ƒW S  t y   ˆ ¡  ‚ w r   )rÎ   Ú	reset_all)Ús©Ú_writeÚansi_wrapperr   r   Ú_safe_write  s   
þz'auto_wrap_for_ansi.<locals>._safe_write)rÚ   Úgetr+   ÚcoloramarÕ   ÚAnsiToWin32r    r!   rg   r   rI   )r   rÔ   Úcachedrã   rÛ   r   rá   r   rÞ   r   r     s*   ÿ

ýýc                   C   s   t tjdd ƒp
t ¡ S )Nr   )r   r   rt   Úgetfilesystemencodingr   r   r   r   rÙ   .  s   rB   c                 C   s   d S r   r   )rB   r   r   r   r   r   r€   1  s   r€   rE   c                 C   s   t t| ƒƒS r   )ÚlenrÑ   )rE   r   r   r   Úterm_len7  r=   rè   c                 C   s    z|   ¡ W S  ty   Y dS w r¾   )r.   r+   r]   r   r   r   r.   ;  s
   
ÿr.   Úsrc_funcÚwrapper_funcc                    s(   t ƒ ‰ dtjtj f‡ ‡‡fdd„}|S )Nr   c                     sn   ˆƒ } | d u r	d S zˆ   | ¡}W n ty   d }Y nw |d ur"|S ˆƒ }z|ˆ | < W |S  ty6   Y |S w r   )râ   r+   r   ©Úcacheré   rê   r   r   ÚfuncH  s$   ÿ
þþz&_make_cached_stream_func.<locals>.func)r   r    r3   rg   )ré   rê   rí   r   rë   r   Ú_make_cached_stream_funcB  s   rî   c                   C   ó   t jS r   )r   rt   r   r   r   r   Ú<lambda>^  ó    rð   c                   C   rï   r   )r   ry   r   r   r   r   rð   _  rñ   c                   C   rï   r   )r   r}   r   r   r   r   rð   `  rñ   )rt   ry   r}   Úbinary_streamsÚtext_streamsr/   rË   )NN)r�   NrŽ   Fr   )Fr   Úior›   Úrer   Útypingr    Úweakrefr   ÚplatformrÒ   ÚCYGWINÚWINr   r3   ÚCallablerg   Ú__annotations__ÚcompilerÏ   r"   r4   r5   r   r   r´   r6   r   ÚTextIOWrapperr   r#   rS   rT   rZ   r\   r^   rb   rc   rj   rn   rr   rw   r|   r~   r‚   r…   r†   ÚUnionrN   rŒ   ÚTupler¼   r²   rÑ   rÓ   rÕ   Ú_winconsoler€   rÙ   rÚ   ÚMutableMappingrè   r.   rî   Ú_default_text_stdinÚ_default_text_stdoutÚ_default_text_stderrrò   ÚMappingró   r   r   r   r   Ú<module>   sŽ  
 "
ûÿþýüû
ú E 	"""		ÿÿÿ
þù
ÿþýüûúù
ø2ü
ÿþýü
ûü
ÿþýü
ûÿÿÿ
þ
ÿÿÿ
þ
ÿÿÿ
þ	ÿþýü

ûûÿþýüû
úQÿÿÿ
þÿÿÿþ'ÿÿÿ

þÿþ
ý$ý	ýþ"ÿ