/opt/imunify360/venv/lib/python3.11/site-packages/nats/aio/__pycache__
� ԆEW�z�� � � d dl mZ d dlZd dlmZmZmZmZmZm Z d dl mZ d dlm Z d dlmZ erd dlmZ dZd Z G d � d� � Z G d� d � � ZdS )� )�annotationsN)� TYPE_CHECKING� AsyncIterator� Awaitable�Callable�List�Optional)�uuid4)�errors)�Msg)�JetStreamContexti i c �� � e Zd ZdZddddddeefd'd�Zed(d�� � Zed(d�� � Z ed)d�� � Z ed*d�� � Zed*d�� � Zed*d�� � Z d+d,d�Zd � Zd!� Zd-d"�Zd.d/d$�Zd-d%�Zd-d&�ZdS )0�Subscriptiona� A Subscription represents interest in a particular subject. A Subscription should not be constructed directly, rather `connection.subscribe()` should be used to get a subscription. :: nc = await nats.connect() # Async Subscription async def cb(msg): print('Received', msg) await nc.subscribe('foo', cb=cb) # Sync Subscription sub = nc.subscribe('foo') msg = await sub.next_msg() print('Received', msg) r � N�id�int�subject�str�queue�cb�*Optional[Callable[[Msg], Awaitable[None]]]�future�Optional[asyncio.Future]�max_msgs�pending_msgs_limit�pending_bytes_limit�return�Nonec �. � || _ || _ || _ || _ || _ d| _ || _ || _ d| _ || _ | | _ t j |�� � | _ |�i | _ nd | _ d| _ d | _ d | _ d | _ d S )Nr F)�maxsize)�_conn�_id�_subject�_queue� _max_msgs� _received�_cb�_future�_closed�_pending_msgs_limit�_pending_bytes_limit�asyncio�Queue�_pending_queue�_pending_next_msgs_calls� _pending_size�_wait_for_msgs_task�_message_iterator�_jsi) �self�connr r r r r r r r s �u/builddir/build/BUILD/imunify360-venv-2.6.2/opt/imunify360/venv/lib/python3.11/site-packages/nats/aio/subscription.py�__init__zSubscription.__init__? s� � � �� ������ ����!��������������� $6�� �$7��!�29�-�HZ�2[�2[�2[��� �:�,.�D�)�)�,0�D�)����#'�� �!%��� 6:�� � � � c � � | j S )z< Returns the subject of the `Subscription`. )r# �r4 s r6 r zSubscription.subjectf s � � �}�r8 c � � | j S )zX Returns the queue name of the `Subscription` if part of a queue group. )r$ r: s r6 r zSubscription.queuem s � � �{�r8 �AsyncIterator[Msg]c �F � | j st j d� � �| j S )a� Retrieves an async iterator for the messages from the subscription. This is only available if a callback isn't provided when creating a subscription. :: nc = await nats.connect() sub = await nc.subscribe('foo') # Use `async for` which implicitly awaits messages async for msg in sub.messages: print('Received', msg) zCcannot iterate over messages with a non iteration subscription type)r2 r �Errorr: s r6 �messageszSubscription.messagest s* � � �%� f��,�d�e�e�e��%�%r8 c �4 � | j � � � S )zw Number of delivered messages by the NATS Server that are being buffered in the pending queue. )r. �qsizer: s r6 �pending_msgszSubscription.pending_msgs� s � � �"�(�(�*�*�*r8 c � � | j S )zk Size of data sent by the NATS Server that is being buffered in the pending queue. )r0 r: s r6 � pending_byteszSubscription.pending_bytes� s � � �!�!r8 c � � | j S )zK Number of delivered messages to this subscription so far. )r&