
(h                 @   s  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	 e	 r d  d l
 m Z m Z m Z m Z d  d l m Z d  d l m Z e e d	 e e f Z d
 d   Z Gd d   d e  Z Gd d   d e  Z Gd d	   d	 e  Z d S)    )SpecifierSet)canonicalize_name)InstallRequirement)Hashes)MYPY_CHECK_RUNNING)	FrozenSetIterableOptionalTuple)_BaseVersion)Link	Candidatec             C   s<   | s
 |  St  d d   | D  } d j |  d j |   S)Nc             s   s   |  ] } t  |  Vq d  S)N)r   ).0e r   G/tmp/pip-build-kmztzv_d/pip/pip/_internal/resolution/resolvelib/base.py	<genexpr>   s    zformat_name.<locals>.<genexpr>z{}[{}],)sortedformatjoin)projectextrasZcanonical_extrasr   r   r   format_name   s    r   c               @   sp   e  Z d  Z d d   Z e d d    Z e d d    Z d d   Z d	 d
   Z d d   Z	 d d   Z
 d S)
Constraintc             C   s   | |  _  | |  _ d  S)N)	specifierhashes)selfr   r   r   r   r   __init__   s    	zConstraint.__init__c             C   s   t  t   t    S)N)r   r   r   )clsr   r   r   empty#   s    zConstraint.emptyc             C   s   t  | j | j d d   S)Ntrust_internetF)r   r   r   )r   Zireqr   r   r   	from_ireq(   s    zConstraint.from_ireqc             C   s   t  |  j  p t  |  j  S)N)boolr   r   )r   r   r   r   __nonzero__-   s    zConstraint.__nonzero__c             C   s
   |  j    S)N)r$   )r   r   r   r   __bool__1   s    zConstraint.__bool__c             C   sI   t  | t  s t S|  j | j @} |  j | j d d  @} t | |  S)Nr!   F)
isinstancer   NotImplementedr   r   r   )r   otherr   r   r   r   r   __and__5   s
    zConstraint.__and__c             C   s   |  j  j | j d d S)NprereleasesT)r   containsversion)r   	candidater   r   r   is_satisfied_by=   s    zConstraint.is_satisfied_byN)__name__
__module____qualname__r   classmethodr    r"   r$   r%   r)   r.   r   r   r   r   r      s   r   c               @   sX   e  Z d  Z e d d    Z e d d    Z d d   Z d d   Z d	 d
   Z d S)Requirementc             C   s   t  d   d S)zThe "project name" of a requirement.

        This is different from ``name`` if this requirement contains extras,
        in which case ``name`` would contain the ``[...]`` part, while this
        refers to the name of the project.
        zSubclass should overrideN)NotImplementedError)r   r   r   r   project_nameF   s    	zRequirement.project_namec             C   s   t  d   d S)zThe name identifying this requirement in the resolver.

        This is different from ``project_name`` if this requirement contains
        extras, where ``project_name`` would not contain the ``[...]`` part.
        zSubclass should overrideN)r4   )r   r   r   r   nameQ   s    zRequirement.namec             C   s   d S)NFr   )r   r-   r   r   r   r.   [   s    zRequirement.is_satisfied_byc             C   s   t  d   d  S)NzSubclass should override)r4   )r   r   r   r   get_candidate_lookup_   s    z Requirement.get_candidate_lookupc             C   s   t  d   d  S)NzSubclass should override)r4   )r   r   r   r   format_for_errorc   s    zRequirement.format_for_errorN)	r/   r0   r1   propertyr5   r6   r.   r7   r8   r   r   r   r   r3   E   s
   
r3   c               @   s   e  Z d  Z e d d    Z e d d    Z e d d    Z e d d    Z e d	 d
    Z e d d    Z	 d d   Z
 d d   Z d d   Z d S)r   c             C   s   t  d   d S)zThe "project name" of the candidate.

        This is different from ``name`` if this candidate contains extras,
        in which case ``name`` would contain the ``[...]`` part, while this
        refers to the name of the project.
        zOverride in subclassN)r4   )r   r   r   r   r5   i   s    	zCandidate.project_namec             C   s   t  d   d S)zThe name identifying this candidate in the resolver.

        This is different from ``project_name`` if this candidate contains
        extras, where ``project_name`` would not contain the ``[...]`` part.
        zOverride in subclassN)r4   )r   r   r   r   r6   t   s    zCandidate.namec             C   s   t  d   d  S)NzOverride in subclass)r4   )r   r   r   r   r,   ~   s    zCandidate.versionc             C   s   t  d   d  S)NzOverride in subclass)r4   )r   r   r   r   is_installed   s    zCandidate.is_installedc             C   s   t  d   d  S)NzOverride in subclass)r4   )r   r   r   r   is_editable   s    zCandidate.is_editablec             C   s   t  d   d  S)NzOverride in subclass)r4   )r   r   r   r   source_link   s    zCandidate.source_linkc             C   s   t  d   d  S)NzOverride in subclass)r4   )r   Zwith_requiresr   r   r   iter_dependencies   s    zCandidate.iter_dependenciesc             C   s   t  d   d  S)NzOverride in subclass)r4   )r   r   r   r   get_install_requirement   s    z!Candidate.get_install_requirementc             C   s   t  d   d  S)NzSubclass should override)r4   )r   r   r   r   r8      s    zCandidate.format_for_errorN)r/   r0   r1   r9   r5   r6   r,   r:   r;   r<   r=   r>   r8   r   r   r   r   r   h   s   
N)Z pip._vendor.packaging.specifiersr   pip._vendor.packaging.utilsr   Zpip._internal.req.req_installr   Zpip._internal.utils.hashesr   Zpip._internal.utils.typingr   Ztypingr   r   r	   r
   Zpip._vendor.packaging.versionr   Zpip._internal.models.linkr   ZCandidateLookupr   objectr   r3   r   r   r   r   r   <module>   s   "(#