U
    EZh -                  	   @   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 Z7dPddZ8dQddZ9zd dl:m;  m<Z= W n( e>k
r   d dl?m;  m@Z= Y nX e=jAZBd dlCZCdd ZDeEdd ZFeEd d! ZGeFe_FeGe_Gd"d# ZHd$d% ZIzeJ  d&ZKW n eLeMfk
r   d'ZKY nX d(d) ZNdRd*d+ZOd,d- ZPd.d/ ZQz(d dlRZSejTUd0d1ZVeVW d2k ZXW n e>k
r   d'ZXY nX d3d4 ZYd5ZZe
[d6eZ d7 Z\d8Z]d9j^e]eZd:Z_e]e_d;Z`d<d=d>d?d@dAdBdCdDg	ZadEZbdFdGcdHdI eaD  dJ ZddKeb dL ZedMed dF ee dN Zfe
[d6ef d7 ZgehdOZizd dljZjd&ZkW n e>k
rZ   d'ZkY nX dS )S    N)HTTPMessage)OrderedDict)MutableMapping)floor)six)MD5UnavailableError)tzlocal)
exceptionsc                   @   s   e Zd ZdS )HTTPHeadersN)__name__
__module____qualname__ r   r   V/home/aprabhat/apps/x.techxrdev.in/venv/lib/python3.8/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   s<   t | tr| ||S t | tr$| S tdt|  dd S )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| |S t dS )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.
    N)MD5_AVAILABLEhashlibmd5r   )argsrN   r   r   r   get_md5   s    	rV   c                 C   s,   |d krt j}|dkrt| S t| S d S )Nwin32)sysplatform_windows_shell_splitshlexsplit)r.   rY   r   r   r   compat_shell_split   s
    r]   c                 C   s:  | sg S g }g }d}d}| D ]}|dkr2|d7 }q|dkr|dkr|| dtt|d   |d }d}|dkr|| d q| }| d q|dkr|s|dkr| d|  d}|r| d| g }q|dkr| d|  d}| | q|rtd	|  |dkr | d|  |r6| 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.   
componentsZbuffZ	is_quotedZnum_backslashes	character	remainderr   r   r   rZ      sJ    


rZ   c                  C   s(   t jdkrddlm}  t| fS tfS d S )NrW   r   
tzwinlocal)rX   rY   dateutil.tzrk   r   rj   r   r   r   get_tzinfo_options  s    
rm   ZBOTO_DISABLE_CRTfalsetruec              	   C   sN   t sdS tj}ztt|d}t|}W n ttfk
rD   Y dS X || kS )z&Not intended for use outside botocore.Fr4   )	HAS_CRTawscrt__version__mapre   r\   tuple	TypeErrorr9   )minimum_versionZcrt_version_strZcrt_version_intsZcrt_version_tupler   r   r   has_minimum_crt_version+  s    rw   z(?:[0-9]{1,3}\.){3}[0-9]{1,3}^$z[0-9A-Fa-f]{1,4}z(?:{hex}:{hex}|{ipv4}))hexZipv4)rz   ls32z(?:%(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>]  s     r   )z(?:%25|%)(?:[z]|%[a-fA-F0-9]{2})+z\[z)?\]z	
)NN)r2   r3   )N)lrM   datetimerX   r(   r@   rS   http.clientr   loggingr[   reoscollectionsr   collections.abcr   mathr   Zbotocore.vendoredr   Zbotocore.exceptionsr   rl   r   urllib3r	   	getLoggerr   loggerr
   urllib.parser   r   r   r   r   r   r   r   r   r   r   ior   _IOBasebase64r   email.utilsr   	itertoolsr   	file_typezipZunquote_strr&   r+   r1   r;   Zxml.etree.cElementTreeetreeZcElementTreeZETreeImportErrorZxml.etree.ElementTreeZElementTreeZ
ParseErrorZXMLParseErrorjsonrC   classmethodrJ   rL   rO   rP   rT   rR   AttributeErrorr9   rV   r]   rZ   rm   Zawscrt.authrq   environgetdisabledlowerrp   rw   IPV4_PATcompileIPV4_REHEX_PATformatLS32_PATr}   _variationsUNRESERVED_PATrf   IPV6_PATZONE_ID_PATIPV6_ADDRZ_PATIPV6_ADDRZ_RE	frozensetZUNSAFE_URL_CHARSgzipZHAS_GZIPr   r   r   r   <module>   s   
0







^

