o
    Ee@                     @   s  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Zd dlmZm	Z	m
Z
mZmZmZ ejdkr8d dlmZ n#ejrBd dlmZ nzd dlmZ W n eyZ   G dd dZY nw G dd ded	d
Zh dZh dZdede	e fddZde	e deeef fddZdejjdeeef defdd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/d0d1d2d3d4d5d6d7d8d9d:d;d<Zdeeef deeeee	e f f fd=d>ZdS )?    N)DictListOptionalTupleUnioncast)      )	TypedDictc                   @   s   e Zd Zdd ZdS )r
   c                  O   s   d S )N )_args_kwargsr   r   f/var/www/bmteknikk.ddns.net/venv/lib/python3.10/site-packages/setuptools/_vendor/packaging/metadata.py__init_subclass__   s   zTypedDict.__init_subclass__N)__name__
__module____qualname__r   r   r   r   r   r
      s    r
   c                   @   s.  e Zd ZU dZeed< eed< eed< ee ed< eed< eed< ee ed< eed	< eed
< eed< eed< ee ed< eed< ee ed< ee ed< ee ed< ee ed< eed< eed< ee ed< ee ed< ee ed< eed< ee ed< eeef ed< eed< ee ed< ee ed< dS )RawMetadataaq  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.

    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.

    metadata_versionnameversion	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project_urlsdescription_content_typeprovides_extradynamicN)r   r   r   __doc__str__annotations__r   r   r   r   r   r   r      s<   
 r   F)total>   r   r   r   r   r   r   r%   r   r   r    r*   r&   r   r-   >   r/   r#   r"   r$   r   r!   r(   r'   r)   r.   r+   r   datareturnc                 C   s   dd |  dD S )zCSplit a string of comma-separate keyboards into a list of keywords.c                 S      g | ]}|  qS r   strip).0kr   r   r   
<listcomp>       z#_parse_keywords.<locals>.<listcomp>,)split)r4   r   r   r   _parse_keywords   s   r?   c              	   C   sf   i }| D ],}dd | ddD }|dgtddt|   |\}}||v r,td|||< q|S )	z?Parse a list of label/URL string pairings separated by a comma.c                 S   r6   r   r7   )r9   pr   r   r   r;      r<   z'_parse_project_urls.<locals>.<listcomp>r=       r      z duplicate labels in project urls)r>   extendmaxlenKeyError)r4   urlspairpartslabelurlr   r   r   _parse_project_urls   s   
rM   msgsourcec                 C   sH   t |tr|  }|S | jdd}z|ddW S  ty#   tdw )zGet the body of the message.Tdecodeutf8strictzpayload in an invalid encoding)
isinstancer1   get_payloadrQ   UnicodeDecodeError
ValueError)rN   rO   payloadbpayloadr   r   r   _get_payload   s   
rZ   r   zauthor-emailr   
classifierr!   r   zdescription-content-typer-   zdownload-urlr    r/   z	home-pager   r   r   r%   zmaintainer-emailr&   zmetadata-versionr   r   r$   zobsoletes-distr)   platformr   r,   r#   r(   r.   r"   r'   r+   r*   r   r   r   )zproject-urlr#   zprovides-distzprovides-extrar"   zrequires-distzrequires-externalzrequires-pythonr   zsupported-platformr   c                 C   s  i }i }t | trtjjtjjd| }ntjjtjjd	| }t
| D ]}| }||}g }d}|D ]Q}t |tjjtfsFJ t |tjjrg }	tj|D ]#\}
}z|
dd W n tyn   d}d}Y nw d}|	|
|f qU|ttj|	 q9|| q9|s|||< q(t|}|du r|||< q(|tv rt|dkr|d	 ||< q(|tv r|||< q(|d
krt|dkrt|d	 ||< q(|dkrzt|||< W q( ty   |||< Y q(w |||< q(zt|| }W n ty   |dg |j t | t!d Y n.w |r;d|v r*t"t|#d}|dg $||g nd|v r7|d | n||d< t"t%||fS )a  Parse a distribution's 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.

    )policyTrR   rS   latin1FNrA   r   r   r,   r   rP   )&rT   r1   emailparserParserr]   compat32parsestrBytesParser
parsebytes	frozensetkeyslowerget_allheaderHeaderdecode_headerrQ   rV   appendmake_header_EMAIL_TO_RAW_MAPPINGget_STRING_FIELDSrF   _LIST_STRING_FIELDSr?   rM   rG   rZ   rW   
setdefaultrU   bytesr   poprD   r   )r4   rawunparsedparsedr   headersvaluevalid_encodinghchunksbinencodingraw_namerX   description_headerr   r   r   parse_email   s|   

	







r   )email.feedparserr_   email.headeremail.messageemail.parseremail.policysystypingr   r   r   r   r   r   version_infor
   TYPE_CHECKINGtyping_extensionsImportErrorr   rq   rr   r1   r?   rM   messageMessagert   rZ   ro   r   r   r   r   r   <module>   s     
C"(	
2 