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.6/site-packages/setuptools/__pycache__/package_index.cpython-36.pyc
3

vh@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.ej/dZ0ej/dej1Z2ej/dZ3ej/dej1j4Z5dj6Z7ddddgZ8dZ9dZ:e:j;ej<ddedZ=ddZ>ddZ?ddZ@dEd dZAdFd!d"ZBdGd#d$ZCdedfd%dZDdHd&d'ZEd(d)ZFej/d*ej1ZGeFd+d,ZHGd-d.d.eIZJGd/d0d0eJZKGd1ddeZLej/d2jMZNd3d4ZOd5d6ZPdId7d8ZQd9d:ZRGd;d<d<eIZSGd=d>d>ejTZUejVjWfd?d@ZXeQe9eXZXdAdBZYdCdDZZdS)Jz#PyPI and direct package downloadingN)wraps)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>
\s+\(<a (?:title="MD5 hash"
\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})Zpy_major
setuptoolscCs2y
tj|Stk
r,td|fYnXdS)Nz1Not a URL, existing file, or requirement spec: %r)rparse
ValueErrorr)specr&#/usr/lib/python3.6/package_index.pyparse_requirement_arg3s

r(cCs|j}d\}}}|jdr|jdr8|dd}d}nn|jddrb|dd}|dd}d}nD|jd
r~|dd}d}n(|jd
dr|dd}|dd}d}|||fS)z=Return (base,pyversion) or (None,None) for possible .exe nameNz.exez
.win32.exe
Zwin32z	.win32-pyz.win-amd64.exez	win-amd64z
.win-amd64-py)NNNiiiiiiir/i)lowerendswith
startswith)namer0basepy_verZplatr&r&r'r<s$



c	Csxtjj|}|\}}}}}}tjj|jdd}|dkrX|dkrXtjj|jdd}d|krp|jdd\}}||fS)	N/zsourceforge.netdownload#)rr#urlparseunquotesplit)	urlpartsschemeserverpathZ
parametersqueryfragmentr4r&r&r'egg_info_for_urlTsrGccsdt|\}}xt|||D]
}|VqW|r`tj|}|r`x$t||jd|tdD]
}|VqRWdS)zEYield egg or source distribution objects that might be found at a URLr7)
precedenceN)rGdistros_for_locationEGG_FRAGMENTmatchrgroupr)r@metadatar4rFdistrKr&r&r'r_s

cCs|jdr|dd
}|jdr8d|kr8tj|||gS|jdrxd|krxt|}|js^gSt||j|jtddgS|jd	rt|\}}}|dk	rt	||||t
|Sx4tD],}|j|r|dt|}t	|||SqWgS)z:Yield egg or source distribution objects based on basenamez.egg.zipNr,z.egg-z.whlr7)locationproject_nameversionrHz.exer/)
r1r	Z
from_locationrZ
is_compatiblerQrRrrrr

EXTENSIONSlen)rPbasenamerMZwheelZwin_baser5platformZextr&r&r'rIms.



rIcCstt|tjj||S)zEYield possible egg or source distribution objects based on a filename)rIrosrDrU)filenamerMr&r&r'distros_for_filenamesrYc
cs|jd}|r.tdd|ddDr.dSxNtdt|dD]8}t||dj|d|dj||d|||dVqBWdS)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!
    rOcss|]}tjd|VqdS)z	py\d\.\d$N)rerK).0pr&r&r'	<genexpr>sz(interpret_distro_name.<locals>.<genexpr>r9Nr7)
py_versionrHrV)r?anyrangerTr	join)rPrUrMr^rHrVrAr\r&r&r'rs
 $ccsnt}|j}|dkr>xTtjj|j|D]}|||Vq&Wn,x*|D]"}||}||krD|||VqDWdS)zHList unique elements, preserving order. Remember all elements ever seen.N)setaddrZmovesfilterfalse__contains__)iterablekeyseenZseen_addelementkr&r&r'unique_everseens
rkcstfdd}|S)zs
    Wrap a function returning an iterable such that the resulting iterable
    only ever yields unique items.
    cst||S)N)rk)argskwargs)funcr&r'wrapperszunique_values.<locals>.wrapper)r)rnror&)rnr'
