h gʇddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z m Z m Z mZmZmZddlmZmZmZmZddlmZddlmZe jdZe jd kreZnGd d eZGd d eZGddedZ hdZ!hdZ"dhZ#dQdZ$dRdZ%dSd Z&id!d!d"d#d$d%d&d&d'd(d)d*d+d+d,d-d.d.d/d/d0d1d2d3d4d4d5d6d7d8d9d9d:d:d;dd?d@dAdBdCdDdEdFdG Z'dHe'(DZ)dTdJZ*e+Z,gdKZ-edKZ.e/gdLZ0GdMdNe eZ1GdOdPZ2dS)U) annotationsN)AnyCallableGenericLiteral TypedDictcast)licenses requirements specifiersutils)version)NormalizedLicenseExpressionT) c8eZdZUdZded<ded<d dZd d Zd S) 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] exceptionsreturnNonec"||_||_dSN)rr)selfrrs b/home/jenkins/workspace/simtester-sanitize/venv/lib/python3.11/site-packages/packaging/metadata.py__init__zExceptionGroup.__init__)s"DL(DOOOc@|jjd|jd|jdS)N(z, )) __class____name__rr)rs r__repr__zExceptionGroup.__repr__-s*n-VV VV$/VVV Vr!N)rrrrrr)rr)r& __module__ __qualname____doc____annotations__r r'r!rrrse   #### ) ) ) ) W W W W W Wr!rc2eZdZUdZded< dfd ZxZS) InvalidMetadataz'A metadata field contains invalid data.rfieldrrrcX||_t|dSr)r/superr )rr/rr%s rr zInvalidMetadata.__init__7s(  !!!!!r!)r/rrrrr)r&r(r)r*r+r __classcell__)r%s@rr.r.1sQ11JJJ;""""""""""r!r.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 <ded!<ded"<d#S)$ 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_extradynamiclicense_expression license_filesN)r&r(r)r*r+r,r!rr4r4@s{    IIILLLLLLNNNKKKLLL#"""OOO        "!!!r!r4F)total>r6r=r?r9rr<rFr:r>rArKrGr5rRrO> rQrDrCrEr8rBrSrIrHrJrPrLr@rNdatarrr7c@d|dDS)zCSplit a string of comma-separated keywords into a list of keywords.c6g|]}|Sr,strip).0ks r z#_parse_keywords..s / / /!AGGII / / /r!,)split)rUs r_parse_keywordsr_s / /tzz# / / //r!rMc i}|D]v}d|ddD}|dgtddt|z z|\}}||vrt d|||<w|S)z?Parse a list of label/URL string pairings separated by a comma.c6g|]}|Sr,rX)rZps rr\z'_parse_project_urls..s 777q777r!r]r rz duplicate labels in project urls)r^extendmaxlenKeyError)rUurlspairpartslabelurls r_parse_project_urlsrns D  $87DJJsA$6$6777 bTSAE N334555 s D===>> >U Kr!msgemail.message.Messagesource bytes | strcRt|tr-|}t|tsJ|S|d}t|tsJ |ddS#t $r}t d|d}~wwxYw)zGet the body of the message.Tdecodeutf8strictzpayload in an invalid encodingN) isinstancer get_payloadbytesruUnicodeDecodeError ValueError)rorqpayloadbpayloadexcs r _get_payloadrs&# H//##'3'''''??$?//(E***** H??6844 4! H H H=>>C G Hs1B B&B!!B&r=z author-emailr> classifierrBr:zdescription-content-typerOz download-urlrArQz home-pager<r;r?zlicense-expressionrRz license-filerSrFzmaintainer-emailrGmetadata-versionr5r6rErJr8rDrIrPrCrHrLrKr9r@r) zobsoletes-distplatformz project-urlrDz provides-distzprovides-extrarCz requires-distzrequires-externalzrequires-pythonr9zsupported-platformrci|]\}}|| Sr,r,)rZemailraws r rsTTT seTTTr!(tuple[RawMetadata, dict[str, list[str]]]c i}i}t|trCtjtjj|}nBtjtjj |}t| D]}| }| |pg}g}d}|D] }t|tjjtfsJt|tjjrg} tj|D]J\} } | ddd} n#t$$rd} d}YnwxYw| | | fK|ttj| || |s|||<Jt*|} | |||<m| t.vr t1|dkr |d || <| t2vr||| <| d kr-t1|dkrt5|d || <| d kr+ t7||| <#t8$r |||<YwxYw|||< t;||} | r}d |vrTt=t|d }| d g!|| gnd |vr|d | nf| |d <n`#tD$rS| d g|#t|tH YnwxYwt=tJ||fS)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. )policyTrvrwlatin1FNr rr;rNr:rt)&rxrrparserParserrcompat32parsestr BytesParser parsebytes frozensetkeyslowerget_allheaderHeader decode_headerrur{append make_header_EMAIL_TO_RAW_MAPPINGget_STRING_FIELDSrg _LIST_FIELDSr_rnrhrr pop setdefaultrer|ryrzr4)rUrunparsedparsedr6headersvaluevalid_encodinghchunksbinencodingraw_namer}description_headers r parse_emailrs/ 8:C%'H$Y$$EL,A$BBKKDQQ))1F)GGRRSWXX &++--((t#t#zz|| ..&&,"# # Aa%,"5s!;<< < < <!U\011 :<%*\%?%?%B%B 3 3MC* 68444 $* .///#+)./ MM3/2222  S!9!9&!A!ABBCCCC Q  "HTN (,,T22  #HTN  ~ % %#e**//!!HCMM % %!CMM  # #E a+E!H55CMM ' ' ' 3E : :H  ' ' '!& ' #HTNN -vt,,  -##%)#sww}/E/E%F%F"##M266=='1(**'..w7777%,M"!    M2..55   ju&=&=  > >      ,  S ! !8 ++s7%E>>F F J44KKM""AN?>N?)1.01.11.22.12.2z2.32.4)r5r6rceZdZUdZded<ded<ded<ddd+d Zd,dZd-dZ d.d/dZd0dZ d1dZ d2dZ d1dZ d1dZ d3d!Zd4d#Zd5d%Zd6d'Zd7d)Zd3d*ZdS)8 _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). rr6r_MetadataVersionaddedrrrrc||_dSrr)rrs rr z_Validator.__init__s  r!_ownerMetadatac8||_t||_dSr)r6_RAW_TO_EMAIL_MAPPINGr)rrr6s r __set_name__z_Validator.__set_name__s -d3 r!instancetype[Metadata]rcT|j}|j|j}|jtvs|5 t |d|j}||}n#t $rYnwxYw|||j< |j|j=n#t$rYnwxYwtt|S)N _process_) __dict___rawrr6_REQUIRED_ATTRSgetattrAttributeErrorrhr r)rrrcacher converters r__get__z_Validator.__get__s! !!$),, 9 ' '5+< )07>U$)>U>U0V0V " %(("     !di  di((    D Au~~s#A A)(A)7 B BBNrocauseException | Noner.c t|j|dt|ji}||_|S)Nr/)r.r format_maprepr __cause__)rrorrs r_invalid_metadataz_Validator._invalid_metadata sC M3>>7D4G4G*HII    r!rcn|tvr||dtt|S)Nz is not a valid metadata version)_VALID_METADATA_VERSIONSrr rrrs r_process_metadata_versionz$_Validator._process_metadata_versions< 0 0 0((E)U)U)UVV V$e,,,r!c|s|d tj|d|S#tj$r }||d||d}~wwxYw)N{field} is a required fieldTvalidate is invalid for {field}r)rrcanonicalize_name InvalidNamerrrs r _process_namez_Validator._process_names H(()FGG G   #ED 9 9 9 9 L     ((555S)  s1A AA version_module.Versionc|s|d tj|S#tj$r }||d||d}~wwxYw)Nrrr)rversion_moduleparseInvalidVersionrs r_process_versionz_Validator._process_version(s H(()FGG G !'.. .,   ((555S)  s-AAAc8d|vr|d|S)z%Check the field contains no newlines. z{field} must be a single line)rrs r_process_summaryz_Validator._process_summary2s% 5==(()HII I r!cXhd}tj}||d<||dj}}||vs||vr(|dt|d||dd}|dkr%|dt|dd h}|d d}|d kr,||vr(|d t|d||S) N> text/plain text/x-rst text/markdownz content-typez{field} must be one of , not charsetzUTF-8z0{field} can only specify the UTF-8 charset, not GFM CommonMarkvariantrz(valid Markdown variants for {field} are ) rr EmailMessageget_content_typerparamsrlistr) rr content_typesr content_type parametersrmarkdown_variantsrs r!_process_description_content_typez,_Validator._process_description_content_type8spEEE -,,.."'  $ $ & & , , . . N # *!  } , , EKKMM0Q0Q((PD,?,?PPuPP ..G44 g  ((TT']]TT #L1..E22 ? * *w>O/O/O((#TBS=T=T####  r!r7cttj|D]?}|dvr||d|tvr||d@t ttj|S)N>r6rrz" is not allowed as a dynamic fieldz is not a valid dynamic field)maprrrrr)rr dynamic_fields r_process_dynamicz_Validator._process_dynamicXs E22  M GGG,,$JJJ&;;;,,$EEE<C 5))***r!list[utils.NormalizedName]cg} |D]+}|tj|d, |S#tj$r }||d||d}~wwxYw)NTrrr)rrrrr)rrnormalized_namesr6rs r_process_provides_extraz"_Validator._process_provides_extrads $ V V ''(?t(T(T(TUUUU V$ #     ((444C)  s.5A$AA$specifiers.SpecifierSetc tj|S#tj$r }||d||d}~wwxYwNrr)r SpecifierSetInvalidSpecifierrrs r_process_requires_pythonz#_Validator._process_requires_pythonssh *511 1*   ((555S)  sAAAlist[requirements.Requirement]cg} |D])}|tj|* |S#tj$r }||d||d}~wwxYwr)rr RequirementInvalidRequirementr)rrreqsreqrs r_process_requires_distz!_Validator._process_requires_dist{s  ; ; L4S99:::: ;K .   ((3333)  s,3A"AA""NormalizedLicenseExpression | Nonec tj|S#t$r }||d||d}~wwxYwr)r canonicalize_license_expressionr|rrs r_process_license_expressionz&_Validator._process_license_expressionse ;EBB B   ((555S)  s A;Acg}|D]}d|vr||dd|vr||dtj|s&tj|r||dtj||kr||d|||S)Nz..zD is invalid for {field}, parent directory indicators are not allowed*z/ is invalid for {field}, paths must be resolvedz/ is invalid for {field}, paths must be relativez5 is invalid for {field}, paths must use '/' delimiter)rpathlib PurePosixPath is_absolutePureWindowsPathas_posixr)rrpathspaths r_process_license_filesz!_Validator._process_license_filessK  Dt||,,BBBd{{,,PPP%d++7799 *400<<>> ,,PPP&t,,55774??,,333 LL     r!)rrrr)rrr6rrr)rrrrrrr)rorrrrr.)rrrr)rrrr)rrrr)rr7rr7)rr7rr)rrrr)rr7rr)rrrr)r&r(r)r*r+r rrrrrrrrrrrrrrr,r!rrrsIIIMMM #(4444837----     @ + + + + $ $ $ $    r!rcdeZdZUdZded<edddraJRepresentation 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). r4rTrrUrboolrc 6|}||_|rrg} |j}t|}n.#t $r!}||d}Yd}~nd}~wwxYwt|jtz}|dhz}|D]} |r |j | j } n8#t$r+t | d| } || YMwxYwt| } | |kr;t| } t | | d| d|} || t|| #t $r} || Yd} ~ d} ~ wwxYw|rtd||S)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`. Nr5unrecognized field: z introduced in metadata version rzinvalid metadata)copyrr5rindexr.rrrrrrhrrr)clsrUrinsrr5 metadata_agemetadata_version_excfields_to_checkkeyfield_metadata_versionr field_ager/s rfrom_rawzMetadata.from_raws<cee99;; + E*,J (# 7==>NOO " ( ( (!!"6777#'       ( (11OCO  23 3O& + ++'%%58\#5F5L22'%%%"1#7Uc7U7U"V"VC&--c222$H%%=$B$B2%% %|33$9#$>E"1 %#(!T!T#9!T!TAQ!T!T##C '--c222$C%%%%&+++%%c********+ E$%7DDD sZ!A A7A22A7!E$B76E72C,)E+C,,AE E F%E??FrrcJt|\}}|rPg}|D]9}|tvr|d}nd|}|t||:|rt d| |||S#t$r}t d|jdd}~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 datar rrzinvalid or unparsed metadataN)rrrr.rr+r) r#rUrrrr unparsed_keyr exc_groups r from_emailzMetadata.from_emails$D)) X  =*,J ( J J #888!-BBBGGE\EEG!!/,"H"HIIII =$Z<<< <<h<77 7    . 0D  s&A== B"BB"z_Validator[_MetadataVersion]r5z_Validator[str]r6z"_Validator[version_module.Version]rrrz_Validator[list[str] | None]rQr8rr@z_Validator[str | None]r9r:rrOr;r<rAr=r>rrFrGr?rz._Validator[NormalizedLicenseExpression | None]rRrSrBz1_Validator[list[requirements.Requirement] | None]rHz*_Validator[specifiers.SpecifierSet | None]rKrLz!_Validator[dict[str, str] | None]rNz-_Validator[list[utils.NormalizedName] | None]rPrIrJrCrDrEN)rUr4rrrr)rUrrrrrr)'r&r(r)r*r+ classmethodr+r/rr5r6rrQr8r@r9r:rOr;r<rAr=r>rFrGr?rRrSrBrHrKrLrNrPrIrJrCrDrEr,r!rrrs=A66666[6p?C[66@Z\\AAAA<'JLLD((((3=*,,G>>>>:,6J---GD.8jllI::::08B 8O8O8OOOOO:&0jllG2222R*4*,,K666637Az7N7N7NNNNNL-7Z\\H99990(2 I44441+5:E+B+B+BLBBBB4%/Z\\F1111.+5:<r@s1"""""" 877777777777''''''111111FN3w#NNWWWWWWWW$"""""j"""EEEEE)5EEEEP$ " 0000 %%%%PHHHH> hN-=   :  N y y.O,**  F!"#$'!$&$,(/=@UT6K6Q6Q6S6STTTm,m,m,m,`VXX MLLJK)CCCDDUUUUUUUUpo%o%o%o%o%o%o%o%o%o%r!