
    |g]~                    ~   d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlm	Z	m
Z
mZmZmZmZ ddlmZmZmZ ddlmZ  ej*                  d      Z	 e eZ G d
 de      Z G d ded      Zh dZh dZdhZdBdZ dCdZ!dDdZ"i ddddddddddddd d d!d"d#d#d$d$d%d%d&d'd(d)d*d*d+d+d,d-d.d/dd0d1d2d3d4d5d6d7d8d9d:Z#e#jI                         D  ci c]  \  } }|| 
 c}} Z%dEd;Z& e'       Z(g d<Z)ed<   Z* e+g d=      Z, G d> d?ee         Z- G d@ dA      Z.y# e$ r  G d d	e      ZY w xY wc c}} w )F    )annotationsN)AnyCallableGenericLiteral	TypedDictcast   )requirements
specifiersutils)versionTc                  6    e Zd ZU dZded<   ded<   d	dZd
dZy)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.
        strmessagelist[Exception]
exceptionsc                     || _         || _        y N)r   r   )selfr   r   s      b/var/www/html/pythonbot/venv/lib/python3.12/site-packages/setuptools/_vendor/packaging/metadata.py__init__zExceptionGroup.__init__&   s    "DL(DO    c                h    | j                   j                   d| j                  d| j                  dS )N(z, ))	__class____name__r   r   )r   s    r   __repr__zExceptionGroup.__repr__*   s1    nn--.a/?r$//ATTUVVr   N)r   r   r   r   returnNone)r"   r   )r    
__module____qualname____doc____annotations__r   r!    r   r   r   r      s    	 ##	)	Wr   r   c                  2     e Zd ZU dZded<   	 d fdZ xZS )InvalidMetadataz'A metadata field contains invalid data.r   fieldc                2    || _         t        | 	  |       y r   )r+   superr   )r   r+   r   r   s      r   r   zInvalidMetadata.__init__7   s    
!r   )r+   r   r   r   r"   r#   )r    r$   r%   r&   r'   r   __classcell__)r   s   @r   r*   r*   1   s    1J;" "r   r*   c                  *   e Zd ZU dZded<   ded<   ded<   ded<   ded<   ded	<   ded
<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded <   y!)"RawMetadataa  A 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.

    r   metadata_versionnamer   	list[str]	platformssummarydescriptionkeywords	home_pageauthorauthor_emaillicensesupported_platformsdownload_urlclassifiersrequiresprovides	obsoletes
maintainermaintainer_emailrequires_distprovides_distobsoletes_distrequires_pythonrequires_externaldict[str, str]project_urlsdescription_content_typeprovides_extradynamicN)r    r$   r%   r&   r'   r(   r   r   r0   r0   @   s      
ILLNKL #" O     "! r   r0   F)total>   r2   r9   r;   r5   r   r8   rB   r6   r:   r=   rG   rC   r1   rK   >   rM   r@   r?   rA   r4   r>   rE   rD   rF   rL   rH   r<   rJ   c                f    | j                  d      D cg c]  }|j                          c}S c c}w )zCSplit a string of comma-separate keyboards into a list of keywords.,)splitstrip)dataks     r   _parse_keywordsrU      s$    #zz#/!AGGI///s   .c                   i }| D ]s  }|j                  dd      D cg c]  }|j                          }}|j                  dgt        ddt	        |      z
        z         |\  }}||v rt        d      |||<   u |S c c}w )z?Parse a list of label/URL string pairings separated by a comma.rP   r
    r      z duplicate labels in project urls)rQ   rR   extendmaxlenKeyError)rS   urlspairppartslabelurls          r   _parse_project_urlsrc      s    D  $ %)JJsA$67q77bTSAE
