U
    ÌZjzI  ã                
   @   sf  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¡o^dejkZdejkozdej dd	¡kZej	 
d¡o’e o’e ZdZejejejgejf  ed
< e d¡Zedœdd„Zdoejeje eje eeejdœdd„Zeedœdd„Zejedœdd„Z G dd„ dej!ƒZ"G dd„ dƒZ#dpejeedœdd„Z$dqejeedœd d!„Z%ejejej dœd"d#„Z&ejejej dœd$d%„Z'ejedœd&d'„Z(ejeeje ed(œd)d*„Z)ejeje eje ed+œd,d-„Z*drejeje eje ejejegef ejejgejej f eeejd.œd/d0„Z+dsejeje eje eejd1œd2d3„Z,dtejeje eje eejd4œd5d6„Z-ejdœd7d8„Z.ejdœd9d:„Z/ejdœd;d<„Z0dueje eje ejd=œd>d?„Z1dveje eje ejd=œd@dA„Z2dweje eje ejd=œdBdC„Z3ej4eej5e6f eeje eje ejdDœdEdF„Z7dxeeeje eje eej8ejef dIœdJdK„Z9G dLdM„ dMƒZ:eedNœdOdP„Z;ejedœdQdR„Z<dyejej eje edSœdTdU„Z=ej	 
d¡�rDe�rDdVdWl>m?Z? edœdXdY„Z@eƒ ZAejBejejf edZ< dzejeje ejdSœd[d
„Zn8edœd\dY„Z@ejeje eje ejej d]œd^d_„Z?ee6d`œdadb„ZCejedœdcdd„ZDejg ejf ejg ejf ejg ejf deœdfdg„ZEeEdhdi„ e1ƒZFeEdjdi„ e2ƒZGeEdkdi„ e3ƒZHe.e/e0dlœZIejJeejg ejf f edm< e1e2e3dlœZKejJeejeje eje gejf f edn< dS ){é    N)ÚWeakKeyDictionaryÚcygwinÚwinZGCCÚAPPENGINE_RUNTIMEzDevelopment/ÚSERVER_SOFTWAREÚ Úauto_wrap_for_ansiz\033\[[;?0-9]*[a-zA-Z]©Úreturnc                   C   s   t  ¡ pt  ¡ S ©N)ÚsysÚgetfilesystemencodingÚgetdefaultencoding© r   r   úP/var/www/html/TRUCKING_PROJECT/venv/lib/python3.8/site-packages/click/_compat.pyÚget_filesystem_encoding   s    r   F)ÚstreamÚencodingÚerrorsÚforce_readableÚforce_writabler
   c                 C   s0   |d krt | ƒ}|d krd}t| ||d||d�S )NÚreplaceT)Úline_bufferingr   r   )Úget_best_encodingÚ_NonClosingTextIOWrapper)r   r   r   r   r   r   r   r   Ú_make_text_stream   s    úr   )r   r
   c                 C   s.   zt  | ¡jdkW S  tk
r(   Y dS X dS )z$Checks if a given encoding is ascii.ÚasciiFN)ÚcodecsÚlookupÚnameÚLookupError)r   r   r   r   Úis_ascii_encoding-   s    r!   )r   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)Úgetattrr   r   r!   ©r   Úrvr   r   r   r   5   s    r   c                	       s\   e Zd Zdejeje eje eeejddœ‡ fdd„Z	ddœdd„Z
edœd	d
„Z‡  ZS )r   FN)r   r   r   r   r   Úextrar
   c                    s4   t  t jt|||ƒ¡ | _}tƒ j|||f|Ž d S r   )ÚtÚcastÚBinaryIOÚ_FixupStreamÚ_streamÚsuperÚ__init__)Úselfr   r   r   r   r   r%   ©Ú	__class__r   r   r,   >   s
    	 
ÿ
z!_NonClosingTextIOWrapper.__init__r	   c                 C   s&   z|   ¡  W n tk
r    Y nX d S r   )ÚdetachÚ	Exception©r-   r   r   r   Ú__del__L   s    z _NonClosingTextIOWrapper.__del__c                 C   s
   | j  ¡ S r   )r*   Úisattyr2   r   r   r   r4   R   s    z_NonClosingTextIOWrapper.isatty)FF)Ú__name__Ú
__module__Ú__qualname__r&   r(   ÚOptionalÚstrÚboolÚAnyr,   r3   r4   Ú__classcell__r   r   r.   r   r   =   s     úør   c                   @   sr   e Zd ZdZdejeedœdd„Zeej	dœdd„Z
eed	œd
d„Zedœdd„Zedœdd„Zedœ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).
    F)r   r   r   c                 C   s   || _ || _|| _d S r   )r*   Ú_force_readableÚ_force_writable)r-   r   r   r   r   r   r   r,   a   s    z_FixupStream.__init__©r   r
   c                 C   s   t | j|ƒS r   )r"   r*   ©r-   r   r   r   r   Ú__getattr__k   s    z_FixupStream.__getattr__)Úsizer
   c                 C   s2   t | jdd ƒ}|d k	r&t t||ƒ¡S | j |¡S )NÚread1)r"   r*   r&   r'   ÚbytesÚread)r-   rB   Úfr   r   r   rC   n   s    z_FixupStream.read1r	   c                 C   sZ   | j r
dS t| jdd ƒ}|d k	r.t t|ƒ ¡S z| j d¡ W n tk
rT   Y dS X dS )NTÚreadabler   F)r=   r"   r*   r&   r'   r:   rE   r1   ©r-   Úxr   r   r   rG   v   s    z_FixupStream.readablec                 C   s‚   | j r
dS t| jdd ƒ}|d k	r.t t|ƒ ¡S z| j d¡ W n> tk
r|   z| j d¡ W n tk
rv   Y Y dS X Y nX dS )NTÚwritabler   ó    F)r>   r"   r*   r&   r'   r:   Úwriter1   rH   r   r   r   rJ   ‚   s    z_FixupStream.writablec                 C   sV   t | jdd ƒ}|d k	r$t t|ƒ ¡S z| j | j ¡ ¡ W n tk
rP   Y dS X dS )NÚseekableFT)r"   r*   r&   r'   r:   ÚseekÚtellr1   rH   r   r   r   rM   ‘   s    z_FixupStream.seekableN)FF)r5   r6   r7   Ú__doc__r&   r(   r:   r,   r9   r;   rA   ÚintrD   rC   rG   rJ   rM   r   r   r   r   r)   W   s     üü
r)   )r   Údefaultr
   c                 C   s0   zt |  d¡tƒW S  tk
r*   | Y S X d S ©Nr   )Ú
isinstancerE   rD   r1   ©r   rR   r   r   r   Ú_is_binary_readerœ   s    rV   c                 C   sT   z|   d¡ W n@ tk
rN   z|   d¡ W Y dS  tk
rD   Y nX | Y S X dS )NrK   r   FT)rL   r1   rU   r   r   r   Ú_is_binary_writer¥   s    

rW   c                 C   sH   t | dƒrt tj| ¡S t| dd ƒ}|d k	rDt |dƒrDt tj|¡S d S ©NFÚbufferT)rV   r&   r'   r(   r"   ©r   Úbufr   r   r   Ú_find_binary_reader²   s    
r\   c                 C   sH   t | dƒrt tj| ¡S t| dd ƒ}|d k	rDt |dƒrDt tj|¡S d S rX   )rW   r&   r'   r(   r"   rZ   r   r   r   Ú_find_binary_writerÄ   s    
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_   )r   ÚattrÚvaluer
   c                 C   s$   t | |dƒ}||kp"|dko"|dk	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`   ra   Zstream_valuer   r   r   Ú_is_compat_stream_attrß   s    rb   )r   r   r   r
   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_streamr   r   Ú	is_binaryÚfind_binaryr   r   r
   c           	      C   s~   || dƒrt  t j| ¡}nFt  t j| ¡} t| ||ƒrH|d krDt| ƒsH| S || ƒ}|d kr\| S |}|d krld}t|||||d�S )NFr   )r   r   )r&   r'   r(   ÚTextIOrc   r_   r   )	rd   r   r   re   rf   r   r   Zbinary_readerZpossible_binary_readerr   r   r   Ú_force_correct_text_streamó   s,    	