unique_valuessrpz3<([^>]*\srel\s{0,10}=\s{0,10}['"]?([^'" >]+)[^>]*)>ccsxvtj|D]h}|j\}}tttj|jjd}d|ksFd|krx,t	j|D]}t
jj|t
|jdVqRWqWxHdD]@}|j|}|d	kr~t	j||}|r~t
jj|t
|jdVq~WdS)
zEFind rel="homepage" and rel="download" links in `page`, yielding URLs,Zhomepager8r7
<th>Home Page<th>Download URLN)rrrsr;)RELfinditergroupsrbrstrstripr0r?HREFrr#urljoin
htmldecoderLfindsearch)r@pagerKtagZrelZrelsposr&r&r'find_external_linkss"

rc@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'rsrc@sBeZdZejdZddZeddZddZ	dd	Z
d
dZdS)
HashCheckerzK(?P<hash_name>sha1|sha224|sha384|sha256|sha512|md5)=(?P<expected>[a-f0-9]+)cCs||_tj||_||_dS)N)	hash_namehashlibnewhashexpected)rrrr&r&r'__init__szHashChecker.__init__cCs>tjj|d}|stS|jj|}|s0tS|f|jS)z5Construct a (possibly null) ContentChecker from a URLr7r;)rr#r=rpatternr}	groupdict)clsr@rFrKr&r&r'from_urlszHashChecker.from_urlcCs|jj|dS)N)rupdate)rrr&r&r'rszHashChecker.feedcCs|jj|jkS)N)rZ	hexdigestr)rr&r&r'r!szHashChecker.is_validcCs||j}||S)N)r)rrrmsgr&r&r'r$s
zHashChecker.reportN)rrrrZcompilerrclassmethodrrrrr&r&r&r'rsrcs<eZdZdZdKddZdLd	d
ZdMddZdNd
dZddZddZ	ddZ
ddZdOddZddZ
dPfdd	ZddZdd Zd!d"Zd#d$Zd%d&ZdQd'd(ZdRd)d*Zd+d,Zd-Zd.d/Zd0d1ZdSd2d3Zd4d5Zd6d7Zd8d9Zd:d;Zd<d=Ze dTd>d?Z!d@dAZ"dBdCZ#dDdEZ$dFdGZ%dHdIZ&Z'S)Urz;A distribution index that scans web pages for download URLshttps://pypi.org/simple/*NTcOstj|f|||dd|jd|_i|_i|_i|_tjdj	t
t|j|_
g|_|ortjor|prtj}|rtj||_n
tjj|_dS)Nr6|)r
rr1	index_urlscanned_urlsfetched_urls
package_pagesrZrrarrrKallowsto_scanrZis_availableZfind_ca_bundleZ
opener_foropenerrrequesturlopen)rrZhostsZ	ca_bundleZ
verify_sslrlkwZuse_sslr&r&r'r,szPackageIndex.__init__FcCs||jkr|rdSd|j|<t|s4|j|dStt|}|r^|j|sRdS|jd||sr|sr||jkrtt|j	|dS|j|sd|j|<dS|j
d|d|j|<d}|j|||}|dkrdSd|j|j<d|j
jddjkr|jdS|j}|j}t|tsRt|tjjr4d	}n|j
jd
pDd	}|j|d}|jx6tj|D](}	tjj|t|	jd}
|j|
qfW|j |j!rt"|d
ddkr|j#||}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!htmlzcontent-typezlatin-1charsetignorer7codei)$r
URL_SCHEMEprocess_filenamelistrurl_okdebugrrrcinfoopen_urlr@headersgetr0closeread
isinstancerwrerror	HTTPErrorZ	get_paramdecoderyrur#rzr{rLprocess_urlr2rgetattr
process_index)rr@Zretrievediststmplfr4r~rrKlinkr&r&r'rAsP





 zPackageIndex.process_urlcCstjj|s|jd|dStjj|rd|rdtjj|}x(tj|D]}|jtjj||dqFWt	|}|r|j
