
    i                        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 ddlmZ d	d
gZddZ G d d	e          Z G d d
          ZdS )    )annotations)Iterator   )parse_requirement)ParserSyntaxError)Marker_normalize_extra_values)SpecifierSet)canonicalize_nameInvalidRequirementRequirementreturn	list[str]c                     t           S N)__all__     ]/home/ubuntu/.hermes/hermes-agent/venv/lib/python3.11/site-packages/packaging/requirements.py__dir__r      s    Nr   c                      e Zd ZdZdS )r   zJ
    An invalid requirement was found, users should refer to PEP 508.
    N)__name__
__module____qualname____doc__r   r   r   r   r      s           r   c                  R    e 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   ao  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.

    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.
    requirement_stringstrr   Nonec                   	 t          |          }n/# t          $ r"}t          t          |                    |d }~ww xY w|j        | _        |j        pd | _        t          |j        pg           | _        t          |j	                  | _	        d | _
        |j
        >t          j        t                    | _
        t          |j
                  | j
        _        d S d S r   )_parse_requirementr   r   r   nameurlsetextrasr
   	specifiermarkerr   __new__r	   _markers)selfr   parsedes       r   __init__zRequirement.__init__5   s    	4'(:;;FF  	4 	4 	4$SVV,,!3	4  	%z1T #FM$7R 8 8'3F4D'E'E%)=$ .00DK#:6=#I#IDK    %$s    
>9>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   c                     t          |           S r   )r   r*   s    r   __getstate__zRequirement.__getstate__V   s     4yyr   stateobjectc                   t          |t                    rt	 t          |          }n%# t          $ r}t	          d|          |d }~ww xY w|j        | _        |j        | _        |j        | _        |j        | _        |j	        | _	        d S t          |t                    r| j                            |           d S t	          d|          )Nz Cannot restore Requirement from )
isinstancer   r   r   	TypeErrorr"   r#   r%   r&   r'   dict__dict__update)r*   r;   tmpexcs       r   __setstate__zRequirement.__setstate__[   s    eS!! 	W!%((% W W W L5 L LMMSVVWDIwDH*DK ]DN*DKFeT"" 	M  '''FD5DDEEEs   ' 
A	AA	c                \    d                     |                     | j                            S )N )r4   r7   r"   r9   s    r   __str__zRequirement.__str__n   s$    wwt''	22333r   c                B    d| j         j         dt          |           dS )N<(z)>)	__class__r   r   r9   s    r   __repr__zRequirement.__repr__q   s&    <4>*<<SYY<<<<r   intc           	         t          t          |                     t          | j                                                S r   )hashtupler7   r   r"   r9   s    r   __hash__zRequirement.__hash__t   s1    E$**+<TY+G+GHHIIJJJr   otherboolc                   t          |t                    st          S t          | j                  t          |j                  k    o?| j        |j        k    o/| j        |j        k    o| j        |j        k    o| j        |j        k    S r   )	r>   r   NotImplementedr   r"   r%   r&   r#   r'   )r*   rS   s     r   __eq__zRequirement.__eq__w   s    %-- 	"!! di((,=ej,I,II ,u|+,%/1, EI%, u|+	
r   N)r   r   r   r   )r"   r   r   r.   )r   r   )r;   r<   r   r   )r   rN   )rS   r<   r   rT   )r   r   r   r   r-   r7   r:   rE   rH   rM   rR   rW   r   r   r   r   r      s         ,J J J J% % % %$   
F F F F&4 4 4 4= = = =K K K K

 

 

 

 

 

r   N)r   r   )
__future__r   typingr   _parserr   r!   
_tokenizerr   markersr   r	   
specifiersr
   utilsr   r   r   
ValueErrorr   r   r   r   r   <module>r`      s   # " " " " "       < < < < < < ) ) ) ) ) ) 4 4 4 4 4 4 4 4 $ $ $ $ $ $ $ $ $ $ $ $           c
 c
 c
 c
 c
 c
 c
 c
 c
 c
r   