Edit File: utils.pyo
� ��abc�����������@���s\��d��Z��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�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�m�Z�m�Z�m�Z�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'�m(�Z(�m)�Z)�m*�Z*�d@�Z+�e�j,����Z-�i�d�d�6d�d�6Z.�e�j/����d�k�r�d����Z0�d����Z�n��d����Z1�d����Z2�e3�d���Z4�d����Z5�d����Z6�d����Z7�d����Z8�d����Z9�e3�d���Z:�d����Z;�d����Z<�d ����Z=�d!����Z>�d"����Z?�d#����Z@�d$����ZA�eB�d%�d&���ZC�d'����ZD�d(����ZE�d)����ZF�d*����ZG�d+����ZH�d,����ZI�e�jJ�d-������ZK�d.����ZL�d�d/���ZN�d0����ZO�d1�d2���ZP�d3����ZQ�d4����ZR�d5�jS�d6���ZT�eT�d7�ZU�eT�d8�ZV�d9����ZW�d:����ZX�d;����ZY�e�jZ�d<���Z[�e�jZ�d<���Z\�d=����Z]�d>����Z^�d?����Z_�d�S(A���s���� requests.utils ~~~~~~~~~~~~~~ This module provides utility functions that are used within Requests that are also useful for external consumption. i����Ni���(���t���__version__(���t���certs(���t���to_native_string(���t���parse_http_list(���t���quotet���urlparset���bytest���strt���OrderedDictt���unquotet ���getproxiest���proxy_bypasst ���urlunparset ���basestringt ���integer_typest���is_py3t���proxy_bypass_environmentt���getproxies_environment(���t���cookiejar_from_dict(���t���CaseInsensitiveDict(���t ���InvalidURLt ���InvalidHeadert���FileModeWarningt���UnrewindableBodyErrors���.netrct���_netrciP���t���httpi���t���httpst���Windowsc���������C���s"��t��r�d�d��l�}�n�d�d��l�}�yE�|�j�|�j�d���}�|�j�|�d���d�}�|�j�|�d���d�}�Wn�t�k �rz�t�SX|�s��|�r��t�S|�j�d���}�x�|�D]w�}�|�d�k�r��d�|��k�r��t �Sn��|�j �d�d ���}�|�j �d �d���}�|�j �d�d���}�t�j�|�|��t�j ���r��t �Sq��Wt�S( ���Ni����s;���Software\Microsoft\Windows\CurrentVersion\Internet Settingst���ProxyEnablei����t ���ProxyOverridet���;s���<local>t���.s���\.t���*s���.*t���?(���R���t���winregt���_winregt���OpenKeyt���HKEY_CURRENT_USERt���QueryValueExt���OSErrort���Falset���splitt���Truet���replacet���ret���matcht���I(���t���hostR"���t���internetSettingst���proxyEnablet ���proxyOverridet���test(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���proxy_bypass_registry.���s2���� c���������C���s!���t�����r�t�|����St�|����Sd�S(���s����Return True, if the host should be bypassed. Checks proxy settings gathered from the environment, if specified, or the registry. N(���R���R���R4���(���R/���(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyR���O���s���� c���������C���s"���t��|��d���r�|��j����}��n��|��S(���s/���Returns an internal sequence dictionary update.t���items(���t���hasattrR5���(���t���d(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���dict_to_sequence[���s����c���������C���s���d��}�d�}�t�|��d���r*�t�|����}�n��t�|��d���rE�|��j�}�nm�t�|��d���r��y�|��j����}�Wn�t�j�k �rz�q��Xt�j�|���j�}�d�|��j �k�r��t �j�d�t���q��n��t�|��d���rty�|��j ����}�Wn,�t�t�f�k �r��|�d��k �rq|�}�qqqtXt�|��d���rt|�d��k�rty3�|��j�d�d ���|��j ����}�|��j�|�pId���Wqqt�t�f�k �rmd�}�qqXqtn��|�d��k�r�d�}�n��t�d�|�|���S( ���Ni����t���__len__t���lent���filenot���bs%��Requests has determined the content-length for this request using the binary size of the file: however, the file has been opened in text mode (i.e. without the 'b' flag in the mode). This may lead to an incorrect content-length. In Requests 3.0, support will be removed for files in text mode.t���tellt���seeki���(���t���NoneR6���R:���R;���t���iot���UnsupportedOperationt���ost���fstatt���st_sizet���modet���warningst���warnR���R=���R'���t���IOErrorR>���t���max(���t���ot���total_lengtht���current_positionR;���(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt ���super_lend���s@���� c���������C���se��yGd�d�l��m��}�m�}�d�}�x^�t�D]V�}�y�t�j�j�d�j�|�����}�Wn�t�k �r_�d�SXt�j�j �|���r&�|�}�Pq&�q&�W|�d�k�r��d�St �|����}�d�}�t�|��t���r��|�j �d���}�n��|�j�j�|���d�} �yG�|�|���j�| ���} �| �r| �d�rd�n�d�}�| �|�| �d �f�SWn#�|�t�f�k �rE|�rF���qFn�XWn�t�t�f�k �r`n�Xd�S( ���s;���Returns the Requests tuple auth for a given url from netrc.i����(���t���netrct���NetrcParseErrors���~/{0}Nt���:t���asciii����i���i���(���RN���RO���R?���t���NETRC_FILESRB���t���patht ���expandusert���formatt���KeyErrort���existsR���t ���isinstanceR���t���decodet���netlocR)���t���authenticatorsRH���t���ImportErrort���AttributeError(���t���urlt���raise_errorsRN���RO���t ���netrc_patht���ft���loct���rit���splitstrR/���R���t���login_i(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���get_netrc_auth����s8���� c���������C���s[���t��|��d�d���}�|�rW�t�|�t���rW�|�d�d�k�rW�|�d�d�k�rW�t�j�j�|���Sd�S(���s0���Tries to guess the filename of the given object.t���namei����t���<i����t���>N(���t���getattrR?���RX���R ���RB���RS���t���basename(���t���objRg���(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���guess_filename����s����%c���������C���sD���|��d�k�r�d�St�|��t�t�t�t�f���r:�t�d�����n��t�|����S(���s���Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g., :: >>> from_key_val_list([('key', 'val')]) OrderedDict([('key', 'val')]) >>> from_key_val_list('string') ValueError: need more than 1 value to unpack >>> from_key_val_list({'key': 'val'}) OrderedDict([('key', 'val')]) :rtype: OrderedDict s+���cannot encode objects that are not 2-tuplesN(���R?���RX���R���R���t���boolt���intt ���ValueErrorR���(���t���value(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���from_key_val_list����s ����c���������C���se���|��d�k�r�d�St�|��t�t�t�t�f���r:�t�d�����n��t�|��t�j���r[�|��j ����}��n��t �|����S(���s���Take an object and test to see if it can be represented as a dictionary. If it can be, return a list of tuples, e.g., :: >>> to_key_val_list([('key', 'val')]) [('key', 'val')] >>> to_key_val_list({'key': 'val'}) [('key', 'val')] >>> to_key_val_list('string') ValueError: cannot encode objects that are not 2-tuples. :rtype: list s+���cannot encode objects that are not 2-tuplesN(���R?���RX���R���R���Rn���Ro���Rp���t���collectionst���MappingR5���t���list(���Rq���(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���to_key_val_list����s����c���������C���sh���g��}�x[�t��|����D]M�}�|�d� |�d�k�o8�d�k�n�rS�t�|�d�d�!��}�n��|�j�|���q�W|�S(���s��Parse lists as described by RFC 2068 Section 2. In particular, parse comma-separated lists where the elements of the list may include quoted-strings. A quoted-string could contain a comma. A non-quoted string could have quotes in the middle. Quotes are removed automatically after parsing. It basically works like :func:`parse_set_header` just that items may appear multiple times and case sensitivity is preserved. The return value is a standard :class:`list`: >>> parse_list_header('token, "quoted value"') ['token', 'quoted value'] To create a header from the :class:`list` again, use the :func:`dump_header` function. :param value: a string with a list header. :return: :class:`list` :rtype: list i���i����t���"(���t���_parse_list_headert���unquote_header_valuet���append(���Rq���t���resultt���item(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���parse_list_header��s����$c���������C���s����i��}�x��t��|����D]~�}�d�|�k�r5�d�|�|�<q�n��|�j�d�d���\�}�}��|��d� |��d�k�ol�d�k�n�r��t�|��d�d�!��}��n��|��|�|�<q�W|�S(���s^��Parse lists of key, value pairs as described by RFC 2068 Section 2 and convert them into a python dict: >>> d = parse_dict_header('foo="is a fish", bar="as well"') >>> type(d) is dict True >>> sorted(d.items()) [('bar', 'as well'), ('foo', 'is a fish')] If there is no value for a key it will be `None`: >>> parse_dict_header('key_without_value') {'key_without_value': None} To create a header from the :class:`dict` again, use the :func:`dump_header` function. :param value: a string with a dict header. :return: :class:`dict` :rtype: dict t���=i���i����Rw���N(���Rx���R?���R)���Ry���(���Rq���R{���R|���Rg���(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���parse_dict_header1��s���� $c���������C���sq���|��rm�|��d�|��d�k�o%�d�k�n�rm�|��d�d�!}��|�sN�|��d� d�k�rm�|��j��d�d���j��d�d���Sn��|��S( ���s����Unquotes a header value. (Reversal of :func:`quote_header_value`). This does not use the real unquoting but what browsers are actually using for quoting. :param value: the header value to unquote. :rtype: str i����i����Rw���i���i���s���\\s���\s���\"(���R+���(���Rq���t���is_filename(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyRy���T��s ����* c���������C���s+���i��}�x�|��D]�}�|�j��|�|�j�<q �W|�S(���s����Returns a key/value dictionary from a CookieJar. :param cj: CookieJar object to extract cookies from. :rtype: dict (���Rq���Rg���(���t���cjt���cookie_dictt���cookie(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���dict_from_cookiejarm��s���� c���������C���s ���t��|�|����S(���s����Returns a CookieJar from a key/value dictionary. :param cj: CookieJar to insert cookies into. :param cookie_dict: Dict of key/values to insert into CookieJar. :rtype: CookieJar (���R���(���R����R����(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���add_dict_to_cookiejar|��s����c���������C���sv���t��j�d�t���t�j�d�d�t�j��}�t�j�d�d�t�j��}�t�j�d���}�|�j�|����|�j�|����|�j�|����S(���sl���Returns encodings from given content string. :param content: bytestring to extract encodings from. s����In requests 3.0, get_encodings_from_content will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)s!���<meta.*?charset=["\']*(.+?)["\'>]t���flagss+���<meta.*?content=["\']*;?charset=(.+?)["\'>]s$���^<\?xml.*?encoding=["\']*(.+?)["\'>](���RF���RG���t���DeprecationWarningR,���t���compileR.���t���findall(���t���contentt ���charset_ret ���pragma_ret���xml_re(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���get_encodings_from_content���s����c���������C���s_���|��j��d���}�|�s�d�St�j�|���\�}�}�d�|�k�rK�|�d�j�d���Sd�|�k�r[�d�Sd�S(���s}���Returns encodings from given HTTP Header Dict. :param headers: dictionary to extract encoding from. :rtype: str s���content-typet���charsets���'"t���texts ���ISO-8859-1N(���t���getR?���t���cgit���parse_headert���strip(���t���headerst���content_typet���params(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���get_encoding_from_headers���s����c���������c���s����|�j��d�k�r)�x�|��D]�}�|�Vq�Wd�St�j�|�j����d�d���}�x+�|��D]#�}�|�j�|���}�|�rK�|�VqK�qK�W|�j�d�d�t��}�|�r��|�Vn��d�S(���s���Stream decodes a iterator.Nt���errorsR+���t����t���final(���t���encodingR?���t���codecst���getincrementaldecoderRY���R*���(���t���iteratort���rR|���t���decodert���chunkt���rv(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���stream_decode_response_unicode���s���� c���������c���sd���d�}�|�d�k�s�|�d�k�r-�t�|����}�n��x0�|�t�|����k��r_�|��|�|�|�!V|�|�7}�q0�Wd�S(���s ���Iterate over slices of a string.i����N(���R?���R:���(���t���stringt���slice_lengtht���pos(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���iter_slices���s����c���������C���s����t��j�d�t���g��}�t�|��j���}�|�rc�y�t�|��j�|���SWqc�t�k �r_�|�j�|���qc�Xn��y�t�|��j�|�d�d��SWn�t �k �r��|��j�SXd�S(���s����Returns the requested content back in unicode. :param r: Response object to get unicode content from. Tried: 1. charset from content-type 2. fall back and replace all unicode characters :rtype: str s����In requests 3.0, get_unicode_from_response will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)R����R+���N( ���RF���RG���R����R����R����R���R����t���UnicodeErrorRz���t ���TypeError(���R����t���tried_encodingsR����(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���get_unicode_from_response���s���� t4���ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzs���0123456789-._~c���������C���s����|��j��d���}�x��t�d�t�|�����D]��}�|�|�d�d�!}�t�|���d�k�r��|�j����r��y�t�t�|�d�����}�Wn!�t�k �r��t�d�|�����n�X|�t�k�r��|�|�|�d�|�|�<q��d�|�|�|�|�<q%�d�|�|�|�|�<q%�Wd�j �|���S(���s����Un-escape any percent-escape sequences in a URI that are unreserved characters. This leaves all reserved, illegal and non-ASCII bytes encoded. :rtype: str t���%i���i����i���i���s%���Invalid percent-escape sequence: '%s'R����( ���R)���t���rangeR:���t���isalnumt���chrRo���Rp���R���t���UNRESERVED_SETt���join(���t���urit���partst���it���ht���c(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���unquote_unreserved���s���� c���������C���sK���d�}�d�}�y�t��t�|����d�|��SWn�t�k �rF�t��|��d�|��SXd�S(���s����Re-quote the given URI. This function passes the given URI through an unquote/quote cycle to ensure that it is fully and consistently quoted. :rtype: str s���!#$%&'()*+,/:;=?@[]~s���!#$&'()*+,/:;=?@[]~t���safeN(���R���R����R���(���R����t���safe_with_percentt���safe_without_percent(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���requote_uri ��s���� c���������C���s����t��j�d�t�j�|������d�}�|�j�d���\�}�}�t��j�d�t�j�t�t�|���������d�}�t��j�d�t�j�|�����d�|�@}�|�|�@|�|�@k�S(���s����This function allows you to check if an IP belongs to a network subnet Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24 returns False if ip = 192.168.1.1 and net = 192.168.100.0/24 :rtype: bool s���=Li����t���/(���t���structt���unpackt���sockett ���inet_atonR)���t���dotted_netmaskRo���(���t���ipt���nett���ipaddrt���netaddrt���bitst���netmaskt���network(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���address_in_network#��s ����+#c���������C���s/���d�d�d�|��>d�A}�t��j�t�j�d�|�����S(���s����Converts mask from /xx format to xxx.xxx.xxx.xxx Example: if mask is 24 function returns 255.255.255.0 :rtype: str I��������i���i ���s���>I(���R����t ���inet_ntoaR����t���pack(���t���maskR����(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyR����2��s����c���������C���s-���y�t��j�|����Wn�t��j�k �r(�t�SXt�S(���s��� :rtype: bool (���R����R����t���errorR(���R*���(���t ���string_ip(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���is_ipv4_address=��s ����c���������C���s����|��j��d���d�k�r��y�t�|��j�d���d���}�Wn�t�k �rF�t�SX|�d�k��s_�|�d�k�rc�t�Sy�t�j�|��j�d���d���Wq��t�j�k �r��t�SXn�t�St�S(���sV��� Very simple check of the cidr format in no_proxy variable. :rtype: bool R����i���i ���i����( ���t���countRo���R)���Rp���R(���R����R����R����R*���(���t���string_networkR����(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt ���is_valid_cidrH��s���� c���������c���st���|�d�k �}�|�r4�t�j�j�|����}�|�t�j�|��<n��z �d�VWd�|�ro�|�d�k�r_�t�j�|��=qo�|�t�j�|��<n��Xd�S(���s����Set the environment variable 'env_name' to 'value' Save previous value, yield, and then restore the previous value stored in the environment variable 'env_name'. If 'value' is None, do nothingN(���R?���RB���t���environR����(���t���env_nameRq���t ���value_changedt ���old_value(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���set_environ`��s���� c��� ��� ���C���sc��d����}�|�}�|�d �k�r*�|�d���}�n��t�|����j�}�|�rd����|�j�d�d���j�d���D��}�|�j�d���d�}�t�|���r��x��|�D]8�}�t�|���r��t�|�|���r��t�Sq��|�|�k�r��t�Sq��Wqx@�|�D]5�}�|�j �|���s|�j�d���d�j �|���r��t�Sq��Wn��t �d�|����8�y�t�|���}�Wn �t�t �j�f�k �rNt�}�n�XWd �QX|�r_t�St�S( ���sL��� Returns whether we should bypass proxies or not. :rtype: bool c���������S���s(���t��j�j�|����p'�t��j�j�|��j������S(���N(���RB���R����R����t���upper(���t���k(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���<lambda>|��R����t���no_proxyc���������s���s���|��]�}�|�r�|�Vq�d��S(���N(����(���t���.0R/���(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pys ���<genexpr>���s����t��� R����t���,RP���i����N(���R?���R���RZ���R+���R)���R����R����R����R*���t���endswithR����R���R����R����t���gaierrorR(���( ���R^���R����t ���get_proxyt���no_proxy_argRZ���R����t���proxy_ipR/���t���bypass(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���should_bypass_proxiesv��s4���� % +c���������C���s!���t��|��d�|��r�i��St����Sd�S(���sA��� Return a dict of environment proxies. :rtype: dict R����N(���R����R ���(���R^���R����(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���get_environ_proxies���s����c���������C���s����|�p �i��}�t��|����}�|�j�d�k�rC�|�j�|�j�|�j�d�����S|�j�d�|�j�|�j�d�|�j�d�g�}�d�}�x(�|�D] �}�|�|�k�rz�|�|�}�Pqz�qz�W|�S(���s����Select a proxy for the url, if applicable. :param url: The url being for the request :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs t���alls���://s���all://N(���R���t���hostnameR?���R����t���scheme(���R^���t���proxiest���urlpartst ���proxy_keyst���proxyt ���proxy_key(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���select_proxy���s���� s���python-requestsc���������C���s���d�|��t��f�S(���sO��� Return a string representing the default user agent. :rtype: str s���%s/%s(���R����(���Rg���(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���default_user_agent���s����c�����������C���s2���t��i�t����d�6d�j�d ���d�6d�d�6d�d �6��S(���s9��� :rtype: requests.structures.CaseInsensitiveDict s ���User-Agents���, t���gzipt���deflates���Accept-Encodings���*/*t���Accepts ���keep-alivet ���Connection(���R����R����(���R���R����R����(����(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���default_headers���s ���� c��� ������C���s����g��}�d�}�x��t��j�d�|����D]��}�y�|�j�d�d���\�}�}�Wn�t�k �ra�|�d�}�}�n�Xi�|�j�d���d�6}�xa�|�j�d���D]P�}�y�|�j�d���\�}�}��Wn�t�k �r��Pn�X|��j�|���|�|�j�|���<q��W|�j�|���q�W|�S( ���s����Return a dict of parsed link headers proxies. i.e. Link: <http:/.../front.jpeg>; rel=front; type="image/jpeg",<http://.../back.jpeg>; rel=back;type="image/jpeg" :rtype: list s��� '"s���, *<R���i���R����s���<> '"R^���R~���(���R,���R)���Rp���R����Rz���( ���Rq���t���linkst ���replace_charst���valR^���R����t���linkt���paramt���key(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���parse_header_links���s ���� s����RQ���i���i���c���������C���s���|��d� }�|�t��j�t��j�f�k�r&�d�S|�d� t��j�k�r=�d�S|�d� t��j�t��j�f�k�r]�d�S|�j�t���}�|�d�k�r|�d�S|�d�k�r��|�d �d �d���t�k�r��d �S|�d�d �d���t�k�r��d�Sn��|�d�k�r��|�d� t �k�r��d �S|�d�t �k�r��d�Sn��d �S(���s��� :rtype: str i���s���utf-32i���s ���utf-8-sigi���s���utf-16i����s���utf-8Ns ���utf-16-bei���s ���utf-16-les ���utf-32-bes ���utf-32-le(���R����t���BOM_UTF32_LEt���BOM_UTF32_BEt���BOM_UTF8t���BOM_UTF16_LEt���BOM_UTF16_BER����t���_nullt���_null2t���_null3R?���(���t���datat���samplet ���nullcount(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���guess_json_utf��s*���� c���������C���sS���t��|��|���\�}�}�}�}�}�}�|�s7�|�|�}�}�n��t�|�|�|�|�|�|�f���S(���s����Given a URL that may or may not have a scheme, prepend the given scheme. Does not replace a present scheme with the one provided as an argument. :rtype: str (���R���R���(���R^���t ���new_schemeR����RZ���RS���R����t���queryt���fragment(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���prepend_scheme_if_needed1��s����!c���������C���sR���t��|����}�y"�t�|�j���t�|�j���f�}�Wn�t�t�f�k �rM�d�}�n�X|�S(���s{���Given a url with authentication components, extract them into a tuple of username,password. :rtype: (str,str) R����(���R����R����(���R���R ���t���usernamet���passwordR]���R����(���R^���t���parsedt���auth(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���get_auth_from_urlB��s����" s���^\S[^\r\n]*$|^$c���������C���s����|��\�}�}�t��|�t���r$�t�}�n�t�}�y&�|�j�|���sO�t�d�|�����n��Wn0�t�k �r��t�d�|�|�t�|���f�����n�Xd�S(���s����Verifies that header value is a string which doesn't contain leading whitespace or return characters. This prevents unintended header injection. :param header: tuple, in the format (name, value). s7���Invalid return character or leading space in header: %ss>���Value for header {%s: %s} must be of type str or bytes, not %sN(���RX���R���t���_CLEAN_HEADER_REGEX_BYTEt���_CLEAN_HEADER_REGEX_STRR-���R���R����t���type(���t���headerRg���Rq���t���pat(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���check_header_validityW��s���� c���������C���sf���t��|����\�}�}�}�}�}�}�|�s4�|�|�}�}�n��|�j�d�d���d�}�t�|�|�|�|�|�d�f���S(���sW��� Given a url remove the fragment and the authentication part. :rtype: str t���@i���i����R����(���R���t���rsplitR���(���R^���R����RZ���RS���R����R��R ��(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt ���urldefragauthl��s ����c���������C���s}���t��|��j�d�d���}�|�d�k �rm�t�|��j�t���rm�y�|�|��j���Wqy�t�t�f�k �ri�t�d�����qy�Xn�t�d�����d�S(���sf���Move file pointer back to its recorded starting position so it can be read again on redirect. R>���s;���An error occurred when rewinding request body for redirect.s+���Unable to rewind request body for redirect.N( ���Rj���t���bodyR?���RX���t���_body_positionR���RH���R'���R���(���t���prepared_requestt ���body_seek(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���rewind_body}��s����(���s���.netrcR���(`���t���__doc__R����R����Rs���t ���contextlibR@���RB���t���platformR,���R����R����RF���R����R����R���t���_internal_utilsR���t���compatR���Rx���R���R���R���R���R���R ���R ���R���R���R ���R���R���R���R���t���cookiesR���t ���structuresR���t ���exceptionsR���R���R���R���RR���t���wheret���DEFAULT_CA_BUNDLE_PATHt ���DEFAULT_PORTSt���systemR4���R8���RM���R(���Rf���Rm���Rr���Rv���R}���R���Ry���R����R����R����R����R����R����R����t ���frozensetR����R����R����R����R����R����R����t���contextmanagerR����R����R?���R����R����R����R����R����t���encodeR��R��R��R ��R��R��R����R��R��R��R��R!��(����(����(����s>���/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.pyt���<module> ���s����^" ! =3 # % 9 "