
    s,g                         d dl mZ d dlmZmZmZmZmZmZm	Z	m
Z
 er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 dd	lmZ  G d
 d      Zy)    )wraps)TYPE_CHECKINGAnyCallableDictListOptionalTypeUnion)Redis   )Retry)DEFAULT_RESULT_TTL)Callback)Queue)backend_classc            $          e Zd ZeZdedddddddddddfdedef   dddee	   de	d	ee	   d
ee
d      deee      dedeeeef      dee   dee	   ded   deeeedef   f      deeeedef   f      deeeedef   f      fdZd Zy)jobNFqueuer   
connectionr   timeout
result_ttlttlqueue_class
depends_onat_frontmetadescriptionfailure_ttlretryr   
on_failure.
on_success
on_stoppedc                     || _         t        | d|      | _        || _        || _        || _        || _        |	| _        || _        || _	        |
| _
        || _        || _        || _        || _        || _        y)ak  A decorator that adds a ``enqueue`` method to the decorated function,
        which in turn creates a RQ job when called. Accepts a required
        ``queue`` argument that can be either a ``Queue`` instance or a string
        denoting the queue name.  For example::

            ..codeblock:python::

                >>> @job(queue='default')
                >>> def simple_add(x, y):
                >>>    return x + y
                >>> ...
                >>> # Puts `simple_add` function into queue
                >>> simple_add.enqueue(1, 2)

        Args:
            queue (Union['Queue', str]): The queue to use, can be the Queue class itself, or the queue name (str)
            connection (Optional[Redis], optional): Redis Connection. Defaults to None.
            timeout (Optional[int], optional): Job timeout. Defaults to None.
            result_ttl (int, optional): Result time to live. Defaults to DEFAULT_RESULT_TTL.
            ttl (Optional[int], optional): Time to live. Defaults to None.
            queue_class (Optional[Queue], optional): A custom class that inherits from `Queue`. Defaults to None.
            depends_on (Optional[List[Any]], optional): A list of dependents jobs. Defaults to None.
            at_front (Optional[bool], optional): Whether to enqueue the job at front of the queue. Defaults to None.
            meta (Optional[Dict[Any, Any]], optional): Arbitraty metadata about the job. Defaults to None.
            description (Optional[str], optional): Job description. Defaults to None.
            failure_ttl (Optional[int], optional): Failture time to live. Defaults to None.
            retry (Optional[Retry], optional): A Retry object. Defaults to None.
            on_failure (Optional[Union[Callback, Callable[..., Any]]], optional): Callable to run on failure. Defaults
                to None.
            on_success (Optional[Union[Callback, Callable[..., Any]]], optional): Callable to run on success. Defaults
                to None.
            on_stopped (Optional[Union[Callback, Callable[..., Any]]], optional): Callable to run when stopped. Defaults
                to None.
        r   )overrideN)r   r   r   r   r   r   r   r   r   r   r   r   r    r"   r!   r#   )selfr   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   s                   g/var/www/trellinator.diamondhoofcare.com/public_html/venv/lib/python3.12/site-packages/rq/decorators.py__init__zjob.__init__   sz    h 
(}{S$$	$ &&
$$$    c                 N     t               fd       }|_        |_        S )Nc                  N   t        j                  t              r(j                  j                  j                        }nj                  }|j                  dd       }|j                  dd       }|j                  dd      }|sj                  }|sj                  }|j                  | |j                  j                  j                  |||j                  j                  j                  j                  j                   j"                  j$                        S )N)namer   r   job_idr   F)argskwargsr   r   r   r   r-   r   r   r   r   r    r!   r"   r#   )
isinstancer   strr   r   popr   r   enqueue_callr   r   r   r   r   r   r    r!   r"   r#   )r.   r/   r   r   r-   r   fr&   s         r'   delayzjob.__call__.<locals>.delayW   s    $**c*((djjT__(U

L$7JZZ$/Fzz*e4H!__
==%%??HH%!YY ,, ,,jj??????! &  r)   )r   r5   enqueue)r&   r4   r5   s   `` r'   __call__zjob.__call__V   s/    	q!	 
!	F 	r)   )__name__
__module____qualname__r   r   r   r   r1   r	   intr
   r   r   boolr   r   r   r(   r7    r)   r'   r   r      sd   K "&,!/3*.)-%)%)#'DHDHDH!B%Wc\"B% B% #	B%
 B% c]B% d7m,B% T#Y'B% B% tCH~&B% c]B% c]B%  B% U8Xc3h-?#?@AB% U8Xc3h-?#?@AB%  U8Xc3h-?#?@A!B%H'r)   r   N)	functoolsr   typingr   r   r   r   r   r	   r
   r   redisr   r   r   defaultsr   r   r   r   utilsr   r=   r)   r'   <module>rC      s2     R R R (    n nr)   