K iddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z m Z m Z mZmZmZddlmZmZmZmZddlmZddlmZe j2dZe j6d k\reZn Gd d eZGd d eZGddedZ hdZ!hdZ"dhZ#dFdZ$dGdZ%dHdZ&iddddddddddd d!d"d"d#d$d%d%d&d&d'd(d)d*d+d+d,d-d.d/d0d0d1d1d2d3dd4d5d6d7d8d9d:d;d Z'e'jQDcic]\}}|| c}}Z)dId?Z*e+Z,gd@Z-ed@Z.e/gdAZ0GdBdCe eZ1GdDdEZ2ycc}}w)J) annotationsN)AnyCallableGenericLiteral TypedDictcast)licenses requirements specifiersutils)version)NormalizedLicenseExpressionT) c6eZdZUdZded<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 X/mnt/ssd/data/python-lab/Trading/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/rr#s rrzInvalidMetadata.__init__7s  !r)r/rrrr&r')r$r(r)r*r+r __classcell__)r#s@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 <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_extradynamiclicense_expression license_filesN)r$r(r)r*r+r,rrr4r4@s   I L LN K L#"O    "!rr4F)total>r6r=r?r9rr<rFr:r>rArKrGr5rRrO> rQrDrCrEr8rBrSrIrHrJrPrLr@rNcf|jdDcgc]}|jc}Scc}w)zCSplit a string of comma-separated keywords into a list of keywords.,)splitstrip)dataks r_parse_keywordsr[s$#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.rVr rz duplicate labels in project urls)rWrXextendmaxlenKeyError)rYurlspairppartslabelurls r_parse_project_urlsris D $%)JJsA$67q77 bTSAE N345 s D==> >U A D K!8sA=ct|tr$|j}t|tsJ|S|jd}t|tsJ |j ddS#t $r}t d|d}~wwxYw)zGet the body of the message.Tdecodeutf8strictzpayload in an invalid encodingN) isinstancer get_payloadbytesrlUnicodeDecodeError ValueError)msgsourcepayloadbpayloadexcs r _get_payloadrys&#//#'3'''??$?/(E*** H??684 4! H=>C G HsA,, B5 BBr=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-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. )policyTrmrnlatin1Fr rr;rNr:rk)&roremailparserParserr~compat32parsestr BytesParser parsebytes frozensetkeyslowerget_allheaderHeader decode_headerrlrrappend make_header_EMAIL_TO_RAW_MAPPINGget_STRING_FIELDSra _LIST_FIELDSr[rirbryr pop setdefaultr_rsrprqr4)rYrawunparsedparsedr6headersvaluevalid_encodinghchunksbinencodingraw_namervdescription_headers r parse_emailrsO 8:C%'H$$$ELL,A,A$BKKDQ))1F1F)GRRSWX &++-(t#zz| ..&,"# Aa%,,"5"5s!;< <<!U\\001:<%*\\%?%?%B 3MC* 684 $*MM3/2 3 S!9!9&!ABC QG# P"HTN (,,T2  #HTN  ~ %#e*/!!HCM %!CM  #E a+E!H5CM ' ' 3E :H #HTNit#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.32.4)r5r6rceZdZUdZded<ded<ded<dd dd Zdd Zdd Z d dd ZddZ ddZ d dZ ddZ ddZ d!dZ d"dZd#dZ d$dZ d%dZd!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). rr6r_MetadataVersionaddedrrc||_yrr)rrs rrz_Validator.__init__s  rc.||_t||_yr)r6_RAW_TO_EMAIL_MAPPINGr)r_ownerr6s 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___rawrr6_REQUIRED_ATTRSgetattrAttributeErrorrbr 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__)rrtcauserxs r_invalid_metadataz_Validator._invalid_metadata s< 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_versions2 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)rrcanonicalize_name InvalidNamerrrxs r _process_namez_Validator._process_namess(()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_version(sk(()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_summary2s 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 , 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_type8s/E --,,."'  $ $ & , , . N # * *!  } , EKKM0Q((+D,?+@uiP ..G4 g ((DT']OT #L1..E2 ? *w>O/O((r6rr{z" is not allowed as a dynamic fieldz is not a valid dynamic field)maprrrrr)rr dynamic_fields r_process_dynamicz_Validator._process_dynamicXs E2 M GG,,$''IJ&;;,,$''DE  C 5)**rcg} |D](}|jtj|d* |S#tj$r}|j d||d}~wwxYw)NTrrr)rrrrr)rrnormalized_namesr6rxs r_process_provides_extraz"_Validator._process_provides_extrads $ V ''(?(?t(TU V$ #    (((34C)  s-4A#AA#c tj|S#tj$r}|j|d||d}~wwxYwNrr)r SpecifierSetInvalidSpecifierrrs r_process_requires_pythonz#_Validator._process_requires_pythonssV **51 1** (()45S)  sAAAcg} |D]&}|jtj|( |S#tj$r}|j d||d}~wwxYwr)rr RequirementInvalidRequirementr)rrreqsreqrxs r_process_requires_distz!_Validator._process_requires_dist{s{  ; L44S9: ;K .. (('233)  s+2A!AA!c~ tj|S#t$r}|j|d||d}~wwxYwr)r canonicalize_license_expressionrsrrs r_process_license_expressionz&_Validator._process_license_expressionsP ;;EB B (()45S)  s <7<cg}|D]}d|vr|j|dd|vr|j|dtj|js#tj|jr|j|dtj|j |k7r|j|d|j ||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_filess Dt|,,hBBd{,,hOP%%d+779**40<<>,,hOP&&t,5574?,,hUV LL + , r)rrr&r')rMetadatar6rr&r')rr rztype[Metadata]r&rr)rtrrzException | Noner&r.)rrr&r)rrr&r)rrr&zversion_module.Version)rr7r&r7)rr7r&zlist[utils.NormalizedName])rrr&zspecifiers.SpecifierSet)rr7r&zlist[requirements.Requirement])rrr&z"NormalizedLicenseExpression | None)r$r(r)r*r+rrrrrrrrrrrrrrr r,rrrrs IM  #(   4837/ -  @ + $ $ $ $   (  +rrceZdZUdZded<eddd7dZeddd8dZeZ ded < eZ d ed < eZ d ed < edZ ded< eZ ded< edZded< eZded< eZded< edZded< eZded< eZded< edZded< eZded< eZded< edZded < edZded!< eZded"< ed#Zd$ed%< ed#Zded&< edZded'< edZd(ed)< edZd*ed+< edZded,< edZ d-ed.< edZ!d/ed0< edZ"ded1< edZ#ded2< edZ$ded3< edZ%ded4< edZ&ded5<y6)9r aJRepresentation 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). r4rTrc |}|j|_|rg} |j}tj |}t|jtz}|dhz}|D]t} |rc |j| j} tj | } | kDr/t| } t | | d| d|} |j | it|| v|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`. Nr5unrecognized field: z introduced in metadata version rzinvalid metadata)copyrr5rindexr.rrrrrrbrrr)clsrYrinsrr5 metadata_agemetadata_version_excfields_to_checkkeyfield_metadata_versionrx field_ager/s rfrom_rawzMetadata.from_rawse99; *,J (##7 7==>NO (1OCO  23 3O& ++'%58\\#5F5L5L2 %=$B$B2% %|3$9#$>E"1 %#(')I#9":&AQ@R!T#C '--c2$C%/ +6$%7DD Q# (!!"67#'  (" (%"1#9McW7U"VC&--c2$%"'+%%c**+sZ!C.+E.DAE E. D7DD)EEEE E*E%%E*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) rrYrrrr unparsed_keyr exc_groups r from_emailzMetadata.from_emails$D) X *,J ( J #88!- 00ABG 4\4DEG!!/,"HI  J$Z<< <<h<7 7  . 0D0D  sA** B3B  Bz_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)rYr4rboolr&r )rY bytes | strrrr&r )'r$r(r)r*r+ classmethodrrrr5r6rrQr8r@r9r:rOr;r<rAr=r>rFrGr?rRrSrBrHrKrLrNrPrIrJrCrDrEr,rrr r s =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.+5r0s1" 87'1FNN3w#NWW$"j"E)5EP$ " 0 %PH> hN-=   :  N y y.O,**  F!"#$'!$&$,(/=@7L6Q6Q6ST seTm,`X MJKCDTTno%o%i Us E