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/buyercall_forms/buyercall/buyercall/__pycache__/app.cpython-38.pyc
U

k�if��@s�ddlmZmZmZddlmZddlmZddlm	Z	m
Z
mZmZm
Z
mZmZmZddlmZmZdddd	d
ddd
dddddddddddgZd dd�Zedfdd�Zd!dd�ZdS)"�)�Flask�has_request_context�request)�Celery)�User)�api_keys�
blueprints�error_templates�exception_handler�
extensions�logging_handler�
middleware�template_processors)�authentication�localez#buyercall.blueprints.activity.taskszbuyercall.blueprints.user.tasksz buyercall.blueprints.issue.tasksz"buyercall.blueprints.billing.tasksz buyercall.blueprints.admin.tasksz+buyercall.blueprints.contacts.contact_tasksz"buyercall.blueprints.widgets.tasksz%buyercall.blueprints.widgets.bw_tasksz*buyercall.blueprints.form_leads.form_tasksz"buyercall.blueprints.reports.tasksz&buyercall.blueprints.partnership.tasksz'buyercall.blueprints.phonenumbers.tasksz*buyercall.blueprints.phonenumbers.bw_tasksz6buyercall.blueprints.phonenumbers.bw_operational_tasksz!buyercall.blueprints.mobile.tasksz%buyercall.blueprints.sms.bw_sms_tasksz%buyercall.blueprints.sms.tw_sms_taskszbuyercall.blueprints.sms.tasksz#buyercall.blueprints.sysadmin.tasksNcsj�pt��t�j�jd�jdd�}|jtdd�|j��j�|j�G���fdd�d����|_|S)z�
    Create a new celery object and tie together the celery config to the app's
    config. Wrap all tasks in the context of the application.

    :param app: Flask app
    :return: Celery app
    �CELERY_BROKER_URL�CELERY_RESULT_BACKEND)ZbrokerZresult_backendT)�forcecs>eZdZdZdZdd�Zd
��fdd�	Z��fdd	�Z�ZS)z&create_celery_app.<locals>.ContextTaskTZ_flask_request_contextcSsZt�s
dStjtjtjttj�d�}dtjkrLtjtj�d�dd�|d<|||j	<dS)zIncludes all the information about current HTTP request context
            as an additional argument to the task.
            N)�pathZbase_url�method�headers�?�Zquery_string)
rrrZurl_rootr�dictr�url�find�CONTEXT_ARG_NAME)�self�kwargs�context�r �?/home/arjun/projects/buyercall_forms/buyercall/buyercall/app.py�_include_request_context>s�
z?create_celery_app.<locals>.ContextTask._include_request_contextNcs0|pd}|pi}|�|�t�|�j||f|�S)Nr )r"�super�apply_async)r�argsr�rest)�ContextTask�	__class__r r!r$Ps
z2create_celery_app.<locals>.ContextTask.apply_asyncc
sd|�|jd�}|dkst�r.�j|f|�|�S�jf|�� �j|f|�|�W5QR�SQRXdS)N)�poprr�__call__Ztest_request_context)rr%rr)�TaskBase�appr r!r*Ws
z/create_celery_app.<locals>.ContextTask.__call__)NN)	�__name__�
__module__�__qualname__Zabstractrr"r$r*�
__classcell__r �r'r+r,)r(r!r'9s
r')	�
create_apprZimport_name�configZautodiscover_tasks�CELERY_TASK_LIST�conf�updateZTask)r,�celeryr r1r!�create_celery_app)s
�&r8cCstt|dd�}t||�t|�t|�t|�t|�t|�t|�t|�t	|�t
|t�|jj
spt|�|S)a
    Create an application using the Flask app factory pattern:
    http://flask.pocoo.org/docs/0.10/patterns/appfactories

    :param application_name: Name of the application
    :param settings_override: Override settings
    :type settings_override: dict
    :return: Flask app
    T)Zinstance_relative_config)r�configure_settingsrr
rrrrr
r	rrZbabel_instanceZlocale_selector_funcr)Zapplication_name�settings_overrider,r r r!r2cs


r2cCs:|j�d�|jjddd�d|j_|r4|j�|�|jS)z�
    Modify the settings of the application (mutates the app passed in).

    :param app: Flask application instance
    :param settings_override: Override settings
    :type settings_override: dict
    :return: Add configuration settings
    zconfig.settingszsettings.pyT)ZsilentZnone)r3Zfrom_objectZfrom_pyfileZSWAGGER_UI_DOC_EXPANSIONr6)r,r:r r r!r9�s	r9)N)N)Zflaskrrrr7rZ buyercall.blueprints.user.modelsrZbuyercall.registerrrr	r
rrr
rZbuyercall.initializerrr4r8r-r2r9r r r r!�<module>s6(
�
: