ROOTPLOIT
Server: LiteSpeed
System: Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: niphet (1079)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //lib/python3.8/site-packages/setuptools/__pycache__/package_index.cpython-38.pyc
U

Qab@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
ddlmZmZmZmZddlZddlmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!ddlm"Z"ddl#m$Z$dd	l%m&Z&dd
l'm(Z(ddl)m*Z*ddl+m,Z,dd
l-m.Z.e/Z0e1dZ2e1dej3Z4e1dZ5e1dej3j6Z7d8Z9ddddgZ:dZ;dZ<e<j=dj=ej>edZ?ddZ@ddZAddZBdGd dZCdHd!d"ZDdId#d$ZEdedfd%dZFdJd&d'ZGd(d)ZHe1d*ej3ZIeHd+d,ZJGd-d.d.ZKGd/d0d0eKZLGd1ddeZMe1d2jNZOd3d4ZPd5d6ZQdKd7d8ZRd9d:ZSGd;d<d<ZTGd=d>d>ejUZVejWjXfd?d@ZYdAdBZZeRe;eYZYdCdDZ[dEdFZ\dS)Lz#PyPI and direct package downloadingNwraps)six)urllibhttp_clientconfigparsermap)

CHECKOUT_DISTDistributionBINARY_DISTnormalize_pathSOURCE_DISTEnvironmentfind_distributions	safe_namesafe_versionto_filenameRequirementDEVELOP_DISTEGG_DIST)ssl_support)log)DistutilsError)	translate)get_all_headers)unescape)Wheelz^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PackageIndexdistros_for_urlparse_bdist_wininstinterpret_distro_namez<setuptools/{setuptools.__version__} Python-urllib/{py_major}z{}.{})Zpy_major
setuptoolscCs4zt|WStk
r.td|fYnXdS)Nz1Not a URL, existing file, or requirement spec: %r)rparse
ValueErrorr)specr&</usr/lib/python3.8/site-packages/setuptools/package_index.pyparse_requirement_arg4sr(cCs|}d\}}}|dr|dr8|dd}d}nn|ddrb|d	d
}|dd}d}nD|dr~|dd}d
}n(|ddr|d	d
}|dd}d
}|||fS)z=Return (base,pyversion) or (None,None) for possible .exe name)NNN.exez
.win32.exeNiZwin32z	.win32-pyiiz.win-amd64.exeiz	win-amd64z
.win-amd64-pyi)lowerendswith
startswith)namer+basepy_verZplatr&r&r'r=s$



c	Csxtj|}|\}}}}}}tj|dd}|dkrX|dkrXtj|dd}d|krp|dd\}}||fS)N/zsourceforge.netdownload#)rr#urlparseunquotesplit)	urlpartsschemeserverpathZ
parametersqueryfragmentr/r&r&r'egg_info_for_urlUsrAccs\t|\}}t|||D]
}|Vq|rXt|}|rXt||d|tdD]
}|VqLdS)zEYield egg or source distribution objects that might be found at a URLr6)
precedenceN)rAdistros_for_locationEGG_FRAGMENTmatchr groupr	)r:metadatar/r@distrEr&r&r'r`s

cCs|dr|dd}|dr8d|kr8t|||gS|drxd|krxt|}|s^gSt||j|jtddgS|d	rt|\}}}|dk	rt	||||t
|StD]0}||r|dt|}t	|||SqgS)
z:Yield egg or source distribution objects based on basename.egg.zipNr*z.egg-z.whlr6)locationproject_nameversionrBr))
r,r
Z
from_locationrZ
is_compatiblerLrMrrr r
EXTENSIONSlen)rKbasenamerGZwheelZwin_baser0platformZextr&r&r'rCns<


rCcCstt|tj||S)zEYield possible egg or source distribution objects based on a filename)rCrosr>rP)filenamerGr&r&r'distros_for_filenames

rTc
cs||d}|s,tdd|ddDr,dStdt|dD]8}t||d|d|d||d|||dVq>dS)zGenerate 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!
    rJcss|]}td|VqdS)z	py\d\.\d$N)rerE).0pr&r&r'	<genexpr>sz(interpret_distro_name.<locals>.<genexpr>Nr6)
