U
    ^                      @   s,   d dl mZ dZG dd deZdd ZdS )    wraps   c                   @   s   e Zd ZdS )MaxRetriesExceptionN)__name__
__module____qualname__ r	   r	   3/home/feoh/src/personal/bitesofpy/211/decorators.pyr      s   r   c                 C   s   dd }|S )zHComplete this decorator, make sure
       you print the exception thrownc                    s   t    fdd}|S )Nc               
      sd   d}|t k rRz | |}|W S  tk
rF } zt| W 5 d }~X Y nX |d7 }qtdt  d S )Nr      z$Exceeded Maximum Number of Retries: )MAX_RETRIES	Exceptionprintr   )argskwargsZtriesresultexcwrapped_functionr	   r
   _wrapper   s    

z5retry.<locals>.decorator_with_wraps.<locals>._wrapperr   )r   r   r	   r   r
   decorator_with_wraps   s    z#retry.<locals>.decorator_with_wrapsr	   )funcr   r	   r	   r
   retry
   s    r   N)	functoolsr   r   r   r   r   r	   r	   r	   r
   <module>   s   