
    j                        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
mZ ddlmZmZ ddlmZ erd d	lmZ d
dgZddZ G d d
e          Z G d d          ZdS )    )annotations)TYPE_CHECKING   )parse_requirement)ParserSyntaxError)Marker_normalize_extra_values)InvalidSpecifierSpecifierSetcanonicalize_name)IteratorInvalidRequirementRequirementreturn	list[str]c                     t           S N)__all__     U/var/www/html/python-test/venv/lib/python3.11/site-packages/packaging/requirements.py__dir__r      s    Nr   c                      e Zd ZdZdS )r   zf
    An invalid requirement was found, users should refer to PEP 508.

    .. versionadded:: 16.1
    N)__name__
__module____qualname____doc__r   r   r   r   r      s           r   c                  V    e Zd ZdZdZddZdd
ZddZddZddZ	ddZ
ddZddZdS )r   a  Parse a requirement.

    Parse a given requirement string into its parts, such as name, specifier,
    URL, and extras. Raises InvalidRequirement on a badly-formed requirement
    string.

    .. versionadded:: 16.1

    .. versionchanged:: 22.0
        Added equality (``__eq__``) and hashing (``__hash__``) so requirements
        can be compared and stored in sets / dicts.

    .. versionchanged:: 23.2
        Equality and hashing began canonicalizing requirement names, so
        requirements whose names differ only by normalization (e.g.
        ``Requirement("Foo")`` vs ``Requirement("foo")``) now compare and hash
        equal.

    Instances are safe to serialize with :mod:`pickle`. They use a stable
    format so the same pickle can be loaded in future packaging releases.

    .. versionchanged:: 26.2

        Added a stable pickle format. Pickles created with packaging 26.2+ can
        be unpickled with future releases.  Backward compatibility with pickles
        from packaging < 26.2 is supported but may be removed in a future
        release.

    .. versionchanged:: 26.3

        The dedicated pickle support introduced in 26.2 did not preserve the
        specifier's explicit :attr:`~packaging.specifiers.SpecifierSet.prereleases`
        override; it is now included again.

        Equality and hashing normalize requirement names, extras, and
        equivalent specifiers. The string representation still preserves the
        parsed name and extras spelling.
    )extrasmarkername	specifierurlrequirement_stringstrr   Nonec                   	 t          |          }n/# t          $ r"}t          t          |                    |d }~ww xY w|j        | _        |j        pd | _        t          |j                  | _        	 t          |j	                  | _	        n/# t          $ r"}t          t          |                    |d }~ww xY wd | _        |j        >t          j        t                    | _        t          |j                  | j        _        d S d S r   )_parse_requirementr   r   r&   r"   r$   setr    r   r#   r
   r!   r   __new__r	   _markers)selfr%   parsedes       r   __init__zRequirement.__init__R   s   	4'(:;;FF  	4 	4 	4$SVV,,!3	4  	%z1T #FM 2 2	4+78H+I+IDNN 	4 	4 	4$SVV,,!3	4%)=$ .00DK#:6=#I#IDK    %$s(    
>9>5B 
B;B66B;r"   Iterator[str]c              #    K   |V  | j         r/d                    t          | j                             }d| dV  | j        rt	          | j                  V  | j        rd| j         V  | j        rdV  | j        rd| j         V  d S d S )N,[]z @  z; )r    joinsortedr#   r&   r$   r!   )r-   r"   formatted_extrass      r   _iter_partszRequirement._iter_partsd   s      


; 	*"xxt{(;(;<<)&))))))> 	&dn%%%%%8 	""""""{ 			; 	%$t{$$$$$$$	% 	%r   tuple[str, bool | None]c                8    t          |           | j        j        fS r   )r&   r#   _prereleasesr-   s    r   __getstate__zRequirement.__getstate__v   s    
 D		4>677r   stateobjectc                   t          |t                    r|}d }nt          |t                    rWt          |          dk    rDt          |d         t                    r)|d         t          |d         t                    r|\  }}ntt          |t
                    rM|                                t          | j                  k    r#| j        D ]}t          | |||                    d S t          d|          	 t          |          }n%# t          $ r}t          d|          |d }~ww xY w|j        | _        |j        | _        |j        | _        |j        | _        || j        _        |j        | _        d S )N   r   r   z Cannot restore Requirement from )
isinstancer&   tuplelenbooldictkeysr*   	__slots__setattr	TypeErrorr   r   r"   r$   r    r#   r=   r!   )r-   r@   r%   prereleaseskeytmpexcs          r   __setstate__zRequirement.__setstate__}   s   eS!! 	J&+'+KKue$$	JE

a58S))  q!Za$%?%?! /4+t$$ 	JT^9L9L)L)L~ / /c5:....FHuHHIII	S011CC! 	S 	S 	SHuHHIIsR	SH	7j&1#js   <D 
D.D))D.c                \    d                     |                     | j                            S )N )r7   r:   r"   r>   s    r   __str__zRequirement.__str__   s$    wwt''	22333r   c                B    d| j         j         dt          |           dS )N<(z)>)	__class__r   r&   r>   s    r   __repr__zRequirement.__repr__   s&    <4>*<<SYY<<<<r   intc                    t          t          | j                  t          d | j        D                       | j        | j        | j        f          S )Nc              3  4   K   | ]}t          |          V  d S r   r   .0r/   s     r   	<genexpr>z'Requirement.__hash__.<locals>.<genexpr>   s+      DD1+A..DDDDDDr   )hashr   r"   	frozensetr    r#   r$   r!   r>   s    r   __hash__zRequirement.__hash__   sS     !$),,DDDDDDD
 
 	
r   otherrG   c                r   t          |t                    st          S t          d | j        D                       }t          d |j        D                       }t          | j                  t          |j                  k    o5||k    o/| j        |j        k    o| j        |j        k    o| j	        |j	        k    S )Nc              3  4   K   | ]}t          |          V  d S r   r   r]   s     r   r_   z%Requirement.__eq__.<locals>.<genexpr>   s+      JJ 1! 4 4JJJJJJr   c              3  4   K   | ]}t          |          V  d S r   r   r]   s     r   r_   z%Requirement.__eq__.<locals>.<genexpr>   s+       L L!!21!5!5 L L L L L Lr   )
rD   r   NotImplementedra   r    r   r"   r#   r$   r!   )r-   rc   self_extrasother_extrass       r   __eq__zRequirement.__eq__   s    %-- 	"!!  JJdkJJJJJ  L Lu| L L LLLdi((,=ej,I,II ,|+,%/1, EI%, u|+	
r   N)r%   r&   r   r'   )r"   r&   r   r1   )r   r;   )r@   rA   r   r'   )r   r&   )r   rZ   )rc   rA   r   rG   )r   r   r   r   rJ   r0   r:   r?   rQ   rT   rY   rb   rj   r   r   r   r   r   #   s        % %X AIJ J J J$% % % %$8 8 8 8! ! ! !@4 4 4 4= = = =
 
 
 
 
 
 
 
 
 
r   N)r   r   )
__future__r   typingr   _parserr   r)   
_tokenizerr   markersr   r	   
specifiersr
   r   utilsr   collections.abcr   r   r   
ValueErrorr   r   r   r   r   <module>rt      s4   # " " " " "             < < < < < < ) ) ) ) ) ) 4 4 4 4 4 4 4 4 6 6 6 6 6 6 6 6 $ $ $ $ $ $ )((((((           ]
 ]
 ]
 ]
 ]
 ]
 ]
 ]
 ]
 ]
r   