o
    “siV4  ã                   @   s°  U d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	m
Z
 ddlmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZmZ dd	lmZ er[dd
lmZ ddlmZ ei ƒZ ee!d< eej"e#f Z$ee%e#f Z&edee$gdf Z'ee#e'f Z(e )e*¡Z+ddde%de$ddfdd„Z,ddde%de$fdd„Z-ddde%de$fdd„Z.ddde%fdd„Z/de#de#fdd„Z0ddde#d efd!d"„Z1d#d$d%d&œZ2d'e#dee# fd(d)„Z3ddd*e&de$fd+d,„Z4ddd*e%de$fd-d.„Z5ddd*ee% d/e$d0e#fd1d2„Z6ddd*e%fd3d4„Z7ddd*e%fd5d6„Z8ddd*e9fd7d8„Z:ddd*e%fd9d:„Z;de%fd;d<„Z<d=e%ddde$fd>d?„Z=e fd@edee#ee# f fdAdB„Z>dCdDdeee#ef  fdEdF„Z?dGe#de#fdHdI„Z@dJeee#ee# e#f  dee# fdKdL„ZAdMdN„ ZBdOdP„ ZCe4e5e	e6dQdR�e	e6dSdR�e7e:e;e8dTœZDee#e(f e!dU< dVdWiZEdXdYiZFh dZ£ZGeBd[ƒeBd\ƒeBd]ƒeBd^ƒeCd_d`ƒeBdaƒeCdbdcƒeCdddeƒeBdfƒeBdgƒeBdhƒeBdiƒeCdjdkƒeCdldmƒdnœZHG dodp„ dpeIƒZJdS )qak  Translation layer between pyproject config and setuptools distribution and
metadata objects.

The distribution and metadata objects are modeled after (an old version of)
core metadata, therefore configs in the format specified for ``pyproject.toml``
need to be processed before being applied.

**PRIVATE MODULE**: API reserved for setuptools internal usage only.
é    N)ÚMapping)ÚAddress)ÚpartialÚreduce)Úchain)ÚMappingProxyType)
ÚTYPE_CHECKINGÚAnyÚCallableÚDictÚListÚOptionalÚSetÚTupleÚTypeÚUnion)ÚSetuptoolsDeprecationWarning©Úmetadata©ÚDistributionÚEMPTYr   ÚdistÚconfigÚfilenameÚreturnc              	   C   sp   |s| S t j |¡pd}t| ||ƒ t| ||ƒ t  ¡ }t  |¡ z|  ¡  |  ¡  W t  |¡ | S t  |¡ w )z=Apply configuration dict read with :func:`read_configuration`Ú.)	ÚosÚpathÚdirnameÚ_apply_project_tableÚ_apply_tool_tableÚgetcwdÚchdirZ_finalize_requiresZ_finalize_license_files)r   r   r   Úroot_dirZcurrent_directory© r%   úuC:\Users\PC\students\dividedattentionclub\venv\lib\python3.10\site-packages\setuptools/config/_apply_pyprojecttoml.pyÚapply$   s   


