๓ `8(Zc@@s‰ddlmZddlmZddlmZddddd d d gZd ed eƒfd „ƒYZd„Zd„Z d„Z dS(i(tabsolute_import(t namedtuplei(tLocationParseErrortschemetauththosttporttpathtquerytfragmenttUrlcB@sweZdZdZdddddddd„Zed„ƒZed„ƒZed„ƒZ ed„ƒZ d„Z RS( sg Datastructure for representing an HTTP URL. Used as a return value for :func:`parse_url`. c C@sN|r#|jdƒ r#d|}ntt|ƒj||||||||ƒS(Nt/(t startswithtsuperR t__new__(tclsRRRRRRR ((sK/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/util/url.pyRs !cC@s|jS(s@For backwards-compatibility with urlparse. We're nice like that.(R(tself((sK/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/util/url.pythostnamescC@s6|jp d}|jdk r2|d|j7}n|S(s)Absolute path including the query string.R t?N(RRtNone(Rturi((sK/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/util/url.pyt request_uriscC@s$|jrd|j|jfS|jS(s(Network location including host and ports%s:%d(RR(R((sK/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/util/url.pytnetloc's c C@s๎|\}}}}}}}d}|dk r>||d7}n|dk r[||d7}n|dk rt||7}n|dk r—|dt|ƒ7}n|dk rฐ||7}n|dk rอ|d|7}n|dk r๊|d|7}n|S(sˆ Convert self into a url This function should more or less round-trip with :func:`.parse_url`. The returned url may not be exactly the same as the url inputted to :func:`.parse_url`, but it should be equivalent by the RFC (e.g., urls with a blank port will have : removed). Example: :: >>> U = parse_url('http://google.com/mail/') >>> U.url 'http://google.com/mail/' >>> Url('http', 'username:password', 'host.com', 80, ... '/path', 'query', 'fragment').url 'http://username:password@host.com:80/path?query#fragment' ts://t@t:Rt#N(Rtstr( RRRRRRRR turl((sK/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/util/url.pyR.s"         cC@s|jS(N(R(R((sK/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/util/url.pyt__str__Vs(N( t__name__t __module__t__doc__tslotsRRtpropertyRRRRR(((sK/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/util/url.pyR s (cC@sฃd}d}xV|D]N}|j|ƒ}|dkr:qn|dksR||kr|}|}qqW|dks}|dkrŠ|ddfS|| ||d|fS(sา Given a string and an iterable of delimiters, split on the first found delimiter. Return two split parts and the matched delimiter. If not found, then the first part is the full input string. Example:: >>> split_first('foo/bar?baz', '?/=') ('foo', 'bar?baz', '/') >>> split_first('foo/bar?baz', '123') ('foo/bar?baz', '', None) Scales linearly with number of delims. Not ideal for large number of delims. iRiN(Rtfind(tstdelimstmin_idxt min_delimtdtidx((sK/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/util/url.pyt split_firstZs    c C@s|s tƒSd }d }d }d }d }d }d }d|kr^|jddƒ\}}nt|dddgƒ\}}} | r’| |}nd|krน|jddƒ\}}n|r๔|ddkr๔|jd dƒ\}}|d 7}nd |kr`|jd dƒ\} }|s'| }n|rW|jƒsHt|ƒ‚nt|ƒ}qvd }n| rv|rv|}n|s˜t|||||||ƒSd|krฟ|jddƒ\}}nd|krๆ|jddƒ\}}nt|||||||ƒS( s: Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is performed to parse incomplete urls. Fields not provided will be None. Partly backwards-compatible with :mod:`urlparse`. Example:: >>> parse_url('http://google.com/mail/') Url(scheme='http', host='google.com', port=None, path='/mail/', ...) >>> parse_url('google.com:80') Url(scheme=None, host='google.com', port=80, path=None, ...) >>> parse_url('/foo?bar') Url(scheme=None, host=None, port=None, path='/foo', query='bar', ...) s://iR RRRit[t]RN(R RtsplitR*trsplittisdigitRtint( RRRRRRR Rtpath_tdelimt_host((sK/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/util/url.pyt parse_url{sJ !           cC@s(t|ƒ}|jpd|j|jfS(s5 Deprecated. Use :func:`.parse_url` instead. thttp(R4RRR(Rtp((sK/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/util/url.pytget_hostิs N( t __future__Rt collectionsRt exceptionsRt url_attrsR R*R4R7(((sK/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/util/url.pytsP ! Y