py_versionrBrQ)r9anyrangerOr
join)rKrPrGrZrBrQr;rWr&r&r'r s
ccsft}|j}|dkr:tj|j|D]}|||Vq$n(|D]"}||}||kr>|||Vq>dS)zHList unique elements, preserving order. Remember all elements ever seen.N)setaddrZmovesfilterfalse__contains__)iterablekeyseenZseen_addZelementkr&r&r'unique_everseens
rfcstfdd}|S)zs
    Wrap a function returning an iterable such that the resulting iterable
    only ever yields unique items.
    cst||SN)rf)argskwargsfuncr&r'wrapperszunique_values.<locals>.wrapperr)rkrlr&rjr'
unique_valuessrmz(<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>c	cst|D]d}|\}}tttj|d}d|ksDd|kr
t	|D]}t
j|t
|dVqNq
dD]@}||}|dkrtt	||}|rtt
j|t
|dVqtdS)zEFind rel="homepage" and rel="download" links in `page`, yielding URLs,Zhomepager3r6)z
<th>Home Pagez<th>Download URLr2N)RELfinditergroupsr^rstrstripr+r9HREFrr#urljoin
htmldecoderFfindsearch)r:pagerEtagZrelZrelsposr&r&r'find_external_linkss
r|c@s(eZdZdZddZddZddZdS)	ContentCheckerzP
    A null content checker that defines the interface for checking content
    cCsdS)z3
        Feed a block of data to the hash.
        Nr&selfblockr&r&r'feedszContentChecker.feedcCsdS)zC
        Check the hash. Return False if validation fails.
        Tr&rr&r&r'is_validszContentChecker.is_validcCsdS)zu
        Call reporter with information about the checker (hash name)
        substituted into the template.
        Nr&)rreportertemplater&r&r'reportszContentChecker.reportN)__name__
__module____qualname____doc__rrrr&r&r&r'r}sr}c@sBeZdZedZddZeddZddZ	dd	Z
d
dZdS)
HashCheckerzK(?P<hash_name>sha1|sha224|sha384|sha256|sha512|md5)=(?P<expected>[a-f0-9]+)cCs||_t||_||_dSrg)	hash_namehashlibnewhashexpected)rrrr&r&r'__init__szHashChecker.__init__cCs>tj|d}|stS|j|}|s0tS|f|S)z5Construct a (possibly null) ContentChecker from a URLr2)rr#r7r}patternrx	groupdict)clsr:r@rEr&r&r'from_urlszHashChecker.from_urlcCs|j|dSrg)rupdater~r&r&r'rszHashChecker.feedcCs|j|jkSrg)rZ	hexdigestrrr&r&r'r"szHashChecker.is_validcCs||j}||Srg)r)rrrmsgr&r&r'r%s
zHashChecker.reportN)rrrrUcompilerrclassmethodrrrrr&r&r&r'r	s

rcs<eZdZdZdJddZdKd	d
ZdLddZdMd
dZddZddZ	ddZ
ddZdNddZddZ
dOfdd	ZddZdd Zd!d"Zd#d$Zd%d&ZdPd'd(ZdQd)d*Zd+d,Zd-Zd.d/Zd0d1ZdRd2d3Zd4d5Zd6d7Zd8d9Zd:d;Zd<d=Ze dSd>d?Z!d@dAZ"dBdCZ#dDdEZ$dFdGZ%dHdIZ&Z'S)Trz;A distribution index that scans web pages for download URLshttps://pypi.org/simple/*NTcOstj|f|||dd|d|_i|_i|_i|_td	t
t|j|_
g|_|ortjor|prt}|rt||_n
tjj|_dS)Nr1|)rrr,	index_urlscanned_urlsfetched_urls
package_pagesrUrr]rrrEallowsto_scanrZis_availableZfind_ca_bundleZ
opener_foropenerrrequesturlopen)rrZhostsZ	ca_bundleZ
verify_sslrhkwZuse_sslr&r&r'r-s
zPackageIndex.__init__FcCs||jkr|sdSd|j|<t|s2||dStt|}|r\||sPdS|d||sn|rn||jkrtt|j	|dS||sd|j|<dS|
d|d|j|<d}||||}|dkrdSd|j|j<d|j
ddkr|dS|j}|}t|tsNt|tjjr0d	}n|j
d
p@d	}||d}|t|D](}	tj|t|	d}
||
q`| |j!rt"|d
ddkr|#||}dS)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!htmlcontent-typezlatin-1charsetignorer6code)$r
URL_SCHEMEprocess_filenamelistrurl_okdebugrrr_infoopen_urlr:headersgetr+closeread
isinstancerrrerror	HTTPErrorZ	get_paramdecodertrpr#rurvrFprocess_urlr-rgetattr
process_index)rr:Zretrievediststmplfr/ryrrElinkr&r&r'rBsP





 zPackageIndex.process_urlcCstj|s|d|dStj|r^|s^tj|}t|D]}|tj||dqBt	|}|r|
d|tt|j
|dS)Nz
Not found: %sTz	Found: %s)rRr>existswarnisdirrealpathlistdirrr]rTrrrr_)rfnnestedr>itemrr&r&r'ruszPackageIndex.process_filenamecCsbt|}|o|ddk}|s8|tj|dr<dSd}|rRt||n|||dS)Nr6fileTzN
Note: Bypassing %s (disallowed host; see http://bit.ly/2hrImnY for details).
)	rrFr+rrr#r7rr)rr:Zfatalsis_filerr&r&r'rszPackageIndex.url_okcCs2ttjj|}dd|D}tt|j|dS)Ncss0|](}t|D]}|dr||fVqqdS)z	.egg-linkN)rRrr,)rVr>entryr&r&r'rXs

z.PackageIndex.scan_egg_links.<locals>.<genexpr>)filterrRr>rr	itertoolsstarmap
scan_egg_link)rZsearch_pathdirsZ	egg_linksr&r&r'scan_egg_linkss
zPackageIndex.scan_egg_linksc	Csttj||}ttdttj|}W5QRXt	|dkrDdS|\}}t
tj||D](}tjj|f||_t|_
||q^dS)NrY)openrRr>r]rrrrrrsrOrrKr
rBr_)rr>rZ	raw_lineslinesZegg_pathZ
setup_pathrHr&r&r'rs zPackageIndex.scan_egg_linkc
	sfdd}t|D]:}z |tj|t|dWqtk
rNYqXq||\}}|rt||D]H}t	|\}}	|
dr|	s|r|d||f7}n
||qlt
dd|SdSd	S)
z#Process the contents of a PyPI pagecs|jrtttjj|tjdd}t|dkrd|dkrt	|d}t
|d}dj|
i|<t|t|fSdS)Nr1rYr5r6rT)NN)r-rrrrr#r8rOr9rrr
setdefaultr+r)rr;pkgverrr&r'scansz(PackageIndex.process_index.<locals>.scanr6.pyz
#egg=%s-%scSsd|dddS)Nz<a href="%s#md5=%s">%s</a>r6rY)rF)mr&r&r'<lambda>z,PackageIndex.process_index.<locals>.<lambda>rN)rtrprr#rurvrFr$r|rAr,need_version_infoscan_urlPYPI_MD5sub)
rr:ryrrErrnew_urlr/fragr&rr'rs( 
zPackageIndex.process_indexcCs|d|dS)NzPPage at %s links to .py file(s) without version info; an index scan is required.)scan_allrr:r&r&r'rszPackageIndex.need_version_infocGs:|j|jkr*|r |j|f||d||jdS)Nz6Scanning index of all packages (this may take a while))rrrrrrrrhr&r&r'rszPackageIndex.scan_allcCsz||j|jd|j|js:||j|jd|j|jsR||t|j|jdD]}||qfdS)Nr1r&)	rrunsafe_namerrrcrLnot_found_in_indexr)rrequirementr:r&r&r'
find_packagess
zPackageIndex.find_packagescsR|||||jD]"}||kr0|S|d||qtt|||S)Nz%s does not match %s)prescanrrcrsuperrobtain)rrZ	installerrH	__class__r&r'rs
zPackageIndex.obtaincCsL||jd||sH|t|td|jjtj	
|fdS)z-
        checker is a ContentChecker
        zValidating %%s checksum for %sz7%s validation failed for %s; possible download problem?N)rrrrrRunlinkrrr.r>rP)rcheckerrStfpr&r&r'
check_hashs
zPackageIndex.check_hashcCsN|D]D}|jdks0t|r0|ds0tt|r<||q|j|qdS)z;Add `urls` to the list that will be prescanned for searchesNfile:)rrr-rrrappend)rZurlsr:r&r&r'add_find_linkss
zPackageIndex.add_find_linkscCs"|jrtt|j|jd|_dS)z7Scan urls scheduled for prescanning (e.g. --find-links)N)rrrrrr&r&r'rszPackageIndex.prescancCs<||jr|jd}}n|jd}}|||j|dS)Nz#Couldn't retrieve index page for %rz3Couldn't find index page for %r (maybe misspelled?))rcrrrr)rrZmethrr&r&r'r#s
zPackageIndex.not_found_in_indexcCs~t|tsjt|}|rR||d||}t|\}}|drN||||}|Stj	
|rb|St|}t|
||ddS)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.
        r6rrKN)rrr
_download_urlrFrAr,	gen_setuprRr>rr(rfetch_distribution)rr%tmpdirr<foundr/r@r&r&r'r3-s

zPackageIndex.downloadc	sd|id}d
fdd	}|rH|||}|s^|dk	r^|||}|dkrjdk	rx||}|dkr|s|||}|dkrdrdpd|nd||j|jd	SdS)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|dkr}||jD]v}|jtkrFsF|krd|d|<q||ko\|jtkp\}|r|j}||_tj	
|jr|SqdS)Nz&Skipping development or system egg: %sr6)rcrBrrr
r3rKdownload_locationrRr>r)ZreqenvrHZtestZloc
develop_okrZskippedsourcerr&r'rwgs&z-PackageIndex.fetch_distribution.<locals>.findz:No local packages or working download links found for %s%sza source distribution of rzBest match: %s)rK)N)rrrrrZcloner)	rrr
force_scanrrZlocal_indexrHrwr&rr'rOs2




zPackageIndex.fetch_distributioncCs"|||||}|dk	r|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)rrK)rrrrrrHr&r&r'fetchszPackageIndex.fetchc
	Cst|}|r*ddt||ddDp,g}t|dkrtj|}tj||krtj	||}ddl
m}|||st
|||}ttj	|dd2}	|	d|dj|djtj|dfW5QRX|S|rtd	||fntd
dS)NcSsg|]}|jr|qSr&)rM)rVdr&r&r'
<listcomp>sz*PackageIndex.gen_setup.<locals>.<listcomp>r6r)samefilezsetup.pywzIfrom setuptools import setup
setup(name=%r, version=%r, py_modules=[%r])
zCan'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.)rDrEr rFrOrRr>rPdirnamer]Zsetuptools.command.easy_installr	shutilZcopy2rwriterLrMsplitextr)
rrSr@rrErrPZdstr	rr&r&r'rsB


zPackageIndex.gen_setupi c	Cs|d|d}zt|}||}t|tjjrJt	d||j
|jf|}d}|j}d}d|krt
|d}	ttt|	}||||||t|dV}
||}|r|||
||d7}||||||qqq||||
W5QRX|WS|r|XdS)	NzDownloading %szCan't download %s: %s %srr2zcontent-lengthzContent-Lengthwbr6)rrrrrrrrrrrrdl_blocksizermaxrint
reporthookrrrr
r)rr:rSfprrblocknumZbssizeZsizesrrr&r&r'_download_tos:





zPackageIndex._download_tocCsdSrgr&)rr:rSrZblksizerr&r&r'rszPackageIndex.reporthookc
Cs|drt|Szt||jWSttjfk
r}z<ddd|jD}|r`|	||nt
d||fW5d}~XYntjj
k
r}z|WYSd}~XYntjjk
r}z*|r|	||jnt
d||jfW5d}~XYntjk
rF}z,|r$|	||jnt
d||jfW5d}~XYnPtjtjfk
r}z(|rt|	||nt
d||fW5d}~XYnXdS)Nr cSsg|]}t|qSr&)rr)rVargr&r&r'rsz)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_openopen_with_authrr$r
InvalidURLr]rhrrrrrZURLErrorreasonZ
BadStatusLinelineZ
HTTPExceptionsocket)rr:Zwarningvrr&r&r'rs>
"zPackageIndex.open_urlcCst|\}}|r0d|kr4|dddd}qnd}|drJ|dd}tj||}|dksj|d	rv|||S|d
ks|dr|||S|dr|	||S|d
krt
jt
j
|dS||d|||SdS)Nz...\_Z__downloaded__rIr*Zsvnzsvn+Zgitzgit+zhg+rrYT)rAreplacer,rRr>r]r-
_download_svn
_download_git_download_hgrrurl2pathnamer#r7r_attempt_download)rr<r:rr.r@rSr&r&r'rs$

