HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/lazr/uri/__pycache__/_uri.cpython-38.pyc
U

��O�J�+@s�dZeZddddddgZddlZzeWnek
r@eZYnXd	d
ddd
dddd
ddddddddddddddddd d!d"d#d$d$d%d%d&d%d
d'd(d'd'd)d'd*�*Zd+Z	d,Z
d-Zd.Zd/e
eefZ
d0Zd1Zd2Zd3eZd4Zd5e
eeeefZd6e
eeeefZd7Zd8Zd9e	eeefZd:eeefZe�eej�Ze�eej�Zd;d�Zd<d�Zd=d>�ZGd?d�de �Z!Gd@d�d�Z"dAdBdCiZ#e�e#ejej$B�Z%e�dD�Z&dEd�Z'dS)Fz/Functions for working with generic syntax URIs.�URI�InvalidURIError�find_uris_in_text�possible_uri_re�merge�remove_dot_segments�NZ674Z80Z2628Z53Z21Z1096Z70Z1720Z443Z143Z631Z702Z389Z1038Z3905Z2049Z119Z110Z554Z5060Z5061Z161Z605Z23Z69Z3372Z575Z602Z210Z1525Z22Z6667Z3690)*ZacapZdav�dictZdns�ftpZgo�gopherZh323�http�https�imapZippz	iris.beepZldapZmtqpZmupdateZnfsZnntp�pop�rtspZsipZsipsZsnmpz	soap.beepz
soap.beeps�telnetZtftpZtipZvemmizxmlrpc.beepzxmlrpc.beepszz39.50rzz39.50sZprosperoZwais�bzr+http�bzr+sshZircZsftpZssh�svn�svn+sshz(?P<scheme>[a-z][-a-z0-9+.]*)z9(?P<userinfo>(?:[-a-z0-9._~!$&\'()*+,;=:]|%[0-9a-f]{2})*)zs(?P<host>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|(?:[-a-z0-9._~!$&\'()*+,;=]|%[0-9a-f]{2})*|\[[0-9a-z:.]+\])z(?P<port>[0-9]*)z!(?P<authority>(?:%s@)?%s(?::%s)?)z2(?:/(?:[-a-z0-9._~!$&\'()*+,;=:@]|%[0-9a-f]{2})*)*z](?:[-a-z0-9._~!$&\'()*+,;=@]|%[0-9a-f]{2})+(?:/(?:[-a-z0-9._~!$&\'()*+,;=:@]|%[0-9a-f]{2})*)*z^(?:[-a-z0-9._~!$&\'()*+,;=:@]|%[0-9a-f]{2})+(?:/(?:[-a-z0-9._~!$&\'()*+,;=:@]|%[0-9a-f]{2})*)*z/(?:%s)?�z(?P<hierpart>//%s%s|%s|%s|%s)z!(?P<relativepart>//%s%s|%s|%s|%s)z=(?P<query>(?:[-a-z0-9._~!$&\'()*+,;=:@/?\[\]]|%[0-9a-f]{2})*)z<(?P<fragment>(?:[-a-z0-9._~!$&\'()*+,;=:@/?]|%[0-9a-f]{2})*)z%s:%s(?:\?%s)?(?:#%s)?$z%s(?:\?%s)?(?:#%s)?$cCs2|r|dkrd|S|�d�}|d|d�|S)a/Merge two URI path components into a single path component.

    Follows rules specified in Section 5.2.3 of RFC 3986.

    The algorithm in the RFC treats the empty basepath edge case
    differently for URIs with and without an authority section, which
    is why the third argument is necessary.
    r�/N�)�rfind)�basepath�relpath�
has_authority�slash�r�//usr/lib/python3/dist-packages/lazr/uri/_uri.pyr�s	
cCs�g}|r�|�d�r |dd�}q|�d�r8|dd�}q|�d�sJ|dkr\d|dd�}q|�d	�sn|d
kr�d|dd�}t|�dkr�|d
=q|dkr�d}q|�d�r�|�dd�}n
|�d�}|dkr�t|�}|�|d|��||d�}qd�|�S)zqRemove '.' and '..' segments from a URI path.

    Follows the rules specified in Section 5.2.4 of RFC 3986.
    z../�Nz./�z/./z/.rz/../z/..�r���)�.z..rr)�
startswith�len�find�append�join)�path�outputrrrrr�s,