N345 
sD= =>>UA D K! 8s   A=c                    t        |t              r| j                         }|S | j                  d      }	 |j                  dd      S # t        $ r t        d      w xY w)zGet the body of the message.Tdecodeutf8strictzpayload in an invalid encoding)
isinstancer   get_payloadrf   UnicodeDecodeError
ValueError)msgsourcepayloadbpayloads       r   _get_payloadrq      sb     &#( ///6	???6844! 	?=>>	?s   A Ar9   zauthor-emailr:   
classifierr>   r6   zdescription-content-typerK   zdownload-urlr=   rM   z	home-pager8   r7   r;   rB   zmaintainer-emailrC   metadata-versionr1   r2   rA   zobsoletes-distrF   platformr4   r@   rE   rL   r?   rD   rH   rG   r5   r<   r   )zproject-urlr@   zprovides-distzprovides-extrar?   zrequires-distzrequires-externalzrequires-pythonr5   zsupported-platformr   c           	        i }i }t        | t              rHt        j                  j	                  t        j
                  j                        j                  |       }nGt        j                  j                  t        j
                  j                        j                  |       }t        |j                               D ]  }|j                         }|j                  |      xs g }g }d}|D ]  }t        |t        j                  j                  t        f      sJ t        |t        j                  j                        rg }	t        j                  j!                  |      D ]-  \  }
}	 |
j#                  dd       d}|	j'                  |
|f       / |j'                  t        t        j                  j)                  |	                   |j'                  |        |s|||<   't*        j-                  |      }||||<   E|t.        v rt1        |      dk(  r
|d   ||<   e|t2        v r|||<   t|d	k(  r!t1        |      dk(  rt5        |d         ||<   |d
k(  r	 t7        |      ||<   |||<    	 t;        ||       }|rfd|v rCt=        t        |j?                  d            }|jA                  dg       jC                  ||g       nd|v r|d   j'                  |       n||d<   	 t=        tJ        |      |fS # t$        $ r d}d}Y w xY w# t8        $ r	 |||<   Y dw xY w# tD        $ rB |jA                  dg       j'                  |jG                  t        | tH                           Y w xY w)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.

    )policyTrg   rh   latin1Fr
   r   r7   rJ   r6   re   )&ri   r   emailparserParserrv   compat32parsestrBytesParser
parsebytes	frozensetkeyslowerget_allheaderHeaderdecode_headerrf   rk   appendmake_header_EMAIL_TO_RAW_MAPPINGget_STRING_FIELDSr[   _LIST_FIELDSrU   rc   r\   rq   r	   pop
setdefaultrY   rl   rj   bytesr0   )rS   rawunparsedparsedr2   headersvaluevalid_encodinghchunksbinencodingraw_namero   description_headers                  r   parse_emailr     sO     8:C%'H$$$ELL,A,A$BKKDQ))1F1F)GRRSWX
 &++-( t# zz|
 ..&,"   #	 A a%,,"5"5s!;<<< !U\\001 :<%*\\%?%?%B 	3MC*

684 $*MM3/2	3 S!9!9&!ABC QG#	 P "HTN(,,T2 #HTN ~%#e*/!!HCM %!CM #E
a+E!H5CM '' 3E :H #HTNit#t-vt,  #%)#sww}/E%F"##M26=='1 (*'..w7%,M" S!8++Q . /#+)./J  '!&'  
M2.55ju&=>	

s7   'K<L6L% <L	L	L"!L"%AM0/M0)1.01.11.22.12.2z2.3)r1   r2   r   c                      e Zd ZU dZded<   ded<   ded<   dd	 	 	 dd	Zdd
ZddZ	 d	 	 	 	 	 ddZddZ	ddZ
ddZddZddZddZ	 	 	 	 d dZd!dZ	 	 	 	 d"dZy)#
_Validatorav  Validate 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).
    r   r2   r   _MetadataVersionaddedr   r   c                   || _         y r   r   )r   r   s     r   r   z_Validator.__init__  s    
 
r   c                .    || _         t        |   | _        y r   )r2   _RAW_TO_EMAIL_MAPPINGr   )r   _ownerr2   s      r   __set_name__z_Validator.__set_name__  s    	-d3r   c                z   |j                   }|j                  j                  | j                        }| j                  t        v s|"	 t        | d| j                         } ||      }||| j                  <   	 |j                  | j                  = t        t        |      S # t        $ r Y Bw xY w# t        $ r Y *w xY w)N	_process_)
__dict___rawr   r2   _REQUIRED_ATTRSgetattrAttributeErrorr\   r	   r   )r   instancer   cacher   	converters         r   __get__z_Validator.__get__  s     !!!!$)), 99'5+<)07	$))>U0V	 "%( dii	dii( Au~ "   		s$   B 8B. 	B+*B+.	B:9B:Nc           	         t        | j                  |j                  dt        | j                        i            }||_        |S )Nr+   )r*   r   
format_maprepr	__cause__)r   rm   causeexcs       r   _invalid_metadataz_Validator._invalid_metadata  s<     MM3>>7D4G*HI
 
