HEX
Server: Apache
System: Linux infong-uk86 4.4.400-icpu-106 #2 SMP Mon Sep 15 08:23:40 UTC 2025 x86_64
User: u44115835 (4976590)
PHP: 8.4.17
Disabled: NONE
Upload Files
File: //kunden/lib/python3/dist-packages/breezy/__pycache__/urlutils.cpython-39.pyc
a

�*�^��@s2dZddlmZddlZddlZddlZzddlZWneyRddlm	ZYn0ddl
mZmZddl
m
Z
e
e�d�dd	lmZmZmZmZGd
d�dej�ZGdd
�d
ej�ZGdd�dej�Zdldd�Zdmdd�Zer�ejZejZejZnpdZiZee d�d�!e"e#e d����D]0\Z$Z%e$dk�r<e%ev�r<e%nd�&e$�ee%<�qiZ'dndd�ZeZej(Zej(Z(dodd�Z)d d!�Z*d"d#�Z+d$d%�Z,d&d'�Z!d(d)�Z-d*d+�Z.d,d-�Z/d.d/�Z0d0d1�Z1e/Z2e.Z3e4d2�Z5e4d3�Z6ej7d4k�r�e1Z2e0Z3e6Z5e�8d5�Z9e�8d6�Z:d7d8�Z;d9d:�Z<d;d<�Z=d=d>�Z>dpd?d@�Z?dAdB�Z@dCdD�ZAdEdF�ZBdGdH�ZCdIdJ�ZDdKdL�ZEdMdN�ZFdOdP�ZGdQZHdRdS�eHD�ZIdTdS�eID�dUdS�eID�ZJeKdVdS�e d�D�dWdS�e d�D��ZLeL�MdXdY�eJD��eNdZ�ZOeNd[�ZPd\d]�ZQd^d_�ZRd`da�ZSdbdc�ZTddde�ZUdfdg�ZVGdhdi�dieW�ZXdjdk�ZYdS)qz5A collection of function for handling URL operations.�)�absolute_importN)�parse�)�errors�osutils)�lazy_importz-
from posixpath import split as _posix_split
)�int2byte�PY3�	text_type�unichrc@seZdZdZdS)�
InvalidURLz6Invalid url supplied to transport: "%(path)s"%(extra)sN)�__name__�
__module__�__qualname__�_fmt�rr�1/usr/lib/python3/dist-packages/breezy/urlutils.pyr0src@seZdZdZdd�ZdS)�InvalidURLJoinz>Invalid URL join request: %(reason)s: %(base)r + %(join_args)rcCs&||_||_||_tj�|||�dS�N)�reason�base�	join_argsr�	PathError�__init__)�selfrrrrrrr9szInvalidURLJoin.__init__N�r
rrrrrrrrr5src@seZdZdZdd�ZdS)�InvalidRebaseURLsz3URLs differ by more than path: %(from_)r and %(to)rcCs ||_||_tj�||d�dS)NzURLs differ by more than path.)�from_�torrr)rrrrrrrDs
�zInvalidRebaseURLs.__init__Nrrrrrr@srTcCst||d�dS)atReturn the last component of a URL.

    :param url: The URL in question
    :param exclude_trailing_slash: If the url looks like "path/to/foo/"
        ignore the final slash and return 'foo' rather than ''
    :return: Just the final component of the URL. This can return ''
        if you don't exclude_trailing_slash, or if you are at the
        root of the URL.
    ��exclude_trailing_slashr��split��urlr rrr�basenameKs
r%cCst||d�dS)a4Return the parent directory of the given path.

    :param url: Relative or absolute URL
    :param exclude_trailing_slash: Remove a final slash
        (treat http://host/foo/ as http://host/foo, but
        http://host/ stays http://host/)
    :return: Everything in the URL except the last path chunk
    rrr!r#rrr�dirnameXsr&zAABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-���z%{0:02X}�/cCs�|s|durtd��|S|tf}zt|\}}WnHtyxt��}|�dd�|D��|j}t|}||ft|<Yn0|�|�s�|Sd�	t
||��S)aCquote('abc def') -> 'abc%20def'

        Each part of a URL, e.g. the path info, the query, etc., has a
        different set of reserved characters that must be quoted.

        RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists
        the following reserved characters.

        reserved    = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
                      "$" | ","

        Each of these characters is reserved in some component of a URL,
        but not necessarily in all of them.

        By default, the quote function is intended for quoting the path
        section of a URL.  Thus, it will not encode '/'.  This character
        is reserved, but in typical usage the quote function is being
        called on a path where the existing slash characters are used as
        reserved characters.
        NzNone object cannot be quotedcSsg|]}||f�qSrr��.0�crrr�
