§
    �óÉ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                     e¦  «        d+d„¦   «         Zd,d„Zd-d„Zd.d„Zd/d„Zd0d „Zd1d$„Z d2d(„Z!dS )3z2
Tools for converting old- to new-style metadata.
é    )ÚannotationsN)Ú	GeneratorÚIterableÚIterator)ÚMessage)ÚParser)ÚLiteral)ÚRequirementÚstrÚreturnúbool | Literal['']c                ó2   — | o|                       d¦  «         S )Nú#)Ú
startswith)r   s    úr/home/lighthouse/badge-speaker-benchmark/.benchmark-venv-community/lib/python3.11/site-packages/wheel/_metadata.pyÚ	_nonblankr      s   € ØÐ*�s—~’~ cÑ*Ô*Ð*Ð*ó    ÚiterableúIterable[str]úIterator[str]c                óf   — t           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)r   s    r   r   r      s$   € õ Œ?×(Ò(­­[¸(Ñ)CÔ)CÑDÔDÐDr   Útextc                ó€   — t          t          t          t          j        |                      ¦   «         ¦  «        ¦  «        S ©N)Úfilterr   r   r   ÚstripÚ
splitlines)r   s    r   Ú_r#   *   s(   € å•)�S¥¤¨D¯OªOÑ,=Ô,=Ñ>Ô>Ñ?Ô?Ð?r   Úsústr | Iterator[str]ú3Generator[tuple[str | None, list[str]], None, None]c              #  ó2  K  — d}g }t          | ¦  «        D ]z}|                     d¦  «        rN|                     d¦  «        r)|s|r||fV — |dd…                              ¦   «         }g }ŒUt	          d|¦  «        ‚|                     |¦  «         Œ{||fV — dS )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)r$   ÚsectionÚcontentÚlines       r   Úsplit_sectionsr2   /   sÏ   è è € ð €GØ€GÝ˜A‘”ð 
!ð 
!ˆØ�?Š?˜3ÑÔð 		!Ø�}Š}˜SÑ!Ô!ð BØð +˜gð +Ø! 7Ð*Ð*Ð*Ð*Ø˜q ˜tœ*×*Ò*Ñ,Ô,�Ø��å Ð!:¸DÑAÔAÐAà�NŠN˜4Ñ Ô Ð Ð ð �7Ð
ÐÐÐÐÐr   Úextrac                óR   — t          j        dd| ¦  «                             ¦   «         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)r3   s    r   Ú
safe_extrar8   J   s%   € õ
 Œ6Ð# S¨%Ñ0Ô0×6Ò6Ñ8Ô8Ð8r   Únamec                ó.   — 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.]+ú-)r5   r6   )r9   s    r   Ú	safe_namer<   R   s   € õ Œ6Ð" C¨Ñ.Ô.Ð.r   Úrequirementr
   c                óÒ   — | j         r
d| j         z   S g }| j        D ]$}|                     |j        |j        z   ¦  «         Œ%|r%dd                     t          |¦  «        ¦  «        z   S dS )zFReturn the version specifier for a requirement in PEP 345/566 fashion.z @ ú ú,Ú )ÚurlÚ	specifierr.   ÚoperatorÚversionÚjoinÚsorted)r=   Úrequires_distÚspecs      r   Úrequires_to_requires_distrJ   Y   s|   € à„ð 'Ø�{”Ñ&Ð&à!€MØÔ%ð ;ð ;ˆØ×Ò˜Tœ]¨T¬\Ñ9Ñ:Ô:Ð:Ð:àð Ø�S—X’X�f ]Ñ3Ô3Ñ4Ô4Ñ4Ð4àˆrr   Úrequirementsú	list[str]c              #  óú   K  — | D ]u}t          |¦  «        }t          |¦  «        }d                     t          d„ |j        D ¦   «         ¦  «        ¦  «        }|rd|› d�}t          |j        ¦  «        |z   |z   V — ŒvdS )z=Yield Requires-Dist: strings for parsed requirements strings.r@   c              3  ó4   K  — | ]}t          |¦  «        V — Œd S r   )r8   )Ú.0Úes     r   ú	<genexpr>z'convert_requirements.<locals>.<genexpr>m   s(   è è € Ð RÐ R°1¥¨A¡¤Ð RÐ RÐ RÐ RÐ RÐ Rr   r(   r)   N)r
   rJ   rF   rG   Úextrasr<   r9   )rK   ÚreqÚparsed_requirementrI   rR   s        r   Úconvert_requirementsrU   h   s¥   è è € àð Að AˆÝ(¨Ñ-Ô-ÐÝ(Ð);Ñ<Ô<ˆØ—’�&Ð RÐ RÐ8JÔ8QÐ RÑ RÔ RÑRÔRÑSÔSˆØð 	#Ø"˜�]�]�]ˆFåÐ*Ô/Ñ0Ô0°6Ñ9¸DÑ@Ð@Ð@Ð@Ð@ðAð Ar   Úextras_requireúdict[str | None, list[str]]úIterator[tuple[str, str]]c              #  óT  K  — |                       ¦   «         D ]�\  }}d}|pd}d|v r|                     dd¦  «        \  }}t          |¦  «        }|rd|fV — |rd|z   dz   }|d|› d�z  }|rd	|z   }t          |¦  «        D ]'}t	          t          ||z   ¦  «        ¦  «        }d
|fV — Œ(Œ‘dS )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.
    rA   ú:r*   úProvides-Extraú(z) and z
extra == 'ú'z ; úRequires-DistN)ÚitemsÚsplitr8   rU   r   r
   )rV   r3   ÚdependsÚ	conditionÚnew_reqÚcanonical_reqs         r   Úgenerate_requirementsre   t   s  è è € ð )×.Ò.Ñ0Ô0ð 1ð 1‰ˆˆwØˆ	Ø�˜ˆØ�%ˆ<ˆ<Ø$Ÿ{š{¨3°Ñ2Ô2ÑˆE�9å˜5Ñ!Ô!ˆØð 	/Ø" EÐ)Ð)Ð)Ð)Øð 7Ø )™O¨hÑ6�	ØÐ. eÐ.Ð.Ð.Ñ.ˆIàð 	*Ø 	Ñ)ˆIå+¨GÑ4Ô4ð 	1ð 	1ˆGÝ¥¨G°iÑ,?Ñ @Ô @ÑAÔAˆMØ! =Ð0Ð0Ð0Ð0Ð0ð	1ð!1ð 1r   Úegg_info_pathÚpkginfo_pathr   c           
     ó²  — t          |d¬¦  «        5 }t          ¦   «                              |¦  «        }ddd¦  «         n# 1 swxY w Y   |                     dd¦  «         |d= |d= t          j                             | d¦  «        }t          j                             |¦  «        r˜t          |d¬¦  «        5 }|                     ¦   «         }ddd¦  «         n# 1 swxY w Y   t          t          |¦  «        d	„ ¬