r   c                Z    |t         vr| j                  |d      t        t        |      S )Nz  is not a valid metadata version)_VALID_METADATA_VERSIONSr   r	   r   r   r   s     r   _process_metadata_versionz$_Validator._process_metadata_version  s2    00((E94T)UVV$e,,r   c                    |s| j                  d      	 t        j                  |d       |S # t        j                  $ r}| j                  |d|      d }~ww xY w)N{field} is a required fieldTvalidate is invalid for {field}r   )r   r   canonicalize_nameInvalidNamer   r   r   s      r   _process_namez_Validator._process_name  sp    (()FGG	##ED9 L    	(()45S )  	s   . AAAc                    |s| j                  d      	 t        j                  |      S # t        j                  $ r}| j                  |d|      d }~ww xY w)Nr   r   r   )r   version_moduleparseInvalidVersionr   s      r   _process_versionz_Validator._process_version  sh    (()FGG	!''..,, 	(()45S )  	s   * AAAc                0    d|v r| j                  d      |S )z%Check the field contains no newlines.
z{field} must be a single line)r   r   s     r   _process_summaryz_Validator._process_summary(  s     5=(()HIIr   c                    h d}t         j                  j                         }||d<   |j                         j	                         |d   j
                  }}||vs||j	                         vr | j                  dt        |       d|      |j                  dd      }|dk7  r| j                  dt        |             dd	h}|j                  d
d      }|dk(  r$||vr | j                  dt        |       d|      |S )N>   
text/plain
text/x-rsttext/markdownzcontent-typez{field} must be one of z, not charsetzUTF-8z0{field} can only specify the UTF-8 charset, not GFM
CommonMarkvariantr   z(valid Markdown variants for {field} are )	rx   r   EmailMessageget_content_typer   paramsr   listr   )	r   r   content_typesr   content_type
parametersr   markdown_variantsr   s	            r   !_process_description_content_typez,_Validator._process_description_content_type.  s/   E--,,."' $$&,,.N#** ! },EKKM0Q((+D,?+@uiP  ..G4g((DT']OT  #L1..E2?*w>O/O((<TBS=T<U Vk#  r   c                    t        t        j                  |      D ]6  }|dv r| j                  |d      |t        vs$| j                  |d       t        t        t        j                  |            S )N>   r2   r   rs   z" is not allowed as a dynamic fieldz is not a valid dynamic field)mapr   r   r   r   r   )r   r   dynamic_fields      r   _process_dynamicz_Validator._process_dynamicN  s     E2 	XM GG,,iAB  &;;,,y8U-VWW	X C		5)**r   c                    g }	 |D ](  }|j                  t        j                  |d             * 	 |S # t        j                  $ r}| j	                  d|      d }~ww xY w)NTr   r   r   )r   r   r   r   r   )r   r   normalized_namesr2   r   s        r   _process_provides_extraz"_Validator._process_provides_extraX  s     	$ V ''(?(?t(TUV $#    	(((34C )  	s   -4 A"AA"c                    	 t        j                  |      S # t         j                  $ r}| j                  |d|      d }~ww xY wNr   r   )r   SpecifierSetInvalidSpecifierr   r   s      r   _process_requires_pythonz#_Validator._process_requires_pythong  sS    	**511** 	(()45S )  	s    AA  Ac                    g }	 |D ]&  }|j                  t        j                  |             ( 	 |S # t        j                  $ r}| j	                  d|      d }~ww xY wr   )r   r   RequirementInvalidRequirementr   )r   r   reqsreqr   s        r   _process_requires_distz!_Validator._process_requires_disto  st     	 ;L44S9:;
 K .. 	Y((C72K)LTW(XX	Ys   +2 A AA )r   r   r"   r#   )r   Metadatar2   r   r"   r#   )r   r   r   ztype[Metadata]r"   r   r   )rm   r   r   zException | Noner"   r*   )r   r   r"   r   )r   r   r"   r   )r   r   r"   zversion_module.Version)r   r3   r"   r3   )r   r3   r"   zlist[utils.NormalizedName])r   r   r"   zspecifiers.SpecifierSet)r   r3   r"   zlist[requirements.Requirement])r    r$   r%   r&   r'   r   r   r   r   r   r   r   r   r   r   r   r   r   r(   r   r   r   r     s     IM
 #(   
	48 37/	-@+$$ 
$$ 
(r   r   c                  f   e Zd ZU dZded<   eddd3d       Zeddd4d       Z e       Z	ded	<   	  e       Z
d
ed<   	  e       Zded<   	  ed      Zded<   	  e       Zded<   	  ed      Zded<   	  e       Zded<   	  e       Zded<   	  ed      Zded<   	  e       Zded<   	  e       Zded<   	  ed      Zded<   	  e       Zded<   	  e       Zded<   	  ed      Zded <   	  ed      Zded!<   	  e       Zded"<   	  ed      Zded#<   	  ed      Zd$ed%<   	  ed      Zd&ed'<   	  ed      Zded(<   	  ed      Zd)ed*<   	  ed      Zd+ed,<   	  ed      Z ded-<   	  ed      Z!ded.<   	  ed      Z"ded/<   	  ed      Z#ded0<   	  ed      Z$ded1<   y2)5r   aJ  Representation 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).
    r0   r   Tr   c                   |        }|j                         |_        |rg }	 |j                  }t        j	                  |      }t        |j                        t        z  }|dhz  }|D ]l  }		 |r[	 | j                  |	   j                  }
