Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/celery/backends/__pycache__/couchbase.cpython-39.pyc
Ðазад
a t�hA � @ s� d Z ddlmZ ddlmZ ddlmZ zddlmZ ddl m Z W n ey^ d Z ZY n0 zdd lm Z W n ey� dZ Y n0 d ZG dd� de�ZdS ) zCouchbase result store backend.� )� _parse_url)�ImproperlyConfigured� )�KeyValueStoreBackend)�PasswordAuthenticator)�ClusterN)�FMT_AUTO)�CouchbaseBackendc sz e Zd ZdZdZdZdZdZdZdZ dZ dZeZ d� fd d � Zdd� Zed d� �Zdd� Zdd� Zdd� Zdd� Z� ZS )r z�Couchbase backend. Raises: celery.exceptions.ImproperlyConfigured: if module :pypi:`couchbase` is not available. �default� localhosti� NFTg @c s |� dt� t� j|i |�� || _td u r4td��d } } } }}|rtt|�\} }}}}}} |rp|�d�nd }| j j �dd �} | d ur�t| t �s�td��ni } |p�| �d| j�| _t|p�| �d| j��| _|p�| �d| j�| _|p�| �d | j�| _|�p | �d | j�| _d | _d S )NZexpires_typezGYou need to install the couchbase library to use the Couchbase backend.�/Zcouchbase_backend_settingsz6Couchbase backend settings should be grouped in a dict�host�port�bucket�username�password)� setdefault�int�super�__init__�urlr r r �stripZappZconf�get� isinstance�dictr r r r r �_connection)�selfr �args�kwargsZuhostZuport�unameZupassZubucket�_�config�� __class__� ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/celery/backends/couchbase.pyr , s0 � �zCouchbaseBackend.__init__c C s~ | j du rx| jr,| jr,d| j� d| j� �}nd| j� �}| jrT| jrTt| j| j�}nd}t||�}|�| j�}|�� | _ | j S )z Connect to the Couchbase server.Nzcouchbase://�:) r r r r r r r r Zdefault_collection)r �uri�optZclusterr r$ r$ r% �_get_connectionM s z CouchbaseBackend._get_connectionc C s | � � S �N)r) )r r$ r$ r% � connection` s zCouchbaseBackend.connectionc C s | j �|�jS r* )r+ r �content�r �keyr$ r$ r% r d s zCouchbaseBackend.getc C s8 t d ur | jj||| jt d� n| jj||| jd� d S )N)�ttl�format)r/ )r r+ Zupsert�expires)r r. �valuer$ r$ r% �setg s zCouchbaseBackend.setc C s | j �|�S r* )r+ Z get_multi)r �keysr$ r$ r% �mgetn s zCouchbaseBackend.mgetc C s | j �|� d S r* )r+ �remover- r$ r$ r% �deleteq s zCouchbaseBackend.delete)N)�__name__� __module__�__qualname__�__doc__r r r r r �quietZsupports_autoexpire�timeout�strZkey_tr r) �propertyr+ r r3 r5 r7 � __classcell__r$ r$ r"