ÿÿûrh   )Útext_readerr   r   r   r
   c                 C   s   t | ||tt|d�S )N©r   )rh   rV   r\   )ri   r   r   r   r   r   r   Ú_force_correct_text_reader!  s    úrk   )Útext_writerr   r   r   r
   c                 C   s   t | ||tt|d�S )N©r   )rh   rW   r]   )rl   r   r   r   r   r   r   Ú_force_correct_text_writer1  s    úrn   c                  C   s   t tjƒ} | d krtdƒ‚| S )Nz6Was not able to determine binary stream for sys.stdin.)r\   r   ÚstdinÚRuntimeError)Úreaderr   r   r   Úget_binary_stdinA  s    
rr   c                  C   s   t tjƒ} | d krtdƒ‚| S )Nz7Was not able to determine binary stream for sys.stdout.)r]   r   Ústdoutrp   ©Úwriterr   r   r   Úget_binary_stdoutH  s    
rv   c                  C   s   t tjƒ} | d krtdƒ‚| S )Nz7Was not able to determine binary stream for sys.stderr.)r]   r   Ústderrrp   rt   r   r   r   Úget_binary_stderrO  s    
rx   )r   r   r
   c                 C   s,   t tj| |ƒ}|d k	r|S ttj| |dd�S )NTrj   )Ú_get_windows_console_streamr   ro   rk   ©r   r   r$   r   r   r   Úget_text_stdinV  s    r{   c                 C   s,   t tj| |ƒ}|d k	r|S ttj| |dd�S ©NTrm   )ry   r   rs   rn   rz   r   r   r   Úget_text_stdout_  s    r}   c                 C   s,   t tj| |ƒ}|d k	r|S ttj| |dd�S r|   )ry   r   rw   rn   rz   r   r   r   Úget_text_stderrh  s    r~   )ÚfileÚmoder   r   r
   c                 C   s"   d|k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_openq  s    
