f]~ ~ddlmZddlZddlZddlZddlZddlZddlZddlm Z m Z m Z m Z m Z mZddlmZmZmZddlmZej*dZ eeZGd d eZGd d e dZhdZhdZdhZdBdZ dCdZ!dDdZ"iddddddddddddd d d!d"d#d#d$d$d%d%d&d'd(d)d*d*d+d+d,d-d.d/dd0d1d2d3d4d5d6d7d8d9d: Z#e#jIDcic]\}}|| c}}Z%dEd;Z&e'Z(gd<Z)e d<Z*e+gd=Z,Gd>d?e eZ-Gd@dAZ.y#e$rGdd eZYwxYwcc}}w)F) annotationsN)AnyCallableGenericLiteral TypedDictcast) requirements specifiersutils)versionTc6eZdZUdZded<ded<d dZd dZy) ExceptionGroupzA minimal implementation of :external:exc:`ExceptionGroup` from Python 3.11. If :external:exc:`ExceptionGroup` is already defined by Python itself, that version is used instead. strmessagelist[Exception] exceptionsc ||_||_yN)rr)selfrrs [/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/packaging/metadata.py__init__zExceptionGroup.__init__&s"DL(DOch|jjd|jd|jdS)N(z, )) __class____name__rr)rs r__repr__zExceptionGroup.__repr__*s1nn--.a /?r$//ATTUV VrN)rrrrreturnNone)r"r)r __module__ __qualname____doc____annotations__rr!rrrrs  ## ) Wrrc2eZdZUdZded< dfd ZxZS)InvalidMetadataz'A metadata field contains invalid data.rfieldc2||_t| |yr)r+superr)rr+rrs rrzInvalidMetadata.__init__7s  !r)r+rrrr"r#)r r$r%r&r'r __classcell__)rs@rr*r*1s1 J;""rr*c*eZdZUdZded<ded<ded<ded<ded<ded <ded <ded <ded <ded <ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded <y!)" RawMetadataaA dictionary of raw core metadata. Each field in core metadata maps to a key of this dictionary (when data is provided). The key is lower-case and underscores are used instead of dashes compared to the equivalent core metadata field. Any core metadata field that can be specified multiple times or can hold multiple values in a single field have a key with a plural name. See :class:`Metadata` whose attributes match the keys of this dictionary. Core metadata fields that can be specified multiple times are stored as a list or dict depending on which is appropriate for the field. Any fields which hold multiple values in a single field are stored as a list. rmetadata_versionnamer list[str] platformssummary descriptionkeywords home_pageauthor author_emaillicensesupported_platforms download_url classifiersrequiresprovides obsoletes maintainermaintainer_email requires_dist provides_distobsoletes_distrequires_pythonrequires_externaldict[str, str] project_urlsdescription_content_typeprovides_extradynamicN)r r$r%r&r'r(rrr0r0@s   I L LN K L#"O    "!rr0F)total>r2r9r;r5rr8rBr6r:r=rGrCr1rK> rMr@r?rAr4r>rErDrFrLrHr<rJcf|jdDcgc]}|jc}Scc}w)zCSplit a string of comma-separate keyboards into a list of keywords.,)splitstrip)dataks r_parse_keywordsrUs$#zz# /!AGGI // /s.c i}|D]s}|jddDcgc]}|j}}|jdgtddt |z z|\}}||vr t d|||<u|Scc}w)z?Parse a list of label/URL string pairings separated by a comma.rPr rz duplicate labels in project urls)rQrRextendmaxlenKeyError)rSurlspairppartslabelurls r_parse_project_urlsrcs D$%)JJsA$67q77 bTSAE N345 s D==> >U AD K!8sA=ct|tr|j}|S|jd} |jddS#t$r t dwxYw)zGet the body of the message.Tdecodeutf8strictzpayload in an invalid encoding) isinstancer get_payloadrfUnicodeDecodeError ValueError)msgsourcepayloadbpayloads r _get_payloadrqsb&#(///6 ???684 4! ?=> > ?s AAr9z author-emailr: classifierr>r6zdescription-content-typerKz download-urlr=rMz home-pager8r7r;rBzmaintainer-emailrCmetadata-versionr1r2rAzobsoletes-distrFplatformr4r@rErLr?rDrHrGr5r<r) z project-urlr@z provides-distzprovides-extrar?z requires-distzrequires-externalzrequires-pythonr5zsupported-platformrc i}i}t|trHtjj tj j j|}nGtjjtj j j|}t|jD]}|j}|j|xsg}g}d}|D]}t|tjjtfsJt|tjjrg} tjj!|D]-\} } | j#ddd} | j'| | f/|j'ttjj)| |j'||s|||<'t*j-|} | |||<E| t.vrt1|dk(r |d|| <e| t2vr||| <t| d k(r!t1|dk(rt5|d|| <| d k(r t7||| <|||< t;||} | rfd |vrCt=t|j?d }|jAd gjC|| gnd |vr|d j'| n| |d < t=tJ||fS#t$$rd} d}YwxYw#t8$r |||<YdwxYw#tD$rB|jAd gj'|jGt|tH YwxYw) a Parse a distribution's metadata stored as email headers (e.g. from ``METADATA``). This function returns a two-item tuple of dicts. The first dict is of recognized fields from the core metadata specification. Fields that can be parsed and translated into Python's built-in types are converted appropriately. All other fields are left as-is. Fields that are allowed to appear multiple times are stored as lists. The second dict contains all other fields from the metadata. This includes any unrecognized fields. It also includes any fields which are expected to be parsed into a built-in type but were not formatted appropriately. Finally, any fields that are expected to appear only once but are repeated are included in this dict. )policyTrgrhlatin1Fr rr7rJr6re)&riremailparserParserrvcompat32parsestr BytesParser parsebytes frozensetkeyslowerget_allheaderHeader decode_headerrfrkappend make_header_EMAIL_TO_RAW_MAPPINGget_STRING_FIELDSr[ _LIST_FIELDSrUrcr\rqr pop setdefaultrYrlrjbytesr0)rSrawunparsedparsedr2headersvaluevalid_encodinghchunksbinencodingraw_namerodescription_headers r parse_emailrs? 8:C%'H$$$ELL,A,A$BKKDQ))1F1F)GRRSWX &++-(zz| ..&,"Aa%,,"5"5s!;< <<!U\\001:<%*\\%?%?%BMC* 684 $*MM3/2&C S!9!9&!ABC QGP"HTN (,,T2  #HTN  ~ %#e*/!!HCM %!CM  #E a+E!H5CM ' ' 3E :H #HTNi)t-vt, #%)#sww}/E%F"##M26=='1(*'..w7%,M"  S !8 ++Q./#+)./J '!& '  M2.55   ju&=  >  s7'K<L6 L%< L L L"!L"%AM0/M0)1.01.11.22.12.2z2.3)r1r2rceZdZUdZded<ded<ded<dd dd Zdd Zdd Z d dd ZddZ ddZ ddZ ddZ ddZ ddZ d dZd!dZ d"dZy )# _ValidatoravValidate a metadata field. All _process_*() methods correspond to a core metadata field. The method is called with the field's raw value. If the raw value is valid it is returned in its "enriched" form (e.g. ``version.Version`` for the ``Version`` field). If the raw value is invalid, :exc:`InvalidMetadata` is raised (with a cause as appropriate). rr2r_MetadataVersionaddedrrc||_yrr)rrs rrz_Validator.__init__s  rc.||_t||_yr)r2_RAW_TO_EMAIL_MAPPINGr)r_ownerr2s r __set_name__z_Validator.__set_name__s -d3 rcz|j}|jj|j}|jtvs|" t |d|j}||}|||j< |j|j=tt|S#t $rYBwxYw#t$rY*wxYw)N _process_) __dict___rawrr2_REQUIRED_ATTRSgetattrAttributeErrorr\r r)rinstancercacher converters r__get__z_Validator.__get__s!! !!$)), 99 '5+< )07 $))>U0V "%( dii  dii(Au~"     s$B8B. B+*B+. B:9B:Nc t|j|jdt|ji}||_|S)Nr+)r*r format_maprepr __cause__)rrmcauseexcs r_invalid_metadataz_Validator._invalid_metadatas< MM3>>7D4G*HI   rcZ|tvr|j|dtt|S)Nz is not a valid metadata version)_VALID_METADATA_VERSIONSrr rrrs r_process_metadata_versionz$_Validator._process_metadata_version s2 0 0((E94T)UV V$e,,rc|s|jd tj|d|S#tj$r}|j|d|d}~wwxYw)N{field} is a required fieldTvalidate is invalid for {field}r)rr canonicalize_name InvalidNamerrrs r _process_namez_Validator._process_namesp(()FG G   # #ED 9 L    (()45S)  s.AAAc|s|jd tj|S#tj$r}|j|d|d}~wwxYw)Nrrr)rversion_moduleparseInvalidVersionrs r_process_versionz_Validator._process_versionsh(()FG G !''. .,, (()45S)  s*AAAc0d|vr|jd|S)z%Check the field contains no newlines. z{field} must be a single line)rrs r_process_summaryz_Validator._process_summary(s 5=(()HI I rchd}tjj}||d<|jj |dj }}||vs||j vr |j dt|d||jdd}|dk7r|j dt|dd h}|jd d}|d k(r$||vr |j d t|d||S) N> text/plain text/x-rst text/markdownz content-typez{field} must be one of z, not charsetzUTF-8z0{field} can only specify the UTF-8 charset, not GFM CommonMarkvariantrz(valid Markdown variants for {field} are ) rxr EmailMessageget_content_typerparamsrlistr) rr content_typesr content_type parametersrmarkdown_variantsrs r!_process_description_content_typez,_Validator._process_description_content_type.s/E --,,."'  $ $ & , , . N # * *!  } , EKKM0Q((+D,?+@uiP ..G4 g ((DT']OT #L1..E2 ? *w>O/O((r2rrsz" is not allowed as a dynamic fieldz is not a valid dynamic field)maprrrrr)rr dynamic_fields r_process_dynamicz_Validator._process_dynamicNsz E2M GG,,iAB&;;,,y8U-VWW 3C 5)**rcg} |D](}|jtj|d* |S#tj$r}|j d|d}~wwxYw)NTrrr)rr rrr)rrnormalized_namesr2rs r_process_provides_extraz"_Validator._process_provides_extraXsy $ ''(?(?t(TU$ #    (((34C)  s-4A"AA"c tj|S#tj$r}|j|d|d}~wwxYwNrr)r SpecifierSetInvalidSpecifierrrs r_process_requires_pythonz#_Validator._process_requires_pythongsS **51 1** (()45S)  sAAAcg} |D]&}|jtj|( |S#tj$r}|j d|d}~wwxYwr)rr RequirementInvalidRequirementr)rrreqsreqrs r_process_requires_distz!_Validator._process_requires_distoso  L44S9: K.. Y((C72K)LTW(X X Ys+2A AA )rrr"r#)rMetadatar2rr"r#)rrrztype[Metadata]r"rr)rmrrzException | Noner"r*)rrr"r)rrr"r)rrr"zversion_module.Version)rr3r"r3)rr3r"zlist[utils.NormalizedName])rrr"zspecifiers.SpecifierSet)rr3r"zlist[requirements.Requirement])r r$r%r&r'rrrrrrrrrrrrrr(rrrrs IM  #(   4837/ -  @+ $ $ $ $   ( rrcfeZdZUdZded<eddd3dZeddd4dZeZ ded < eZ d ed < eZ d ed < edZ ded< eZ ded< edZded< eZded< eZded< edZded< eZded< eZded< edZded< eZded< eZded< edZded < edZded!< eZded"< edZded#< edZd$ed%< edZd&ed'< edZded(< edZd)ed*< edZd+ed,< edZ ded-< edZ!ded.< edZ"ded/< edZ#ded0< edZ$ded1<y2)5raJRepresentation of distribution metadata. Compared to :class:`RawMetadata`, this class provides objects representing metadata fields instead of only using built-in types. Any invalid metadata will cause :exc:`InvalidMetadata` to be raised (with a :py:attr:`~BaseException.__cause__` attribute as appropriate). r0rTrc|}|j|_|rg} |j}tj |}t|jtz}|dhz}|D]l} |r[ |j| j} tj | } | kDr't| } t | d} |j | at|| n|r td||S#t $r}|j |d}Yd}~d}~wwxYw#t$r#t | d| } |j | YwxYw#t $r} |j | Yd} ~ d} ~ wwxYw)zCreate an instance from :class:`RawMetadata`. If *validate* is true, all metadata will be validated. All exceptions related to validation will be gathered and raised as an :class:`ExceptionGroup`. Nr1unrecognized field: zW{field} introduced in metadata version {field_metadata_version}, not {metadata_version}zinvalid metadata)copyrr1rindexr*rrrrrr\rrr)clsrSrinsrr1 metadata_agemetadata_version_excfields_to_checkkeyfield_metadata_versionr field_ager+s rfrom_rawzMetadata.from_rawse99; *,J (##7 7==>NO (1OCO  23 3O&+'%58\\#5F5L5L2 %=$B$B2% %|3$9#$>E"1 %!S#C '--c2$C%/'6$%7DD Q# (!!"67#'  (" (%"1#9McW7U"VC&--c2$%"'+%%c**+sZ!C&+D>.DAD> D>& D /DD )D;8D>:D;;D>> E"EE"c$t|\}}|rEg}|D]0}|tvr|d}nd|}|jt||2|r t d| |j ||S#t$r}t d|j dd}~wwxYw)zParse metadata from email headers. If *validate* is true, the metadata will be validated. All exceptions related to validation will be gathered and raised as an :class:`ExceptionGroup`. z has invalid datarrrzinvalid or unparsed metadataN)rrrr*rrr) rrSrrrr unparsed_keyr exc_groups r from_emailzMetadata.from_emails$D) X *,J ( #88!- 00ABG 4\4DEG!!/,"HI !)$Z<< <<h<7 7  . 0D0D  sA** B3B  Bz_Validator[_MetadataVersion]r1z_Validator[str]r2z"_Validator[version_module.Version]rrrz_Validator[list[str] | None]rMr4rr<z_Validator[str | None]r5r6rrKr7r8r=r9r:rrBrCr;r>z1_Validator[list[requirements.Requirement] | None]rDz*_Validator[specifiers.SpecifierSet | None]rGrHz!_Validator[dict[str, str] | None]rJz-_Validator[list[utils.NormalizedName] | None]rLrErFr?r@rAN)rSr0rboolr"r)rS bytes | strrr r"r)%r r$r%r&r' classmethodrrrr1r2rrMr4r<r5r6rKr7r8r=r9r:rBrCr;r>rDrGrHrJrLrErFr?r@rAr(rrrr}sc =A66p?C66@\2A<&LD/(3=,G />:,6-G )D.8lI+:08B8O5O:&0lG #2R*4,K'637A7N4NL-7\H*90(2 I%41+5E+BL(B4%/\F "1.+5rs+" .-'FNN3$*$N"j"=)5=H"   0 %P?: hN-=   :  N y y,** F &!" #$"$&$,(/9<7L6Q6Q6ST seTm,`X FCDCDll^g%g%GWWWWnUsD# D9#D65D6