3 B\3@sddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZejeZe jrddlmZGdddejZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddl#m$Z$ddl%m&Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-e'Z.e/Z/eZ0ddZ1ddZ2dEddZ3dFd d!Z4ndd l5mZdd l5mZdd l5mZdd l5mZdd lmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"dd"l6m7Z7ddl8m+Z+e9Z.dd#l,m:Z/dd$l,m;Z-ddlm?Z?Wn"e@k rdd-lAm?Z?YnXejBdd.dJkrddlCZDeEZFd0d1ZGn"ddlHZIeIjJjKjLZFddlDZDd2d1ZGd3d4ZMeNd5d6ZOeNd7d8ZPeOe_OePe_Pd9d:ZQd;d<ZRyejSd=ZTWneUk rpd>ZTYnXd?d@ZVdKdAdBZWdCdDZXdS)LN)floor)six)MD5UnavailableError) exceptions) http_clientc@s eZdZdS) HTTPHeadersN)__name__ __module__ __qualname__r r i/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-emcbgzcf/botocore/botocore/compat.pyr"sr)quote) urlencode)unquote) unquote_plus)urlparse)urlsplit) urlunsplit)urljoin) parse_qsl)parse_qs) HTTPResponse)IOBase) encodebytes) formatdate) zip_longestcCs|jjjjj|dS)zSet the timeout of the socket from an HTTPResponse. :param http_response: An instance of ``httplib.HTTPResponse`` N)_fpfpraw_sock settimeout) http_responsetimeoutr r r set_socket_timeout<sr#cCstj|dS)N)inspectgetfullargspec)funcr r r accepts_kwargsDsr(cCs|S)Nr )sencodingerrorsr r r ensure_unicodeIsr,utf-8strictcCs8t|tr|j||St|tr$|Stdt|dS)Nz#Expected str or bytes, received %s.) isinstancestrencodebytes ValueErrortype)r)r*r+r r r ensure_bytesMs    r5)Message)izip) izip_longest) encodestringc@seZdZddZdS)rccsx|jD]\}}|VqWdS)N)_headers)selffieldvaluer r r __iter__kszHTTPHeaders.__iter__N)rr r r>r r r r rgscCs|j|}t|j|S)N)r1rdecode)r=r*Z byte_stringr r r unquote_stros r@cCs|jjjj|dS)zSet the timeout of the socket from an HTTPResponse. :param http_response: An instance of ``httplib.HTTPResponse`` N)rrrr )r!r"r r r r#yscCstj|dS)Nr$)r% getargspec)r'r r r r(scCst|tjr|St|||S)N)r/r text_typeunicode)r)r*r+r r r r,s cCs8t|tr|j||St|tr$|Stdt|dS)Nz%Expected str or unicode, received %s.)r/rCr1r0r3r4)r)r*r+r r r r5s    ) OrderedDictr$cCstjddtjdddS)Nignorez$Certificate has no.*subjectAltName.*z.*urllib3\.connection)messagecategorymodule)warningsfilterwarningsrSecurityWarningr r r r filter_ssl_san_warningss rMcCsdS)Nr r r r r rMscCstjddtjddtdS)NrFz+A true SSLContext object is not available.*z.*urllib3\.util\.ssl_)rGrHrI)rJrKrInsecurePlatformWarningrMr r r r filter_ssl_warningss rOcCs(|}x|jD]\}}|||<qW|S)N)items)clsd new_instancekeyr=r r r from_dicts rUcCs$|}x|D]\}}|||<q W|S)Nr )rQpairsrSrTr=r r r from_pairss rWcCs^tj}|ddkrP|ddkrP|ddkrPi}x*|D]}||||jd<q4Wn tj|}|S)aJ There is a bug in Python versions < 2.6.5 that prevents you from passing unicode keyword args (#4978). This function takes a dictionary of kwargs and returns a copy. If you are using Python < 2.6.5, it also encodes the keys to avoid this bug. Oh, and version_info wasn't a namedtuple back then, either! rr$rEzutf-8)sys version_infor1copy)kwargsvi copy_kwargsrTr r r r`s$  r`cCs@tjdddkr|jS|jdd}|jd}||j|S) a Returns the total seconds in a ``datetime.timedelta``. Python 2.6 does not have ``timedelta.total_seconds()``, so we have to calculate this ourselves. On 2.7 or better, we'll take advantage of the built-in method. The math was pulled from the ``datetime`` docs (http://docs.python.org/2.7/library/datetime.html#datetime.timedelta.total_seconds). :param delta: The timedelta object :type delta: ``datetime.timedelta`` Nr$rEg @g$@)r$rEg.A)r[r\ total_secondsdays microsecondsseconds)deltaZday_in_secondsZmicro_in_secondsr r r rbs  rbTFcOstrtj||StdS)a Attempts to get an md5 hashing object. :param raise_error_if_unavailable: raise an error if md5 is unavailable on this system. If False, None will be returned if it is unavailable. :type raise_error_if_unavailable: bool :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_AVAILABLEhashlibmd5r)argsr^r r r get_md5s  rkcCs,|dkrtj}|dkrt|Stj|SdS)Nwin32)r[platform_windows_shell_splitshlexsplit)r)rmr r r compat_shell_splits rqcCs>|sgSg}g}d}d}x|D]}|dkr4|d7}q|dkr|dkr~|jdtt|d|d}d}|dkr~|jdq| }|jdq|d kr| r|dkr|jd|d}|r|jdj|g}q|dkr|jd|d}|j|qW|r td ||dkr$|jd||r:|jdj||S) aSplits 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\rX"r$  z"No closing quotation in string: %s)rurv)appendintrjoinr3)r) componentsZbuffZ is_quotedZnum_backslashes character remainderr r r rn sJ      rn)NN)r-r.)r-)r-r.)r-r.)r$rE)N)Yr]datetimer[r%rJrhloggingromathrZbotocore.vendoredrZbotocore.exceptionsrurllib3r getLoggerrloggerPY3Zbotocore.vendored.six.movesr HTTPMessager urllib.parser rrrrrrrrr http.clientrior_IOBasebase64r email.utilsr itertoolsr file_typezipr@r#r(r,r5urllib email.messager6Z email.Utilsfiler7r8httplibr9 collectionsrD ImportErrorZ ordereddictr\Z simplejsonjson SyntaxErrorZ XMLParseErrorrMxml.etree.cElementTreexmletree cElementTree ParseErrorrO classmethodrUrWr`rbrirgr3rkrqrnr r r r s