þr'   r$   c                 C   sv   |  di ¡ ¡ }|sd S t| |ƒ t|ƒ | ¡ D ]\}}t|ƒ}t  ||¡}t|ƒr2|| ||ƒ qt| ||ƒ qd S )NÚproject)	ÚgetÚcopyÚ_handle_missing_dynamicÚ_unify_entry_pointsÚitemsÚjson_compatible_keyÚPYPROJECT_CORRESPONDENCEÚcallableÚ_set_config)r   r   r$   Úproject_tableÚfieldÚvalueÚnorm_keyZcorrespr%   r%   r&   r    :   s   
úr    c           	      C   sŠ   |  di ¡  di ¡}|sd S | ¡ D ]*\}}t|ƒ}|tv r0t| }d|› d|› �}t |t¡ t  ||¡}t| ||ƒ qt	|| |ƒ d S )NÚtoolÚ
setuptoolszThe parameter `z` is deprecated, )
r)   r-   r.   ÚTOOL_TABLE_DEPRECATIONSÚwarningsÚwarnr   ÚTOOL_TABLE_RENAMESr1   Ú_copy_command_options)	r   r   r   Ú
tool_tabler3   r4   r5   Z
suggestionÚmsgr%   r%   r&   r!   K   s   r!   r2   c                 C   sZ   t | dg ¡ƒ}t ¡ D ]\}}||v s*||v s*|| ƒ}|r*t ||¡}t |t¡ qdS )zJBe temporarily forgiving with ``dynamic`` fields not listed in ``dynamic``ÚdynamicN)Úsetr)   Ú_PREVIOUSLY_DEFINEDr-   Ú_WouldIgnoreFieldÚmessager9   r:   )r   r2   r?   r3   Úgetterr4   r>   r%   r%   r&   r+   ^   s   €ûr+   Úkeyc                 C   s   |   ¡  dd¡S )z1As defined in :pep:`566#json-compatible-metadata`ú-Ú_)ÚlowerÚreplace)rE   r%   r%   r&   r.   j   s   r.   r3   r4   c                 C   sZ   t | jd|› �d ƒ}|r||ƒ d S t| j|ƒs|tv r%t| j||ƒ d S t| ||ƒ d S )NÚset_)Úgetattrr   ÚhasattrÚSETUPTOOLS_PATCHESÚsetattr)r   r3   r4   Úsetterr%   r%   r&   r1   o   s   r1   ztext/markdownz
text/x-rstz
text/plain)z.mdz.rstz.txtÚfilec                 C   sd   t j |  ¡ ¡\}}|sd S |tv rt| S d dd„ t ¡ D ƒ¡}d|› d�}td| › d|› �ƒ‚)Nú, c                 s   s$   � | ]\}}|› d |› d�V  qdS )z (ú)Nr%   ©Ú.0ÚkÚvr%   r%   r&   Ú	<genexpr>ˆ   s   €" z&_guess_content_type.<locals>.<genexpr>z3only the following file extensions are recognized: r   zUndefined content type for )r   r   ÚsplitextrH   Ú_CONTENT_TYPESÚjoinr-   Ú
ValueError)rP   rG   ÚextÚvalidr>   r%   r%   r&   Ú_guess_content_type€   s   r^   Úvalc                 C   sv   ddl m} t|tƒr| ||¡}t|ƒ}n| d¡p$| | dg ¡|¡}|d }t| d|ƒ |r9t| d|ƒ d S d S )Nr   ©ÚexpandÚtextrP   zcontent-typeZlong_descriptionÚlong_description_content_type)Úsetuptools.configra   Ú
isinstanceÚstrÚ
read_filesr^   r)   r1   )r   r_   r$   ra   rb   Úctyper%   r%   r&   Ú_long_description�   s   

