o
    "`^hS+                     @   s<  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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 eeZG d
d deZd dlmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z( d dlm)Z) d dl*m+Z, d dl-m.Z. d dl/m0Z0 d dl1m2Z2 e,Z3e4Z4e"Z5dd Z6dd Z7dFddZ8dGddZ9zd dl:m;  m<Z= W n e>y   d dl?m;  m@Z= Y nw e=jAZBd dlCZCdd ZDeEdd ZFeEd d! ZGeFe_FeGe_Gd"d# ZHd$d% ZIzeJ  d&ZKW n eLy
   d'ZKY nw d(d) ZMdHd*d+ZNd,d- ZOd.d/ ZPzd dlQZRejSTd0d1ZUeUV d2k ZWW n e>y<   d'ZWY nw d3ZXe
Yd4eX d5 ZZd6Z[d7j\e[eXd8Z]e[e]d9Z^g d:Z_d;Z`d<d=ad>d? e_D  d@ ZbdAe` dB ZcdCeb d< ec dD Zde
Yd4ed d5 ZeefdEZgz	d dlhZhd&ZiW dS  e>y   d'ZiY dS w )I    N)HTTPMessage)OrderedDict)MutableMapping)floor)six)MD5UnavailableError)tzlocal)
exceptionsc                   @   s   e Zd ZdS )HTTPHeadersN)__name__
__module____qualname__ r   r   M/home/air/shanriGPT/back/venv/lib/python3.10/site-packages/botocore/compat.pyr
   %   s    r
   )
quote	urlencodeunquoteunquote_plusurlparseurlsplit
urlunspliturljoin	parse_qslparse_qs)HTTPResponse)IOBase)encodebytes)
formatdate)zip_longestc                 C   s   | j jjj| dS )z|Set the timeout of the socket from an HTTPResponse.

    :param http_response: An instance of ``httplib.HTTPResponse``

    N)_fpfpraw_sock
settimeout)http_responsetimeoutr   r   r   set_socket_timeout@   s   r&   c                 C   s   t | d S )N   )inspectgetfullargspec)funcr   r   r   accepts_kwargsH   s   r+   c                 C   s   | S Nr   sencodingerrorsr   r   r   ensure_unicodeM   s   r1   utf-8strictc                 C   s8   t | tr| ||S t | tr| S tdt|  d)Nz Expected str or bytes, received .)
isinstancestrencodebytes
ValueErrortyper-   r   r   r   ensure_bytesQ   s
   

r;   c                   C   s   t jddtjdd d S )Nignorez+A true SSLContext object is not available.*z.*urllib3\.util\.ssl_)messagecategorymodule)warningsfilterwarningsr	   InsecurePlatformWarningr   r   r   r   filter_ssl_warningsb   s   
rC   c                 C   s$   |  }|  D ]\}}|||< q|S r,   )items)clsdnew_instancekeyvaluer   r   r   	from_dictl   s   
rJ   c                 C   s    |  }|D ]\}}|||< q|S r,   r   )rE   pairsrG   rH   rI   r   r   r   
from_pairst   s   
rL   c                 C   s   t  | }|S )zI
    This used to be a compat shim for 2.6 but is now just an alias.
    )copy)kwargscopy_kwargsr   r   r   rO      s   
rO   c                 C   s   |   S )z
    Returns the total seconds in a ``datetime.timedelta``.

    This used to be a compat shim for 2.6 but is now just an alias.

    :param delta: The timedelta object
    :type delta: ``datetime.timedelta``
    )total_seconds)deltar   r   r   rP      s   	rP   TFc                  O   s   t r
tj| i |S t )a:  
    Attempts to get an md5 hashing object.

    :param args: Args to pass to the MD5 constructor
    :param kwargs: Key word arguments to pass to the MD5 constructor
    :return: An MD5 hashing object if available. If it is unavailable, None
        is returned if raise_error_if_unavailable is set to False.
    )MD5_AVAILABLEhashlibmd5r   )argsrN   r   r   r   get_md5   s   	rV   c                 C   s(   |d u rt j}|dkrt| S t| S )Nwin32)sysplatform_windows_shell_splitshlexsplit)r.   rY   r   r   r   compat_shell_split   s
   
