HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/celery/app/__pycache__/base.cpython-310.pyc
o

-we��@szdZddlZddlZddlZddlZddlZddlmZmZm	Z	ddl
m
Z
ddlmZddl
mZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlm Z m!Z!ddl"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ddl,m-Z-m.Z.ddl/m0Z0ddl1m2Z2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9ddl:m;Z;m<Z<m=Z=ddl>m?Z?m@Z@mAZAddlBmCZCddlDmEZEmFZFddlGmHZHmIZImJZJddlKmLZLmMZMddlNmOZPddlQmRZRdd lSmTZTmUZUdd!lVmWZWdd"lXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z`maZad#ZbeCec�Zdd$hZeejf�gd%�Zhd&Zid'd(�Zjd)d*�Zkd+d,�ZlGd-d.�d.ee7�ZmGd/d0�d0�ZnenZodS)1z#Actual App instance implementation.�N)�UserDict�defaultdict�deque)�datetime��
attrgetter)�Exit)�isoparse)�pools)�LamportClock��oid_from)�register_after_fork)�cached_property)�uuid)�starpromise)�	platforms�signals)	�_announce_app_finalized�_deregister_app�
_register_app�_set_current_app�_task_stack�connect_on_app_finalize�get_current_app�get_current_worker_task�set_default_app)�AlwaysEagerIgnored�ImproperlyConfigured)�get_loader_cls)�PromiseProxy�maybe_evaluate)�abstract)�AttributeDictMixin)�Signal)�first�
head_from_fun�
maybe_list)�
gen_task_name�instantiate�symbol_by_name)�
get_logger)�FallbackContext�
mro_lookup)�maybe_make_aware�timezone�to_utc�)�backends�builtins)�prepare)�add_autoretry_behaviour)�DEFAULT_SECURITY_DIGEST�find_deprecated_settings)�TaskRegistry)	�
AppPickler�Settings�_new_key_to_old�_old_key_to_new�
_unpickle_app�_unpickle_app_v2�appstr�	bugreport�detect_settings)�Celeryzcelery.fixups.django:fixup�FORKED_BY_MULTIPROCESSINGz�
The environment variable {0!r} is not set,
and as such the configuration could not be loaded.

Please set this variable and make sure it points to
a valid configuration module.

Example:
    {0}="proj.celeryconfig"
cCst|j|tthtgd�S)z�Return true if app has customized method `attr`.

    Note:
        This is used for optimizations in cases where we know
        how the default behavior works, but need to account
        for someone using inheritance to override a method/property.
    )�stop�monkey_patched)r-�	__class__rB�object�__name__)�app�attr�rK�H/home/arjun/projects/env/lib/python3.10/site-packages/celery/app/base.py�app_has_customBs�rMcCst��|�|�S)z
Unpickle app.)r�	_rgetattr)�reverse_name�argsrKrKrL�_unpickle_appattrNsrQc
CsFz|��WdSty"}ztjd|dd�WYd}~dSd}~ww)Nz!after forker raised exception: %rr1)�exc_info)�_after_fork�	Exception�logger�info)rI�excrKrKrL�_after_fork_cleanup_appUs��rXc@s`eZdZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Ze
dd��ZdS)�PendingConfigurationNcCs t�|d|�t�|d|�dS)N�_data�callback)rG�__setattr__)�self�confr[rKrKrL�__init__iszPendingConfiguration.__init__cCs||j|<dS�N�rZ�r]�key�valuerKrKrL�__setitem__m�z PendingConfiguration.__setitem__cCs|j��dSr`)rZ�clear�r]rKrKrLrgprfzPendingConfiguration.clearcOs|jj|i|��dSr`)rZ�update�r]rP�kwargsrKrKrLrisszPendingConfiguration.updatecOs|jj|i|��Sr`)rZ�
setdefaultrjrKrKrLrlv�zPendingConfiguration.setdefaultcCs
||jvSr`ra)r]rcrKrKrL�__contains__ys
z!PendingConfiguration.__contains__cC�
t|j�Sr`)�len�datarhrKrKrL�__len__�
zPendingConfiguration.__len__cCror`)�reprrqrhrKrKrL�__repr__�rszPendingConfiguration.__repr__cC�|��Sr`)r[rhrKrKrLrq��zPendingConfiguration.data)rH�
__module__�__qualname__r[rZr_rergrirlrnrrrurrqrKrKrKrLrY^srYc@seZdZdZeZejZejej	ZZ	dZ
dZdZe
ZdZdZdZdZdZdZdZdZdZdZdZdZd	ZdZdZdZdZ					
d�dd�Z d
d�Z!dd�Z"dd�Z#dd�Z$dd�Z%dd�Z&dd�Z'd�dd�Z(d�dd�Z)dd �Z*d�d!d"�Z+d�d#d$�Z,d%d&�Z-d'd(�Z.d�d)d*�Z/d+d,�Z0	d�d-d.�Z1d�d/d0�Z2d�d2d3�Z3ddddde4d4fd5d6�Z5			d�d8d9�Z6d:d;�Z7d<d=�Z8d>d?�Z9									@d�dAdB�Z:d�dCdD�Z;d�dEdF�Z<					d�dGdH�Z=					d�dIdJ�Z>e=Z?d�dKdL�Z@d�dMdN�ZAeAZBd�dOdP�ZCeCZDdQdR�ZEdSdT�ZFd�dUdV�ZGdWdX�ZHdYdZ�ZId[d\�ZJd]d^�ZKd_d`�ZLdadb�ZMdcdd�ZN	d�dfdg�ZO	d�dhdi�ZPd�djdk�ZQdldm�ZR	n		d�dodp�ZSdqdr�ZTdsdt�ZUdudv�ZVdwdx�ZWdydz�ZXd{d|�ZYd}d~�ZZdd��Z[e\d�d���Z]e\d�d���Z^e\d�d���Z_e\d�d���Z`e\d�d���Zae\d�d���Zbe\d�d���Zce\d�d���Zdeed�d���Zfeed�d���Zgeed�d���Zhe\d�d���Zieed�d���Zje\d�d���Zkeed�d���Zleljmd�d���Zleed�d���Zneed�d���Zoeojmd�d���Zoe\d�d���Zpe\d�d���Zqe\d�d���Zre\d�d���Zse\d�d���Zte\d�d���Zueed�d���Zvd�d��Zwe\d�d���ZxdS)�rBa�Celery application.

    Arguments:
        main (str): Name of the main module if running as `__main__`.
            This is used as the prefix for auto-generated task names.

    Keyword Arguments:
        broker (str): URL of the default broker used.
        backend (Union[str, Type[celery.backends.base.Backend]]):
            The result store backend class, or the name of the backend
            class to use.

            Default is the value of the :setting:`result_backend` setting.
        autofinalize (bool): If set to False a :exc:`RuntimeError`
            will be raised if the task registry or tasks are used before
            the app is finalized.
        set_as_current (bool):  Make this the global current app.
        include (List[str]): List of modules every worker should import.

        amqp (Union[str, Type[AMQP]]): AMQP object or class name.
        events (Union[str, Type[celery.app.events.Events]]): Events object or
            class name.
        log (Union[str, Type[Logging]]): Log object or class name.
        control (Union[str, Type[celery.app.control.Control]]): Control object
            or class name.
        tasks (Union[str, Type[TaskRegistry]]): A task registry, or the name of
            a registry class.
        fixups (List[str]): List of fix-up plug-ins (e.g., see
            :mod:`celery.fixups.django`).
        config_source (Union[str, class]): Take configuration from a class,
            or object.  Attributes may include any settings described in
            the documentation.
        task_cls (Union[str, Type[celery.app.task.Task]]): base task class to
            use. See :ref:`this section <custom-task-cls-app-wide>` for usage.
    Nzcelery.app.amqp:AMQPzcelery.app.events:Eventszcelery.app.log:Loggingzcelery.app.control:Controlzcelery.app.task:Taskz celery.app.registry:TaskRegistryFTcst���_d�_t��_|�_|p�j�_|p�j�_|p ��	��_
|p&�j�_|p,�j�_|p2�j
�_
|�_t�j��_tt��_tt��_|�_|�_|�_d�_|
�_t��_t��_d�_t���_t��_ |	�_!t"�j!t#�s|���j!pyi��_!t$�d��_%|p�i�_&t��_'��(d|
���(d|���(d|�|�)�D]
\}}��(||�q�t*t+�j&�j,��jt-t.fd��_/|dur�t�j0�n|�_1�fdd��j1D��_2�jrڈ�3��j4dur�t5d	d
��_4t5ddhd
��_6t5dd
��_7t5dd
��_8d�_9��:�t;��dS)NF�__reduce_args__�
broker_url�result_backend�include)�prefix�keyscsg|]}t|����qSrK)r*)�.0�fixuprhrKrL�
<listcomp>!sz#Celery.__init__.<locals>.<listcomp>zapp.on_configure��namezapp.on_after_configure�source)r��providing_argszapp.on_after_finalizezapp.on_after_fork)<�	threading�local�_local�_backend_cacher�clock�main�amqp_cls�
events_cls�_get_default_loader�
loader_cls�log_cls�control_cls�task_cls�set_as_currentr*�registry_clsr�set�user_options�steps�autofinalize�	namespace�
strict_typing�
configured�_config_sourcer�_pending_defaults�_pending_periodic_tasks�	finalized�RLock�_finalize_mutex�_pending�_tasks�
isinstancer8rM�_using_v1_reduce�_preconf�_preconf_set_by_auto�_Celery__autoset�itemsr:rY�_finalize_pending_confr<r;�_conf�builtin_fixups�fixups�_fixups�set_current�on_configurer$�on_after_configure�on_after_finalize�
on_after_fork�use_fast_trace_task�on_initr)r]r��loader�backend�amqp�events�log�controlr��tasks�brokerr}�changes�
config_sourcer�r�r�r�r�rkrcrdrKrhrLr_�sr




��
�zCelery.__init__cCstj�d�p
|jp
dS)N�
CELERY_LOADERzcelery.loaders.app:AppLoader)�os�environ�getr�rhrKrKrLr�8s
��zCelery._get_default_loadercCsdS)z!Optional callback called at init.NrKrhrKrKrLr�@�zCelery.on_initcCs&|dur||j|<|j�|�dSdSr`)r�r��addrbrKrKrL�	__autosetCs
�zCelery.__autosetcC�t|�dS)z*Make this the current app for this thread.N)rrhrKrKrLr�H�zCelery.set_currentcCr�)z*Make this the default app for all threads.N)rrhrKrKrL�set_defaultLr�zCelery.set_defaultcCs*|jsd|_tdurt|t�dSdSdS�NT)�_after_fork_registeredrrXrhrKrKrL�_ensure_after_forkPs�zCelery._ensure_after_forkcCsd|_t|�dS)aOClean up after the application.

        Only necessary for dynamically created apps, and you should
        probably use the :keyword:`with` statement instead.

        Example:
            >>> with Celery(set_as_current=False) as app:
            ...     with app.connection_for_write() as conn:
            ...         pass
        N)�_poolrrhrKrKrL�closeVszCelery.closec