d|tt|j
|dS)Nz
Not found: %sTz	Found: %s)rWrDexistswarnisdirrealpathlistdirrrarYrrrrc)rfnnestedrDitemrr&r&r'rtszPackageIndex.process_filenamecCsbt|}|o|jdjdk}|s8|jtjj|dr<dSd}|rRt||n|j||dS)Nr7fileTzN
Note: Bypassing %s (disallowed host; see http://bit.ly/2hrImnY for details).
)	rrLr0rrr#r=rr)rr@Zfatalsis_filerr&r&r'rszPackageIndex.url_okcCs2ttjj|}dd|D}ttj|j|dS)Ncss0|](}tj|D]}|jdr||fVqqdS)z	.egg-linkN)rWrr1)r[rDentryr&r&r'r]sz.PackageIndex.scan_egg_links.<locals>.<genexpr>)filterrWrDrr	itertoolsstarmap
scan_egg_link)rZsearch_pathdirsZ	egg_linksr&r&r'scan_egg_linksszPackageIndex.scan_egg_linksc
Csttjj||}ttdttj|}WdQRXt	|dkrDdS|\}}x>t
tjj||D](}tjj|f||_t|_
|j|q`WdS)Nr9)openrWrDrarrrrwrxrTrrPrrHrc)rrDrZ	raw_lineslinesZegg_pathZ
setup_pathrNr&r&r'rs zPackageIndex.scan_egg_linkc

sfdd}xHtj|D]:}y |tjj|t|jdWqtk
rPYqXqW||\}}|rxXt||D]J}t	|\}}	|j
dr|	r|r|d||f7}n
j|j|qrWt
jdd|SdSd	S)
z#Process the contents of a PyPI pagecs|jjrtttjj|tjdjd}t|dkrd|dkrt	|d}t
|d}djj|j
i|<t|t|fSdS)Nr6r9r:r7rT)NN)r2rrrrr#r>rTr?rrr
setdefaultr0r)rrApkgver)rr&r'scans"z(PackageIndex.process_index.<locals>.scanr7z.pyz
#egg=%s-%scSsd|jdddS)Nz<a href="%s#md5=%s">%s</a>r7r!r9)rL)mr&r&r'<lambda>sz,PackageIndex.process_index.<locals>.<lambda>rN)ryrurr#rzr{rLr$rrGr1need_version_infoscan_urlPYPI_MD5sub)
rr@r~rrKrrnew_urlr4fragr&)rr'rs$ 

zPackageIndex.process_indexcCs|jd|dS)NzPPage at %s links to .py file(s) without version info; an index scan is required.)scan_all)rr@r&r&r'rszPackageIndex.need_version_infocGs:|j|jkr*|r |j|f||jd|j|jdS)Nz6Scanning index of all packages (this may take a while))rrrrr)rrrlr&r&r'rszPackageIndex.scan_allcCs~|j|j|jd|jj|js:|j|j|jd|jj|jsR|j|x&t|jj|jfD]}|j|qhWdS)Nr6)	rrunsafe_namerrrgrQnot_found_in_indexr)rrequirementr@r&r&r'
find_packagess
zPackageIndex.find_packagescsR|j|j|x,||jD]}||kr.|S|jd||qWtt|j||S)Nz%s does not match %s)prescanrrgrsuperrobtain)rrZ	installerrN)	__class__r&r'rs
zPackageIndex.obtaincCsL|j|jd||jsH|jtj|td|jjtj	j
|fdS)z-
        checker is a ContentChecker
        zValidating %%s checksum for %sz7%s validation failed for %s; possible download problem?N)rrrrrWunlinkrrr3rDrU)rcheckerrXtfpr&r&r'
check_hashs

zPackageIndex.check_hashcCsTxN|D]F}|jdks4t|s4|jds4tt|r@|j|q|jj|qWdS)z;Add `urls` to the list that will be prescanned for searchesNzfile:)rrr2rrrappend)rZurlsr@r&r&r'add_find_links
s



zPackageIndex.add_find_linkscCs"|jrtt|j|jd|_dS)z7Scan urls scheduled for prescanning (e.g. --find-links)N)rrrr)rr&r&r'rszPackageIndex.prescancCs<||jr|jd}}n|jd}}|||j|jdS)Nz#Couldn't retrieve index page for %rz3Couldn't find index page for %r (maybe misspelled?))rgrrrr)rrmethrr&r&r'r"s
zPackageIndex.not_found_in_indexcCs~t|tsjt|}|rR|j|jd||}t|\}}|jdrN|j|||}|Stj	j
|rb|St|}t|j
||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.
        r7z.pyrPN)rrr
_download_urlrLrGr1	gen_setuprWrDrr(rfetch_distribution)rr%tmpdirrBfoundr4rFr&r&r'r8,s

zPackageIndex.downloadc	sjd|id}d
fdd	}|rHjj|||}|r`|dk	r`|||}|dkrjdk	rzj||}|dkr|rj|||}|dkrˆjdrdpd|njd||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}x||jD]t}|jtkrJrJ|krjd|d|<q||ko`|jtkp`}|rj|j}||_tj	j
|jr|SqWdS)Nz&Skipping development or system egg: %sr7)rgrHrrrr8rPdownload_locationrWrDr)ZreqenvrNZtestloc)
develop_okrskippedsourcerr&r'r|fs z-PackageIndex.fetch_distribution.<locals>.findz:No local packages or working download links found for %s%sza source distribution of rzBest match: %s)rP)N)rrrrrcloner)	rrr
force_scanrrZlocal_indexrNr|r&)rrrrrr'rNs0




zPackageIndex.fetch_distributioncCs"|j||||}|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)rrP)rrrrrrNr&r&r'fetchszPackageIndex.fetchc

Cstj|}|r*ddt||jddDp,g}t|dkrtjj|}tjj||krtjj	||}ddl
m}|||stj
|||}ttjj	|dd2}	|	jd|dj|djtjj|dfWdQRX|S|rtd	||fntd
dS)NcSsg|]}|jr|qSr&)rR)r[dr&r&r'
<listcomp>sz*PackageIndex.gen_setup.<locals>.<listcomp>r7r)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.)rJrKrrLrTrWrDrUdirnameraZsetuptools.command.easy_installrshutilZcopy2rwriterQrRsplitextr)
rrXrFrrKrrUdstrrr&r&r'rs2

 zPackageIndex.gen_setupi cCs|jd|d}ztj|}|j|}t|tjjrJtd||j	|j
f|j}d}|j}d}d|krt|d}	t
tt|	}|j|||||t|dZ}
xD|j|}|r|j||
j||d7}|j|||||qPqW|j|||
WdQRX|S|r|jXdS)	NzDownloading %szCan't download %s: %s %srr7zcontent-lengthzContent-Lengthwbr;)rrrrrrrrrrrdl_blocksizermaxrint
reporthookrrrr	rr)rr@rXfprrblocknumZbssizeZsizesrrr&r&r'_download_tos:





zPackageIndex._download_tocCsdS)Nr&)rr@rXrZblksizerr&r&r'rszPackageIndex.reporthookcCs|jdrt|Syt||jSttjfk
r}z>djdd|jD}|r^|j	||nt
d||fWYdd}~Xntjj
k
r}z|Sd}~Xntjjk
r}z,|r|j	||jnt
d||jfWYdd}~Xntjk
r8}z.|r|j	||jnt
d||jfWYdd}~XnPtjtjfk
r}z*|rf|j	||nt
d||fWYdd}~XnXdS)Nzfile: cSsg|]}t|qSr&)rw)r[argr&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)r2
local_openopen_with_authrr$r
InvalidURLrarlrrrrrZURLErrorreasonZ
BadStatusLinelineZ
HTTPExceptionsocket)rr@Zwarningvrr&r&r'rs6
"zPackageIndex.open_urlcCst|\}}|r4x&d|kr0|jddjdd}qWnd}|jdrN|dd}tjj||}|jt|sztdj	|d	|d
ks|jdr|j
||S|dks|jd
r|j||S|jdr|j||S|dkrt
jjt
jj|dS|j|d|j||SdS)Nz...\_Z__downloaded__z.egg.zipr,zInvalid filename {filename})rXsvnzsvn+gitzgit+zhg+rr9Tr/)rGreplacer1rWrDrar2rwr$format
_download_svn
_download_git_download_hgrrurl2pathnamer#r=r_attempt_download)rrBr@rr3rFrXr&r&r'rs(


zPackageIndex._download_urlcCs|j|ddS)NT)r)rr@r&r&r'r=szPackageIndex.scan_urlcCs6|j||}d|jddjkr.|j|||S|SdS)Nrzcontent-typer)rrr0_download_html)rr@rXrr&r&r'r)@szPackageIndex._attempt_downloadcCslt|}x@|D]8}|jrtjd|rD|jtj||j||SPqW|jtj|td|dS)Nz <title>([^- ]+ - )?Revision \d+:zUnexpected HTML page found at )	rrxrZr}rrWrr%r)rr@rrXrrr&r&r'r*Gs


zPackageIndex._download_htmlcCs|jddd}g}|jjdrd|krtjj|\}}}}}}	|r|jdrd|ddkr|ddjdd\}}tjj|\}
}|
rd	|
kr|
jd	d\}}
d
|d|
g}n
d
|
g}|}||||||	f}tjj|}|jd||t	j
d
dg|d||g|S)Nr:r7rzsvn:@z//r6r9:z--username=z--password=z'Doing subversion checkout from %s to %sr!checkoutz-q)r?r0r2rr#r=	splituser
urlunparser
subprocess
check_call)rr@rXZcredsrBnetlocrDr\qrauthhostuserZpwrAr&r&r'r%Vs$ 
zPackageIndex._download_svncCsptjj|\}}}}}|jddd}|jddd}d}d|krR|jdd\}}tjj||||df}||fS)N+r7r:rr+rr;)rr#Zurlsplitr?rsplitZ
urlunsplit)r@
pop_prefixrBr2rDrErrevr&r&r'_vcs_split_rev_from_urlksz$PackageIndex._vcs_split_rev_from_urlcCsr|jddd}|j|dd\}}|jd||tjddd	||g|dk	rn|jd
|tjdd|dd	|g|S)
Nr:r7rT)r9zDoing git clone from %s to %sr"rz--quietzChecking out %sz-Cr-)r?r;rr0r1)rr@rXr:r&r&r'r&}szPackageIndex._download_gitc	Csv|jddd}|j|dd\}}|jd||tjddd	||g|dk	rr|jd
|tjdd|dd
d|dg|S)Nr:r7rT)r9zDoing hg clone from %s to %sZhgrz--quietzUpdating to %sz--cwdZupz-Cz-rz-q)r?r;rr0r1)rr@rXr:r&r&r'r'szPackageIndex._download_hgcGstj|f|dS)N)rr)rrrlr&r&r'rszPackageIndex.debugcGstj|f|dS)N)rr)rrrlr&r&r'rszPackageIndex.infocGstj|f|dS)N)rr)rrrlr&r&r'rszPackageIndex.warnr)rr<NT)F)F)F)N)N)FFFN)FF)N)F)(rrrrrrrrrrrrrrrrrrrr8rrrr
rrrrrr)r*r%staticmethodr;r&r'rrr
__classcell__r&r&)rr'r)sL

3



+
		
#
J

)$
#!

z!&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?cCs|jd}t|S)Nr7)rLr)rKZwhatr&r&r'
decode_entitys
r?cCs
tt|S)z'Decode HTML entities in the given text.)
entity_subr?)textr&r&r'r{sr{csfdd}|S)Ncsfdd}|S)Ncs.tj}tjz
||Stj|XdS)N)rZgetdefaulttimeoutZsetdefaulttimeout)rlrmZold_timeout)rntimeoutr&r'_socket_timeouts


z@socket_timeout.<locals>._socket_timeout.<locals>._socket_timeoutr&)rnrC)rB)rnr'rCsz'socket_timeout.<locals>._socket_timeoutr&)rBrCr&)rBr'socket_timeoutsrDcCs2tjj|}|j}tj|}|j}|jddS)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#r>encodebase64Zencodestringrr#)r4Zauth_sZ
auth_bytesZ
encoded_bytesZencodedr&r&r'_encode_auths

rHc@s(eZdZdZddZddZddZdS)	
Credentialz:
    A username/password pair. Use like a namedtuple.
    cCs||_||_dS)N)usernamepassword)rrJrKr&r&r'rszCredential.__init__ccs|jV|jVdS)N)rJrK)rr&r&r'__iter__szCredential.__iter__cCsdt|S)Nz%(username)s:%(password)s)vars)rr&r&r'__str__szCredential.__str__N)rrrrrrLrNr&r&r&r'rIsrIc@s0eZdZddZeddZddZddZd	S)

PyPIConfigcCsPtjdddgd}tjj||tjjtjjdd}tjj	|rL|j
|dS)z%
        Load from ~/.pypirc
        rJrK
repositoryr~z.pypircN)dictfromkeysrRawConfigParserrrWrDra
expanduserrr)rZdefaultsZrcr&r&r'rs
zPyPIConfig.__init__cs&fddjD}ttj|S)Ncs g|]}j|djr|qS)rP)rrx)r[section)rr&r'rsz2PyPIConfig.creds_by_repository.<locals>.<listcomp>)ZsectionsrRr_get_repo_cred)rZsections_with_repositoriesr&)rr'creds_by_repositoryszPyPIConfig.creds_by_repositorycCs6|j|dj}|t|j|dj|j|djfS)NrPrJrK)rrxrI)rrVZrepor&r&r'rWszPyPIConfig._get_repo_credcCs*x$|jjD]\}}|j|r|SqWdS)z
        If the URL indicated appears to be a repository defined in this
        config, return the credential for that repository.
        N)rXitemsr2)rr@rPcredr&r&r'find_credentials
zPyPIConfig.find_credentialN)rrrrpropertyrXrWr[r&r&r&r'rOs	rOcCs:tjj|\}}}}}}|jdr,tjd|d
krFtjj|\}}	nd}|s~tj|}
|
r~t	|
}|
j
|f}tjd||rdt
|}||	||||f}tjj|}
tjj|
}|jd|ntjj|}|jd	t||}|r6tjj|j\}}}}}}||kr6||	kr6||||||f}tjj||_|S)z4Open a urllib2 request, handling HTTP authenticationr,znonnumeric port: ''httphttpsN*Authenticating as %s for %s (from .pypirc)zBasic Z
Authorizationz
User-Agent)r]r^)r_)rr#r=r1rrr.rOr[rwrJrrrHr/rZRequestZ
add_header
user_agentr@)r@rrBr2rDZparamsrErr4r5rZrrArrrs2Zh2Zpath2Zparam2Zquery2Zfrag2r&r&r'r
s6


rcCs|S)Nr&)r@r&r&r'
fix_sf_url>srbcCstjj|\}}}}}}tjj|}tjj|r<tjj|S|j	drtjj
|rg}xtj|D]b}	tjj||	}
|	dkrt
|
d}|j}WdQRXPntjj
|
r|	d7}	|jdj|	dqbWd}
|
j|dj|d	}d\}}n
d\}}}ddi}tj|}tjj|||||S)z7Read a local path, with special support for directoriesr6z
index.htmlrNz<a href="{name}">{name}</a>)r3zB<html><head><title>{url}</title></head><body>{files}</body></html>rE)r@filesOKPath not found	Not foundzcontent-typez	text/html)rerf)rgrhri)rr#r=rr(rWrDisfilerr1rrrarrrr$rStringIOrr)r@rBrCrDZparamrErrXrdrfilepathrZbodyrZstatusmessagerZbody_streamr&r&r'rBs,


r)N)N)N)N)r )[rr0sysrWrZrrrGrr	functoolsrZsetuptools.externrZsetuptools.extern.six.movesrrrrr"Z
pkg_resourcesrr	r
rrr
rrrrrrrrZ	distutilsrZdistutils.errorsrZfnmatchrZsetuptools.py27compatrZsetuptools.py33compatrZsetuptools.wheelrrrJIryrrKrr?rS__all__Z_SOCKET_TIMEOUTZ_tmplr$rRr`r(rrGrrIrYrrkrprtrobjectrrrrr@r?r{rDrHrIrTrOrrrrbrr&r&r&r'<module>s|<
	

!
"

!~
&.