B -<`-@sddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZddlmZeeZe jrddlmZGdd d ejZdd lmZdd lmZdd lmZdd lmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddl%m&Z&ddl'm(Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/e)Z0e1Z1eZ2ddZ3ddZ4dDddZ5dEd!d"Z6ndd l7mZdd l7mZdd l7mZdd l7mZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$dd#l8m9Z9ddl:m-Z-e;Z0dd$l.mm&Z&dd&l*m?Z+Gd'd d e9ZdFd(d)Z2d*dZ3d+dZ4dGd,dZ5dHd-d"Z6dd.l@mAZAyddlBmCmDZEWn(eFk rddlGmCmHZEYnXeEjIZJddlKZKd/d0ZLeMd1d2ZNeMd3d4ZOeNe_NeOe_Od5d6ZPd7d8ZQyeRd9ZSWneTk rVd:ZSYnXd;d<ZUdId=d>ZVd?d@ZWdAdBZXyddClYmZZZWn"eFk rddCl@mZZZYnXdS)JN)floor)six)MD5UnavailableError)tzlocal) exceptions) http_clientc@s eZdZdS) HTTPHeadersN)__name__ __module__ __qualname__r r 6/tmp/pip-target-7cdyy134/lib/python/botocore/compat.pyr#sr)quote) urlencode)unquote) unquote_plus)urlparse)urlsplit) urlunsplit)urljoin) parse_qsl)parse_qs) HTTPResponse)IOBase) encodebytes) formatdate) zip_longestcCs|jjjj|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$cCst|dS)N)inspectgetfullargspec)funcr r r accepts_kwargsEsr)cCs|S)Nr )sencodingerrorsr r r ensure_unicodeJsr-utf-8strictcCs8t|tr|||St|tr$|Stdt|dS)Nz#Expected str or bytes, received %s.) isinstancestrencodebytes ValueErrortype)r*r+r,r r r ensure_bytesNs    r6)Message)izip) izip_longest) encodestringc@seZdZddZdS)rccsx|jD]\}}|VqWdS)N)_headers)selffieldvaluer r r __iter__lszHTTPHeaders.__iter__N)r r r r?r r r r rhscCs||}t||S)N)r2rdecode)r>r+Z byte_stringr r r unquote_strps rAcCs|jjj|dS)zSet the timeout of the socket from an HTTPResponse. :param http_response: An instance of ``httplib.HTTPResponse`` N)rrr r!)r"r#r r r r$zscCst|dS)Nr%)r& getargspec)r(r r r r)scCst|tjr|St|||S)N)r0r text_typeunicode)r*r+r,r r r r-s cCs8t|tr|||St|tr$|Stdt|dS)Nz%Expected str or unicode, received %s.)r0rDr2r1r4r5)r*r+r,r r r r6s    ) OrderedDictcCstjddtjdddS)Nignorez+A true SSLContext object is not available.*z.*urllib3\.util\.ssl_)messagecategorymodule)warningsfilterwarningsrInsecurePlatformWarningr r r r filter_ssl_warningss rMcCs(|}x|D]\}}|||<qW|S)N)items)clsd new_instancekeyr>r r r from_dicts rScCs$|}x|D]\}}|||<q W|S)Nr )rOpairsrQrRr>r r r from_pairss rUcCst|}|S)zI This used to be a compat shim for 2.6 but is now just an alias. )copy)kwargs copy_kwargsr r r rXs rXcCs|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 rYs rYTFcOstrtj||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)argsrWr r r get_md5s  r_cCs,|dkrtj}|dkrt|St|SdS)Nwin32)sysplatform_windows_shell_splitshlexsplit)r*rbr r r compat_shell_splits rfcCs<|sgSg}g}d}d}x|D]}|dkr4|d7}q|dkr|dkr~|dtt|d|d}d}|dkr~|dq| }|dq|dkr|s|dkr|d|d}|r|d|g}q|dkr|d|d}||qW|r td ||dkr"|d||r8|d||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\"r%)  z"No closing quotation in string: %s)appendintrjoinr4)r* componentsZbuffZ is_quotedZnum_backslashes character remainderr r r rcsJ       rccCs(tjdkrddlm}t|fStfSdS)Nr`r) tzwinlocal)rarb dateutil.tzrsr)rsr r r get_tzinfo_optionsQs  ru)MutableMapping)NN)r.r/)r.)r.r/)r.r/)N)[rVdatetimerar&rJr\loggingrdmathrZbotocore.vendoredrZbotocore.exceptionsrrtrurllib3r getLoggerr loggerPY3Zbotocore.vendored.six.movesr HTTPMessager urllib.parserrrrrrrrrr http.clientrior_IOBasebase64r email.utilsr itertoolsr file_typeziprAr$r)r-r6urllib email.messager7Z email.Utilsfiler8r9httplibr: collectionsrEZxml.etree.cElementTreeetreeZ cElementTreeZETree ImportErrorxml.etree.ElementTree ElementTree ParseErrorZ XMLParseErrorjsonrM classmethodrSrUrXrYr]r[r4r_rfrcrucollections.abcrvr r r r s                                               ^