Cs�ddlm}||jd_|durtj}z/z	|j|dd�Wnty9}z|jWYd}~Wd|jd_Sd}~wwWd|jd_dSd|jd_w)zgRun :program:`celery` using `argv`.

        Uses :data:`sys.argv` if `argv` is not specified.
        r��celeryNF)rP�standalone_mode)	�celery.bin.celeryr��params�default�sys�argvr�r�	exit_code)r]r�r��erKrKrL�startds���zCelery.startcCs.|durtj}d|vrtd��|j|d�dS)znRun :program:`celery worker` using `argv`.

        Uses :data:`sys.argv` if `argv` is not specified.
        N�workerzkThe worker sub-command must be specified in argv.
Use app.start() to programmatically start other commands.)r�)r�r��
ValueErrorr�)r]r�rKrKrL�worker_mainws�zCelery.worker_maincs�tr|�dd�rddlm}||ddi|��Sd�fdd�	}t|�dkr7t|d	�r3|d
i|��|�Std
��|rHtd�tt|�t|�g����|d
i|��S)a�Decorator to create a task class out of any callable.

        See :ref:`Task options<task-options>` for a list of the
        arguments that can be passed to this decorator.

        Examples:
            .. code-block:: python

                @app.task
                def refresh_feed(url):
                    store_feed(feedparser.parse(url))

            with setting extra options:

            .. code-block:: python

                @app.task(exchange='feeds')
                def refresh_feed(url):
                    return store_feed(feedparser.parse(url))

        Note:
            App Binding: For custom apps the task decorator will return
            a proxy object, so that the act of creating the task is not
            performed until the task is used or the task registry is accessed.

            If you're depending on binding to be deferred, then you must
            not access any attributes on the returned object until the
            application is fully set up (finalized).
        �lazyTr1)�shared_taskFNcs|������fdd�}|S)Ncsr�r��fdd�}�j|_t|��r�jr �j�fi���}nt�j�f��jd�}�j�|��r7�|�S|S)Ncs|j�fi���Sr`)�_task_from_fun�rI)�fun�optsrKrL�cons�rmzRCelery.task.<locals>.inner_create_task_cls.<locals>._create_task_cls.<locals>.cons)�__doc__)rHrr�r�r r�r��append)r�r��ret)�_filtr�r�r]�shared)r�rL�_create_task_cls�s
�zDCelery.task.<locals>.inner_create_task_cls.<locals>._create_task_clsrK)r��filterr�r�r�rh)r�r�r�r�rL�inner_create_task_cls�sz*Celery.task.<locals>.inner_create_task_clsrz(argument 1 to @task() must be a callablez+@task() takes exactly 1 argument ({} given))TNTrK)	�USING_EXECVr��r�rp�callable�	TypeError�format�sum)r]rPr�r�r�rKrhrL�task�s��zCelery.taskcCstt||d��S)N��bound)�staticmethodr&)r]r�r�rKrKrL�type_checker��zCelery.type_checkercKs�|js
|js
td��|p|�|j|j�}|p|j}||jvrl|r"|nt|�}t	|j|ft
|||d|j|j|j|j
||d�|d�	fi|����}z|j|_Wn	tyVYnw||j|j<|�|�t|fi|��|S|j|}|S)N�"Contract breach: app not finalizedTr�)	rIr��run�
_decoratedr�rx�__annotations__�
__header__�__wrapped__)r�r��RuntimeErrorr(rHrx�Taskr�r��type�dictr�r�r�ry�AttributeErrorr��bindr5)r]r�r��baser�optionsr�r�rKrKrLr��s<

�	
��

�zCelery._task_from_funcKsdt�|�r|�p	|}|jst|�}|�|j|j�|_t|fi|��||j|j<||_	|�
|�|S)z�Utility for registering a task-based class.

        Note:
            This is here for compatibility with old Celery 1.0
            style task classes, you should not need to use this for
            new projects.
        )�inspect�isclassr�rr(rHrxr5r��_appr)r]r�rr�rKrKrL�
register_task�s�
zCelery.register_taskcCst|||�Sr`)r()r]r��modulerKrKrLr(�zCelery.gen_task_namecCs�|j�E|js@|r|jstd��d|_t|�|j}|r$t|���|s|j�	�D]}|�
|�q)|jj|d�Wd�dSWd�dS1sKwYdS)z�Finalize the app.

        This loads built-in tasks, evaluates pending task decorators,
        reads configuration, etc.
        r�T��senderN)
