o
    j                     @   s   d Z ddlZddlZddlmZ ddlmZmZmZm	Z	 ddl
mZ e	dedZG d	d
 d
eZG dd deZG dd deZG dd deZdedefddZdedefddZdee deeddf fddZdedefddZeeefZdS )zThe purpose of this module is implement PEP 621 validations that are
difficult to express as a JSON Schema (or that are not supported by the current
JSON Schema library).
    N)cleandoc)	GeneratorIterableMappingTypeVar   )ValidationErrorT)boundc                   @      e Zd ZdZeZdZdS )RedefiningStaticFieldAsDynamiczAccording to PEP 621:

    Build back-ends MUST raise an error if the metadata specifies a field
    statically as well as being listed in dynamic.
    zMhttps://packaging.python.org/en/latest/specifications/pyproject-toml/#dynamicN__name__
__module____qualname___DESC__doc___URL r   r   x/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/setuptools/config/_validate_pyproject/extra_validations.pyr      s
    r   c                   @   r   ) IncludedDependencyGroupMustExistzDAn included dependency group must exist and must not be cyclic.
    z!https://peps.python.org/pep-0735/Nr   r   r   r   r   r      s    r   c                   @   r   )ImportNameCollisionz\According to PEP 794:

    All import-names and import-namespaces items must be unique.
    !https://peps.python.org/pep-0794/Nr   r   r   r   r   r   #       r   c                   @   r   )ImportNameMissingzLAccording to PEP 794:

    An import name must have all parents listed.
    r   Nr   r   r   r   r   r   ,   r   r   	pyprojectreturnc              	   C   sl   |  di }| dg }|D ]%}||v r3td| d||| ddd|id| ttjtjdd	d
q| S )Nprojectdynamicz(You cannot provide a value for `project.z6` and list it under `project.dynamic` at the same timez...z # ...zdata.project.descriptionZseezPEP 621messagevaluenameZ
definitionrule)getr   r   r   r   )r   Zproject_tabler   fieldr   r   r   validate_project_dynamic5   s$   
r(   c              	   C   sz   |  di }| D ]0\}}|D ])}t|tr9| d }r9||vr9td| d|d| ttjtjdddqq
| S )	Nzdependency-groupszinclude-groupzThe included dependency group z doesn't existzdata.dependency_groups.r   zPEP 735r!   )r&   items
isinstancedictr   r   r   r   )r   Zdependency_groupskeyr#   ZeachZinclude_groupr   r   r   validate_include_depenencyN   s(   
r-   r)   c                 c   s$    | D ]}| dd  V  qd S )N;r   )	partitionrstrip)r)   itemr   r   r   _remove_privatee   s   r2   c              	   C   s   |  di }tt| dg }tt| dg }dd ||  D }|r9td|dttjtjdd	d
t	|| }|D ](}t
|dd d dd D ]}||vrhtd|dttjtjdd	d
qRqA| S )Nr   zimport-nameszimport-namespacesc                 S   s   g | ]
\}}|d kr|qS )r   r   ).0kvr   r   r   
<listcomp>q   s    z/validate_import_name_issues.<locals>.<listcomp>zBDuplicated names are not allowed in import-names/import-namespaceszdata.project.importnames(paces)r   zPEP 794r!   .c                 S   s   |  d| S )Nr7   r   )abr   r   r   <lambda>   s    z-validate_import_name_issues.<locals>.<lambda>zRAll parents of an import name must also be listed in import-namespace/import-names)r&   collectionsCounterr2   r)   r   r   r   r   	frozenset	itertools
accumulatesplitr   )r   r   Zimport_namesZimport_namespacesZ
duplicatednamesr$   parentr   r   r   validate_import_name_issuesj   sD   rD   )r   r<   r?   inspectr   typingr   r   r   r   Zerror_reportingr   r	   r   r   r   r   r(   r-   strr2   rD   ZEXTRA_VALIDATIONSr   r   r   r   <module>   s&    		 *