
    h                     v    d Z ddlZddlmZ ddlmZ dZdZ eed      Zdeej                  fd	Z	d
 Z
efdZy)z/Creating events, and event exchange definition.    N)copy)Exchange)Eventevent_exchangeget_exchange
group_fromceleryevtopictypec                 f    |r	 ||fi |n|}d|vr|j                   |       |        |S | |d<   |S )zCreate an event.

    Notes:
        An event is simply a dictionary: the only required field is ``type``.
        A ``timestamp`` field will be set to the current time if not provided.
    	timestamp)r   r   r   )update)r   _fields__dict____now__fieldsevents         O/var/www/Befach/backend/env/lib/python3.12/site-packages/celery/events/event.pyr   r      sH     ,3HW''E%wyt4 L fL    c                 ,    | j                  dd      d   S )zGet the group part of an event type name.

    Example:
        >>> group_from('task-sent')
        'task'

        >>> group_from('custom-my-event')
        'custom'
    -   r   )splitr   s    r   r   r   !   s     ::c1a  r   c                     t        t              }| j                  j                  dv rd|_        ||j
                  k7  r||_        |S )a8  Get exchange used for sending events.

    Arguments:
        conn (kombu.Connection): Connection used for sending/receiving events.
        name (str): Name of the exchange. Default is ``celeryev``.

    Note:
        The event type changes if Redis is used as the transport
        (from topic -> fanout).
    >   redisgcpubsubfanout)r   r   	transportdriver_typer   name)connr!   exs      r   r   r   .   s?     
n	B~~!!%::rwwIr   )__doc__timer   kombur   __all__EVENT_EXCHANGE_NAMEr   dictr   r   r    r   r   <module>r+      sP    5    !  -G< tTYY 
! 0 r   