3 Pfym @ s d dl mZmZmZ d dlZd dlZd dlZd dlZddlm Z m Z ddlmZm Z mZ G dd deZG dd d e ejeZG d d deZG dd d eZdd ZG dd deZejdZdd Zdd ZG dd deZdS ) )absolute_importdivisionprint_functionN )string_typeswith_metaclass)Version LegacyVersionparsec @ s e Zd ZdZdS )InvalidSpecifierzH An invalid specifier was found, users should refer to PEP 440. N)__name__ __module____qualname____doc__ r r /usr/lib/python3.6/specifiers.pyr s r c @ s e Zd Zejdd Zejdd Zejdd Zejdd Zej d d Z e jdd Z ejdd dZejdddZ dS ) BaseSpecifierc C s dS )z Returns the str representation of this Specifier like object. This should be representative of the Specifier itself. Nr )selfr r r __str__ s zBaseSpecifier.__str__c C s dS )zF Returns a hash value for this Specifier like object. Nr )r r r r __hash__ s zBaseSpecifier.__hash__c C s dS )zq Returns a boolean representing whether or not the two Specifier like objects are equal. Nr )r otherr r r __eq__$ s zBaseSpecifier.__eq__c C s dS )zu Returns a boolean representing whether or not the two Specifier like objects are not equal. Nr )r r r r r __ne__+ s zBaseSpecifier.__ne__c C s dS )zg Returns whether or not pre-releases as a whole are allowed by this specifier. Nr )r r r r prereleases2 s zBaseSpecifier.prereleasesc C s dS )zd Sets whether or not pre-releases as a whole are allowed by this specifier. Nr )r valuer r r r 9 s Nc C s dS )zR Determines if the given item is contained within this specifier. Nr )r itemr r r r contains@ s zBaseSpecifier.containsc C s dS )z Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it. Nr )r iterabler r r r filterF s zBaseSpecifier.filter)N)N)r r r abcabstractmethodr r r r abstractpropertyr setterr r r r r r r s r c @ s e Zd Zi Zd ddZdd Zdd Zd d Zdd Zd d Z dd Z dd Zedd Z edd Zedd Zejdd Zdd Zd!ddZd"ddZdS )#_IndividualSpecifier Nc C sF | j j|}|stdj||jdj |jdj f| _|| _d S )NzInvalid specifier: '{0}'operatorversion)_regexsearchr formatgroupstrip_spec_prereleases)r specr matchr r r __init__R s z_IndividualSpecifier.__init__c C s0 | j d k rdj| jnd}dj| jjt| |S )Nz, prereleases={0!r}r$ z<{0}({1!r}{2})>)r- r) r __class__r str)r prer r r __repr___ s z_IndividualSpecifier.__repr__c C s dj | j S )Nz{0}{1})r) r, )r r r r r l s z_IndividualSpecifier.__str__c C s t | jS )N)hashr, )r r r r r o s z_IndividualSpecifier.__hash__c C sL t |tr0y| j|}W q@ tk r, tS X nt || js@tS | j|jkS )N) isinstancer r1 r NotImplementedr, )r r r r r r r s z_IndividualSpecifier.__eq__c C sL t |tr0y| j|}W q@ tk r, tS X nt || js@tS | j|jkS )N)r6 r r1 r r7 r, )r r r r r r } s z_IndividualSpecifier.__ne__c C s t | dj| j| S )Nz_compare_{0})getattrr) _operators)r opr r r _get_operator s z"_IndividualSpecifier._get_operatorc C s t |ttfst|}|S )N)r6 r r r )r r&