ÿri   c                 C   sF   ddl m} d|v rt| d| |d g|¡ƒ d S t| d|d ƒ d S )Nr   r`   rP   Úlicenserb   )rd   ra   r1   rg   )r   r_   r$   ra   r%   r%   r&   Ú_licenseœ   s   rk   Ú	_root_dirÚkindc                 C   sž   g }g }|D ]+}d|vr|  |d ¡ qd|vr |  |d ¡ qt|d |d d�}|  t|ƒ¡ q|r=t| |d |¡ƒ |rMt| |› d�d |¡ƒ d S d S )NÚnameÚemail)Zdisplay_nameZ	addr_specrQ   Z_email)Úappendr   rf   r1   rZ   )r   r_   rl   rm   r3   Zemail_fieldZpersonÚaddrr%   r%   r&   Ú_people¥   s   ÿrr   c                 C   s   t | d|ƒ d S )NÚproject_urls)r1   )r   r_   rl   r%   r%   r&   Ú_project_urls·   s   rt   c                 C   s    ddl m} t| d||ƒƒ d S )Nr   )ÚSpecifierSetÚpython_requires)Z&setuptools.extern.packaging.specifiersru   r1   )r   r_   rl   ru   r%   r%   r&   Ú_python_requires»   s   rw   c                 C   s*   t | dg ƒrd}t |¡ t| d|ƒ d S )NÚinstall_requireszA`install_requires` overwritten in `pyproject.toml` (dependencies))rK   r9   r:   r1   )r   r_   rl   r>   r%   r%   r&   Ú_dependenciesÁ   s   
ry   c                 C   s$   t | di ƒ}t| di |¥|¥ƒ d S )NÚextras_require)rK   r1   )r   r_   rl   Úexistingr%   r%   r&   Ú_optional_dependenciesÈ   s   r|   c                 C   s€   | }|  d|  di ¡¡}dddœ}t| ¡ ƒD ]\}}t|ƒ}||v r.|r.|  |¡||| < q|r>dd„ | ¡ D ƒ|d< d S d S )Núentry-pointsÚentry_pointsÚconsole_scriptsÚgui_scripts)Úscriptsr€   c                 S   s$   i | ]\}}|d d„ |  ¡ D ƒ“qS )c                 S   s   g | ]\}}|› d |› �‘qS )z = r%   rS   r%   r%   r&   Ú
<listcomp>Ø   s    z2_unify_entry_points.<locals>.<dictcomp>.<listcomp>©r-   )rT   rn   Úgroupr%   r%   r&   Ú
<dictcomp>×   s    ÿÿz'_unify_entry_points.<locals>.<dictcomp>)ÚpopÚlistr-   r.   )r2   r(   r~   ZrenamingrE   r4   r5   r%   r%   r&   r,   Í   s   
€þÿr,   Ú	pyprojectc              	   C   sÄ   |   di ¡}|  di ¡  di ¡}t|ƒ}|j}|   di ¡  di ¡ ¡ D ]<\}}t|ƒ}|  |tƒ ¡}	| |i ¡ | ¡ D ]"\}
}t|
ƒ}
t|ƒ|f|| |
< |
|	vr^t 	d|› d|
› d�¡ q<q#d S )Nr6   r7   ÚcmdclassÚ	distutilszCommand option r   z is not defined)
r)   Ú_valid_command_optionsZcommand_optionsr-   r.   r@   Ú
setdefaultrf   Ú_loggerÚwarning)rˆ   r   r   r=   r‰   Úvalid_optionsÚcmd_optsÚcmdr   r]   rE   r4   r%   r%   r&   r<   Ý   s     €úür<   r‰   c           
      C   s”   ddl m} ddlm} dt|jƒi}|jdd�}dd	„ |D ƒ}d
d	„ |D ƒ}t||  ¡ ƒD ]\}}| 	|t
ƒ ¡}	|	tt|dg ƒƒB }	|	||< q.|S )Né   r   r   r   Úglobalzdistutils.commands)r„   c                 s   s   � | ]}t |ƒV  qd S ©N)Ú_load_ep©rT   Úepr%   r%   r&   rW   ÷   ó   € z)_valid_command_options.<locals>.<genexpr>c                 s   s   � | ]}|r|V  qd S r”   r%   r–   r%   r%   r&   rW   ø   r˜   Zuser_options)Z
_importlibr   Úsetuptools.distr   Ú_normalise_cmd_optionsÚglobal_optionsr~   r   r-   r)   r@   rK   )
r‰   r   r   r�   Zunloaded_entry_pointsZloaded_entry_pointsr~   r‘   Z	cmd_classÚoptsr%   r%   r&   r‹   ð   s   
r‹   r—   zmetadata.EntryPointc              
   C   s`   z| j |  ¡ fW S  ty/ } z|jj› d| j › �}t |› d|› �¡ W Y d }~d S d }~ww )Nz" while trying to load entry-point z: )rn   ÚloadÚ	ExceptionÚ	__class__Ú__name__r�   rŽ   )r—   Úexr>   r%   r%   r&   r•     s   €ýr•   rn   c                 C   s   t | ƒ d¡S )Nz_=)r.   Ústrip)rn   r%   r%   r&   Ú_normalise_cmd_option_key  ó   r£   Údescc                 C   s   dd„ | D ƒS )Nc                 S   s   h | ]}t |d  ƒ’qS )r   )r£   )rT   Zfancy_optionr%   r%   r&   Ú	<setcomp>  s    z)_normalise_cmd_options.<locals>.<setcomp>r%   )r¥   r%   r%   r&   rš     r¤   rš   c                 C   s   t tdd„ |  d¡ƒS )a8  
    Similar to ``operator.attrgetter`` but returns None if ``attr`` is not found
    >>> from types import SimpleNamespace
    >>> obj = SimpleNamespace(a=42, b=SimpleNamespace(c=13))
    >>> _attrgetter("a")(obj)
    42
    >>> _attrgetter("b.c")(obj)
    13
    >>> _attrgetter("d")(obj) is None
    True
    c                 S   s   t | |d ƒS r”   )rK   )ÚaccÚxr%   r%   r&   Ú<lambda>  s    z_attrgetter.<locals>.<lambda>r   )r   r   Úsplit)Úattrr%   r%   r&   Ú_attrgetter  s   r¬   c                     s   ‡ fdd„}|S )aL  
    Return the first "truth-y" attribute or None
    >>> from types import SimpleNamespace
    >>> obj = SimpleNamespace(a=42, b=SimpleNamespace(c=13))
    >>> _some_attrgetter("d", "a", "b.c")(obj)
    42
    >>> _some_attrgetter("d", "e", "b.c", "a")(obj)
    13
    >>> _some_attrgetter("d", "e", "f")(obj) is None
    True
    c                    s&   ‡ fdd„ˆD ƒ}t dd„ |D ƒd ƒS )Nc                 3   s   � | ]	}t |ƒˆ ƒV  qd S r”   )r¬   ©rT   Úi©Úobjr%   r&   rW   /  ó   € z5_some_attrgetter.<locals>._acessor.<locals>.<genexpr>c                 s   s   � | ]	}|d ur|V  qd S r”   r%   r­   r%   r%   r&   rW   0  r±   )Únext)r°   Úvaluesrƒ   r¯   r&   Ú_acessor.  s   z"_some_attrgetter.<locals>._acessorr%   )r-   r´   r%   rƒ   r&   Ú_some_attrgetter"  s   rµ   Úauthor)rm   Z