r]   c                 C   s4  | sg S g }g }d}d}| D ]k}|dkr|d7 }q|dkrG|dkr>| dtt|d   |d }d}|dkr>| d q| }| d q|dv rg|sg|dkrZ| d|  d}|rf| d| g }q|dkrt| d|  d}| | q|rtd	|  |dkr| d|  |r| d| |S )
a  Splits up a windows command as the built-in command parser would.

    Windows has potentially bizarre rules depending on where you look. When
    spawning a process via the Windows C runtime (which is what python does
    when you call popen) the rules are as follows:

    https://docs.microsoft.com/en-us/cpp/cpp/parsing-cpp-command-line-arguments

    To summarize:

    * Only space and tab are valid delimiters
    * Double quotes are the only valid quotes
    * Backslash is interpreted literally unless it is part of a chain that
      leads up to a double quote. Then the backslashes escape the backslashes,
      and if there is an odd number the final backslash escapes the quote.

    :param s: The command string to split up into parts.
    :return: A list of command components.
    Fr   \   "r'    ) 	z No closing quotation in string: )appendintr   joinr9   )r.   
componentsbuff	is_quotednum_backslashes	character	remainderr   r   r   rZ      sL   

rZ   c                  C   s$   t jdkrddlm}  t| fS tfS )NrW   r   
tzwinlocal)rX   rY   dateutil.tzrn   r   rm   r   r   r   get_tzinfo_options  s   
rp   BOTO_DISABLE_CRTfalsetruez(?:[0-9]{1,3}\.){3}[0-9]{1,3}^$z[0-9A-Fa-f]{1,4}z(?:{hex}:{hex}|{ipv4}))hexipv4)rv   ls32)	z(?:%(hex)s:){6}%(ls32)sz::(?:%(hex)s:){5}%(ls32)sz%(?:%(hex)s)?::(?:%(hex)s:){4}%(ls32)sz2(?:(?:%(hex)s:)?%(hex)s)?::(?:%(hex)s:){3}%(ls32)sz6(?:(?:%(hex)s:){0,2}%(hex)s)?::(?:%(hex)s:){2}%(ls32)sz/(?:(?:%(hex)s:){0,3}%(hex)s)?::%(hex)s:%(ls32)sz'(?:(?:%(hex)s:){0,4}%(hex)s)?::%(ls32)sz&(?:(?:%(hex)s:){0,5}%(hex)s)?::%(hex)sz(?:(?:%(hex)s:){0,6}%(hex)s)?::zDABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._!\-~z(?:|c                 C   s   g | ]}|t  qS r   )_subs).0xr   r   r   
<listcomp>N  s    r}   )z(?:%25|%)(?:[z]|%[a-fA-F0-9]{2})+z\[z)?\]z	
)NN)r2   r3   r,   )jrM   datetimerX   r(   r@   rS   http.clientr   loggingr[   reoscollectionsr   collections.abcr   mathr   botocore.vendoredr   botocore.exceptionsr   ro   r   urllib3r	   	getLoggerr   loggerr
   urllib.parser   r   r   r   r   r   r   r   r   r   r   ior   _IOBasebase64r   email.utilsr   	itertoolsr   	file_typezipunquote_strr&   r+   r1   r;   xml.etree.cElementTreeetreecElementTreeETreeImportErrorxml.etree.ElementTreeElementTree
ParseErrorXMLParseErrorjsonrC   classmethodrJ   rL   rO   rP   rT   rR   r9   rV   r]   rZ   rp   awscrt.authawscrtenvirongetdisabledlowerHAS_CRTIPV4_PATcompileIPV4_REHEX_PATformatLS32_PATrz   _variationsUNRESERVED_PATrf   IPV6_PATZONE_ID_PATIPV6_ADDRZ_PATIPV6_ADDRZ_RE	frozensetUNSAFE_URL_CHARSgzipHAS_GZIPr   r   r   r   <module>   s   
0






^



