B
    d                 @   sv   d dl Zd dlmZmZmZmZ ddlmZ ddl	m
Z
 ddlmZmZ ddlmZ G dd	 d	eZG d
d dZdS )    N)AnyListOptionalSet   )parse_requirement)ParserSyntaxError)Marker_normalize_extra_values)SpecifierSetc               @   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   [/var/www/html/venv/lib/python3.7/site-packages/setuptools/_vendor/packaging/requirements.pyr      s   r   c               @   sZ   e Zd ZdZeddddZedddZedd	d
ZedddZ	e
e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.
    N)requirement_stringreturnc          
   C   s
  yt |}W n0 tk
r< } ztt||W d d }~X Y nX |j| _|jrtj|j}|j	dkrtj
||jkrtdn(|j	r|jr|j	s|jstd|j |j| _nd | _t|jr|jng | _t|j| _d | _|jd k	rtt| _t|j| j_d S )NfilezInvalid URL givenzInvalid URL: )r   r   r   strnameurlurllibparseurlparsescheme
urlunparsenetlocsetextrasr   	specifiermarkerr	   __new__r
   _markers)selfr   parsede
parsed_urlr   r   r   __init__!   s*     


zRequirement.__init__)r   c             C   s   | j g}| jr0dt| j}|d| d | jrF|t| j | jrn|d| j  | jrn|d | jr|d| j  d|S )N,[]z@  z;  )	r   r!   joinsortedappendr"   r   r   r#   )r&   partsformatted_extrasr   r   r   __str__;   s    
zRequirement.__str__c             C   s   d|  dS )Nz<Requirement('z')>r   )r&   r   r   r   __repr__O   s    zRequirement.__repr__c             C   s   t | jjt| fS )N)hash	__class__r   r   )r&   r   r   r   __hash__R   s    zRequirement.__hash__)otherr   c             C   sJ   t |tstS | j|jkoH| j|jkoH| j|jkoH| j|jkoH| j|jkS )N)
isinstancer   NotImplementedr   r!   r"   r   r#   )r&   r:   r   r   r   __eq__U   s    
zRequirement.__eq__)r   r   r   r   r   r*   r5   r6   intr9   r   boolr=   r   r   r   r   r      s   r   )urllib.parser   typingr   r   r   r   _parserr   Z
_tokenizerr   markersr	   r
   
specifiersr   
ValueErrorr   r   r   r   r   r   <module>   s   