zPackageIndex._download_urlcCs||ddS)NT)rrr&r&r'r:szPackageIndex.scan_urlcCs6|||}d|ddkr.||||S|SdS)Nrrr)rrr+_download_html)rr:rSrr&r&r'r)=szPackageIndex._attempt_downloadcCsnt|}|D]>}|rtd|rF|t||||SqLq|t|td|dS)Nz <title>([^- ]+ - )?Revision \d+:zUnexpected HTML page found at )	rrsrUrxrrRrr%r)rr:rrSrrr&r&r'r*Ds

zPackageIndex._download_htmlcCstdt|ddd}d}|drd|krtj|\}}}}}}	|s|drd	|d
dkr|d
dd	d\}}t	|\}
}|
rd|
kr|
dd\}}
d||
f}nd
|
}|}||||||	f}tj
|}|d||t
d|||f|S)Nz"SVN download support is deprecatedr5r6rrzsvn:@z//r1rY:z --username=%s --password=%sz --username=z'Doing subversion checkout from %s to %szsvn checkout%s -q %s %s)warningsrUserWarningr9r+r-rr#r7
_splituser
urlunparserrRsystem)rr:rSZcredsr<netlocr>rWqrauthhostuserZpwr;r&r&r'r%Ss&zPackageIndex._download_svncCsptj|\}}}}}|ddd}|ddd}d}d|krR|dd\}}tj||||df}||fS)N+r6r2r5rr+r)rr#Zurlsplitr9rsplitZ
urlunsplit)r:
pop_prefixr<r2r>r?rrevr&r&r'_vcs_split_rev_from_urlisz$PackageIndex._vcs_split_rev_from_urlcCsl|ddd}|j|dd\}}|d||td||f|dk	rh|d|td	||f|S)
Nr5r6rTr9zDoing git clone from %s to %szgit clone --quiet %s %szChecking out %szgit -C %s checkout --quiet %sr9r;rrRr1rr:rSr:r&r&r'r&{szPackageIndex._download_gitcCsl|ddd}|j|dd\}}|d||td||f|dk	rh|d|td	||f|S)
Nr5r6rTr<zDoing hg clone from %s to %szhg clone --quiet %s %szUpdating to %szhg --cwd %s up -C -r %s -qr=r>r&r&r'r'szPackageIndex._download_hgcGstj|f|dSrg)rrrr&r&r'rszPackageIndex.debugcGstj|f|dSrg)rrrr&r&r'rszPackageIndex.infocGstj|f|dSrg)rrrr&r&r'rszPackageIndex.warn)rrNT)F)F)F)N)N)FFFN)FF)N)F)(rrrrrrrrrrrrrrrrrrrr3rrrrrrrrrr)r*r%staticmethodr;r&r'rrr
__classcell__r&r&rr'r*sX

