
    .Ph                         d dl Zd dlZd dlZd dlZddlmZ  G d dej        j                  Z	 G d dej
        j                  ZdS )    N   )
FoldedCasec                       e Zd Zd ZdS )	RawPolicyc                     | j                             t          j        |dd                                                                                     }| d| | j          S )N        c                     dS )NT )lines    \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/importlib_metadata/_adapters.py<lambda>z RawPolicy.fold.<locals>.<lambda>   s    $     )prefix	predicatez: )linesepjointextwrapindentlstrip
splitlines)selfnamevaluefoldeds       r   foldzRawPolicy.fold
   s`    ""OE'=N=NOOOVXXZ\\
 

 00&0$,000r   N)__name__
__module____qualname__r   r
   r   r   r   r   	   s#        1 1 1 1 1r   r   c                        e Zd ZdZ e eeg d                    Z	 dej	        j
        f fdZd Z fdZ fdZd Z fd	Zed
             Z xZS )Messagea  
    Specialized Message subclass to handle metadata naturally.

    Reads values that may have newlines in them and converts the
    payload to the Description.

    >>> msg_text = textwrap.dedent('''
    ...     Name: Foo
    ...     Version: 3.0
    ...     License: blah
    ...             de-blah
    ...     <BLANKLINE>
    ...     First line of description.
    ...     Second line of description.
    ...     <BLANKLINE>
    ...     Fourth line!
    ...     ''').lstrip().replace('<BLANKLINE>', '')
    >>> msg = Message(email.message_from_string(msg_text))
    >>> msg['Description']
    'First line of description.\nSecond line of description.\n\nFourth line!\n'

    Message should render even if values contain newlines.

    >>> print(msg)
    Name: Foo
    Version: 3.0
    License: blah
            de-blah
    Description: First line of description.
            Second line of description.
    <BLANKLINE>
            Fourth line!
    <BLANKLINE>
    <BLANKLINE>
    )

ClassifierzObsoletes-DistPlatformzProject-URLzProvides-DistzProvides-ExtrazRequires-DistzRequires-ExternalzSupported-PlatformDynamicorigc                     t                                          |           }t          |                              t          |                     |S N)super__new__varsupdate)clsr$   res	__class__s      r   r(   zMessage.__new__M   s=    ggooc""S		d$$$
r   c                 8    |                                  | _        d S r&   )_repair_headers_headers)r   argskwargss      r   __init__zMessage.__init__R   s    ,,..r   c                 D    t                                                      S r&   )r'   __iter__r   r-   s    r   r5   zMessage.__iter__V   s    ww!!!r   c                 l    t                                          |          }|t          |          |S )a"  
        Override parent behavior to typical dict behavior.

        ``email.message.Message`` will emit None values for missing
        keys. Typical mappings, including this ``Message``, will raise
        a key error for missing keys.

        Ref python/importlib_metadata#371.
        )r'   __getitem__KeyError)r   itemr,   r-   s      r   r8   zMessage.__getitem__Y   s2     gg!!$'';4.. 
r   c                     d fdt          |           d         D             }| j        r>|                    d|                                 f           |                     d           |S )Nc                 J    d}| rd|z   | vr| S t          j        || z             S )zCorrect for RFC822 indentationr   
)r   dedent)r   r   s     r   redentz'Message._repair_headers.<locals>.redenti   s6    F D6M66?6E>222r   c                 0    g | ]\  }}| |          fS r
   r
   ).0keyr   r?   s      r   
<listcomp>z+Message._repair_headers.<locals>.<listcomp>p   s*    QQQJCC'QQQr   r0   Description )r)   _payloadappendget_payloadset_payload)r   headersr?   s     @r   r/   zMessage._repair_headersh   s    	3 	3 	3 RQQQ$t**Z:PQQQ= 	!NNM4+;+;+=+=>???R   r   c                 `    t                                          t                                S )N)policy)r'   	as_stringr   r6   s    r   rM   zMessage.as_stringv   s"    ww  	 444r   c           	      n      fd}t          t          |t          t                                         S )z[
        Convert PackageMetadata to a JSON-compatible format
        per PEP 0566.
        c                     | j         v r                    |           n|          }| dk    rt          j        d|          }|                                                     dd          }||fS )NKeywordsz\s+-_)multiple_use_keysget_allresplitlowerreplace)rB   r   tkr   s      r   	transformzMessage.json.<locals>.transform   sn    ),0F)F)FDLL%%%DQTIEj  //$$S#..Bu9r   )dictmapr   )r   rZ   s   ` r   jsonzMessage.jsony   s@    	 	 	 	 	 C	3z4#8#899:::r   )r   r   r   __doc__setr\   r   rS   emailmessager    r(   r3   r5   r8   r/   rM   propertyr]   __classcell__)r-   s   @r   r    r       s       " "H   	
 	
 "5=0      
/ / /" " " " "      5 5 5 5 5 ; ; X; ; ; ; ;r   r    )email.messager`   email.policyrU   r   _textr   rL   EmailPolicyr   ra   r    r
   r   r   <module>rh      s            				       1 1 1 1 1( 1 1 1t; t; t; t; t;em# t; t; t; t; t;r   