<listcomp>��z$quote_from_bytes.<locals>.<listcomp>r()�	TypeError�always_safe�
_safe_quoters�KeyError�	_safe_map�copy�update�__getitem__�rstrip�join�map)�s�safeZcachekeyZquoterZsafe_maprrr�quote_from_bytesws 
r=�/~cCs.t|t�s"tjddkr"|�d�}t||d�S)z!Escape relpath to be a valid url.r��utf-8�r<)�
isinstance�str�sys�version_info�encode�quote)�relpathr<rrr�escape�s
rIcCsHt|�tkrtd|tf��t�t|��}t�t|��}tt�||��S)zCompute just the relative sub-portion of a url

    This assumes that both paths are already fully specified file:// URLs.
    zVLength of base (%r) must equal or exceed the platform minimum url length (which is %d))�len�MIN_ABS_FILEURL_LENGTH�
ValueErrorr�normpath�local_path_from_urlrIrH)r�pathrrr�file_relpath�s�rPcCsZt�|�}|sdS|�d�}|�d�}|�d�}|dkrDt|�dfSt|�||�d�fS)z�Find the scheme separator (://) and the first path separator

    This is just a helper functions for other path utilities.
    It could probably be replaced by urlparse
    )NN�schemerOr*���N)�_url_scheme_re�match�group�findrJ�start)r$�mrQrO�first_path_slashrrr�_find_scheme_and_separator�s



rZcCst�|�duS)z,Tests whether a URL is in actual fact a URL.N)rSrT�r$rrr�is_url�sr\cGs�|s|St|�\}}|dur*|dur*d}n|dur:t|�}||d�}|D]b}t|�\}}|durp|durpd}n|dur�t|�}|dur�|}||d�}|}|}qJt||�}qJ|d|�|S)a�Create a URL by joining sections.

    This will normalize '..', assuming that paths are absolute
    (it assumes no symlinks in either path)

    If any of *args is an absolute URL, it will be treated correctly.
    Example:
        join('http://foo', 'http://bar') => 'http://bar'
        join('http://foo', 'bar') => 'http://foo/bar'
        join('http://foo', 'bar', '../baz') => 'http://foo/baz'
    Nr)rZrJ�joinpath)r�args�
scheme_end�
path_startrO�argZarg_scheme_endZarg_path_startrrrr9�s*r9cGs�|�d�}t|�dkr*|ddkr*|��|D]`}|�d�r@g}|�d�D]B}|dkrZqJqJ|dkr�|dgkrxtd||��|��qJ|�|�qJq.|dgkr�dSd�|�SdS)	a�Join URL path segments to a URL path segment.

    This is somewhat like osutils.joinpath, but intended for URLs.

    XXX: this duplicates some normalisation logic, and also duplicates a lot of
    path handling logic that already exists in some Transport implementations.
    We really should try to have exactly one place in the code base responsible
    for combining paths of URLs.
    r*rrRr(�.�..zCannot go above rootN)r"rJ�pop�
startswithr�appendr9)rr^rOra�chunkrrrr]�s&



�

r]cCsZt|�}d}|�|�r,|t|�dd�}n&|�d�sBt|d��n|td�d�}t|�S)z8Convert a url like file:///path/to/foo into /path/to/foozfile://localhost/rN�file:///z8local urls must start with file:/// or file://localhost/�file://)�strip_segment_parametersrerJr�unescape)r$Zfile_localhost_prefixrOrrr�_posix_local_path_from_urls

�rlcCsdtt�|��S)z�Convert a local path like ./foo into a URL like file:///path/to/foo

    This also handles transforming escaping unicode characters, etc.
    ri)rIrZ_posix_abspath)rOrrr�_posix_local_path_to_url*srmcCs�|�d�st|d��t|�}|td�d�}|�d�s`|ddksN|dd	vrXt|d
��t|�S|dkrldSt|�dks�|ddvs�|d
d	vs�|ddkr�t|d��|d��dt|dd��S)z=Convert a url like file:///C:/path/to/foo into C:/path/to/foorizJlocal urls must start with file:///, UNC path urls must start with file://�file:Nz///r?r*�z|:z.Win32 UNC path urls have form file://HOST/path�Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ��zGWin32 file urls start with file:///x:/, where x is a valid drive letter�:)rerrjrJrk�upper)r$Z	win32_urlrrr�_win32_local_path_from_url4s*