r�r�r�r�rr�r!�popleftr��valuesrr��send)r]�auto�pendingr�rKrKrL�finalizes 
��"�zCelery.finalizecs>t|�s
|�fdd��}|jr|j�|��S|j�|�dS)adAdd default configuration from dict ``d``.

        If the argument is a callable function then it will be regarded
        as a promise, and it won't be loaded until the configuration is
        actually needed.

        This method can be compared to:

        .. code-block:: pycon

            >>> celery.conf.update(d)

        with a difference that 1) no copy will be made and 2) the dict will
        not be transferred when the worker spawns child processes, so
        it's important that the same configuration happens at import time
        when pickle restores the object on the other side.
        cs�Sr`rKrK��drKrL�<lambda>/r�z%Celery.add_defaults.<locals>.<lambda>N)r�r�r��add_defaultsr�r�)r]r�rKrrLrs
zCelery.add_defaultscCs@||_|p|j|_|s|jrd|_|jj||d�r|jSdSdS)aRead configuration from object.

        Object is either an actual object or the name of a module to import.

        Example:
            >>> celery.config_from_object('myapp.celeryconfig')

            >>> from myapp import celeryconfig
            >>> celery.config_from_object(celeryconfig)

        Arguments:
            silent (bool): If true then import errors will be ignored.
            force (bool): Force reading configuration immediately.
                By default the configuration will be read only when required.
        N)�silent)r�r�r�r�r��config_from_objectr^)r]�objr�forcer�rKrKrLr4s
��zCelery.config_from_objectcCs:tj�|�}|s|rdStt���|���|j|||d�S)a3Read configuration from environment variable.

        The value of the environment variable must be the name
        of a module to import.

        Example:
            >>> os.environ['CELERY_CONFIG_MODULE'] = 'myapp.celeryconfig'
            >>> celery.config_from_envvar('CELERY_CONFIG_MODULE')
        F)rr)r�r�r�r�ERR_ENVVAR_NOT_SET�stripr�r)r]�
variable_namerr�module_namerKrKrL�config_from_envvarLs
�zCelery.config_from_envvarr�cCs|j�|j�||��dSr`)r�rir��cmdline_config_parser)r]r�r�rKrKrL�config_from_cmdline^s�zCelery.config_from_cmdline�jsonc	
Cs$ddlm}|||||||||d�S)a;Setup the message-signing serializer.

        This will affect all application instances (a global operation).

        Disables untrusted serializers and if configured to use the ``auth``
        serializer will register the ``auth`` serializer with the provided
        settings into the Kombu serializer registry.

        Arguments:
            allowed_serializers (Set[str]): List of serializer names, or
                content_types that should be exempt from being disabled.
            key (str): Name of private key file to use.
                Defaults to the :setting:`security_key` setting.
            key_password (bytes): Password to decrypt the private key.
                Defaults to the :setting:`security_key_password` setting.
            cert (str): Name of certificate file to use.
                Defaults to the :setting:`security_certificate` setting.
            store (str): Directory containing certificates.
                Defaults to the :setting:`security_cert_store` setting.
            digest (str): Digest algorithm used when signing messages.
                Default is ``sha256``.
            serializer (str): Serializer used to encode messages after
                they've been signed.  See :setting:`task_serializer` for
                the serializers supported.  Default is ``json``.
        r)�setup_securityr�)�celery.securityr%)	r]�allowed_serializersrc�key_password�cert�store�digest�
