K idZddlmZddlZddlmZddlmZddlm Z ddl m Z ddl m Z dd lmZd d lmZd d lmZe d ZeedfZ ddZ ddZ ddZdZdZdZdZdZdZy)aSHelper 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_Tc0t|}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_requiresextras_requireextrass e/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/setuptools/command/_requirestxt.py_preparers *. 9F -.> GGcttttft}|j D]D\}}||t j|D]"}||t|zj|$F|S)z Convert requirements in `extras_require` of the form `"extra": ["barbazquux; {marker}"]` to `"extra:{marker}": ["barbazquux"]`. ) rstr_Orderedr dictitemsr parse _suffix_for setdefault)routputsectionvrs rrr'szh{33 4T :F$**,; wQ ;A 7[^+ , 7 7 : ;; MrcZttj|}tt|}t t|}tt t|}|D],}|dt|jzj|.td|jD}||fS)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 3K|]<\}}|ttjdtt|Df>yw)c32K|]}t|ywN)r).0r"s r z?_move_install_requirements_markers...RsB!s1vBsN)listrfromkeysmap _clean_req)r(kr!s rr)z5_move_install_requirements_markers..Ps> Aq DBs:q/ABB CDsAA) r*r rfilter _no_markerrr,rmarkerrrr)rr inst_reqs simple_reqs complex_reqssimple_install_requiresr"expanded_extrass rrr9sU[[!123IY/Kz95L"3sK#89 :sS]*+66q9:#((*O #O 33rcN|jrdt|jzSdS)z;Return the 'extras_require' suffix for a given requirement.r$)r1rreqs rrrYs $'JJ3SZZ 6B6rc<tt|}d|_|S)z=Given a Requirement, remove environment markers and return itN)r rr1)r:r"s rr-r-^sCHAAH Hrc|j Sr')r1r9s rr0r0eszz>rcbt|xsd}d}t||}|j|y)Nc |dzS)N r>)lines r append_crz&_write_requirements..append_crls d{r)rr, writelines)streamreqslinesrBs r_write_requirementsrGis1   #E  5 !E erc |j}tj}t|jxsd|j xsi\}}t ||t|D]:}|jdjditt |||<|jd||jy)Nr>z [{extra}] requirements) distributionioStringIOrrrrGsortedwriteformatvarswrite_or_delete_filegetvalue)cmdbasenamefilenamedistdatarrextras rwrite_requirementsrYss   D ;;=D'/ #T%8%8%>B($n./'9 )?))3DF34D."789^Xt}}Grctj}t||jj|j d||j y)Nzsetup-requirements)rKrLrGrJsetup_requiresrQrR)rSrTrUrWs rwrite_setup_requirementsr\s< ;;=Dc..==>18T]]_Mr)rr rMapping[str, _StrOrIter]return&tuple[list[str], dict[str, list[str]]])rr]r^z'defaultdict[str, _Ordered[Requirement]])rr rz#Mapping[str, _Ordered[Requirement]]r^r_)__doc__ __future__rrK collectionsrcollections.abcr itertoolsrtypingr jaraco.textrpackaging.requirementsr r8r r r rrrrrrr-r0rGrYr\r>rrrhs# ##!#. T] D>H H2JH+H,,$4 42U4+4@7   HNr