�

�
�
�
rucCsT|dkrdSt�|�}|�d�r,dt|�Sdt|d���dt|dd��S)	z�Convert a local path like ./foo into a URL like file:///C:/path/to/foo

    This also handles transforming escaping unicode characters, etc.
    r*rhz//rnrrsr?N)rZ_win32_abspathrerIrCrt)rOZ
win32_pathrrr�_win32_local_path_to_urlSs

�rvrhzfile:///C:/�win32z)^(?P<scheme>[^:/]{2,}):(//)?(?P<path>.*)$z(%[0-9a-fA-F]{2})cCs>|�d�dd�}tt|d��}|tvr,|S|�d���SdS)ztre.sub callback to convert hex-escapes to plain characters (if safe).

    e.g. '%7E' will be converted to '~'.
    rrN�)rU�chr�int�_url_dont_escape_charactersrt)ZmatchobjZ
hex_digits�charrrr�_unescape_safe_charsys
r}cCs�t|�\}}|durt|�S|d|�}||d�}t|t�s||D]}|tvrBt|d|��qBt�t|�}t	|d�
|��St|�}tt
|��D]6}||tvr�d�
dd�t||�d��D��||<q�d�
|�}t�t|�}t	||�S)aIMake sure that a path string is in fully normalized URL form.

    This handles URLs which have unicode characters, spaces,
    special characters, etc.

    It has two basic modes of operation, depending on whether the
    supplied string starts with a url specifier (scheme://) or not.
    If it does not have a specifier it is considered a local path,
    and will be converted into a file:/// url. Non-ascii characters
    will be encoded using utf-8.
    If it does have a url specifier, it will be treated as a "hybrid"
    URL. Basically, a URL that should have URL special characters already
    escaped (like +?&# etc), but may have unicode characters, etc
    which would not be valid in a real URL.

    :param url: Either a hybrid URL or a local path
    :return: A normalized URL which only includes 7-bit ASCII characters.
    Nz7URLs can only contain specific safe characters (not %r)r(cSsg|]}d|�qS)z%%%02Xrr+rrrr.�r/z!normalize_url.<locals>.<listcomp>r@)rZ�local_path_to_urlrBr