r„   ÚrÚstrict)Úfilenamer€   r   r   Úatomicr
   c              
      s$  dˆ k}t  | ¡dkrht‡ fdd„dD ƒƒrJ|r:tƒ dfS t||d�dfS |rXtƒ dfS t||d�dfS |s~t| ˆ ||ƒdfS d	ˆ krŽtd
ƒ‚dˆ kržtdƒ‚dˆ kr®tdƒ‚dd l	}dd l
}zt  | ¡j}W n tk
ræ   d }Y nX t jt jB t jB }	|�r|	tt ddƒO }	t j t j | ¡d| d¡d›�¡}
z&t  |
|	|d k�rLdn|¡}W �qÚW nz tk
�rÔ } zZ|j	|jk�s¸t jdk�rÂ|j	|jk�rÂt j |j¡�rÂt  |jt j¡�rÂW Y ¢
�q‚ W 5 d }~X Y nX �q|d k	�rðt  |
|¡ t|ˆ ||ƒ}t||
t j  | ¡ƒ}t! "t!j#|¡dfS )Nr�   ú-c                 3   s   | ]}|ˆ kV  qd S r   r   )Ú.0Úm©r€   r   r   Ú	<genexpr>Š  s     zopen_stream.<locals>.<genexpr>)ÚwÚarI   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.rI   z&Use the `overwrite`-parameter instead.rŽ   z,Atomic writes only make sense with `w`-mode.r   ÚO_BINARYz.__atomic-writel        Ú08xi¶  Únt)$ÚosÚfsdecodeÚanyrv   r}   rr   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'   ÚIO)r‡   r€   r   r   rˆ   Úbinaryr—   r˜   ÚpermÚflagsÚtmp_filenameÚfdÚerF   Úafr   rŒ   r   Úopen_stream~  sh    

ÿ

þ
ÿ
þýü

r³   c                   @   s|   e Zd Zejeeddœdd„Zeedœdd„ƒZde	dd	œd
d„Z
eejdœdd„Zd dœdd„Zdd„ Zedœdd„ZdS )r©   N)rF   r¯   Úreal_filenamer
   c                 C   s   || _ || _|| _d| _d S ©NF)Ú_fÚ_tmp_filenameÚ_real_filenameÚclosed)r-   rF   r¯   r´   r   r   r   r,   Ï  s    z_AtomicFile.__init__r	   c                 C   s   | j S r   )r¸   r2   r   r   r   r   Õ  s    z_AtomicFile.nameF)Údeleter
   c                 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   s   t | j|ƒS r   )r"   r¶   r@   r   r   r   rA   à  s    z_AtomicFile.__getattr__c                 C   s   | S r   r   r2   r   r   r   Ú	__enter__ã  s    z_AtomicFile.__enter__c                 C   s   | j |d k	d� d S )N)rº   )r»   )r-   Úexc_typeÚ	exc_valueÚtbr   r   r   Ú__exit__æ  s    z_AtomicFile.__exit__c                 C   s
   t | jƒS r   )Úreprr¶   r2   r   r   r   Ú__repr__é  s    z_AtomicFile.__repr__)F)r5   r6   r7   r&   r«   r9   r,   Úpropertyr   r:   r»   r;   rA   r¼   rÀ   rÂ   r   r   r   r   r©   Î  s   r©   )ra   r
   c                 C   s   t  d| ¡S )Nr   )Ú_ansi_reÚsub)ra   r   r   r   Ú