3



+
		
#
L

)$
#z!&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?cCs|d}t|S)Nr)rFr)rEZwhatr&r&r'
decode_entitys
rAcCs
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_subrA)textr&r&r'rvs	rvcsfdd}|S)Ncsfdd}|S)Nc	s2t}tz||WSt|XdSrg)rZgetdefaulttimeoutZsetdefaulttimeout)rhriZold_timeout)rktimeoutr&r'_socket_timeouts

z@socket_timeout.<locals>._socket_timeout.<locals>._socket_timeoutr&)rkrErDrjr'rEsz'socket_timeout.<locals>._socket_timeoutr&)rDrEr&rFr'socket_timeoutsrGcCs2tj|}|}t|}|}|ddS)aq
    A function compatible with Python 2.3-3.3 that will 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)rr#r8encodebase64Z	b64encoderr$)r4Zauth_sZ
auth_bytesZ
encoded_bytesZencodedr&r&r'_encode_auths

rKc@s(eZdZdZddZddZddZdS)	
Credentialz:
    A username/password pair. Use like a namedtuple.
    cCs||_||_dSrgusernamepassword)rrNrOr&r&r'rszCredential.__init__ccs|jV|jVdSrgrMrr&r&r'__iter__szCredential.__iter__cCsdt|S)Nz%(username)s:%(password)s)varsrr&r&r'__str__szCredential.__str__N)rrrrrrPrRr&r&r&r'rLsrLc@s0eZdZddZeddZddZddZd	S)

