o
    Df                     @   sb   d Z ddlZddlmZ ddlmZ dZdZeeddZdeejfd	d
Z	dd Z
efddZdS )z/Creating events, and event exchange definition.    N)copy)Exchange)Eventevent_exchangeget_exchange
group_fromceleryevtopictypec                 K   s@   |r
||fi |n|}d|vr|j | | d |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event r   L/home/ubuntu/webapp/venv/lib/python3.10/site-packages/celery/events/event.pyr      s   r   c                 C   s   |  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
   r   r   r   r   !   s   
r   c                 C   s.   t t}| jjdkrd|_||jk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fanout)r   r   	transportdriver_typer   name)connr   exr   r   r   r   .   s   
r   )__doc__timer   kombur   __all__EVENT_EXCHANGE_NAMEr   dictr   r   r   r   r   r   r   <module>   s    