serializerr%rKrKrLr%cs
�zCelery.setup_securityr�cCs0|r|�||�Stjjt|j||�d|d�dS)a�Auto-discover task modules.

        Searches a list of packages for a "tasks.py" module (or use
        related_name argument).

        If the name is empty, this will be delegated to fix-ups (e.g., Django).

        For example if you have a directory layout like this:

        .. code-block:: text

            foo/__init__.py
               tasks.py
               models.py

            bar/__init__.py
                tasks.py
                models.py

            baz/__init__.py
                models.py

        Then calling ``app.autodiscover_tasks(['foo', 'bar', 'baz'])`` will
        result in the modules ``foo.tasks`` and ``bar.tasks`` being imported.

        Arguments:
            packages (List[str]): List of packages to search.
                This argument may also be a callable, in which case the
                value returned is used (for lazy evaluation).
            related_name (Optional[str]): The name of the module to find.  Defaults
                to "tasks": meaning "look for 'module.tasks' for every
                module in ``packages``.".  If ``None`` will only try to import
                the package, i.e. "look for 'module'".
            force (bool): By default this call is lazy so that the actual
                auto-discovery won't happen until an application imports
                the default modules.  Forcing will cause the auto-discovery
                to happen immediately.
        F)�weakrN)�_autodiscover_tasksr�import_modules�connectr)r]�packages�related_namerrKrKrL�autodiscover_tasks�s(�
�zCelery.autodiscover_taskscKs|r|�||�S|�|�Sr`)�_autodiscover_tasks_from_names�_autodiscover_tasks_from_fixups)r]r1r2rkrKrKrLr.�s
zCelery._autodiscover_taskscCs |j�t|�r|�|�S||�Sr`)r�r3r�)r]r1r2rKrKrLr4�s
��z%Celery._autodiscover_tasks_from_namescCs|jdd�|jD�|d�S)NcSs(g|]}t|d�r|��D]}|�q
qS)r3)�hasattrr3)r�r��pkgrKrKrLr��s����z:Celery._autodiscover_tasks_from_fixups.<locals>.<listcomp>)r2)r4r�)r]r2rKrKrLr5�s

