U eΛ@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl ZddlZddlZddlZddlmZddlZddlmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#ddl$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+dd l,m-Z-e.d Z/e.d ej0Z1e.d Z2e.d ej0j3Z4d5Z6ddddgZ7dZ8dZ9e9j:dj:ej;edZddZ?dAddZ@dBddZAdCdd ZBdedfd!dZCd"d#ZDe.d$ej0ZEeDd%d&ZFGd'd(d(ZGGd)d*d*eGZHGd+ddeZIe.d,jJZKd-d.ZLd/d0ZMdDd1d2ZNd3d4ZOGd5d6d6ZPGd7d8d8e jQZRejSjTfd9d:ZUd;d<ZVeNe8eUZUd=d>ZWd?d@ZXdS)Ez#PyPI and direct package downloadingNwraps) CHECKOUT_DIST Distribution BINARY_DISTnormalize_path SOURCE_DIST Environmentfind_distributions safe_name safe_version to_filename Requirement DEVELOP_DISTEGG_DIST)log)DistutilsError) translate)Wheelunique_everseenz^egg=([-A-Za-z0-9_.+!]+)$zhref\s*=\s*['"]?([^'"> ]+)z([^<]+)\n\s+\(md5\)z([-+.a-z0-9]{2,}):z.tar.gz .tar.bz2 .tar .zip .tgz PackageIndexdistros_for_urlparse_bdist_wininstinterpret_distro_namez}ztd|f|W5d}~XYnXdS)Nz1Not a URL, existing file, or requirement spec: %r)rparse ValueErrorr)specer!F/opt/hc_python/lib/python3.8/site-packages/setuptools/package_index.pyparse_requirement_arg6s r#cCs|}d\}}}|dr|dr8|dd}d}nn|ddrb|d d }|dd}d}nD|d r~|dd }d }n(|ddr|d d }|dd}d }|||fS)z=Return (base,pyversion) or (None,None) for possible .exe name)NNN.exez .win32.exeNiwin32z .win32-pyiiz.win-amd64.exeiz win-amd64z .win-amd64-pyi)lowerendswith startswith)namer'basepy_verplatr!r!r"r?s$            c Csxtj|}|\}}}}}}tj|dd}|dkrX|dkrXtj|dd}d|krp|dd\}}||fS)N/zsourceforge.netdownload#)urllibrurlparseunquotesplit) urlpartsschemeserverpath parametersqueryfragmentr+r!r!r"egg_info_for_urlWs r@ccs\t|\}}t|||D] }|Vq|rXt|}|rXt||d|tdD] }|VqLdS)zEYield egg or source distribution objects that might be found at a URLr3) precedenceN)r@distros_for_location EGG_FRAGMENTmatchrgroupr)r8metadatar+r?distrDr!r!r"rbs   cCs|dr|dd}|dr8d|kr8t|||gS|drxd|krxt|}|s^gSt||j|jtddgS|d rt|\}}}|dk rt ||||t |St D]0}||r|dt | }t |||SqgS) z:Yield egg or source distribution objects based on basename.egg.zipNr&z.egg-z.whlr3)location project_nameversionrAr$) r(r from_locationr is_compatiblerKrLrrrr EXTENSIONSlen)rJbasenamerFwheelZwin_baser,platformextr!r!r"rBps<    rBcCstt|tj||S)zEYield possible egg or source distribution objects based on a filename)rBrosr<rQ)filenamerFr!r!r"distros_for_filenames  rWc 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! rIcss|]}td|VqdS)z py\d\.\d$N)rerD).0pr!r!r" sz(interpret_distro_name..Nr3) py_versionrArS)r7anyrangerPrjoin)rJrQrFr]rArSr9rZr!r!r"rs cstfdd}|S)zs Wrap a function returning an iterable such that the resulting iterable only ever yields unique items. cst||SNr)argskwargsfuncr!r"wrapperszunique_values..wrapperr)rerfr!rdr" unique_valuessrgz(<([^>]*\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,Zhomepager0r3)z Home PagezDownload URLr/N)RELfinditergroupssetmapstrstripr'r7HREFr4rurljoin htmldecoderEfindsearch)r8pagerDtagrelZrelsposr!r!r"find_external_linkss   ryc@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!r|r!r!r"is_validszContentChecker.is_validcCsdS)zu Call reporter with information about the checker (hash name) substituted into the template. Nr!)r|reportertemplater!r!r"reportszContentChecker.reportN)__name__ __module__ __qualname____doc__r~rrr!r!r!r"rzsrzc@sBeZdZedZddZeddZddZ dd Z d d Z d S) HashCheckerzK(?Psha1|sha224|sha384|sha256|sha512|md5)=(?P[a-f0-9]+)cCs||_t||_||_dSra) hash_namehashlibnewhashexpected)r|rrr!r!r"__init__s zHashChecker.__init__cCs>tj|d}|stS|j|}|s0tS|f|S)z5Construct a (possibly null) ContentChecker from a URLr/)r4rr5rzpatternrt groupdict)clsr8r?rDr!r!r"from_urls zHashChecker.from_urlcCs|j|dSra)rupdater{r!r!r"r~szHashChecker.feedcCs|j|jkSra)r hexdigestrrr!r!r"rszHashChecker.is_validcCs||j}||Sra)r)r|rrmsgr!r!r"rs zHashChecker.reportN) rrrrXcompilerr classmethodrr~rrr!r!r!r"rs rcsDeZdZdZdLddZdMd d ZdNd d ZdOd dZddZddZ ddZ ddZ ddZ dPddZ ddZdQfdd Zdd Zd!d"Zd#d$Zd%d&Zd'd(ZdRd)d*ZdSd+d,Zd-d.Zd/Zd0d1Zd2d3ZdTd4d5Zd6d7Zd8d9Zd:d;Zdd?Z e!dUd@dAZ"dBdCZ#dDdEZ$dFdGZ%dHdIZ&dJdKZ'Z(S)Vrz;A distribution index that scans web pages for download URLshttps://pypi.org/simple/*NTcOsltj|f|||dd|d |_i|_i|_i|_td t t |j |_ g|_tjj|_dS)Nr.|)r rr( index_url scanned_urls fetched_urls package_pagesrXrr`rmrrDallowsto_scanr4requesturlopenopener)r|rhostsZ ca_bundleZ verify_sslrbkwr!r!r"rszPackageIndex.__init__Fc Cs||jkr|sdSd|j|<t|s2||dStt|}|r\||sPdS|d||sn|rn||jkrtt|j |dS||sd|j|<dS| d|d|j|<d}| |||}|dkrdSt |t jjr|jdkr| d|jd|j|j<d|jd d kr(|dS|j}|}t |tsvt |t jjrXd }n|jd phd }||d }|t|D](} t j|t| d} |!| q|"|j#rt$|dddkr|%||}dS)z.)filterrUr<rr itertoolsstarmap scan_egg_link)r| search_pathdirsZ egg_linksr!r!r"scan_egg_links|s zPackageIndex.scan_egg_linksc Csttj||}ttdttj|}W5QRXt |dkrDdS|\}}t tj||D](}tjj|f||_ t |_ ||q^dS)Nr\)openrUr<r`rrrmrnrorPr rJrrAr)r|r<rZ raw_lineslinesZegg_pathZ setup_pathrGr!r!r"rs  zPackageIndex.scan_egg_linkcCsd}||js|Stttjj|t|jdd}t|dksRd|dkrV|St |d}t |d}d|j | i|<t|t|fS)N)NNr.r\r2r3rT)r)rrrmr4rr6rPr7r r r setdefaultr'r )r|rZNO_MATCH_SENTINELr9pkgverr!r!r"_scans   zPackageIndex._scanc Cst|D]<}z"|tj|t|dWq tk rDYq Xq ||\}}|s^dSt ||D]H}t |\}}| dr|s|r|d||f7}n | || |qhtdd|S)z#Process the contents of a PyPI pager3r.pyz #egg=%s-%scSsd|dddS)Nz%sr3r\)rE)mr!r!r"z,PackageIndex.process_index..)rprjrr4rrqrrrErryr@r(need_version_infoscan_urlPYPI_MD5sub) r|r8rurDrrnew_urlr+fragr!r!r"rs&"   zPackageIndex.process_indexcCs|d|dS)NzPPage at %s links to .py file(s) without version info; an index scan is required.)scan_allr|r8r!r!r"rszPackageIndex.need_version_infocGs:|j|jkr*|r |j|f||d||jdS)Nz6Scanning index of all packages (this may take a while))rrrrrr|rrbr!r!r"rs zPackageIndex.scan_allcCsz||j|jd|j|js:||j|jd|j|jsR||t|j|jdD]}||qfdS)Nr.r!) rr unsafe_namerrkeyrKnot_found_in_indexr)r| requirementr8r!r!r" find_packagess zPackageIndex.find_packagescsR|||||jD]"}||kr0|S|d||qtt|||S)Nz%s does not match %s)prescanrrrsuperrobtain)r|r installerrG __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) rrrrrUunlinkrrr*r<rQ)r|checkerrVtfpr!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)r|urlsr8r!r!r"add_find_linkss  zPackageIndex.add_find_linkscCs"|jrtt|j|jd|_dS)z7Scan urls scheduled for prescanning (e.g. --find-links)N)rrrmrrr!r!r"r szPackageIndex.prescancCs<||jr|jd}}n |jd}}|||j|dS)Nz#Couldn't retrieve index page for %rz3Couldn't find index page for %r (maybe misspelled?))rrrrr)r|rmethrr!r!r"rs  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. r3rrJN)rrr _download_urlrEr@r( gen_setuprUr<rr#rfetch_distribution)r|rtmpdirr:foundr+r?r!r!r"r0s    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: %sr3) rrArrrr0rJdownload_locationrUr<r)reqenvrGtestloc develop_okr|Zskippedsourcerr!r"rsUs&z-PackageIndex.fetch_distribution..findz:No local packages or working download links found for %s%sza source distribution of rzBest match: %s)rJ)N)rrrrrcloner) r|rr force_scanrrZ local_indexrGrsr!r r"r=s2         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)rrJ)r|rrrrrGr!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!)rL)rYdr!r!r" sz*PackageIndex.gen_setup..r3r)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.)rCrDrrErPrUr<rQdirnamer`Zsetuptools.command.easy_installrshutilcopy2rwriterKrLsplitextr) r|rVr?rrDrrQdstrrr!r!r"rsB       zPackageIndex.gen_setupi c Cs|d|d}zt|}||}t|tjjrJt d||j |j f|}d}|j }d}d|kr| d} ttt| }||||||t|dV} ||} | r|| | | |d7}||||||qqq|||| W5QRX|WS|r|XdS) NzDownloading %szCan't download %s: %s %srr/zcontent-lengthzContent-Lengthwbr3)rrrrrrr4rrrrr dl_blocksizeget_allmaxrmint reporthookrrr~rr) r|r8rVfprrblocknumbssizesizesrr}r!r!r" _download_tos:        zPackageIndex._download_tocCsdSrar!)r|r8rVr$Zblksizer&r!r!r"r"szPackageIndex.reporthookc Cs|drt|Szt||jWSttjjfk r}z>ddd|j D}|rb| ||nt d||f|W5d}~XYnt j jk r}z |WYSd}~XYnt j jk r}z,|r| ||jnt d||jf|W5d}~XYntjjk rP}z.|r,| ||jnt d||jf|W5d}~XYnTtjjtj fk r}z*|r| ||nt d||f|W5d}~XYnXdS)Nr cSsg|] }t|qSr!)rn)rYargr!r!r"rsz)PackageIndex.open_url..z%s %szDownload error for %s: %sz;%s returned a bad status line. The server might be down, %s)r) local_openopen_with_authrrhttpclient InvalidURLr`rbrrr4rrURLErrorreason BadStatusLineline HTTPExceptionsocket)r|r8warningvrr!r!r"rsJ $zPackageIndex.open_urlcCst|\}}|r0d|kr4|dddd}qnd}|drJ|dd}tj||}|dksj|d rv|||S|d ks|d r|||S|d r| ||S|d krt j t j |dS||d|||SdS)Nz...\_Z__downloaded__rHr&svnzsvn+gitzgit+zhg+rr\T)r@replacer(rUr<r`r) _download_svn _download_git _download_hgr4r url2pathnamerr5r_attempt_download)r|r:r8rr*r?rVr!r!r"r s$        zPackageIndex._download_urlcCs||ddS)NT)rrr!r!r"r)szPackageIndex.scan_urlcCs6|||}d|ddkr.||||S|SdS)Nrrr)r(rr'_download_html)r|r8rVrr!r!r"rB,s zPackageIndex._attempt_downloadcCsnt|}|D]>}|r td|rF|t||||SqLq |t|td|dS)Nz ([^- ]+ - )?Revision \d+:zUnexpected HTML page found at ) r���ro���rX���rt���r���rU���r���r>��r���)r|���r8���r���rV���r���r3��r!���r!���r"���rC��3��s����   zPackageIndex._download_htmlc�����������������C���s��t�dt�|ddd�}d}|�drd|krtj|\}}}}}} |s|drd |d d��kr|d d��d d\}}t |\} } | rd | kr| d d\} } d | | f�}nd | �}| }|||||| f}tj |}|� d||�t d|||f��|S�)Nz"SVN download support is deprecatedr2���r3���r���r���zsvn:@z//r.���r\���:z --username=%s --password=%sz --username=z'Doing subversion checkout from %s to %szsvn checkout%s -q %s %s)warningsr��� UserWarningr7���r'���r)���r4���r���r5��� _splituser urlunparser���rU���system)r|���r8���rV���credsr:���netlocr<���rZ���qr���authhostuserpwr9���r!���r!���r"���r>��B��s&����   zPackageIndex._download_svnc�����������������C���sp���t�j|�\}}}}}|ddd�}|ddd�}d�}d|krR|dd\}}t�j||||df}�|�|fS�)N+r3���r/���r2���r���rD��r���)r4���r���urlsplitr7���rsplit urlunsplit)r8��� pop_prefixr:���rL��r<���r>���r���revr!���r!���r"���_vcs_split_rev_from_urlX��s����z$PackageIndex._vcs_split_rev_from_urlc�����������������C���sl���|�ddd�}|�j|dd\}}|�d||�td||f��|d�k rh|�d|�td ||f��|S�) Nr2���r3���r���TrV��zDoing git clone from %s to %szgit clone --quiet %s %szChecking out %szgit -C %s checkout --quiet %sr7���rX��r���rU���rJ��r|���r8���rV���rW��r!���r!���r"���r?��j��s���� zPackageIndex._download_gitc�����������������C���sl���|�ddd�}|�j|dd\}}|�d||�td||f��|d�k rh|�d|�td ||f��|S�) Nr2���r3���r���TrY��zDoing hg clone from %s to %szhg clone --quiet %s %szUpdating to %szhg --cwd %s up -C -r %s -qrZ��r[��r!���r!���r"���r@��z��s���� zPackageIndex._download_hgc�����������������G���s���t�j|f|��d�S�ra���)r���r���r���r!���r!���r"���r�����s����zPackageIndex.debugc�����������������G���s���t�j|f|��d�S�ra���)r���r���r���r!���r!���r"���r�����s����zPackageIndex.infoc�����������������G���s���t�j|f|��d�S�ra���)r���r���r���r!���r!���r"���r�����s����zPackageIndex.warn)r���r���NT)F)F)F)N)N)FFFN)FF)N)F))r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r��r���r���r0���r��r��r��r��r(��r"��r���r��r���rB��rC��r>�� staticmethodrX��r?��r@��r���r���r��� __classcell__r!���r!���r���r"���r�����sZ���������  5      #������ L )$ # z!&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?c�����������������C���s���|��d}t|S�)Nr���)rE���r���unescape)rD���whatr!���r!���r"��� decode_entity��s���� r`��c�����������������C���s ���t�t|�S�)a�� Decode HTML entities in the given text. >>> htmldecode( ... 'https://../package_name-0.1.2.tar.gz' ... '?tokena=A&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"���rr�����s���� rr���c��������������������s����fdd}|S�)Nc��������������������s����fdd}|S�)Nc��������������� ������s2���t��}t��z�|�|W�S�t�|�X�d�S�ra���)r5��getdefaulttimeoutsetdefaulttimeout)rb���rc���Z old_timeout)re���timeoutr!���r"���_socket_timeout��s ���� z@socket_timeout.<locals>._socket_timeout.<locals>._socket_timeoutr!���)re���rf��re��rd���r"���rf����s����z'socket_timeout.<locals>._socket_timeoutr!���)re��rf��r!���rg��r"���socket_timeout��s���� rh��c�����������������C���s2���t�j|�}|�}t|}|�}|ddS�)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���)r4���r���r6���encodebase64 b64encoder���r=��)rN��Zauth_sZ auth_bytesZ encoded_bytesencodedr!���r!���r"��� _encode_auth��s ����  rn��c�������������������@���s(���e�Zd�ZdZdd�Zdd�Zdd�ZdS�) Credentialz: A username/password pair. Use like a namedtuple. c�����������������C���s���||�_�||�_d�S�ra���usernamepassword)r|���rq��rr��r!���r!���r"���r�����s����zCredential.__init__c�����������������c���s���|�j�V��|�jV��d�S�ra���rp��r���r!���r!���r"���__iter__��s����zCredential.__iter__c�����������������C���s ���dt�|��S�)Nz%(username)s:%(password)s)varsr���r!���r!���r"���__str__��s����zCredential.__str__N)r���r���r���r���r���rs��ru��r!���r!���r!���r"���ro����s���ro��c�������������������@���s0���e�Zd�Zdd�Zedd�Zdd�Zdd�Zd S�) PyPIConfigc�����������������C���sP���t�dddgd}tj|�|�tjtjdd}tj |rL|� |�dS�)z% Load from ~/.pypirc rq��rr�� repositoryr���~z.pypircN) dictfromkeys configparserRawConfigParserr���rU���r<���r`��� expanduserr���r���)r|���defaultsrcr!���r!���r"���r�����s ���� zPyPIConfig.__init__c��������������������s&����fdd���D�}tt�j|S�)Nc��������������������s ���g�|�]}��|d��r|qS�)rw��)r���ro���)rY���sectionr���r!���r"���r����s���z2PyPIConfig.creds_by_repository.<locals>.<listcomp>)sectionsry��rm���_get_repo_cred)r|���Zsections_with_repositoriesr!���r���r"���creds_by_repository��s���� zPyPIConfig.creds_by_repositoryc�����������������C���s6���|��|d�}|t|��|d�|��|d�fS�)Nrw��rq��rr��)r���ro���ro��)r|���r��repor!���r!���r"���r����s ����zPyPIConfig._get_repo_credc�����������������C���s*���|�j��D�]\}}||r |��S�q dS�)z If the URL indicated appears to be a repository defined in this config, return the credential for that repository. N)r��itemsr)���)r|���r8���rw��credr!���r!���r"���find_credential��s���� zPyPIConfig.find_credentialN)r���r���r���r���propertyr��r��r��r!���r!���r!���r"���rv����s ���  rv��c�����������������C���s<��t�j|�}|\}}}}}}|dr2tjd|dkrHt|\} } nd} | st� |�} | rt | } | j |�f} t j d | ��| rdt| �} || ||||f} t�j| }t�j|}|d| �n t�j|�}|dt�||}| r8t�j|j\}}}}}}||kr8|| kr8||||||f} t�j| |_|S�) z4Open a urllib2 request, handling HTTP authenticationrE��znonnumeric port: '')r-��httpsN*Authenticating as %s for %s (from .pypirc)zBasic Authorizationz User-Agent)r��)r4���r���r5���r(���r-��r.��r/��rH��rv��r��rn���rq��r���r���rn��rI��r���Request add_header user_agentr8���)r8���r���parsedr:���rL��r<���paramsr>���r���rN��addressr��r���r9���r���r���r#��s2Zh2Zpath2Zparam2Zquery2Zfrag2r!���r!���r"���r,����s8����          r,��c�����������������C���s ���|��d\}}}�|r|nd|�fS�)zNsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.rD��N) rpartition)rO��rP��delimr!���r!���r"���rH��4��s����rH��c�����������������C���s���|�S�ra���r!���)r8���r!���r!���r"��� fix_sf_url?��s����r��c�������������� ���C���s��t�j|�\}}}}}}t�j|}tj|r<t�j|�S�| drtj |rg�}t |D�]d} tj || } | dkrt | d} | �} W�5�Q�R�X��qntj | r| d7�} |dj| d�q`d} | j|�d |d} d \}}n d \}}} d d i}t| }t�j|�||||S�) z7Read a local path, with special support for directoriesr.���z index.htmlrz<a href="{name}">{name}</a>)r*���zB<html><head><title>{url}{files}ri)r8files)OK)rzPath not foundz Not foundrz text/html)r4rr5rrArUr<isfilerr(rrr`rrrformatioStringIOrr)r8r:r;r<paramr>rrVrrfilepathr#bodyrstatusmessagerZ body_streamr!r!r"r+Cs.        r+)N)N)N)r)YrsysrUrXrrr5rkrrrFr{r http.clientr- urllib.parser4urllib.request urllib.error functoolsrr pkg_resourcesrrrrrr r r r r rrr distutilsrdistutils.errorsrfnmatchrZsetuptools.wheelrZ setuptools.extern.more_itertoolsrrrCIrprrDrr7rO__all__Z_SOCKET_TIMEOUTZ_tmplr version_inforr#rr@rrBrWrrgriryrzrrrrar`rrrhrnror|rvrrr,rHrr+r!r!r!r"s <          !  #  !  &/