B
    ufæ
  ã               @   s¦   d dl Z d dlZejr*d dlZd dlmZ G dd„ de jƒZG dd„ deƒZG dd„ deƒZ	G d	d
„ d
eƒZ
e
ƒ ZG dd„ deƒZG dd„ deƒZG dd„ deƒZdS )é    N)ÚRetryCallStatec               @   sF   e Zd ZdZejdedœdd„ƒZd ddœdd	„Zd d
dœdd„Z	dS )Ú	stop_basez(Abstract base class for stop strategies.r   )Úretry_stateÚreturnc             C   s   d S )N© )Úselfr   r   r   ú[/home/ankuromar296_gmail_com/myenv/lib/python3.7/site-packages/pip/_vendor/tenacity/stop.pyÚ__call__   s    zstop_base.__call__Ústop_all)Úotherr   c             C   s
   t | |ƒS )N)r
   )r   r   r   r   r   Ú__and__    s    zstop_base.__and__Ústop_anyc             C   s
   t | |ƒS )N)r   )r   r   r   r   r   Ú__or__#   s    zstop_base.__or__N)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚabcÚabstractmethodÚboolr	   r   r   r   r   r   r   r      s
   r   c               @   s0   e Zd ZdZeddœdd„Zdedœdd	„ZdS )
r   z+Stop if any of the stop condition is valid.N)Ústopsr   c             G   s
   || _ d S )N)r   )r   r   r   r   r   Ú__init__*   s    zstop_any.__init__r   )r   r   c                s   t ‡ fdd„| jD ƒƒS )Nc             3   s   | ]}|ˆ ƒV  qd S )Nr   )Ú.0Úx)r   r   r   ú	<genexpr>.   s    z$stop_any.__call__.<locals>.<genexpr>)Úanyr   )r   r   r   )r   r   r	   -   s    zstop_any.__call__)r   r   r   r   r   r   r   r	   r   r   r   r   r   '   s   r   c               @   s0   e Zd ZdZeddœdd„Zdedœdd	„ZdS )
r
   z*Stop if all the stop conditions are valid.N)r   r   c             G   s
   || _ d S )N)r   )r   r   r   r   r   r   4   s    zstop_all.__init__r   )r   r   c                s   t ‡ fdd„| jD ƒƒS )Nc             3   s   | ]}|ˆ ƒV  qd S )Nr   )r   r   )r   r   r   r   8   s    z$stop_all.__call__.<locals>.<genexpr>)Úallr   )r   r   r   )r   r   r	   7   s    zstop_all.__call__)r   r   r   r   r   r   r   r	   r   r   r   r   r
   1   s   r
   c               @   s    e Zd ZdZdedœdd„ZdS )Ú_stop_neverzNever stop.r   )r   r   c             C   s   dS )NFr   )r   r   r   r   r   r	   >   s    z_stop_never.__call__N)r   r   r   r   r   r	   r   r   r   r   r   ;   s   r   c               @   s0   e Zd ZdZdddœdd„Zdedœd	d
„ZdS )Ústop_when_event_setz!Stop when the given event is set.zthreading.EventN)Úeventr   c             C   s
   || _ d S )N)r   )r   r   r   r   r   r   H   s    zstop_when_event_set.__init__r   )r   r   c             C   s
   | j  ¡ S )N)r   Úis_set)r   r   r   r   r   r	   K   s    zstop_when_event_set.__call__)r   r   r   r   r   r   r	   r   r   r   r   r   E   s   r   c               @   s0   e Zd ZdZeddœdd„Zdedœdd	„ZdS )
Ústop_after_attemptz.Stop when the previous attempt >= max_attempt.N)Úmax_attempt_numberr   c             C   s
   || _ d S )N)r"   )r   r"   r   r   r   r   R   s    zstop_after_attempt.__init__r   )r   r   c             C   s   |j | jkS )N)Úattempt_numberr"   )r   r   r   r   r   r	   U   s    zstop_after_attempt.__call__)r   r   r   r   Úintr   r   r	   r   r   r   r   r!   O   s   r!   c               @   s0   e Zd ZdZeddœdd„Zdedœdd	„ZdS )
Ústop_after_delayz3Stop when the time from the first attempt >= limit.N)Ú	max_delayr   c             C   s
   || _ d S )N)r&   )r   r&   r   r   r   r   \   s    zstop_after_delay.__init__r   )r   r   c             C   s   |j | jkS )N)Úseconds_since_startr&   )r   r   r   r   r   r	   _   s    zstop_after_delay.__call__)r   r   r   r   Úfloatr   r   r	   r   r   r   r   r%   Y   s   r%   )r   ÚtypingÚTYPE_CHECKINGÚ	threadingÚpip._vendor.tenacityr   ÚABCr   r   r
   r   Ú
stop_neverr   r!   r%   r   r   r   r   Ú<module>   s   



