
    ,h                        d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ dd	lmZ d
dlmZ d
dlmZ  ed      Zeedf   Z	 	 	 	 	 	 ddZ	 	 	 	 ddZ	 	 	 	 	 	 ddZd Zd Zd Zd Zd Zd Zy)aS  Helper code used to generate ``requires.txt`` files in the egg-info directory.

The ``requires.txt`` file has an specific format:
    - Environment markers need to be part of the section headers and
      should not be part of the requirement spec itself.

See https://setuptools.pypa.io/en/latest/deprecated/python_eggs.html#requires-txt
    )annotationsN)defaultdict)Mapping)filterfalse)TypeVar)yield_lines)Requirement   )_reqs)
_StrOrIter_Tc                0    t        |      }t        | |      S )zGiven values for ``install_requires`` and ``extras_require``
    create modified versions in a way that can be written in ``requires.txt``
    )_convert_extras_requirements"_move_install_requirements_markers)install_requiresextras_requireextrass      a/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/setuptools/command/_requirestxt.py_preparer      s     *.9F-.>GG    c                    t        t        t        t           f   t              }| j                         D ]D  \  }}||    t        j                  |      D ]"  }||t        |      z      j                  |       $ F |S )z
    Convert requirements in `extras_require` of the form
    `"extra": ["barbazquux; {marker}"]` to
    `"extra:{marker}": ["barbazquux"]`.
    )
r   str_Orderedr	   dictitemsr   parse_suffix_for
setdefault)r   outputsectionvrs        r   r   r   '   sz     h{334T:F$**, ;
wQ 	;A7[^+,77:	;; Mr   c                Z   t        t        j                  |             }t        t        |      }t        t        |      }t        t        t        |            }|D ],  }|dt        |j                        z      j                  |       . t        d |j                         D              }||fS )a+  
    The ``requires.txt`` file has an specific format:
        - Environment markers need to be part of the section headers and
          should not be part of the requirement spec itself.

    Move requirements in ``install_requires`` that are using environment
    markers ``extras_require``.
    :c              3     K   | ]<  \  }}|t        t        j                  d  t        t        |      D                    f > yw)c              3  2   K   | ]  }t        |        y wN)r   ).0r"   s     r   	<genexpr>z?_move_install_requirements_markers.<locals>.<genexpr>.<genexpr>R   s     B!s1vBs   N)listr   fromkeysmap
_clean_req)r(   kr!   s      r   r)   z5_move_install_requirements_markers.<locals>.<genexpr>P   s>       Aq 
DBs:q/ABBCDs   AA)r*   r   r   filter
_no_markerr   r,   r   markerr   r   r   )r   r   	inst_reqssimple_reqscomplex_reqssimple_install_requiresr"   expanded_extrass           r   r   r   9   s     U[[!123IY/Kz95L"3sK#89 :sS]*+66q9:   #((* O #O33r   c                N    | j                   rdt        | j                         z   S dS )z;Return the 'extras_require' suffix for a given requirement.r$    )r1   r   reqs    r   r   r   Y   s     $'JJ3SZZ 6B6r   c                <    t        t        |             }d|_        |S )z=Given a Requirement, remove environment markers and return itN)r	   r   r1   )r:   r"   s     r   r-   r-   ^   s    CHAAHHr   c                    | j                    S r'   )r1   r9   s    r   r0   r0   e   s    zz>r   c                b    t        |xs d      }d }t        ||      }| j                  |       y )N c                    | dz   S )N
r>   )lines    r   	append_crz&_write_requirements.<locals>.append_crl   s    d{r   )r   r,   
writelines)streamreqslinesrB   s       r   _write_requirementsrG   i   s1    
#E 	5!E
er   c           	        | j                   }t        j                         }t        |j                  xs d|j
                  xs i       \  }}t        ||       t        |      D ]:  }|j                   dj                  di t                      t        |||          < | j                  d||j                                y )Nr>   z
[{extra}]
requirements)distributionioStringIOr   r   r   rG   sortedwriteformatvarswrite_or_delete_filegetvalue)cmdbasenamefilenamedistdatar   r   extras           r   write_requirementsrY   s   s    D;;=D'/#T%8%8%>B($n ./' 9

)?))3DF34D."789 ^Xt}}Gr   c                    t        j                         }t        || j                  j                         | j                  d||j                                y )Nzsetup-requirements)rK   rL   rG   rJ   setup_requiresrQ   rR   )rS   rT   rU   rW   s       r   write_setup_requirementsr\      s<    ;;=Dc..==>18T]]_Mr   )r   r   r   Mapping[str, _StrOrIter]return&tuple[list[str], dict[str, list[str]]])r   r]   r^   z'defaultdict[str, _Ordered[Requirement]])r   r   r   z#Mapping[str, _Ordered[Requirement]]r^   r_   )__doc__
__future__r   rK   collectionsr   collections.abcr   	itertoolsr   typingr   jaraco.textr   packaging.requirementsr	   r8   r   r   r   r   r   r   r   r   r   r-   r0   rG   rY   r\   r>   r   r   <module>rh      s    # 	 # # !  # .   T]D>H H2JH+H,,$4 42U4+4@7

HNr   