maintainer)Úreadmerj   ÚauthorsÚmaintainersÚurlsÚdependenciesZoptional_dependenciesÚrequires_pythonr/   Zscript_filesr�   Únamespace_packagesz5consider using implicit namespaces instead (PEP 420).>   rc   rs   Zlicense_fileZlicense_filesZprovides_extraszmetadata.namezmetadata.versionzmetadata.descriptionzmetadata.long_descriptionrv   zmetadata.python_requireszmetadata.licensezmetadata.authorzmetadata.author_emailzmetadata.maintainerzmetadata.maintainer_emailzmetadata.keywordszmetadata.classifierszmetadata.project_urlsr~   Z_orig_install_requiresrx   Z_orig_extras_requirerz   )rn   ÚversionÚdescriptionr·   zrequires-pythonrj   r¸   r¹   ÚkeywordsZclassifiersrº   r}   r»   zoptional-dependenciesc                   @   s    e Zd ZdZdZedd„ ƒZdS )rB   zGInform users that ``pyproject.toml`` would overwrite previous metadata.a      {field!r} defined outside of `pyproject.toml` would be ignored.
    !!


    ##########################################################################
    # configuration would be ignored/result in error due to `pyproject.toml` #
    ##########################################################################

    The following seems to be defined outside of `pyproject.toml`:

    `{field} = {value!r}`

    According to the spec (see the link below), however, setuptools CANNOT
    consider this value unless {field!r} is listed as `dynamic`.

    https://packaging.python.org/en/latest/specifications/declaring-project-metadata/

    For the time being, `setuptools` will still consider the given value (as a
    **transitional** measure), but please note that future releases of setuptools will
    follow strictly the standard.

    To prevent this warning, you can list {field!r} under `dynamic` or alternatively
    remove the `[project]` table from your file and rely entirely on other means of
    configuration.
    

!!
    c                 C   s    ddl m} || jj||d�ƒS )Nr   )Úcleandoc)r3   r4   )ÚinspectrÁ   ÚMESSAGEÚformat)Úclsr3   r4   rÁ   r%   r%   r&   rC   v  s   z_WouldIgnoreField.messageN)r    Ú
__module__Ú__qualname__Ú__doc__rÃ   ÚclassmethodrC   r%   r%   r%   r&   rB   Y  s
    rB   )KrÈ   Úloggingr   r9   Úcollections.abcr   Zemail.headerregistryr   Ú	functoolsr   r   Ú	itertoolsr   Útypesr   Útypingr   r	   r
   r   r   r   r   r   r   r   Zsetuptools._deprecation_warningr   Zsetuptools._importlibr   r™   r   r   Ú__annotations__ÚPathLikerf   Z_PathÚdictZ
_DictOrStrZ
_CorrespFnZ_CorrespondenceÚ	getLoggerr    r�   r'   r    r!   r+   r.   r1   rY   r^   ri   rk   rr   rt   rw   r‡   ry   r|   r,   r<   r‹   r•   r£   rš   r¬   rµ   r/   r;   r8   rM   rA   ÚUserWarningrB   r%   r%   r%   r&   Ú<module>   s–    	0
ý	"
(

øÿò