c	Cs�|�d�}d}t|�D]�\}}|dkr(qzt|dd�d�}Wntk
rVYqYnXt|�|kr~t|�|dd�||<qd||dd�f||<qd�|�S)	z�Return a version of 's' where no unreserved characters are encoded.

    Unreserved characters are defined in Section 2.3 of RFC 3986.

    Percent encoded sequences are normalised to upper case.
    �%zBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~rNr �z%%%02X%sr)�split�	enumerate�int�
ValueError�chrr()�string�result�
unreserved�index�itemZchrrr�normalise_unreserved�s

r7c@seZdZdZdS)rzInvalid URIN)�__name__�
__module__�__qualname__�__doc__rrrrr�sc@s�eZdZdZd!dd�Zdd�Zedd��Zed	d
��Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �ZdS)"rz�A class that represents a URI.

    This class can represent arbitrary URIs that conform to the
    generic syntax described in RFC 3986.
    Nc	Cs�|dk	r@|dkr@|dkr@|dkr@|dkr@|dkr@|dkr@|dksP|dksPtd��|dk	�r4t|t�r�z|�d�Wntk
r�td��YnXt�|�}	|	dkr�td|��|	�d�|_	|	�d�|_
|	�d�|_|	�d	�|_|	�d
�}
|	�d�}|dk�r|
|_
n|
dt|�d�|_
|	�d
�|_|	�d�|_nt|dk�rFtd��|dk�rl|dk	�sd|dk	�rltd��|dk�r~td��||_	||_
||_||_||_
||_||_|��|j	dk�r�|j�s�td|j	��dS)z�Create a URI instance.

        Can be called with either a string URI or the component parts
        of the URI as keyword arguments.

        In either case, all arguments are expected to be appropriately
        URI encoded.
        NzeURI() must be called with a single string argument or with URI components given as keyword arguments.�ASCIIz%URIs must consist of ASCII charactersz"%s" is not a valid URI�scheme�userinfo�host�port�hierpart�	authorityr �query�fragmentzURIs must have a schemez*host must be given if userinfo or port arezURIs must have a path)
rrr	r
rr
ZmmsrrrZbzrrrz%s URIs must have a host name)�AssertionError�
isinstance�unicode�encode�UnicodeEncodeErrorr�uri_pat�match�groupr=r>r?r@r)r%rCrD�
_normalise)�self�urir=r>r?r@r)rCrDrKrArBrrr�__init__�sv
�������

�





�
��zURI.__init__cCs�|j��|_|jdk	r"t|j�|_|jdk	r<t|j���|_|jdkrNd|_n"|jdk	rp|jt�|j�krpd|_|jdk	r�|jdkr�d|_tt	|j��|_|j
dk	r�t|j
�|_
|jdk	r�t|j�|_dS)z(Perform normalisation of URI components.Nrr)r=�lowerr>r7r?r@�
_default_port�getr)rrCrD�rNrrrrMs"





zURI._normalisecCsH|jdkrdS|j}|jdk	r,d|j|f}|jdk	rDd||jf}|S)zThe authority part of the URINz%s@%s�%s:%s)r?r>r@�rNrBrrrrB3s


z
URI.authoritycCs&|j}|dkr|jSd||jfSdS)z The hierarchical part of the URINz//%s%s)rBr)rVrrr�	hier_part?sz
URI.hier_partcCsDd|j|jf}|jdk	r(|d|j7}|jdk	r@|d|j7}|S)NrUz?%sz#%s)r=rWrCrD)rNrOrrr�__str__Hs