��z&Celery._autodiscover_tasks_from_fixupsrc*Kszd}} |j}!|pt�}|p|}|	p|!j}	|j}"|"jr$tjtd�dd�|�dd�}#|	�	||p0||||�}|durst
|t�rIt|�|�
���}$nt
|t�r[tt|��|�
���}$n|}$|$dkrot�|�d|$�d	��d}$|$|d
<|rw|s�|j}|r�|s�|jjp�|jj}|s�|jj}|"jr�|�d|jj�d��|!j|||||||||||t|
�t|�|p�|j|||jj||||f|#|d�|��}%|�d
g�}&|&D]}'|�|'�q�|r�|!j|dd�}|� |��2}(|(j!�"��|#s�|j#�$|(|�|!j%|(||%fi|��Wd�n	1�swYWd�n	1�swY|
�p!|j&|�})|#|)_'|�r;| �s3|jd}} |�r;|�(|)�|)S)z�Send task by name.

        Supports the same arguments as :meth:`@-Task.apply_async`.

        Arguments:
            name (str): Name of task to call (e.g., `"tasks.add"`).
            result_cls (AsyncResult): Specify custom result class.
        Nz,task_always_eager has no effect on send_task�)�
stacklevel�
ignore_resultFrz% has an expiration date in the past (aJs ago).
We assume this is intended and so we have set the expiration date to 0 instead.
According to RabbitMQ's documentation:
"Setting the TTL to 0 causes messages to be expired upon reaching a queue unless they can be delivered to a consumer immediately."
If this was unintended, please check the code which published this task.�
expiration�priority)r:�replaced_task_nesting�stamped_headers)�auto_declareT))r�r�routerr^�task_always_eager�warnings�warnr�pop�router�rr.�now�
total_seconds�strr	rU�warning�current_worker_task�request�root_id�id�task_inherit_parent_priorityrl�
delivery_infor��create_task_messager'�
thread_oid�task_send_sent_event�Producer�producer_or_acquire�
connection�_reraise_as_library_errorsr��on_task_call�send_task_message�AsyncResult�ignored�	add_trail)*r]r�rPrk�	countdown�eta�task_id�producerrUr@�
result_cls�expires�	publisher�link�
link_error�
add_to_parent�group_id�group_index�retries�chord�reply_to�
time_limit�soft_time_limitrL�	parent_id�
route_name�shadow�chain�	task_typer=r�parent�have_parentr�r^r:�	expires_s�messager>�stamp�P�resultrKrKrL�	send_task�s�

���
���
�����������
zCelery.send_taskcK�|j|p|jjfi|��S)z|Establish connection used for consuming.

        See Also:
            :meth:`connection` for supported arguments.
        )�_connectionr^�broker_read_url�r]�urlrkrKrKrL�connection_for_read-�zCelery.connection_for_readcKrz)z|Establish connection used for producing.

        See Also:
            :meth:`connection` for supported arguments.
        )r{r^�broker_write_urlr}rKrKrL�connection_for_write5r�zCelery.connection_for_writec