�_url_safe_charactersr�_url_hex_escapes_re�subr}rCr9�list�rangerJ�	bytearrayrF)r$r_r`�prefixrOr-Z
path_chars�irrr�
normalize_url�s,
��

r�cCsvt|�\}}|dur|St|�\}}|dur0|S|d|�}|d|�}||krT|Stjdkr�|dkr�||d|d�}||d|d�}||kr�|S||dd�}	||dd�}
|	�d�r�|	dd�}	|	�d�}|
�d�}|dgkr�g}|dgk�rg}g}
t||�D]$\}}||k�r(�q6|
�|��qt|
�}d	d
�||d�D�}
|
�||d��d�	|
��ptdS)z�Return a path to other from base.

    If other is unrelated to base, return other. Else return a relative path.
    This assumes no symlinks as part of the url.
    Nrwrirror*rRr(cSsg|]}d�qS)rcr)r,�xrrrr.�r/z relative_url.<locals>.<listcomp>rb)
rZrD�platform�endswithr"�ziprfrJ�extendr9)r�otherZdummyZbase_first_slashZother_first_slashZbase_schemeZother_schemeZ
base_driveZother_drive�	base_pathZ
other_pathZ
base_sectionsZother_sectionsZoutput_sections�b�oZ	match_lenrrr�relative_url�sD




r�cCsVt|�dks$|ddvs$|ddkr2t||d��||dd�7}|dd�}||fS)	z<On win32 the drive letter needs to be added to the url base.rqr?z:|ror*z(win32 file:/// paths need a drive letterrN)rJr)�url_baserOrrr�_win32_extract_drive_letter�s$�r�cCs�t|�\}}|durF|dur>|r6|�d�r6|dd�}t|�S|dfS|d|�}||d�}tjdkr�|�d�r�t||�\}}|r�t|�dkr�|�d�r�|dd�}t|�\}}|||fS)afSplit a URL into its parent directory and a child directory.

    :param url: A relative or absolute URL
    :param exclude_trailing_slash: Strip off a final '/' if it is part
        of the path (but not if it is part of the protocol specification)

    :return: (parent_url, child_dir).  child_dir may be the empty string if
        we're at the root.
    Nr*rRr(rwrhr)rZr�Z_posix_splitrDr�rer�rJ)r$r �
scheme_locrYr�rO�head�tailrrrr"�s
r"cCsZt|�}|�d|�d�d�}|dkr.|gfS|d|�dd�||dd��d�D�fS)z�Split the subsegment of the last segment of a URL.

    :param url: A relative or absolute URL
    :return: (url, subsegments)
    �,r*rrRNcSsg|]}t|��qSr)rC)r,r;rrrr.)r/z0split_segment_parameters_raw.<locals>.<listcomp>)�strip_trailing_slashrV�rfindr")r$ZlurlZ
segment_startrrr�split_segment_parameters_raws	
�r�c	Cs�t|�\}}i}|D]b}z|�dd�\}}WntyHt|d��Yn0t|t�s\t|��t|t�snt|��|||<q||fS)z�Split the segment parameters of the last segment of a URL.

    :param url: A relative or absolute URL
    :return: (url, segment_parameters)
    �=rzmissing = in subsegment)r�r"rLrrBrCr0)r$�base_url�subsegments�
parameters�
subsegment�key�valuerrr�split_segment_parameters,s


r�cCst|�\}}|S)zjStrip the segment parameters from a URL.

    :param url: A relative or absolute URL
    :return: url
    )r�)r$r�r�rrrrjAsrjcGsL|s|S|D].}t|t�s&td|��d|vrtd||��qd�|f|�S)aCreate a new URL by adding subsegments to an existing one.

    This adds the specified subsegments to the last path in the specified
    base URL. The subsegments should be bytestrings.

    :note: You probably want to use join_segment_parameters instead.
    z!Subsegment %r is not a bytestringr�z, exists in subsegments)rBrCr0rr9)rr�r�rrr�join_segment_parameters_rawKs
�r�cCs�t|�\}}i}|�|�|��D]T\}}t|t�s@td|��t|t�sZtd||f��d|vrntd||��|||<q"t|gdd�t|���D��R�S)aHCreate a new URL by adding segment parameters to an existing one.

    The parameters of the last segment in the URL will be updated; if a
    parameter with the same key already exists it will be overwritten.

    :param url: A URL, as string
    :param parameters: Dictionary of parameters, keys and values as bytestrings
    zparameter key %r is not a strz&parameter value %r for %r is not a strr�z= exists in parameter keycSsg|]}d|�qS)z%s=%sr)r,�itemrrrr.ur/z+join_segment_parameters.<locals>.<listcomp>)	r�r6�itemsrBrCr0rr��sorted)r$r�rZexisting_parametersZnew_parametersr�r�rrr�join_segment_parameters^s(	


��
��r�cCs t|�tkr|dd�S|SdS)z$Strip slashes after the drive letterNrR)rJ�WIN32_MIN_ABS_FILEURL_LENGTHr[rrr�!_win32_strip_local_trailing_slashxsr�cCsr|�d�s|Stjdkr*|�d�r*t|�St|�\}}|durJ|dd�S|dusb|t|�dkrf|S|dd�S)aStrip trailing slash, except for root paths.

    The definition of 'root path' is platform-dependent.
    This assumes that all URLs are valid netloc urls, such that they
    form:
    scheme://host/path
    It searches for ://, and then refuses to remove the next '/'.
    It can also handle relative paths
    Examples:
        path/to/foo       => path/to/foo
        path/to/foo/      => path/to/foo
        http://host/path/ => http://host/path
        http://host/path  => http://host/path
        http://host/      => http://host/
        file:///          => file:///
        file:///foo/      => file:///foo
        # This is unique on win32 platforms, and is the only URL
        # format which does it differently.
        file:///c|/       => file:///c:/
    r*rwriNrRr)r�rDr�rer�rZrJ)r$r�rYrrrr��s
r�c
Cs�tr\t|t�rRz|�d�Wn4tyP}zt|d|f��WYd}~n
d}~00t�|�St|t�r�z|�d�}Wn4ty�}zt|d|f��WYd}~n
d}~00t|�}z|�d�}Wn4ty�}zt|d|f��WYd}~n
d}~00|SdS)zRUnescape relpath from url format.

    This returns a Unicode path from a URL
    �asciiz!URL was not a plain ASCII url: %sNr@z%Unable to encode the URL as utf-8: %s)	r	rBr
rF�UnicodeErrorr�urlparse�unquote�decode)r$�eZunquotedZunicode_pathrrrrk�s0


�


�
�rkz;/?:@&=+$,#cCsg|]}t|��qSr)�ordr+rrrr.�r/r.cCsg|]}d|�qS�z%02xr�r,r�rrrr.�r/cCsg|]}d|�qS�z%02Xrr�rrrr.�r/cCsg|]}d|t|�f�qSr��rr�rrrr.�r/cCsg|]}d|t|�f�qSr�r�r�rrrr.�r/ccs |]}|d|�d�fVqdS)�%r�N)rF)r,�hexrrr�	<genexpr>�s�r�zBabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~zSabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.-!~*'()/;?:@&=+$,%#c	CsN|�d�}|d�d�|d<tdt|��D]�}||}zt|dd�||<Wnlty�dtrt|dd��d�n
|dd�||<Yn2ty�tt	|dd�d���d�||<Yn0||tr�|dd��d�n
|dd�7<q*d	�
|�}z|�d�}Wnt�y|YS0z|�|�Wnt�yD|YS0|SdS)
z�Unescape a segment for display.

    Helper for unescape_for_display

    :param url: A 7-bit ASCII URL
    :param encoding: The final output encoding

    :return: A unicode string which can be safely encoded into the
         specified encoding.
    �%rr@rNr?r�rxr/)
r"rFr�rJ�_hex_display_mapr3r	�UnicodeDecodeErrorrrzr9r��UnicodeEncodeError)Zsegment�encodingZescaped_chunks�jr�Z	unescapedZdecodedrrr�_unescape_segment_for_display�s.
 �&0


r�cCs�|durtd��|�d�rJzt|�}|�|�|WStyH|YS0|�d�}tdt|��D]}t|||�||<qbd�	|�S)a�Decode what you can for a URL, so that we get a nice looking path.

    This will turn file:// urls into local paths, and try to decode
    any portions of a http:// style url that it can.

    Any sections of the URL which can't be represented in the encoding or
    need to stay as escapes are left alone.

    :param url: A 7-bit ASCII URL
    :param encoding: The final output encoding

    :return: A unicode string which can be safely encoded into the
         specified encoding.
    Nz0you cannot specify None for the display encodingrir*r)
rLrerNrFr�r"r�rJr�r9)r$r�rO�resr�rrr�unescape_for_displays



r�cCsbt|�}|�d�dks&|�tj�dkr8tj�|�d��S|�d�}|dkrZ||dd�S|SdS)a�Derive a TO_LOCATION given a FROM_LOCATION.

    The normal case is a FROM_LOCATION of http://foo/bar => bar.
    The Right Thing for some logical destinations may differ though
    because no / may be present at all. In that case, the result is
    the full name without the scheme indicator, e.g. lp:foo-bar => foo-bar.
    This latter case also applies when a Windows drive
    is used without a path, e.g. c:foo-bar => foo-bar.
    If no /, path separator or : is found, the from_location is returned.
    r*rz/\rsrN)rjrV�os�seprOr%r8)Z
from_locationr�rrr�derive_to_location8s
r�cCst�d|�|kS)Nz/foo)r�pathjoinr[rrr�_is_absoluteNsr�cCsrt|�\}}|dur|St|�r$|St�|�}t�|�}|dd�|dd�krZt||��t|dt|d|��S)z�Convert a relative path from an old base URL to a new base URL.

    The result will be a relative path.
    Absolute paths and full URLs are returned unaltered.
    Nr?)rZr�r�r�determine_relative_pathr9)r$Zold_base�new_baserQZ	separatorZ
old_parsedZ
new_parsedrrr�
rebase_urlRs


�r�c
Cs�t�|�}t�|�}d}tt||��D]\}\}}||kr&qHq&|d7}||d�}||d�}dgt|�|}	t|	�dkr�dStj|	�S)z4Determine a relative path from from_path to to_path.rRrNrcrrb)rZ	splitpath�	enumerater�rJr�)
Z	from_pathZto_pathZ
from_segmentsZto_segments�countZfrom_elementZ
to_elementZunique_fromZ	unique_toZsegmentsrrrr�es

�r�c@sReZdZdZdd�Zdd�Zdd�Zedd	��Zd
d�Z	e
dd
��Zddd�ZdS)�URLzParsed URL.cCs�||_||_t|j�|_||_|jdur6t|j�|_nd|_||_|jdurZt|j�|_nd|_||_t	�
t|�|_t|j�|_
dSr)rQ�quoted_hostr��host�quoted_user�user�quoted_password�password�portr�r�r}�quoted_pathrO)rrQr�r�r�r�r�rrrr{s 

�zURL.__init__cCsHt||j�oF|j|jkoF|j|jkoF|j|jkoF|j|jkoF|j|jkSr)rB�	__class__rQr�r�r�rO)rr�rrr�__eq__�s
�
�
�
�
�z
URL.__eq__cCs&d|jj|j|j|j|j|j|jfS)Nz<%s(%r, %r, %r, %r, %r, %r)>)r�r
rQr�r�r�r�r�)rrrr�__repr__�s
�zURL.__repr__cCs^t|t�rn<t|t�r@z|��}WqHty<t|��YqH0nt|��tj|dd�\}}}}}}d}}	}
}d|vr�|�dd�\}}
d|vr�|�dd�\}}	n|}
d|
v�r|
ddkr�|
d	d
k�s|
�dd�\}
}|�rzt	|�}Wn$t
�ytd||f��Yn0nd}|
dk�rL|
ddk�rL|
d	d
k�rL|
dd	�}
||||	|
||�S)
zRCreate a URL object from a string.

        :param url: URL as bytestring
        F)Zallow_fragmentsN�@rrsr�[rR�]z!invalid port number %s in url:
%sr()rBrCr
rFr�rr��rsplitr"rzrL)�clsr$rQ�netlocrO�paramsZqueryZfragmentr�r�r�r�rrr�from_string�s<	

�
$�&zURL.from_stringcCs`|j}d|vrd|}|jdur.d|j|f}|jdurFd||jf}t�|j||jdddf�S)Nrsz[%s]z%s@%sz%s:%d)r�r�r�r�Z
urlunparserQr�)rr�rrr�__str__�s

