\h=QddlZddlZddlZddlZddlZddlZ ddlmZddl m Z ddl m Z mZmZmZmZmZddlmZmZej,eZdZdZGd d eZy#e$r ddl mZYMwxYw) N)Thread)DistlibException)HTTPBasicAuthHandlerRequestHTTPPasswordMgrurlparse build_opener string_types)zip_dir ServerProxyzhttps://pypi.org/pypipypiceZdZdZdZddZdZdZdZdZ d Z d Z dd Z dd Z dd Z ddZdZ ddZ ddZddZdZdZddZy) PackageIndexzc This class represents a package index compatible with PyPI, the Python Package Index. s.----------ThIs_Is_tHe_distlib_index_bouNdaRY_$Nc|xst|_|jt|j\}}}}}}|s|s|s|dvrt d|jzd|_d|_d|_d|_ttjd5}dD]+} tj| dg||} | dk(r | |_n-dddy#t$rYBwxYw#1swYyxYw) z Initialise an instance. :param url: The URL of the index. If not specified, the URL for PyPI is used. )httphttpszinvalid repository: %sNw)gpggpg2z --versionstdoutstderrr) DEFAULT_INDEXurlread_configurationr rpassword_handler ssl_verifierrgpg_homeopenosdevnull subprocess check_callOSError) selfrschemenetlocpathparamsqueryfragsinksrcs \/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pip/_vendor/distlib/index.py__init__zPackageIndex.__init__%s'- !4 > OO  88JK>>(FM*24 (D ! !QI ![[+557 y1;;=  $ # "$*   RWW--h7CD h% $668 $ LL/277+;+;H+E!# $ MM"''//(3 4%%aggi7  ))) ! ! $ $s$G9 H9HHc|jtjj|st d|ztjj |d}tjj |st d|z|j|j|j}}t|j}dd|fd|fg}d||fg}|j||} |j| S)a2 Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The pathname of the directory which contains the documentation. This should be the directory that contains the ``index.html`` for the documentation. :return: The HTTP response received from PyPI upon submission of the request. znot a directory: %rz index.htmlz not found: %r)rI doc_uploadr]versionr)rAr!r)isdirrrlrrKr]rr getvaluerMrO) r&rPdoc_dirfnr]rzip_datafieldsrrRs r0upload_documentationz!PackageIndex.upload_documentation!s  ww}}W%"#87#BC C WW\\'< 0ww~~b!"?R#78 8 x'7'7g7#,,.+4.9g"68T8,-%%fe4  ))r6c|jdddg}| |j}|r|jd|g|jd||gtj ddj ||S)a| Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The verifying command as a list suitable to be passed to :class:`subprocess.Popen`. rbrcrdrez--verifyrgrh)rrrirZr[rl)r&signature_filename data_filenamerqr5s r0get_verify_commandzPackageIndex.get_verify_command=shxxZ8  }}H  JJ X. / J 2MBC ^SXXc]3 r6c|js td|j|||}|j|\}}}|dvrtd|z|dk(S)a6 Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: True if the signature was verified, else False. z0verification unavailable because gpg unavailable)rrz(verify command failed with error code %sr)rrrr)r&rrrqr5r/rrs r0verify_signaturezPackageIndex.verify_signatureUsoxx"$12 2%%&8-&.0!--c2FF V "#MPR#RS SQwr6c n|d}tjdnKt|ttfr|\}}nd}t t |}tjd|zt|d5}|jt|} |j} d} d} d} d} d | vrt| d } |r || | |  |j| }|snD| t|z } |j||r|j|| d z } |r || | | X |j! ddd dk\r | krt#d | | fz|rB|j%}||k7rt#d |d|d|tjd|yy#|j!wxYw#1swY}xYw)a This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). The method is just like the :func:`urlretrieve` function in the standard library, except that it allows digest computation to be done during download and checking that the downloaded data matched any expected value. :param url: The URL of the file to be downloaded (assumed to be available via an HTTP GET request). :param destfile: The pathname where the downloaded file is to be saved. :param digest: If specified, this must be a (hasher, value) tuple, where hasher is the algorithm used (e.g. ``'md5'``) and ``value`` is the expected value. :param reporthook: The same as for :func:`urlretrieve` in the standard library. NzNo digest specifiedrzDigest specified: %swbi rzcontent-lengthzContent-Lengthrz1retrieval incomplete: got only %d out of %d bytesz digest mismatch for z : expected z, got zDigest verified: %s)rZr[ isinstancelisttuplegetattrrr rOrinfointrlenr|rr\rr)r&rdestfiledigest reporthookdigesterhasherdfpsfpheaders blocksizesizerblocknumblockactuals r0 download_filezPackageIndex.download_filems, >H LL. /&4-0!'/ww/1H LL/&8 9(D ! S##GCL1C ((* #w.w'789DxD9HHY/E CJ&DIIe$ .MH!"8Y= 5 : 19"C,   '')F&7=x7=v(GHH LL. 7  5  s%2F+BFF+F((F++F4cg}|jr|j|j|jr|j|jt|}|j |S)z Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse). )rrYrr r )r&reqhandlersopeners r0rOzPackageIndex.send_requestsX  OOD11 2    OOD-- .x({{3r6c g}|j}|D]^\}}t|ttfs|g}|D];}|j d|zd|zj dd|j df=`|D]4\}} } |j d|zd|d| dj dd| f6|j d|zdzdfdj |} d |z} | tt| d } t|j| | S) a& Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, file_bytes) tuple. s--z)Content-Disposition: form-data; name="%s"rUr6z&Content-Disposition: form-data; name="z "; filename=""s smultipart/form-data; boundary=)z Content-typezContent-length) boundaryrrrrirrlstrrrr)r&rrpartsrkvaluesvkeyrnvaluebodyctrs r0rMzPackageIndex.encode_requests.== (IAvftUm4  ( H$@wHHW% '( ( (%*  C5 LL x!"(&/     eh&.45||E" . 9!#d)n txxw//r6ct|trd|i}t|jd} |j ||xsd|dS#|dwxYw)Nr]g@)timeoutandr\)rr r rsearch)r&termsoperator rpc_proxys r0rzPackageIndex.searchs[ e\ *UOE#6  !##E8+rsq ' ;;&   8 $'  _!6_!'&'sA A.-A.