¦  «        }|D ]9\  }}	t          ||	i¦  «        D ]"\  }
}|
|f|                     ¦   «         vr|||
<   Œ#Œ:|d         }|r�|d                              ¦   «         }d                     |d                              ¦   «         t          j        d                     |dd…         ¦  «        ¦  «        df¦  «        }|                     |¦  «         |d= |S )zN
    Convert .egg-info directory with PKG-INFO to the Metadata 2.1 format
    zutf-8)ÚencodingNzMetadata-Versionz2.1r[   r^   zrequires.txtc                ó   — | d         pdS )Nr   rA   © )Ú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ÚpathrF   ÚexistsÚreadrG   r2   re   r_   r"   ÚlstripÚtextwrapÚdedentÚset_payload)rf   rg   ÚheadersÚpkg_infoÚrequires_pathÚrequires_fileÚrequiresÚparsed_requirementsr3   Úreqsrn   ÚvalueÚdescriptionÚdescription_linesÚdedented_descriptions                  r   Úpkginfo_to_metadatar‡   “   sh  € õ 
ˆl WÐ	-Ñ	-Ô	-ð +°Ý‘8”8—>’> 'Ñ*Ô*ˆð+ð +ð +ñ +ô +ð +ð +ð +ð +ð +ð +øøøð +ð +ð +ð +ð ×ÒÐ.°Ñ6Ô6Ð6àÐ!Ð"Ø�Ð!Ý”G—L’L °Ñ?Ô?€MÝ	„w‡~‚~�mÑ$Ô$ð *Ý�-¨'Ð2Ñ2Ô2ð 	,°mØ$×)Ò)Ñ+Ô+ˆHð	,ð 	,ð 	,ñ 	,ô 	,ð 	,ð 	,ð 	,ð 	,ð 	,ð 	,øøøð 	,ð 	,ð 	,ð 	,õ %¥^°HÑ%=Ô%=ÐCWÐCWÐXÑXÔXÐØ.ð 	*ð 	*‰KˆE�4Ý3°U¸D°MÑBÔBð *ð *‘
��UØ˜�< x§~¢~Ñ'7Ô'7Ð7Ð7Ø$)�H˜S‘Møð*ð ˜=Ô)€KØð $Ø$ ]Ô3×>Ò>Ñ@Ô@ÐØ#Ÿyšyð " !Ô$×+Ò+Ñ-Ô-Ý” §	¢	Ð*;¸A¸B¸BÔ*?Ñ @Ô @ÑAÔAØðñ 
ô  
Ðð 	×ÒÐ1Ñ2Ô2Ð2Ø�]Ð#à€Os#   ’"A Á AÁAÂ7CÃCÃC)r   r   r   r   )r   r   r   r   )r   r   r   r   )r$   r%   r   r&   )r3   r   r   r   )r9   r   r   r   )r=   r
   r   r   )rK   rL   r   r   )rV   rW   r   rX   )rf   r   rg   r   r   r   )"Ú__doc__Ú
__future__r   Ú	functoolsr   Úos.pathrt   r5   ry   Úcollections.abcr   r   r   Úemail.messager   Úemail.parserr   Útypingr	   Úpackaging.requirementsr
   r   Úsingledispatchr   Úregisterr   r#   r2   r8   r<   rJ   rU   re   r‡   rk   r   r   ú<module>r“      sÅ  ððð ð #Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø Ð Ð Ð Ø €€€Ø 	€	€	€	Ø €€€Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø !Ð !Ð !Ð !Ð !Ð !Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à .Ð .Ð .Ð .Ð .Ð .ð+ð +ð +ð +ð ÔðEð Eð Eñ ÔðEð" ×Ò�cÑÔð@ð @ð @ñ Ôð@ðð ð ð ð69ð 9ð 9ð 9ð/ð /ð /ð /ðð ð ð ð	Að 	Að 	Að 	Að1ð 1ð 1ð 1ð>%ð %ð %ð %ð %ð %r   