PyPIConfigcCsPtdddgd}tj||tjtjdd}tj	|rL|
|dS)z%
        Load from ~/.pypirc
        rNrO
repositoryr~z.pypircN)dictfromkeysrRawConfigParserrrRr>r]
expanduserrr)rdefaultsZrcr&r&r'rs
zPyPIConfig.__init__cs&fddD}ttj|S)Ncs g|]}|dr|qS)rT)rrs)rVsectionrr&r'rsz2PyPIConfig.creds_by_repository.<locals>.<listcomp>)ZsectionsrVr_get_repo_cred)rZsections_with_repositoriesr&rr'creds_by_repositorys
zPyPIConfig.creds_by_repositorycCs6||d}|t||d||dfS)NrTrNrO)rrsrL)rr[Zrepor&r&r'r\s
zPyPIConfig._get_repo_credcCs*|jD]\}}||r
|Sq
dS)z
        If the URL indicated appears to be a repository defined in this
        config, return the credential for that repository.
        N)r]itemsr-)rr:rTcredr&r&r'find_credential
s
zPyPIConfig.find_credentialN)rrrrpropertyr]r\r`r&r&r&r'rSs

rScCs:tj|}|\}}}}}}|dr0td|dkrFt|\}	}
nd}	|	s~t|}|r~t	|}	|j
|f}tjd	||	rdt
|	}	||
||||f}
tj|
}tj|}|d|	ntj|}|dt||}|	r6tj|j\}}}}}}||kr6||
kr6||||||f}
tj|
|_|S)
z4Open a urllib2 request, handling HTTP authenticationr,znonnumeric port: '')ZhttpZhttpsN*Authenticating as %s for %s (from .pypirc)zBasic Z
Authorizationz
User-Agent)rb)rr#r7r,rrr/rSr`rrrNrrrKr0rZRequestZ
add_header
user_agentr:)r:rZparsedr<r2r>Zparamsr?rr4Zaddressr_rr;rrrs2Zh2Zpath2Zparam2Zquery2Zfrag2r&r&r'rs8


rcCs |d\}}}|r|nd|fS)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.r+N)
rpartition)r5r6Zdelimr&r&r'r/Fsr/cCs|Srgr&)r:r&r&r'
fix_sf_urlPsrfc
Cstj|\}}}}}}tj|}tj|r<tj|S|	drtj
|rg}t|D]d}	tj||	}
|	dkrt
|
d}|}W5QRXqntj
|
r|	d7}	|dj|	dq`d}
|
j|d|d}d	\}}n
d
\}}}ddi}t|}tj|||||S)
z7Read a local path, with special support for directoriesr1z
index.htmlrz<a href="{name}">{name}</a>)r.zB<html><head><title>{url}</title></head><body>{files}</body></html>rH)r:files)ZOK)rzPath not foundz	Not foundrz	text/html)rr#r7rr(rRr>isfilerr,rrr]rrrformatrStringIOrr)r:r<r=r>Zparamr?rrSrhrfilepathrZbodyrZstatusmessagerZbody_streamr&r&r'rTs.


r)N)N)N)N)r!)]rsysrRrUrrrJrrr-	functoolsrZsetuptools.externrZsetuptools.extern.six.movesrrrrr"Z
pkg_resourcesr	r
rrr
rrrrrrrrrZ	distutilsrZdistutils.errorsrZfnmatchrZsetuptools.py27compatrZsetuptools.py33compatrZsetuptools.wheelrtypeZ
__metaclass__rrDIrtrrErr9rN__all__Z_SOCKET_TIMEOUTZ_tmplrkversion_inforcr(rrArrCrTr rfrmror|r}rrrrBrArvrGrKrLrXrSrrrr/rfrr&r&r&r'<module>s<
	

!

$


!
&/