Ë
    ªÕ°j,  ã                  ó&  — d Z 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	m
Z
mZmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	„Zej,                  dd
„«       Zej1                  e«      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)z2
Tools for converting old- to new-style metadata.
é    )ÚannotationsN)Ú	GeneratorÚIterableÚIterator)ÚMessage)ÚParser)ÚLiteral)ÚRequirementc                ó.   — | xr | j                  d«       S )Nú#)Ú
startswith)Ústrs    úE/var/www/mission/venv/lib/python3.12/site-packages/wheel/_metadata.pyÚ	_nonblankr      s   € ØÒ*�s—~‘~ cÓ*Ð*Ð*ó    c                ó\   — t         j                  j                  t        t        | «      «      S )a�  
    Yield valid lines of a string or iterable.
    >>> list(yield_lines(''))
    []
    >>> list(yield_lines(['foo', 'bar']))
    ['foo', 'bar']
    >>> list(yield_lines('foo\nbar'))
    ['foo', 'bar']
    >>> list(yield_lines('\nfoo\n#bar\nbaz #comment'))
    ['foo', 'baz #comment']
    >>> list(yield_lines(['foo\nbar', 'baz', 'bing\n\n\n']))
    ['foo', 'bar', 'baz', 'bing']
    )Ú	itertoolsÚchainÚfrom_iterableÚmapÚyield_lines)Úiterables    r   r   r      s    € ô �?‰?×(Ñ(¬¬[¸(Ó)CÓDÐDr   c                ón   — t        t        t        t        j                  | j                  «       «      «      S ©N)Úfilterr   r   r   ÚstripÚ
splitlines)Útexts    r   Ú_r   *   s!   € ä”)œS¤§¡¨D¯O©OÓ,=Ó>Ó?Ð?r   c              #  óþ   K  — d}g }t        | «      D ]a  }|j                  d«      r=|j                  d«      r |s|r||f–— |dd j                  «       }g }ŒEt	        d|«      ‚|j                  |«       Œc ||f–— y­w)ar  Split a string or iterable thereof into (section, content) pairs
    Each ``section`` is a stripped version of the section header ("[section]")
    and each ``content`` is a list of stripped lines excluding blank lines and
    comment-only lines.  If there are any such lines before the first section
    header, they're returned in a first ``section`` of ``None``.
    Nú[ú]é   éÿÿÿÿzInvalid section heading)r   r   Úendswithr   Ú
ValueErrorÚappend)ÚsÚsectionÚcontentÚlines       r   Úsplit_sectionsr,   /   s�   è ø€ ð €GØ€GÜ˜A“ò 
!ˆØ�?‰?˜3ÔØ�}‰}˜SÔ!Ù™gØ! 7Ð*Ò*Ø˜q ˜*×*Ñ*Ó,�Ø‘ä Ð!:¸DÓAÐAà�N‰N˜4Õ ð
!ð �7Ð
Óùs   ‚A;A=c                óL   — t        j                  dd| «      j                  «       S )z°Convert an arbitrary string to a standard 'extra' name
    Any runs of non-alphanumeric characters are replaced with a single '_',
    and the result is always lowercased.
    z[^A-Za-z0-9.-]+r   )ÚreÚsubÚlower)Úextras    r   Ú
safe_extrar2   J   s!   € ô
 �6‰6Ð# S¨%Ó0×6Ñ6Ó8Ð8r   c                ó0   — t        j                  dd| «      S )zŽConvert an arbitrary string to a standard distribution name
    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
    z[^A-Za-z0-9.]+ú-)r.   r/   )Únames    r   Ú	safe_namer6   R   s   € ô �6‰6Ð" C¨Ó.Ð.r   c                óî   — | j                   rd| j                   z   S g }| j                  D ]*  }|j                  |j                  |j                  z   «       Œ, |rddj                  t        |«      «      z   S y)zFReturn the version specifier for a requirement in PEP 345/566 fashion.z @ ú ú,Ú )ÚurlÚ	specifierr'   ÚoperatorÚversionÚjoinÚsorted)ÚrequirementÚrequires_distÚspecs      r   Úrequires_to_requires_distrD   Y   sn   € à‡‚Ø�{—‘Ñ&Ð&à!€MØ×%Ñ%ò ;ˆØ×Ñ˜TŸ]™]¨T¯\©\Ñ9Õ:ð;ñ Ø�S—X‘Xœf ]Ó3Ó4Ñ4Ð4àr   c              #  óæ   K  — | D ]h  }t        |«      }t        |«      }dj                  t        d„ |j                  D «       «      «      }|rd|› d�}t        |j                  «      |z   |z   –— Œj y­w)z=Yield Requires-Dist: strings for parsed requirements strings.r9   c              3  ó2   K  — | ]  }t        |«      –— Œ y ­wr   )r2   )Ú.0Úes     r   ú	<genexpr>z'convert_requirements.<locals>.<genexpr>m   s   è ø€ Ò R°1¤¨A§Ñ Rùs   ‚r!   r"   N)r
   rD   r?   r@   Úextrasr6   r5   )ÚrequirementsÚreqÚparsed_requirementrC   rJ   s        r   Úconvert_requirementsrN   h   sy   è ø€ àò AˆÜ(¨Ó-ÐÜ(Ð);Ó<ˆØ—‘œ&Ñ RÐ8J×8QÑ8QÔ RÓRÓSˆÙØ˜˜ �]ˆFäÐ*×/Ñ/Ó0°6Ñ9¸DÑ@Ó@ñAùs   ‚A/A1c              #  ó2  K  — | j                  «       D ]€  \  }}d}|xs d}d|v r|j                  dd«      \  }}t        |«      }|rd|f–— |rd|z   dz   }|d|› d�z  }|rd	|z   }t        |«      D ]  }t	        t        ||z   «      «      }d
|f–— Œ! Œ‚ y­w)a,  
    Convert requirements from a setup()-style dictionary to
    ('Requires-Dist', 'requirement') and ('Provides-Extra', 'extra') tuples.

    extras_require is a dictionary of {extra: [requirements]} as passed to setup(),
    using the empty extra {'': [requirements]} to hold install_requires.
    r:   ú:r#   úProvides-Extraú(z) and z
extra == 'ú'z ; úRequires-DistN)ÚitemsÚsplitr2   rN   r   r
   )Úextras_requirer1   ÚdependsÚ	conditionÚnew_reqÚcanonical_reqs         r   Úgenerate_requirementsr\   t   sÊ   è ø€ ð )×.Ñ.Ó0ò 1‰ˆˆwØˆ	Ø’˜ˆØ�%‰<Ø$Ÿ{™{¨3°Ó2ÑˆE�9ä˜5Ó!ˆÙØ" EÐ)Ò)ÙØ )™O¨hÑ6�	Ø˜: e W¨AÐ.Ñ.ˆIáØ 	Ñ)ˆIä+¨GÓ4ò 	1ˆGÜ¤¨G°iÑ,?Ó @ÓAˆMØ! =Ð0Ó0ñ	1ñ!1ùs   ‚BBc           
     ó   — t        |d¬«      5 }t        «       j                  |«      }ddd«       j                  dd«       |d= |d= t        j
                  j                  | d«      }t        j
                  j                  |«      rvt        |d¬«      5 }|j                  «       }ddd«       t        t        «      d	„ ¬
«      }|D ]4  \  }}	t        ||	i«      D ]  \  }
}|
|f|j                  «       vsŒ|||
<   Œ! Œ6 |d   }|rq|d   j                  «       }dj                  |d   j                  «       t        j                   dj                  |dd «      «      df«      }|j#                  |«       |d= |S # 1 sw Y   �ŒQxY w# 1 sw Y   ŒàxY w)zN
    Convert .egg-info directory with PKG-INFO to the Metadata 2.1 format
    zutf-8)ÚencodingNzMetadata-Versionz2.1rQ   rT   zrequires.txtc                ó   — | d   xs dS )Nr   r:   © )Úxs    r   ú<lambda>z%pkginfo_to_metadata.<locals>.<lambda>£   s   € ÈQÈqÉTÊZÐUW€ r   )ÚkeyÚDescriptionú
r   r#   )Úopenr   ÚparseÚreplace_headerÚosÚpathr?   ÚexistsÚreadr@   r,   r\   rU   r   ÚlstripÚtextwrapÚdedentÚset_payload)Úegg_info_pathÚpkginfo_pathÚheadersÚpkg_infoÚrequires_pathÚrequires_fileÚrequiresÚparsed_requirementsr1   Úreqsrc   ÚvalueÚdescriptionÚdescription_linesÚdedented_descriptions                  r   Úpkginfo_to_metadatar~   “   s•  € ô 
ˆl WÔ	-ð +°Ü“8—>‘> 'Ó*ˆ÷+ð ×ÑÐ.°Ô6àÐ!Ð"Ø�Ð!Ü—G‘G—L‘L °Ó?€MÜ	‡w�w‡~�~�mÔ$Ü�-¨'Ô2ð 	,°mØ$×)Ñ)Ó+ˆH÷	,ô %¤^°HÓ%=ÑCWÔXÐØ.ò 	*‰KˆE�4Ü3°U¸D°MÓBò *‘
��UØ˜�< x§~¡~Ó'7Ò7Ø$)�H˜S’Mñ*ð	*ð
 ˜=Ñ)€KÙØ$ ]Ñ3×>Ñ>Ó@ÐØ#Ÿy™yð " !Ñ$×+Ñ+Ó-Ü—‘ §	¡	Ð*;¸A¸BÐ*?Ó @ÓAØðó 
Ðð 	×ÑÐ1Ô2Ø�]Ð#à€O÷C+ñ +ú÷	,ð 	,ús   ŽE7ÂFÅ7FÆF)r   r   Úreturnzbool | Literal[''])r   zIterable[str]r   úIterator[str])r   r   r   r€   )r(   zstr | Iterator[str]r   z3Generator[tuple[str | None, list[str]], None, None])r1   r   r   r   )r5   r   r   r   )rA   r
   r   r   )rK   z	list[str]r   r€   )rW   zdict[str | None, list[str]]r   zIterator[tuple[str, str]])rq   r   rr   r   r   r   )"Ú__doc__Ú
__future__r   Ú	functoolsr   Úos.pathri   r.   rn   Úcollections.abcr   r   r   Úemail.messager   Úemail.parserr   Útypingr	   Úpackaging.requirementsr
   r   Úsingledispatchr   Úregisterr   r   r,   r2   r6   rD   rN   r\   r~   r`   r   r   ú<module>rŒ      s¶   ðñõ #ã Û Û Û 	Û ß 9Ñ 9Ý !Ý Ý å .ó+ð ×ÑòEó ðEð" ×Ñ�cÓò@ó ð@ðØðà8óó69ó/óó	Að1Ø/ð1àó1ô>%r   