�zURL.__str__cCst|t�rn<t|t�r@z|��}WqHty<t|��YqH0nt|��t�t|�}|�	d�rdg}n
|�
d�}t|�dkr�|ddkr�|dd�}|�
d�D]B}|dkr�t|�dkr�q�|��q�|dkr�q�q�|dkr�|�
|�q�d�|�}|�	d�s�d|}|S)alTransform a Transport-relative path to a remote absolute path.

        This does not handle substitution of ~ but does handle '..' and '.'
        components.

        Examples::

            t._combine_paths('/home/sarah', 'project/foo')
                => '/home/sarah/project/foo'
            t._combine_paths('/home/sarah', '../../etc')
                => '/etc'
            t._combine_paths('/home/sarah', '/etc')
                => '/etc'

        :param base_path: base path
        :param relpath: relative url string for relative part of remote path.
        :return: urlencoded string for final path.
        r*rrRr(Nrcrb)rBrCr
rFr�rr�r�r}rer"rJrdrfr9)r�rHZ
base_parts�prOrrr�_combine_paths�s6






zURL._combine_pathsNcCsh|durDt|�}tjddkr(|�d�}|�|j|�}t|dd�}n|j}|�|j	|j
|j|j|j
|�S)z�Return a new URL for a path relative to this URL.

        :param offset: A relative path, already urlencoded
        :return: `URL` instance
        Nrr?r@r>rA)rkrDrErFr�rOrGr�r�rQr�r�r�r�)r�offset�relativerOrrr�clone
s
�z	URL.clone)N)
r
rr�__doc__rr�r��classmethodr�r��staticmethodr�r�rrrrr�xs
+
5r�cCs&t�|�}|j|j|j|j|j|jfS)a"Extract the server address, the credentials and the path from the url.

    user, password, host and path should be quoted if they contain reserved
    chars.

    :param url: an quoted url
    :return: (scheme, user, password, host, port, path) tuple, all fields
        are unquoted.
    )r�r�rQr�r�r�r�rO)r$Z
parsed_urlrrr�	parse_url s

�r�)T)T)r*)r>)T)Zr�Z
__future__rr��rerDr��ImportErrorZurllibrr(rrr�globalsZsixishrr	r
rrrrrr%r&r=rGZunquote_to_bytesr1r4r�r�r9r:ryr�r-�formatr2r�rIrPrZr\r]rlrmrurvr~rNrJrKr�r��compilerSr�r}r�r�r�r"r�r�rjr�r�r�r�rkZ_no_decode_charsZ_no_decode_ordsZ_no_decode_hex�dictr�r6�setr{rr�r�r�r�r�r��objectr�r�rrrr�<module>s�

&���

'
$"



,4
(
)&��
���
+ )