Ks2|j|p|jjf||||||||	|
||d�|
��S)aCEstablish a connection to the message broker.

        Please use :meth:`connection_for_read` and
        :meth:`connection_for_write` instead, to convey the intent
        of use for this connection.

        Arguments:
            url: Either the URL or the hostname of the broker to use.
            hostname (str): URL, Hostname/IP-address of the broker.
                If a URL is used, then the other argument below will
                be taken from the URL instead.
            userid (str): Username to authenticate as.
            password (str): Password to authenticate with
            virtual_host (str): Virtual host to use (domain).
            port (int): Port to connect to.
            ssl (bool, Dict): Defaults to the :setting:`broker_use_ssl`
                setting.
            transport (str): defaults to the :setting:`broker_transport`
                setting.
            transport_options (Dict): Dictionary of transport specific options.
            heartbeat (int): AMQP Heartbeat in seconds (``pyamqp`` only).
            login_method (str): Custom login method to use (AMQP only).
            failover_strategy (str, Callable): Custom failover strategy.
            **kwargs: Additional arguments to :class:`kombu.Connection`.

        Returns:
            kombu.Connection: the lazy connection instance.
        )�userid�password�virtual_host�port�ssl�connect_timeout�	transport�transport_options�	heartbeat�login_method�failover_strategy)r�r^r�)r]�hostnamer�r�r�r�r�r�r�r�r�r�r�rkrKrKrLrU=s!
���zCelery.connectionc
Ksv|j}|jj||p|j|p|j|p|j|p|j|p|j|�d|�|
|p%|j	|p)|j
t|jfi|	p1i��|�d|�d�S)N�broker_use_ssl�broker_connection_timeout)r�r�r�r�r�r�r�)
r^r��
Connection�broker_user�broker_password�broker_vhost�broker_port�broker_transport�either�broker_login_method�broker_failover_strategyr�broker_transport_options)r]r~r�r�r�r�r�r�r�r�r�r�r�rkr^rKrKrLr{hs*
����zCelery._connectioncCs|r	|jjdd�S|��S)z)Helper for :meth:`connection_or_acquire`.T��block)�pool�acquirer�)r]r�rKrKrL�_acquire_connection�szCelery._acquire_connectioncOst||j|d�S)aRContext used to acquire a connection from the pool.

        For use within a :keyword:`with` statement to get a connection
        from the pool if one is not already provided.

        Arguments:
            connection (kombu.Connection): If not provided, a connection
                will be acquired from the connection pool.
        )r�)r,r�)r]rUr��_�__rKrKrL�connection_or_acquire�s
zCelery.connection_or_acquirecCst||jjdd�S)aEContext used to acquire a producer from the pool.

        For use within a :keyword:`with` statement to get a producer
        from the pool if one is not already provided

        Arguments:
            producer (kombu.Producer): If not provided, a producer
                will be acquired from the producer pool.
        Tr�)r,�
producer_poolr�)r]r_rKrKrLrT�s

�zCelery.producer_or_acquirecCst|�S)z<Prepare configuration before it is merged with the defaults.)r7)r]�crKrKrL�prepare_config�rwzCelery.prepare_configcCstt���}|�|j�S)z/Return the current time and date as a datetime.)r0r�utcnow�
astimezoner/)r]�
now_in_utcrKrKrLrF�sz
Celery.nowcCs|jj�|�S)zxSelect subset of queues.

        Arguments:
            queues (Sequence[str]): a list of queue names to keep.
        )r��queues�select)r]r�rKrKrL�
select_queues�szCelery.select_queuescGstdtd|�t|jj|�g�S)z�Get key from configuration or use default values.

        Fallback to the value of a configuration key if none of the
        `*values` are true.
        N)r%rr^r�)r]�default_key�defaultsrKrKrLr��s�z
Celery.eithercCst|�S)z)Return information useful in bug reports.)r@rhrKrKrLr@�rwzCelery.bugreportcCs(t�|jp|jj|j�\}}|||d�S)N)rIr~)r2�by_url�backend_clsr^r|r�)r]r�r~rKrKrL�_get_backend�s
�zCelery._get_backendc
Cs:z
|��}|_W|Sty}zt|j�|�d}~ww)z�Get config value by key and finalize loading the configuration.

        Note:
            This is used by PendingConfiguration:
                as soon as you access a key the configuration is read.
        N)�_load_configr�r�ModuleNotFoundErrorrP)r]r^�errrKrKrLr��s���zCelery._finalize_pending_confcCs�t|jt�r|jj|d�n|��|jr|j�|j�d|_t|�	|jj
�|j|j|j
d�}|jdur;|j�|�n||_|j}|rP|j�t|�����|sC|j}|re|��\}}|j|i|��|sU|jj||jd�|jS)Nr
T)�ignore_keysr~)rr�)r�r�r$rr�r�rr�rAr�r^r�r�r�r��	swap_withr�rr!rr��_add_periodic_taskr�)r]�settings�pending_def�pending_beat�periodic_task_args�periodic_task_kwargsrKrKrLr��s0�
��zCelery._load_configc	Cs@d|_zd|jd_WnttfyYnw|jj|d�dS)Nr�r
)r��__dict__�_producer_poolr�KeyErrorr�rrhrKrKrLrS�s�zCelery._after_forkcOs||d<|jj|i|��S)z:Return a new :class:`~celery.Signature` bound to this app.rI)�_canvas�	signaturerjrKrKrLr�szCelery.signaturerKc	KsT|j|||||fi|��\}}|jr|j|||d�|S|j�||fd|ig�|S)a
        Add a periodic task to beat schedule.

        Celery beat store tasks based on `sig` or `name` if provided. Adding the
        same signature twice make the second task override the first one. To
        avoid the override, use distinct `name` for them.
        r�r�)�_sig_to_periodic_task_entryr�r�r�r�)	r]�schedule�sigrPrkr�r�rc�entryrKrKrL�add_periodic_tasks	