t        j	                  |
      }|kD  r't        |	   }t        |d      }|j                  |       at        ||	       n |rt        d|      |S # t
        $ r}|j                  |       d}Y d}~d}~ww xY w# t        $ r# t        |	d|	      }|j                  |       Y w xY w# t
        $ r}|j                  |       Y d}~d}~ww xY w)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`.
        Nr1   unrecognized field: zW{field} introduced in metadata version {field_metadata_version}, not {metadata_version}zinvalid metadata)copyr   r1   r   indexr*   r   r   r   r   r   r\   r   r   r   )clsrS   r   insr   r1   metadata_agemetadata_version_excfields_to_checkkeyfield_metadata_versionr   	field_ager+   s                 r   from_rawzMetadata.from_raw  s    e99;*,J(#&#7#7 7==>NO (1OCO 233O& ++'%58\\#5F5L5L2
 %=$B$B2%	 %|3$9#$>E"1 %!S#C
 '--c2$C%/+6 $%7DD
Q # (!!"67#' ("  ( %"1#9McW7U"VC&--c2$%" ' +%%c**+sZ   !C& +D>.DA D>D>&	D/DD)D;8D>:D;;D>>	E"EE"c               $   t        |      \  }}|rEg }|D ]0  }|t        v r|d}nd|}|j                  t        ||             2 |rt	        d|      	 | j                  ||      S # t        $ r}t	        d|j                        dd}~ww xY w)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   r   r   zinvalid or unparsed metadataN)r   r   r   r*   r   r  r   )	r   rS   r   r   r   r   unparsed_keyr   	exc_groups	            r   
from_emailzMetadata.from_email  s     $D)X*,J ( J#88!- 00ABG 4\4DEG!!/,"HIJ $Z<<	<<h<77 	 .	0D0D	s   A* *	B3B

Bz_Validator[_MetadataVersion]r1   z_Validator[str]r2   z"_Validator[version_module.Version]r   r   r   z_Validator[list[str] | None]rM   r4   r   r<   z_Validator[str | None]r5   r6   r   rK   r7   r8   r=   r9   r:   r   rB   rC   r;   r>   z1_Validator[list[requirements.Requirement] | None]rD   z*_Validator[specifiers.SpecifierSet | None]rG   rH   z!_Validator[dict[str, str] | None]rJ   z-_Validator[list[utils.NormalizedName] | None]rL   rE   rF   r?   r@   rA   N)rS   r0   r   boolr"   r   )rS   bytes | strr   r	  r"   r   )%r    r$   r%   r&   r'   classmethodr  r  r   r1   r2   r   rM   r4   r<   r5   r6   rK   r7   r8   r=   r9   r:   rB   rC   r;   r>   rD   rG   rH   rJ   rL   rE   rF   r?   r@   rA   r(   r   r   r   r   }  sc    =A 6 6p ?C  6 6@\2A<&LD/( 3=,G/>:,6-G) D.8lI+:08B8O5O:&0lG#2R*4,K'637A7N4NL-7\H*90(2I%41+5E+BL(B4%/\F"1.+5<L(74)3%)@J&@2/9/F,F8&0lG#2/0:0GK-G2GQHMD  6BLCO?  8 7Au6M3M96@u6ML3M3 EOENA  72<52IM/I53=E3JN0J6-7e-DH*D#-7e-DH*D#.8u.EI+E$r   r   )rS   r   r"   r3   )rS   r3   r"   rI   )rm   zemail.message.Messagern   r
  r"   r   )rS   r
  r"   z(tuple[RawMetadata, dict[str, list[str]]])/
__future__r   email.feedparserrx   email.headeremail.messageemail.parseremail.policytypingr   r   r   r   r   r	   rW   r   r   r   r   r   TypeVarr   r   	NameError	Exceptionrl   r*   r0   r   r   _DICT_FIELDSrU   rc   rq   r   itemsr   r   object
_NOT_FOUNDr   r   r   r   r   r   )rx   r   s   00r   <module>r     s+   "        . - 'FNN3$* $N"j "=)5 =H"  
0
%P?:hN - =	
  : N y  
 y , * * F   &!" #$ "$&$,(/9 < 7L6Q6Q6ST
seT m,` X
 F CD CDl l^g% g%G  WW WWn Us   D# D9#D65D6