zURI.__str__cCsd|jjt|�fS)Nz%s(%r))�	__class__r8�strrTrrr�__repr__PszURI.__repr__cCsPt||j�rH|j|jkoF|j|jkoF|j|jkoF|j|jkoF|j|jkStSdS�N)rFrYr=rBr)rCrD�NotImplemented)rN�otherrrr�__eq__Ss
�
�
�
�z
URI.__eq__cCs |�|�}|tkrtS|SdSr\)r_r])rNr^Zequalrrr�__ne__]s
z
URI.__ne__c	KsB|s|St|j|j|j|j|j|j|jd�}|�|�|j	f|�S)z;Replace one or more parts of the URI, returning the result.)r=r>r?r@r)rCrD)
rr=r>r?r@r)rCrD�updaterY)rN�partsZ	basepartsrrr�replaceds�
zURI.replacecCs~z|�|�WStk
r YnXt�|�}|dkr<td��t|jd�}|�d�}|dk	r�|�d�|d<|�d�|d<|�d�|d<t|�d�d	t|�d��|d
<|�d�|d<n�|�d�}|�d�}|dkr�|j	|d
<|dk	r�||d<n
|j
|d<nL|�d
��rt|�|d
<n*t|j	||j
dk	d�|d
<t|d
�|d
<||d<|j|d<|j
|d<|j|d<|�d�|d<|jf|�S)z�Resolve the given URI reference relative to this URI.

        Uses the rules from Section 5.2 of RFC 3986 to resolve the new
        URI.
        NzInvalid relative reference)r=rBr>r?r@Zrelativepartr r)rCrr)rrD)rYr�relative_ref_patrKrr=rLrr%r)rCr$rr?r>r@)rNZ	referencerKrbrBr)rCrrr�resolvessH

�



�



zURI.resolvecCs|�d�rt�|���|�S)z�Append the given path to this URI.

        The path must not start with a slash, but a slash is added to
        base URI (before appending the path), in case it doesn't end
        with a slash.
        r)r$rE�ensureSlashre)rNr)rrrr'�sz
URI.appendcCsf|j|jks|j|jkrdS|j|jkr,dS|j}|�d�sD|d7}|j}|�d�s\|d7}|�|�S)z9Returns True if the URI 'other' is contained by this one.FTr)r=rBr)�endswithr$)rNr^rZ	otherpathrrr�contains�s
�

zURI.containscCs<t|�dkrdS|j�d�}|�d�}|t|�d�|kS)z@Return True if the given domain name a parent of the URL's host.rTr#N)r%r?r-)rNZdomainZour_segmentsZdomain_segmentsrrr�underDomain�s

zURI.underDomaincCs&|j�d�r|S|j|jdd�SdS)z:Return a URI with the path normalised to end with a slash.r�r)N)r)rgrcrTrrrrf�szURI.ensureSlashcCs(|j�d�r |j|j�d�d�S|SdS)z>Return a URI with the path normalised to not end with a slash.rrjN)r)rgrc�rstriprTrrr�
ensureNoSlash�szURI.ensureNoSlash)NNNNNNNN)r8r9r:r;rPrM�propertyrBrWrXr[r_r`rcrer'rhrirfrlrrrrr�s.�
A


2
a�
\b
(?:about|gopher|http|https|sftp|news|ftp|mailto|file|irc|jabber|xmpp)
:
(?:
  (?:
    # "//" authority path-abempty
    //
    (?: # userinfo
      [%(unreserved)s:]*
      @
    )?
    (?: # host
      \d+\.\d+\.\d+\.\d+ |
      [%(unreserved)s]*
    )
    (?: # port
      : \d*
    )?
    (?: / [%(unreserved)s:@]* )*
  ) | (?:
    # path-absolute
    /
    (?: [%(unreserved)s:@]+
        (?: / [%(unreserved)s:@]* )* )?
  ) | (?:
    # path-rootless
    [%(unreserved)s@]
    [%(unreserved)s:@]*
    (?: / [%(unreserved)s:@]* )*
  )
)
(?: # query
  \?
  [%(unreserved)s:@/\?\[\]]*
)?
(?: # fragment
  \#
  [%(unreserved)s:@/\?]*
)?
r4z-a-zA-Z0-9._~%!$&'()*+,;=z
([,.?:);>]+)$c	csTt�|�D]D}|��}t�d|�}zt|�}Wntk
rFYq
YnX|Vq
dS)z8Scan a block of text for URIs, and yield the ones found.rN)�possible_uri_pat�finditerrL�uri_trailers_pat�subrr)�textrKZ
uri_stringrOrrrr=s
)(r;�typeZ
__metaclass__�__all__�rerG�	NameErrorrZrRZ	scheme_reZuserinfo_reZhost_reZport_reZauthority_reZpath_abempty_reZpath_noscheme_reZpath_rootless_reZpath_absolute_reZ
path_empty_reZhier_part_reZrelative_part_reZquery_reZfragment_reZuri_reZrelative_ref_re�compile�
IGNORECASErJrdrrr7�	Exceptionrrr�VERBOSErnrprrrrr�<module>s��	
	�4�����=(�*