o
    )ri6                     @  sz   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 G d	d
 d
eZG dd dZdS )    )annotations)Iterator   )parse_requirement)ParserSyntaxError)Marker_normalize_extra_values)SpecifierSet)canonicalize_namec                   @  s   e Zd ZdZdS )InvalidRequirementzJ
    An invalid requirement was found, users should refer to PEP 508.
    N)__name__
__module____qualname____doc__ r   r   U/home/air/biblejyuku/back/venv/lib/python3.10/site-packages/packaging/requirements.pyr      s    r   c                   @  sL   e Zd ZdZdddZdd
dZdddZdddZdddZdddZ	dS )RequirementzParse 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.
    requirement_stringstrreturnNonec              
   C  s   zt |}W n ty } ztt||d }~ww |j| _|jp"d | _t|jp)g | _t|j	| _	d | _
|j
d urItt| _
t|j
| j
_d S d S N)_parse_requirementr   r   r   nameurlsetextrasr	   	specifiermarkerr   __new__r   _markers)selfr   parseder   r   r   __init__"   s   
zRequirement.__init__r   Iterator[str]c                 c  sz    |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_extrasr   r   r   _iter_parts1   s   zRequirement._iter_partsc                 C  s   d | | jS )N )r*   r-   r   r!   r   r   r   __str__C   s   zRequirement.__str__c                 C  s   d| j j d|  dS )N<z('z')>)	__class__r   r/   r   r   r   __repr__F   s   zRequirement.__repr__intc                 C  s   t t| t| jS r   )hashtupler-   r
   r   r/   r   r   r   __hash__I   s   zRequirement.__hash__otherobjectboolc                 C  sR   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   )	
isinstancer   NotImplementedr
   r   r   r   r   r   )r!   r8   r   r   r   __eq__L   s   




zRequirement.__eq__N)r   r   r   r   )r   r   r   r%   )r   r   )r   r4   )r8   r9   r   r:   )
r   r   r   r   r$   r-   r0   r3   r7   r=   r   r   r   r   r      s    




r   N)
__future__r   typingr   _parserr   r   
_tokenizerr   markersr   r   
specifiersr	   utilsr
   
ValueErrorr   r   r   r   r   r   <module>   s   