strip_ansií  s    rÆ   c                 C   s$   t | ttfƒr| j} q | jj d¡S )Nz
ipykernel.)rT   r)   r   r*   r/   r6   Ú
startswithr^   r   r   r   Ú_is_jupyter_kernel_outputñ  s    rÈ   )r   Úcolorr
   c                 C   s0   |d kr*| d krt j} t| ƒ o(t| ƒ S | S r   )r   ro   r4   rÈ   )r   rÉ   r   r   r   Úshould_strip_ansiø  s
    rÊ   é   )ry   c                  C   s   dd l } |  ¡ S rS   )ÚlocaleÚgetpreferredencoding)rÌ   r   r   r   Ú_get_argv_encoding  s    rÎ   Ú_ansi_stream_wrappersc                    s¤   zt  | ¡}W n tk
r&   d}Y nX |dk	r4|S ddl}t| |ƒ}|j| |d�‰t tjˆj	¡}|j
‰ ‡ ‡fdd„}||_
z|t | < W n tk
rž   Y nX |S )zbSupport ANSI color and style codes on Windows by wrapping a
        stream with colorama.
        Nr   )Ústripc                    s.   z
ˆ | ƒW S  t k
r(   ˆ ¡  ‚ Y nX d S r   )ÚBaseExceptionZ	reset_all)Ús©Ú_writeZansi_wrapperr   r   Ú_safe_write$  s
    
z'auto_wrap_for_ansi.<locals>._safe_write)rÏ   Úgetr1   ÚcoloramarÊ   ZAnsiToWin32r&   r'   rg   r   rL   )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   ro   r   r   r   r   r   rÎ   6  s    )rF   r   r   r
   c                 C   s   d S r   r   )rF   r   r   r   r   r   ry   9  s    ry   )rI   r
   c                 C   s   t t| ƒƒS r   )ÚlenrÆ   )rI   r   r   r   Úterm_len?  s    rÚ   c                 C   s&   z
|   ¡ W S  tk
r    Y dS X d S rµ   )r4   r1   r^   r   r   r   r4   C  s    
r4   )Úsrc_funcÚwrapper_funcr
   c                    s"   t ƒ ‰ tjdœ‡ ‡‡fdd„}|S )Nr	   c                     sf   ˆƒ } zˆ   | ¡}W n tk
r,   d }Y nX |d k	r:|S ˆƒ }z|ˆ | < W n tk
r`   Y nX |S r   )rÖ   r1   r#   ©ÚcacherÛ   rÜ   r   r   ÚfuncO  s    
z&_make_cached_stream_func.<locals>.func)r   r&   rg   )rÛ   rÜ   rß   r   rÝ   r   Ú_make_cached_stream_funcJ  s    rà   c                   C   s   t jS r   )r   ro   r   r   r   r   Ú<lambda>a  rK   rá   c                   C   s   t jS r   )r   rs   r   r   r   r   rá   b  rK   c                   C   s   t jS r   )r   rw   r   r   r   r   rá   c  rK   )ro   rs   rw   Úbinary_streamsÚtext_streams)FF)F)F)FF)F)F)NN)NN)NN)r…   Nr†   F)NN)N)Lr   Úior“   Úrer   Útypingr&   Úweakrefr   ÚplatformrÇ   ZCYGWINÚversionZMSYS2ÚenvironrÖ   Z
APP_ENGINEZWINr   r8   ÚCallablerg   Ú__annotations__ÚcompilerÄ   r9   r   r(   r:   r   r!   r«   r   ÚTextIOWrapperr   r)   rV   rW   r\   r]   r_   rb   rc   rh   rk   rn   rr   rv   rx   r{   r}   r~   ÚUnionÚPathLikerQ   r„   ÚTupler³   r©   rÆ   rÈ   rÊ   Z_winconsolery   rÎ   rÏ   ÚMutableMappingrÚ   r4   rà   Z_default_text_stdinZ_default_text_stdoutZ_default_text_stderrrâ   ÚMappingrã   r   r   r   r   Ú<module>   s<    ÿ"
  ûúE		
  þ  ùø2 üû üû   ÿ þ
   ÿ þ
   ÿ þ
û    ûúP   ÿ
 þ ÿ þ'  
þ þý$	ýþ"ÿ