�
��zCelery.add_periodic_taskc	Ksd|sin|}t|tj�r|�||�n|�|j||�}|pt|�||j|j|jt	|j
fi|��d�fS)N)r�r�rPrkr)r�r"�CallableSignature�cloner�r�rtrPrkrr)r]r�r�rPrkr�r�rKrKrLr�s
��
�z"Celery._sig_to_periodic_task_entrycCs6|dur||jjvrt�d|�d��||jj|<dS)NzPeriodic task key='zl' shadowed a previous unnamed periodic task. Pass a name kwarg to add_periodic_task to silence this warning.)r��
beat_schedulerUrI)r]rcr�r�rKrKrLr�+s

�zCelery._add_periodic_taskcCs|j|jddddd�S)z+Create a base task class bound to this app.rr	T)r��	attribute�keep_reducer")�subclass_with_selfr�rhrKrKrL�create_task_cls4s�zCelery.create_task_clsrIc	s`t|�}�r�n|j��fdd�}t||if|j|jd�|��}|s&||d<t|p+|j|f|�S)a�Subclass an app-compatible class.

        App-compatible means that the class has a class attribute that
        provides the default app it should use, for example:
        ``class Foo: app = None``.

        Arguments:
            Class (type): The app-compatible class to subclass.
            name (str): Custom name for the target class.
            attribute (str): Name of the attribute holding the app,
                Default is 'app'.
            reverse (str): Reverse path to this object used for pickling
                purposes. For example, to get ``app.AsyncResult``,
                use ``"AsyncResult"``.
            keep_reduce (bool): If enabled a custom ``__reduce__``
                implementation won't be provided.
        cst�|��ffSr`)rQrzrh��reverserKrL�
__reduce__Qr�z-Celery.subclass_with_self.<locals>.__reduce__)rxr�r�)r*rHrrxr�r)	r]�Classr�r�r�r��kwr��attrsrKr�rLr�;s���zCelery.subclass_with_selfcCst|�|�Sr`r)r]�pathrKrKrLrN^rzCelery._rgetattrcCs|Sr`rKrhrKrKrL�	__enter__aszCelery.__enter__cGs|��dSr`)r�)r]rRrKrKrL�__exit__drzCelery.__exit__cCsdt|�j�dt|��d�S)N�<� �>)rrHr?rhrKrKrLrugszCelery.__repr__cCs |jr|��St|j|��ffSr`)r��
__reduce_v1__r>rF�__reduce_keys__rhrKrKrLr�jszCelery.__reduce__cCst|j|jf|��fSr`)r=rF�PicklerrzrhrKrKrLr�os�zCelery.__reduce_v1__c
CsD|j|jr	|jjn|j|j|j|j|j|j	|j
|j|j|j
|jd�S)zAKeyword arguments used to reconstruct the object when unpickling.)r�r�r�r�r�r�r�r�r�r�r�r�)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rhrKrKrLr�xs�zCelery.__reduce_keys__c
Cs6|j|jr	|jjni|j|j|j|j|j|j	d|j
f
S)z>Deprecated method, please use :meth:`__reduce_keys__` instead.F)r�r�r�r�r�r�r�r�r�r�r�rhrKrKrLrz�s
�zCelery.__reduce_args__cC�
|�d�S)zNWorker application.

        See Also:
            :class:`~@Worker`.
        zcelery.apps.worker:Worker�r�rhrKrKrL�Worker��
