a
    !6aๆ
  ใ                   @   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   ๚8lib/python3.9/site-packages/pip/_vendor/tenacity/stop.pyฺ__call__   s    zstop_base.__call__ฺstop_all)ฺotherr   c                 C   s
   t | |S r   )r   ฉr
   r   r   r   r   ฺ__and__    s    zstop_base.__and__ฺstop_anyc                 C   s
   t | |S 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 r   ฉr   ฉr
   r   r   r   r   ฺ__init__*   s    zstop_any.__init__r   r   c                    s   t  fdd| jD S )Nc                 3   s   | ]}| V  qd S r   r   ฉฺ.0ฺxฉr   r   r   ฺ	<genexpr>.   ๓    z$stop_any.__call__.<locals>.<genexpr>)ฺanyr   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.Nr   c                 G   s
   || _ d S r   r   r   r   r   r   r   4   s    zstop_all.__init__r   r   c                    s   t  fdd| jD S )Nc                 3   s   | ]}| V  qd S r   r   r   r"   r   r   r#   8   r$   z$stop_all.__call__.<locals>.<genexpr>)ฺallr   r	   r   r"   r   r   7   s    zstop_all.__call__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   c                 C   s   dS )NFr   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 r   )r*   )r
   r*   r   r   r   r   H   s    zstop_when_event_set.__init__r   r   c                 C   s
   | j  ก S r   )r*   Zis_setr	   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 r   )r,   )r
   r,   r   r   r   r   R   s    zstop_after_attempt.__init__r   r   c                 C   s   |j | jkS r   )Zattempt_numberr,   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 r   )r/   )r
   r/   r   r   r   r   \   s    zstop_after_delay.__init__r   r   c                 C   s   |j | jkS r   )Zseconds_since_startr/   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_CHECKINGZ	threadingZpip._vendor.tenacityr   ฺABCr   r   r   r(   Z
stop_neverr)   r+   r.   r   r   r   r   ฺ<module>   s   