z
Celery.WorkercKr�)zUEmbeddable worker.

        See Also:
            :class:`~@WorkController`.
        zcelery.worker:WorkControllerr��r]rkrKrKrL�WorkController�r�zCelery.WorkControllercKr�)zf:program:`celery beat` scheduler application.

        See Also:
            :class:`~@Beat`.
        zcelery.apps.beat:Beatr�r�rKrKrL�Beat�r�zCelery.BeatcCrv)zBase task class for this app.)r�rhrKrKrLr�szCelery.TaskcCst|jj�Sr`)�prepare_annotationsr^�task_annotationsrhrKrKrL�annotations�r�zCelery.annotationscCr�)zgCreate new result instance.

        See Also:
            :class:`celery.result.AsyncResult`.
        zcelery.result:AsyncResultr�rhrKrKrLrY�r�zCelery.AsyncResultcCr�)Nzcelery.result:ResultSetr�rhrKrKrL�	ResultSet��
zCelery.ResultSetcCr�)zmCreate new group result instance.

        See Also:
            :class:`celery.result.GroupResult`.
        zcelery.result:GroupResultr�rhrKrKrL�GroupResult�r�zCelery.GroupResultcCs:|jdur|��|jj}t�|�tj|��|_|jS)z�Broker connection pool: :class:`~@pool`.

        Note:
            This attribute is not related to the workers concurrency pool.
        N)r�r�r^�broker_pool_limitr
�	set_limit�connectionsr�)r]�limitrKrKrLr��s

zCelery.poolcCstjS)z2Instance of task being executed, or :const:`None`.)r�toprhrKrKrL�current_task�szCelery.current_taskcCst�S)z�The task currently being executed by a worker or :const:`None`.

        Differs from :data:`current_task` in that it's not affected
        by tasks calling other tasks directly, or eagerly.
        )rrhrKrKrLrJ�szCelery.current_worker_taskcCst|dd�S)z+Universally unique identifier for this app.F��threadsrrhrKrKrL�oid�sz
Celery.oidcCs6z|jjWStyt|dd�|j_}|YSw)z*Per-thread unique identifier for this app.Tr�)r�r�rr
)r]�new_oidrKrKrLrQ�s
�zCelery.thread_oidcC�t|j|d�S)z,AMQP related functionality: :class:`~@amqp`.r�)r)r�rhrKrKrLr���zCelery.amqpcCs|jdur|jSt|jdd�S)z�A reference to the backend object

        Uses self._backend_cache if it is thread safe.
        Otherwise, use self._local
        Nr�)r��getattrr�rhrKrKrL�_backend�s
zCelery._backendcCs|jr||_dS||j_dS)z!Set the backend object on the appN)�thread_safer�r�r�)r]r�rKrKrLr�	s
cC�|jdur
|��|_|jS)zCurrent backend instance.N)r�r�rhrKrKrLr��

zCelery.backendcCr�)zCurrent configuration.N)r�r�rhrKrKrLr^r�zCelery.confcCs
||_dSr`)r�)r]rrKrKrLr^r�cCr�)z#Remote control: :class:`~@control`.r�)r)r�rhrKrKrLr�#r�zCelery.controlcCr�)z0Consuming and sending events: :class:`~@events`.r�)r)r�rhrKrKrLr�(r�z
Celery.eventscCst|j�|d�S)zCurrent loader instance.r�)rr�rhrKrKrLr�-sz
Celery.loadercCr�)zLogging: :class:`~@log`.r�)r)r�rhrKrKrLr�2r�z
Celery.logcCsddlm}|S)Nr)�canvas)r�r�)r]r�rKrKrLr�7szCelery._canvascCs|jdd�|jS)zoTask registry.

        Warning:
            Accessing this attribute will also auto-finalize the app.
        T)r)rr�rhrKrKrLr�<szCelery.taskscCs|jjSr`)r�r�rhrKrKrLr�FrwzCelery.producer_poolcCs|jtjkS)z/Check if the application uses the UTC timezone.)r/�utcrhrKrKrL�uses_utc_timezoneJr�zCelery.uses_utc_timezonecCs*|j}|js|jrtjStjSt�|j�S)z�Current timezone for this app.

        This is a cached property taking the time zone from the
        :setting:`timezone` setting.
        )r^r/�
enable_utcr�r��get_timezone)r]r^rKrKrLr/NszCelery.timezone)NNNNNNNTNNNNNNNTNTr`)F)NNF)FFN)FFr�)Nr�F)NNNNNNNNNNNNNTNNrNNNNNNNNNNr)NNNNNNNNNNNN)NNNNNNNNNNN)Tr�)rKrKN)rKNN)NrINF)yrHrxryr�r9r�r�SYSTEM�IS_macOS�
IS_WINDOWSr�r�r��BUILTIN_FIXUPSr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r_r�r�r�r�r�r�r�r�r�r�r�r�r
r(rrrr!r#r6r%r3r.r4r5ryrr�rUr{�broker_connectionr�r��default_connectionrT�default_producerr�rFr�r�r@r�r�r�rSr�r�r�r�r�r�rNr�r�rur�r�r�rzrr�r�r�rr�rYr�r��propertyr�r�rJr�rQr�r��setterr�r^r�r�r�r�r�r�r�r�r/rKrKrKrLrB�s\%
�W


G


�


� 
�.
�
j

�+
�





#
�
�
	
�#	

























	
rB)pr�rr�r�r�rB�collectionsrrrr�operatorr�click.exceptionsr�dateutil.parserr	�kombur
�kombu.clocksr�kombu.commonr
�kombu.utils.compatr�kombu.utils.objectsr�kombu.utils.uuidr�vinerr�rr�
celery._staterrrrrrrrr�celery.exceptionsrr�celery.loadersr�celery.localr r!�celery.utilsr"�celery.utils.collectionsr#�celery.utils.dispatchr$�celery.utils.functionalr%r&r'�celery.utils.importsr(r)r*�celery.utils.logr+�celery.utils.objectsr,r-�celery.utils.timer.r/r0r�r2r3r�r4r��	autoretryr5r�r6r7�registryr8�utilsr9r:r;r<r=r>r?r@rA�__all__rHrUrr�r�r�rrMrQrXrYrB�ApprKrKrKrL�<module>st,,�	,]