Ë
    UV.jà­  ã                  ó|  — d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	m	Z	m
Z
mZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZmZmZ ddlmZ ddlmZmZ ddlm Z  ddl!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z(m)Z) ddl*m+Z+m,Z, ddl-m.Z. ddl/m0Z0  e$e1«      Z2ejf                  D � ci c]  } | dvsŒ e4| «      d“Œ c} Z5de5d<   dZ6d„ Z7 G d„ de8«      Z9 G d„ de8«      Z: G d „ d!e8«      Z; G d"„ d#e8«      Z< G d$„ d%e0jz                  «      Z= G d&„ d'e0j|                  «      Z> G d(„ d)e0j~                  «      Z?yc c} w )*ar  Amazon SQS transport module for Kombu.

This package implements an AMQP-like interface on top of Amazons SQS service,
with the goal of being optimized for high performance and reliability.

The default settings for this module are focused now on high performance in
task queue situations where tasks are small, idempotent and run very fast.

SQS Features supported by this transport
========================================
Long Polling
------------
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-long-polling.html

Long polling is enabled by setting the `wait_time_seconds` transport
option to a number > 1.  Amazon supports up to 20 seconds.  This is
enabled with 10 seconds by default.

Batch API Actions
-----------------
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-batch-api.html

The default behavior of the SQS Channel.drain_events() method is to
request up to the 'prefetch_count' messages on every request to SQS.
These messages are stored locally in a deque object and passed back
to the Transport until the deque is empty, before triggering a new
API call to Amazon.

This behavior dramatically speeds up the rate that you can pull tasks
from SQS when you have short-running tasks (or a large number of workers).

When a Celery worker has multiple queues to monitor, it will pull down
up to 'prefetch_count' messages from queueA and work on them all before
moving on to queueB.  If queueB is empty, it will wait up until
'polling_interval' expires before moving back and checking on queueA.

Message Attributes
-----------------
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-metadata.html

SQS supports sending message attributes along with the message body.
To use this feature, you can pass a 'message_attributes' as keyword argument
to `basic_publish` method.

Other Features supported by this transport
==========================================
Predefined Queues
-----------------
The default behavior of this transport is to use a single AWS credential
pair in order to manage all SQS queues (e.g. listing queues, creating
queues, polling queues, deleting messages).

If it is preferable for your environment to use multiple AWS credentials, you
can use the 'predefined_queues' setting inside the 'transport_options' map.
This setting allows you to specify the SQS queue URL and AWS credentials for
each of your queues. For example, if you have two queues which both already
exist in AWS) you can tell this transport about them as follows:

.. code-block:: python

    transport_options = {
      'predefined_queues': {
        'queue-1': {
          'url': 'https://sqs.us-east-1.amazonaws.com/xxx/aaa',
          'access_key_id': 'a',
          'secret_access_key': 'b',
          'backoff_policy': {1: 10, 2: 20, 3: 40, 4: 80, 5: 320, 6: 640}, # optional
          'backoff_tasks': ['svc.tasks.tasks.task1'] # optional
        },
        'queue-2.fifo': {
          'url': 'https://sqs.us-east-1.amazonaws.com/xxx/bbb.fifo',
          'access_key_id': 'c',
          'secret_access_key': 'd',
          'backoff_policy': {1: 10, 2: 20, 3: 40, 4: 80, 5: 320, 6: 640}, # optional
          'backoff_tasks': ['svc.tasks.tasks.task2'] # optional
        },
      }
    'sts_role_arn': 'arn:aws:iam::<xxx>:role/STSTest', # optional
    'sts_token_timeout': 900, # optional
    'sts_token_buffer_time': 0, # optional, added in 5.6.0
    }

Note that FIFO and standard queues must be named accordingly (the name of
a FIFO queue must end with the .fifo suffix).

backoff_policy & backoff_tasks are optional arguments. These arguments
automatically change the message visibility timeout, in order to have
different times between specific task retries. This would apply after
task failure.

AWS STS authentication is supported, by using sts_role_arn, and
sts_token_timeout. sts_role_arn is the assumed IAM role ARN we are trying
to access with. sts_token_timeout is the token timeout, defaults (and minimum)
to 900 seconds. After the mentioned period, a new token will be created.

.. versionadded:: 5.6.0
    sts_token_buffer_time (seconds) is the time by which you want to refresh your token
    earlier than its actual expiration time, defaults to 0 (no time buffer will be added),
    should be less than sts_token_timeout.



If you authenticate using Okta_ (e.g. calling |gac|_), you can also specify
a 'session_token' to connect to a queue. Note that those tokens have a
limited lifetime and are therefore only suited for short-lived tests.

.. _Okta: https://www.okta.com/
.. _gac: https://github.com/Nike-Inc/gimme-aws-creds#readme
.. |gac| replace:: ``gimme-aws-creds``


Client config
-------------
In some cases you may need to override the botocore config. You can do it
as follows:

.. code-block:: python

    transport_option = {
      'client-config': {
          'connect_timeout': 5,
       },
    }

For a complete list of settings you can adjust using this option see
https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html

Features
========
* Type: Virtual
* Supports Direct: Yes
* Supports Topic: Yes
* Supports Fanout: Yes
* Supports Priority: No
* Supports TTL: No
é    )ÚannotationsN)ÚdatetimeÚ	timedeltaÚtimezone)ÚJSONDecodeError)ÚEmpty)ÚAny)ÚConfig)ÚClientError)Úensure_promiseÚpromiseÚ	transform)Úget_event_loop)Úboto3Ú
exceptions)ÚAsyncSQSConnection)ÚAsyncMessage)Ú
get_logger)Ú
scheduling)Úbytes_to_strÚsafe_str)ÚdumpsÚloads)Úcached_propertyé   )Úvirtualz-_.é_   é-   é.   é
   c                ó<   — 	 t        | «      S # t        $ r | cY S w xY w)z5Try to convert x' to int, or return x' if that fails.)ÚintÚ
ValueError)Úxs    úUC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\kombu/transport/SQS.pyÚ	maybe_intr&   µ   s$   € ðÜ�1‹vˆøÜò ØŠðús   ‚
 �šc                  ó   — e Zd ZdZy)ÚUndefinedQueueExceptionzAPredefined queues are being used and an undefined queue was used.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    r%   r(   r(   ½   s   „ ÚKr/   r(   c                  ó   — e Zd ZdZy)ÚInvalidQueueExceptionz@Predefined queues are being used and configuration is not valid.Nr)   r.   r/   r%   r1   r1   Á   s   „ ÚJr/   r1   c                  ó   — e Zd ZdZy)ÚAccessDeniedQueueExceptionz”Raised when access to the AWS queue is denied.

    This may occur if the permissions are not correctly set or the
    credentials are invalid.
    Nr)   r.   r/   r%   r3   r3   Å   s   „ òr/   r3   c                  ó   — e Zd ZdZy)ÚDoesNotExistQueueExceptionz"The specified queue doesn't exist.Nr)   r.   r/   r%   r5   r5   Í   s   „ Ú,r/   r5   c                  ó6   ‡ — e Zd ZdZdˆ fd„	Zd„ Zd„ Zd„ Zˆ xZS )ÚQoSz5Quality of Service guarantees implementation for SQS.c                ó”   •— t         ‰| �  ||¬«       | j                  |«      \  }}}}|r|r|r|r| j                  ||||«       y y y y y )N)Úrequeue)ÚsuperÚrejectÚ1_extract_backoff_policy_configuration_and_messageÚapply_backoff_policy)ÚselfÚdelivery_tagr9   Úrouting_keyÚmessageÚbackoff_tasksÚbackoff_policyÚ	__class__s          €r%   r;   z
QoS.rejectÔ   s`   ø€ Ü‰‰�|¨WˆÔ5à×BÑBØóñ 	<ˆ�W˜m¨^ñ ™7¡}¹Ø×%Ñ%Ø˜\¨>¸=õJð :H }˜7ˆ;r/   c                ó  — 	 | j                   |   }|j                  d   }|r|sy| j                  j                  j                  |i «      }|j                  d«      }|j                  d«      }||||fS # t        $ r Y yw xY w)Nr@   )NNNNrB   rC   )Ú
_deliveredÚdelivery_infoÚKeyErrorÚchannelÚpredefined_queuesÚget)r>   r?   rA   r@   Úqueue_configrB   rC   s          r%   r<   z5QoS._extract_backoff_policy_configuration_and_messageÝ   s�   € ð	*Ø—o‘o lÑ3ˆGØ!×/Ñ/°Ñ>ˆKñ ¡'Ø)Ø—|‘|×5Ñ5×9Ñ9¸+ÀrÓJˆØ$×(Ñ(¨Ó9ˆØ%×)Ñ)Ð*:Ó;ˆØ˜G ]°NÐBÐBøô ò 	*Ù)ð	*ús   ‚A3 Á3	A?Á>A?c                óø   — | j                   j                  |   }| j                  |«      \  }}|r|sy |j                  |«      }||v r3|�0| j                   j	                  |«      }	|	j                  |||¬«       y y y )N©ÚQueueUrlÚReceiptHandleÚVisibilityTimeout)rI   Ú_queue_cacheÚ'extract_task_name_and_number_of_retriesrK   ÚsqsÚchange_message_visibility)
r>   r@   r?   rC   rB   Ú	queue_urlÚ	task_nameÚnumber_of_retriesÚpolicy_valueÚcs
             r%   r=   zQoS.apply_backoff_policyê   sŽ   € à—L‘L×-Ñ-¨kÑ:ˆ	à×8Ñ8¸ÓFñ 	%ˆ	Ð$áÑ 1ØØ%×)Ñ)Ð*;Ó<ˆØ˜Ñ%¨,Ð*BØ—‘× Ñ  Ó-ˆAØ×'Ñ'Ø"Ø*Ø".ð (õ ð +CÐ%r/   c                óŒ   — | j                   |   }|j                  }|d   }t        |j                  d   d   d   d   «      }||fS )NÚtaskrG   Úsqs_messageÚ
AttributesÚApproximateReceiveCount)rF   Úheadersr"   Ú
properties)r>   r?   rA   Úmessage_headersrW   rX   s         r%   rS   z+QoS.extract_task_name_and_number_of_retriesú   sa   € Ø—/‘/ ,Ñ/ˆØ!Ÿ/™/ˆØ# FÑ+ˆ	ÜØ×Ñ˜Ñ/°Ñ>Ø+ñ-Ø-FñHóIÐð Ð+Ð+Ð+r/   ©F)	r*   r+   r,   r-   r;   r<   r=   rS   Ú__classcell__©rD   s   @r%   r7   r7   Ñ   s   ø„ Ù?õJòCòö ,r/   r7   c                  ó¾  ‡ — e Zd ZdZdZdZdZdZdZi Z	dZ
i Zi Z e«       ZeZ ej"                  d«      Zˆ fd„Zd	„ Zd
„ Zˆ fd„Zˆ fd„ZdBd„Zd„ Zefd„Zd„ Zd„ Zd„ Zd„ Zd„ Z d„ Z!d„ Z"d„ Z#	 	 dC	 	 	 	 	 dDd„Z$e%dfd„Z&d„ Z'dEd„Z(d„ Z)e%fd„Z*dEd„Z+dCd„Z,d „ Z-	 dCd!„Z.	 dFˆ fd"„	Z/dGˆ fd#„	Z0d$„ Z1d%„ Z2ˆ fd&„Z3	 dEd'„Z4dEd(„Z5d)„ Z6dHd*„Z7d+„ Z8d,„ Z9dEd-„Z:e;d.„ «       Z<e;d/„ «       Z=e>d0„ «       Z?e>d1„ «       Z@e>d2„ «       ZAe>d3„ «       ZBe>d4„ «       ZCe>d5„ «       ZDe>d6„ «       ZEe>d7„ «       ZFe>d8„ «       ZGe>dId9„«       ZHe>d:„ «       ZIe>d;„ «       ZJe;dJd<„«       ZKdKd=„ZLd>„ ZMd?„ ZNd@„ ZOdA„ ZPˆ xZQS )LÚChannelzSQS Channel.z	us-east-1i  r    zkombu%(vhost)sNs@   ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$c                óà   •— t         €t        d«      ‚t        ‰| �  |i |¤Ž | j	                  «        | j                  | j                  «       |j                  d«      xs
 t        «       | _	        y )Nzboto3 is not installedÚhub)
r   ÚImportErrorr:   Ú__init__Ú_validate_predifined_queuesÚ_update_queue_cacheÚqueue_name_prefixrK   r   ri   )r>   ÚargsÚkwargsrD   s      €r%   rk   zChannel.__init__  s`   ø€ Üˆ=ÜÐ6Ó7Ð7Ü‰Ñ˜$Ð) &Ò)Ø×(Ñ(Ô*ð 	× Ñ  ×!7Ñ!7Ô8à—:‘:˜eÓ$Ò8¬Ó(8ˆ�r/   c                ó  — | j                   j                  «       D ]n  \  }}|d   j                  d«      }|j                  d«      }|r|st        dj	                  |d   «      «      ‚|rŒO|sŒRt        dj	                  ||d   «      «      ‚ y)zšCheck that standard and FIFO queues are named properly.

        AWS requires FIFO queues to have a name
        that ends with the .fifo suffix.
        Úurlú.fifoz6Queue with url '{}' must have a name ending with .fifoz.Queue with name '{}' is not a FIFO queue: '{}'N)rJ   ÚitemsÚendswithr1   Úformat)r>   Ú
queue_nameÚqÚfifo_urlÚ	fifo_names        r%   rl   z#Channel._validate_predifined_queues#  s“   € ð "×3Ñ3×9Ñ9Ö;‰MˆJ˜Ø˜‘x×(Ñ(¨Ó1ˆHØ"×+Ñ+¨GÓ4ˆIÙ¡	Ü+ð(ß(.©¨q°©xÓ(8óð ò ¢)Ü+ðß!™6 *¨a°©hÓ7óð ñ <r/   c                ó:  — | j                   r5| j                   j                  «       D ]  \  }}|d   | j                  |<   Œ y | j                  «       j	                  |¬«      }|j                  dg «      D ]%  }|j                  d«      d   }|| j                  |<   Œ' y )Nrr   )ÚQueueNamePrefixÚ	QueueUrlsÚ/éÿÿÿÿ)rJ   rt   rR   rT   Úlist_queuesrK   Úsplit)r>   rn   rw   rx   Úresprr   s         r%   rm   zChannel._update_queue_cache7  s‘   € Ø×!Ò!Ø!%×!7Ñ!7×!=Ñ!=Ö!?‘�
˜AØ01°%±�×!Ñ! *Ò-ð "@àà�x‰x‹z×%Ñ%Ð6GÐ%ÓHˆØ—8‘8˜K¨Ö,ˆCØŸ™ 3›¨Ñ+ˆJØ,/ˆD×Ñ˜jÒ)ñ -r/   c                ó    •— |r| j                   j                  |«       | j                  r| j                  |«       t	        ‰| �  ||g|¢­i |¤ŽS ©N)Ú_noack_queuesÚaddri   Ú_loop1r:   Úbasic_consume)r>   ÚqueueÚno_ackro   rp   rD   s        €r%   rˆ   zChannel.basic_consumeB  sT   ø€ ÙØ×Ñ×"Ñ" 5Ô)Ø�8Š8Ø�K‰K˜ÔÜ‰wÑ$Ø�6ð
Ø ò
Ø$*ñ
ð 	
r/   c                ó’   •— || j                   v r*| j                  |   }| j                  j                  |«       t        ‰| �  |«      S r„   )Ú
_consumersÚ_tag_to_queuer…   Údiscardr:   Úbasic_cancel)r>   Úconsumer_tagr‰   rD   s      €r%   r�   zChannel.basic_cancelK  sC   ø€ Ø˜4Ÿ?™?Ñ*Ø×&Ñ& |Ñ4ˆEØ×Ñ×&Ñ& uÔ-Ü‰wÑ# LÓ1Ð1r/   c                ó    — | j                   r| j                  j                  «       s
t        «       ‚| j	                  | j
                  ||¬«       y)z’Return a single payload message from one of our queues.

        Raises
        ------
            Queue.Empty: if no messages available.
        )ÚtimeoutN)rŒ   ÚqosÚcan_consumer   Ú_pollÚcycle)r>   r’   Úcallbackrp   s       r%   Údrain_eventszChannel.drain_eventsQ  s9   € ð �Š d§h¡h×&:Ñ&:Ô&<Ü“'ˆMð 	�
‰
�4—:‘:˜x°ˆ
Õ9r/   c                ól   — t        j                  | j                  | j                  t        «      | _        y)aA  Reset the consume cycle.

        Returns
        -------
            FairCycle: object that points to our _get_bulk() method
                rather than the standard _get() method.  This allows for
                multiple messages to be returned at once from SQS (
                based on the prefetch limit).
        N)r   Ú	FairCycleÚ	_get_bulkÚ_active_queuesr   Ú_cycle©r>   s    r%   Ú_reset_cyclezChannel._reset_cycle_  s'   € ô !×*Ñ*Ø�N‰N˜D×/Ñ/´ó
ˆ�r/   c                óØ   — |j                  d«      r7|dt        d«        }t        t        |«      «      j	                  |«      }|dz   S t        t        |«      «      j	                  |«      S )z3Format AMQP queue name into a legal SQS queue name.rs   N)ru   ÚlenÚstrr   Ú	translate)r>   ÚnameÚtableÚpartials       r%   Úentity_namezChannel.entity_namem  s_   € à�=‰=˜Ô!Ø˜>œS ›\˜MÐ*ˆGÜœ( 7Ó+Ó,×6Ñ6°uÓ=ˆGØ˜WÑ$Ð$ä”x “~Ó&×0Ñ0°Ó7Ð7r/   c                ó>   — | j                  | j                  |z   «      S r„   )r§   rn   )r>   rw   s     r%   Úcanonical_queue_namezChannel.canonical_queue_namev  s   € Ø×Ñ × 6Ñ 6¸Ñ CÓDÐDr/   c                ó  — | j                  |«      }|| j                  vr| j                  |«       	 | j                  |   S # t        $ r6 | j                  rt        dj                  |«      «      ‚t        d|› d�«      ‚w xY w)z9Try to retrieve the SQS queue URL for a given queue name.ú<Queue with name '{}' must be defined in 'predefined_queues'.úQueue with name 'z' doesn't exist in SQS)r©   rR   rm   rH   rJ   r(   rv   r5   )r>   r‰   Ú	sqs_qnames      r%   Ú_resolve_queue_urlzChannel._resolve_queue_urly  s˜   € ð ×-Ñ-¨eÓ4ˆ	ð ˜D×-Ñ-Ñ-Ø×$Ñ$ YÔ/ð	Ø×$Ñ$ YÑ/Ð/øÜò 		Ø×%Ò%Ü-ð6ç‘&˜Ó#ó%ð %ô
 -Ø# I ;Ð.DÐEóð ð		ús   ²A Á?B c                ó  — 	 | j                  |«      S # t        $ rj | j                  |«      }dt        | j                  «      i}|j                  d«      rd|d<   | j                  ||«      }|d   | j                  |<   |d   cY S w xY w)z¼Ensure a queue with given name exists in SQS.

        Arguments:
        ---------
            queue (str): the AMQP queue name
        Returns
            str: the SQS queue URL
        rQ   rs   ÚtrueÚ	FifoQueuerO   )r®   r5   r©   r¢   Úvisibility_timeoutru   Ú_create_queuerR   )r>   r‰   rp   r­   Ú
attributesr‚   s         r%   Ú
_new_queuezChannel._new_queue’  s–   € ð
	$Ø×*Ñ*¨5Ó1Ð1øÜ)ò 	$Ø×1Ñ1°%Ó8ˆIØ-¬s°4×3JÑ3JÓ/KÐLˆJØ×!Ñ! 'Ô*Ø*0�
˜;Ñ'à×%Ñ% i°Ó<ˆDØ+/°
Ñ+;ˆD×Ñ˜iÑ(Ø˜
Ñ#Ò#ð	$ús   ‚ “A0BÂBc                ó
  — | j                   ry|j                  | j                  j                  d«      xs i «       | j                  j                  d«      }||dœ}|r||d<    | j	                  |¬«      j
                  di |¤ŽS )z=Create an SQS queue with a given name and nominal attributes.Nzsqs-creation-attributesÚ
queue_tags)Ú	QueueNamer^   Útags©r‰   r.   )rJ   ÚupdateÚtransport_optionsrK   rT   Úcreate_queue)r>   rw   r´   r·   Úcreate_paramss        r%   r³   zChannel._create_queue§  s�   € ð ×!Ò!Øà×ÑØ×"Ñ"×&Ñ&Ð'@ÓAÒGÀRô	
ð ×+Ñ+×/Ñ/°Ó=ˆ
ð $Ø$ñ
ˆñ
 Ø$.ˆM˜&Ñ!à6ˆt�x‰x˜jˆxÓ)×6Ñ6ÑG¸ÑGÐGr/   c                ó¸   — | j                   ry| j                  |«      }| j                  «       j                  |¬«       | j                  j                  |d«       y)zDelete queue by name.N©rO   )rJ   r®   rT   Údelete_queuerR   Úpop)r>   r‰   ro   rp   Úq_urls        r%   Ú_deletezChannel._delete¾  sR   € à×!Ò!Øà×'Ñ'¨Ó.ˆØ�‰‹
×ÑØð 	 ô 	
ð 	×Ñ×Ñ˜e TÕ*r/   c                ó   — | j                  |«      }d|i}d|v r�d|d   v r|d   j                  d«      |d<   |j                  d«      rLd|d   v r|d   d   |d<   nd|d<   d|d   v r|d   d   |d<   n3t        t	        j
                  «       «      |d<   nd	|d   v r|d   d	   |d	<   | j                  r#t        «       j                  t        |«      «      }nt        |«      }||d
<   | j                  | j                  |«      ¬«      }|j                  d«      r%|j                  ||d   d   | j                  ¬«       y |j                  di |¤Ž y)zPut message onto queue.rO   ra   Úmessage_attributesÚMessageAttributesrs   ÚMessageGroupIdÚdefaultÚMessageDeduplicationIdÚDelaySecondsÚMessageBodyrº   Úredeliveredr?   rN   Nr.   )rµ   rÂ   ru   r¢   ÚuuidÚuuid4Úsqs_base64_encodingr   Úencoder   rT   r©   rK   rU   Úwait_time_secondsÚsend_message)r>   r‰   rA   rp   rÃ   ÚbodyrZ   s          r%   Ú_putzChannel._putÉ  s‹  € à—‘ Ó&ˆØ˜eÐ$ˆØ˜7Ñ"Ø# w¨|Ñ'<Ñ<ð ˜LÑ)×-Ñ-Ð.BÓCð Ð*Ñ+à�~‰~˜gÔ&Ø# w¨|Ñ'<Ñ<à Ñ-Ð.>Ñ?ð Ð+Ò,ð 09�FÐ+Ñ,Ø+¨w°|Ñ/DÑDà Ñ-Ð.FÑGð Ð3Ò4ô 8;¼4¿:¹:»<Ó7H�FÐ3Ò4à! W¨\Ñ%:Ñ:à Ñ-¨nÑ=ð ˜>Ñ*ð ×#Ò#Ü“>×(Ñ(¬¨w«Ó8‰Dä˜“>ˆDØ $ˆˆ}Ñà�H‰H˜4×4Ñ4°UÓ;ˆHÓ<ˆØ�;‰;�}Ô%Ø×'Ñ'ØØ% lÑ3°NÑCØ"&×"8Ñ"8ð (õ ð ˆA�N‰NÑ$˜VÓ$r/   c                óÒ   — |d   }| j                  |«      }t        |«      }| j                  |«      }|| j                  v r| j	                  ||«       |S | j                  ||||«      S )NÚBody)Ú_decode_python_message_bodyr   Ú_prepare_json_payloadr…   Ú_delete_messageÚ_envelope_payload)r>   rA   rw   rÃ   Úraw_msg_bodyÚdecoded_bytesÚtextÚpayloads           r%   Ú_message_to_pythonzChannel._message_to_pythonò  sq   € Ø˜v‘ˆØ×8Ñ8¸ÓFˆÜ˜MÓ*ˆà×,Ñ,¨TÓ2ˆð ˜×+Ñ+Ñ+Ø× Ñ  ¨WÔ5ØˆNà×%Ñ% g¨t°W¸eÓDÐDr/   c                óp   — | j                  |«      }|D �cg c]  }| j                  |||«      ‘Œ c}S c c}w )aç  Convert a list of SQS Message objects into Payloads.

        This method handles converting SQS Message objects into
        Payloads, and appropriately updating the queue depending on
        the 'ack' settings for that queue.

        Arguments:
        ---------
            messages (SQSMessage): A list of SQS Message objects.
            queue (str): Name representing the queue they came from.

        Returns
        -------
            List: A list of Payload objects
        )rµ   rà   )r>   Úmessagesr‰   rÃ   Úms        r%   Ú_messages_to_pythonzChannel._messages_to_python   s9   € ð  —‘ Ó&ˆÙBJÓKÁ(¸Q�×'Ñ'¨¨5°%Õ8À(ÑKÐKùÒKs   –3c                ó  — | j                  |«      }| j                  |¬«      }| j                  j                  d«      xs g }| j                  j                  d«      xs g }|||xs | j                  ||dœ} |j
                  di |¤ŽS )aM  Unified receive_message wrapper for SQS (boto3.client.SQS) with full attribute support.

        :param queue: The queue as a string
        :param max_number_of_messages: Int of max number of messages to receive.
        :param wait_time_seconds: Int of sqs wait time in seconds.
        :return: SQS client recieve_message
        rº   ÚMessageSystemAttributeNamesÚMessageAttributeNames)rO   ÚMaxNumberOfMessagesÚWaitTimeSecondsrç   ræ   r.   )rµ   rT   Úget_message_attributesrK   rÒ   Úreceive_message)	r>   r‰   Úmax_number_of_messagesrÒ   rÃ   ÚclientÚmessage_system_attribute_namesÚmessage_attribute_namesÚparamss	            r%   Ú_receive_messagezChannel._receive_message  s§   € ð —_‘_ UÓ+ˆØ—‘ �Ó&ˆà)-×)DÑ)D×)HÑ)HØ)ó*+ò *1Ø.0ð 	'ð #'×"=Ñ"=×"AÑ"AØ#ó#%ò #+Ø(*ð 	 ð Ø#9Ø0ÒJ°D×4JÑ4JØ%<Ø+Iñ"
ˆð &ˆv×%Ñ%Ñ/¨Ñ/Ð/r/   c                óZ  — | j                  «       }|r�| j                  || j                  |¬«      }|j                  d«      ra|d   D ]"  }t	        |d   ¬«      j                  «       |d<   Œ$ | j                  |d   |«      D ]  }| j                  j                  ||«       Œ  yt        «       ‚)a;  Try to retrieve multiple messages off ``queue``.

        Where :meth:`_get` returns a single Payload object, this method
        returns a list of Payload objects.  The number of objects returned
        is determined by the total number of messages available in the queue
        and the number of messages the QoS object allows (based on the
        prefetch_count).

        Note:
        ----
            Ignores QoS limits so caller is responsible for checking
            that we are allowed to consume at least one message from the
            queue.  get_bulk will then ask QoS for an estimate of
            the number of extra messages that we can consume.

        Arguments:
        ---------
            queue (str): The queue name to pull from.

        Returns
        -------
            List[Message]
        ©r‰   rÒ   rì   ÚMessagesr×   ©rÔ   N)
Ú_get_message_estimaterñ   rÒ   rK   r   Údecoderä   Ú
connectionÚ_deliverr   )r>   r‰   Úmax_if_unlimitedr—   Ú	max_countr‚   rã   Úmsgs           r%   r›   zChannel._get_bulk3  s¬   € ð< ×.Ñ.Ó0ˆ	ÙØ×(Ñ(ØØ"&×"8Ñ"8Ø'0ð )ó ˆDð �x‰x˜
Ô#Ø˜jÔ)�AÜ ,°!°F±)Ô <× CÑ CÓ E�A�f’Ið *à×3Ñ3°D¸Ñ4DÀeÖL�CØ—O‘O×,Ñ,¨S°%Õ8ð MàÜ‹gˆr/   c                ó   — | j                  || j                  d¬«      }|j                  d«      rFt        |d   d   d   ¬«      j	                  «       }||d   d   d<   | j                  |d   |«      d   S t        «       ‚)z/Try to retrieve a single message off ``queue``.r   ró   rô   r   r×   rõ   )rñ   rÒ   rK   r   r÷   rä   r   )r>   r‰   r‚   rÔ   s       r%   Ú_getzChannel._geta  sŽ   € à×$Ñ$ØØ"×4Ñ4Ø#$ð %ó 
ˆð �8‰8�JÔÜ T¨*Ñ%5°aÑ%8¸Ñ%@ÔA×HÑHÓJˆDØ*.ˆD�Ñ˜QÑ Ñ'Ø×+Ñ+¨D°Ñ,<¸eÓDÀQÑGÐGÜ‹gˆr/   c                óP   — | j                   j                  | j                  |«       y r„   )ri   Ú	call_soonÚ_schedule_queue)r>   r‰   Ú_s      r%   r‡   zChannel._loop1o  s   € Ø�‰×Ñ˜4×/Ñ/°Õ7r/   c                óÊ   — || j                   v rU| j                  j                  «       r)| j                  |t	        | j
                  |f«      ¬«       y | j                  |«       y y ©N)r—   )rœ   r“   r”   Ú_get_bulk_asyncr   r‡   )r>   r‰   s     r%   r  zChannel._schedule_queuer  sX   € Ø�D×'Ñ'Ñ'Ø�x‰x×#Ñ#Ô%Ø×$Ñ$Ø¤G¨D¯K©K¸%¸Ó$Bð %õ ð —‘˜EÕ"ð (r/   c                ót   — | j                   j                  «       }t        |€||«      S t        |d«      |«      S )Nr   )r“   Úcan_consume_max_estimateÚminÚmax)r>   rú   Úmaxcounts      r%   rö   zChannel._get_message_estimate{  sD   € Ø—8‘8×4Ñ4Ó6ˆÜØ (Ð 0ÐØó
ð 	
Ü69¸(ÀAÓ6FØó
ð 	
r/   c                óx   — | j                  «       }|r| j                  |||¬«      S t        |«      } |g «       |S r  )rö   Ú
_get_asyncr   )r>   r‰   r—   r
  s       r%   r  zChannel._get_bulk_async‚  s>   € Ø×-Ñ-Ó/ˆÙØ—?‘? 5¨(¸X�?ÓFÐFä! (Ó+ˆÙ�ŒØˆr/   c                ó¾   — | j                  |«      }| j                  |«      }| j                  |||| j                  |¬«      t	        | j
                  |||«      ¬«      S )Nrº   )rw   rV   Úcountrø   r—   )rµ   r©   Ú_get_from_sqsÚasynsqsr   Ú_on_messages_ready)r>   r‰   r  r—   rÃ   Úqnames         r%   r  zChannel._get_async‹  sd   € Ø—‘ Ó&ˆØ×)Ñ)¨%Ó0ˆØ×!Ñ!Ø¨°UØ—|‘|¨%�|Ó0ÜØ×'Ñ'¨°5¸%óð "ó 
ð 	
r/   c                ó–   — d|v rE|d   r?| j                   j                  }|d   D ]   }| j                  |||«      } ||   |«       Œ" y y y )Nrô   )rø   Ú
_callbacksrà   )r>   r‰   r  râ   Ú	callbacksrü   Ú
msg_parseds          r%   r  zChannel._on_messages_ready–  sZ   € Ø˜Ñ! h¨zÒ&:ØŸ™×2Ñ2ˆIØ 
Ô+�Ø!×4Ñ4°S¸%ÀÓG�
Ø �	˜%Ñ  Õ,ñ ,ð ';Ð!r/   c                óB   — |j                  |||| j                  |¬«      S )zwRetrieve and handle messages from SQS.

        Uses long polling and returns :class:`~vine.promises.promise`.
        )Únumber_messagesrÒ   r—   )rë   rÒ   )r>   rw   rV   rø   r  r—   s         r%   r  zChannel._get_from_sqs�  s/   € ð ×)Ñ)Ø˜	°5Ø"×4Ñ4Øð *ó 
ð 	
r/   c                óh   •— |D ]  }|j                   j                  |d «       Œ  t        ‰| �  |«      S r„   )rG   rÂ   r:   Ú_restore)r>   rA   Úunwanted_delivery_infoÚunwanted_keyrD   s       €r%   r  zChannel._restore©  s5   ø€ ã2ˆLà×!Ñ!×%Ñ% l°DÕ9ð 3ô ‰wÑ Ó(Ð(r/   c                óè  •— 	 | j                   j                  |«      j                  }|d   }d }d|v r| j                  |d   «      }	 | j	                  |¬«      j                  |d   |d   ¬«       t        ‰| �  |«       y # t        $ rI}|j                  d   d   d	k(  rt        |j                  d   d
   «      ‚t        ‰| �-  |«       Y d }~y d }~ww xY w# t        $ r t        ‰| �  |«       Y y w xY w)Nr]   r@   rº   Ú	sqs_queuerP   )rO   rP   ÚErrorÚCodeÚAccessDeniedÚMessage)r“   rK   rG   r©   rT   Údelete_messager:   Ú	basic_ackr   Úresponser3   Úbasic_rejectrH   )r>   r?   ÚmultiplerA   r]   r‰   Ú	exceptionrD   s          €r%   r$  zChannel.basic_ack°  s	  ø€ ð	0Ø—h‘h—l‘l <Ó0×>Ñ>ˆGØ! -Ñ0ˆKð ˆEØ Ñ'Ø×1Ñ1°'¸-Ñ2HÓI�ð0Ø—‘˜u�Ó%×4Ñ4Ø$ [Ñ1Ø"-¨oÑ">ð 5ô ô ‘Ñ! ,Õ/øô ò 3Ø×%Ñ% gÑ.¨vÑ6¸.ÒHÜ4Ø!×*Ñ*¨7Ñ3°IÑ>óð ô ‘Ñ$ \×2Ñ2ûð3ûô ò 	,Ü‰GÑ˜lÖ+ð	,ús)   ƒ*C Á)B Â	CÂ
?CÃCÃC1Ã0C1c                ó°   — | j                  |«      }| j                  | j                  |«      ¬«      }|j                  |dg¬«      }t	        |d   d   «      S )z)Return the number of messages in a queue.rº   ÚApproximateNumberOfMessages)rO   ÚAttributeNamesr^   )rµ   rT   r©   Úget_queue_attributesr"   )r>   r‰   rÃ   rZ   r‚   s        r%   Ú_sizezChannel._sizeÉ  sa   € à—‘ Ó&ˆØ�H‰H˜4×4Ñ4°UÓ;ˆHÓ<ˆØ×%Ñ%ØØ9Ð:ð &ó <ˆô �4˜Ñ%Ð&CÑDÓEÐEr/   c                óÒ   — | j                  |«      }d}t        d«      D ]#  }|t        | j                  |«      «      z  }|rŒ# n | j	                  |¬«      j                  |¬«       |S )z'Delete all current messages in a queue.r   r    rº   rÀ   )rµ   Úranger"   r-  rT   Úpurge_queue)r>   r‰   rÃ   ÚsizeÚis        r%   Ú_purgezChannel._purgeÒ  sf   € à—‘ Ó&ˆð ˆÜ�r–ˆAØ”C˜Ÿ
™
 5Ó)Ó*Ñ*ˆDÚÙð ð 	�‰�uˆÓ×)Ñ)°5Ð)Ô9Øˆr/   c                ó"   •— t         ‰| �  «        y r„   )r:   Úclose)r>   rD   s    €r%   r5  zChannel.closeß  s   ø€ Ü‰‰�r/   c                ó6  — t         j                  j                  ||||¬«      }| j                  �| j                  nd}d|i}| j                  �| j                  |d<   | j
                  j                  d«      xs i }t        di |¤Ž}	 |j                  dd|	i|¤ŽS )	N)Úregion_nameÚaws_access_key_idÚaws_secret_access_keyÚaws_session_tokenTÚuse_sslÚendpoint_urlzclient-configÚconfigr.   )rT   )	r   ÚsessionÚSessionÚ	is_securer<  r¼   rK   r
   rí   )
r>   ÚregionÚaccess_key_idÚsecret_access_keyÚsession_tokenr>  r@  Úclient_kwargsÚclient_configr=  s
             r%   Únew_sqs_clientzChannel.new_sqs_clientè  s¨   € ä—-‘-×'Ñ'ØØ+Ø"3Ø+ð	 (ó 
ˆð '+§n¡nÐ&@�D—N’NÀdˆ	à�yð
ˆð ×ÑÐ(Ø,0×,=Ñ,=ˆM˜.Ñ)Ø×.Ñ.×2Ñ2°?ÓCÒIÀrˆÜÑ(˜-Ñ(ˆØˆw�~‰~ÑD¨FÐD°mÑDÐDr/   c                ó   — |��%| j                   �r|| j                   vrt        d|› d�«      ‚| j                   |   }| j                  j                  d«      r| j	                  ||«      S | j                  j                  d«      s¤|| j
                  v r| j
                  |   S | j                  |j                  d| j                  «      |j                  d| j                  j                  «      |j                  d| j                  j                  «      ¬«      x}| j
                  |<   |S | j                  �| j                  S | j                  | j                  | j                  j                  | j                  j                  ¬«      x}| _        |S )Nr¬   z)' must be defined in 'predefined_queues'.Ústs_role_arnrA  rB  rC  )rA  rB  rC  )rJ   r(   r¼   rK   Ú_handle_sts_sessionÚ_predefined_queue_clientsrG  rA  ÚconninfoÚuseridÚpasswordÚ_sqs)r>   r‰   rx   rZ   s       r%   rT   zChannel.sqsú  s|  € ØÑ ×!7Ó!7à˜D×2Ñ2Ñ2Ü-Ø'¨ wð //ð /ó0ð 0ð ×&Ñ& uÑ-ˆAØ×%Ñ%×)Ñ)¨.Ô9Ø×/Ñ/°°qÓ9Ð9Ø×)Ñ)×-Ñ-¨nÔ=Ø˜D×:Ñ:Ñ:Ø×9Ñ9¸%Ñ@Ð@ð ×+Ñ+Ø#$§5¡5¨°4·;±;Ó#?Ø*+¯%©%Ø /°·±×1EÑ1Eó+Gà./¯e©eØ 3°T·]±]×5KÑ5Kó/Mð	 ,ó ð�A˜×6Ñ6°uÑ=ð �Hà�9‰9Ð Ø—9‘9Ðà×+Ñ+Ø—;‘;ØŸ-™-×.Ñ.Ø"Ÿm™m×4Ñ4ð ,ó 
ð 	
ˆˆDŒIð
 ˆr/   c                ó˜  — |j                  d| j                  «      }t        | d«      s| j                  ||«      S | j                  j                  d ¬«      t        j                  t        j                  «      j                  d ¬«      k  r| j                  ||«      S || j                  vr| j                  ||«      S | j                  |   S )NrA  Ústs_expiration)Útzinfo)rK   rA  ÚhasattrÚ-_new_predefined_queue_client_with_sts_sessionrQ  Úreplacer   Únowr   ÚutcrK  )r>   r‰   rx   rA  s       r%   rJ  zChannel._handle_sts_session  s²   € Ø—‘�x §¡Ó-ˆÜ�tÐ-Ô.Ø×EÑEÀeÈVÓTÐTà× Ñ ×(Ñ(°Ð(Ó5¼¿¹ÄXÇ\Á\Ó8R×8ZÑ8ZÐbfÐ8ZÓ8gÒgØ×EÑEÀeÈVÓTÐTà˜D×:Ñ:Ñ:Ø×IÑIÈ%ÐQWÓXÐXØ×1Ñ1°%Ñ8Ð8r/   c                óz   — | j                  ||«      }|r&d|cxk  r|k  rn |S |dxx   t        |¬«      z  cc<   |S )z¸Generate STS session credentials with an optional expiration buffer.

        The buffer is only applied if it is less than `token_expiry_seconds` to prevent an expired token.
        r   Ú
Expiration)Úseconds)Úgenerate_sts_session_tokenr   )r>   Úrole_arnÚtoken_expiry_secondsÚtoken_buffer_secondsÚcredentialss        r%   Ú&generate_sts_session_token_with_bufferz.Channel.generate_sts_session_token_with_buffer(  sL   € ð
 ×5Ñ5°hÐ@TÓUˆÙ AÐ(<Ô$SÐ?SÔ$SàÐð ˜Ó%¬Ð;OÔ)PÑPÓ%ØÐr/   c                ó4  — | j                  | j                  j                  d«      | j                  j                  dd«      | j                  j                  dd«      «      }|d   | _        | j	                  ||d   |d   |d	   ¬
«      x}| j
                  |<   |S )NrI  Ústs_token_timeouti„  Ústs_token_buffer_timer   rY  ÚAccessKeyIdÚSecretAccessKeyÚSessionToken)rA  rB  rC  rD  )r`  r¼   rK   rQ  rG  rK  )r>   r‰   rA  Ú	sts_credsrZ   s        r%   rT  z5Channel._new_predefined_queue_client_with_sts_session2  s®   € Ø×?Ñ?Ø×"Ñ"×&Ñ& ~Ó6Ø×"Ñ"×&Ñ&Ð':¸CÓ@Ø×"Ñ"×&Ñ&Ð'>ÀÓBó
ˆ	ð
 (¨Ñ5ˆÔØ48×4GÑ4GØØ# MÑ2Ø'Ð(9Ñ:Ø# NÑ3ð	 5Hó 5
ð 	
ˆˆD×*Ñ*¨5Ñ1ð ˆr/   c                ó^   — t        j                  d«      }|j                  |d|¬«      }|d   S )NÚstsÚCelery)ÚRoleArnÚRoleSessionNameÚDurationSecondsÚCredentials)r   rí   Úassume_role)r>   r\  r]  Ú
sts_clientÚ
sts_policys        r%   r[  z"Channel.generate_sts_session_tokenA  s;   € Ü—\‘\ %Ó(ˆ
Ø×+Ñ+ØØ$Ø0ð ,ó 
ˆ
ð
 ˜-Ñ(Ð(r/   c                ór  — | j                   j                  d«      }| j                   j                  d«      }|�¶| j                  rª|| j                  v rt	        | d«      s| j                  |   S || j                  vrt        dj                  |«      «      ‚| j                  |   }t        | j                  |¬«      |j                  d| j                  «      ||¬«      x}| j                  |<   |S | j                  �| j                  S t        | j                  |¬«      | j                  ||¬«      x}| _
        |S )Nræ   rç   rQ  r«   rº   rA  )Úsqs_connectionrA  rî   rï   )rê   rK   rJ   Ú_predefined_queue_async_clientsrS  r(   rv   r   rT   rA  Ú_asynsqs)r>   r‰   rî   rï   rx   rZ   s         r%   r  zChannel.asynsqsJ  s=  € Ø)-×)DÑ)D×)HÑ)HØ)ó*+Ð&à"&×"=Ñ"=×"AÑ"AØ#ó#%Ðð Ð ×!7Ò!7Ø˜×<Ñ<Ñ<Ü˜4Ð!1Ô2Ø×;Ñ;¸EÑBÐBØ˜D×2Ñ2Ñ2Ü-ð+ç‘&˜“-ó!ð !ð ×&Ñ& uÑ-ˆAä"Ø#'§8¡8°% 8Ó#8ØŸ5™5 ¨4¯;©;Ó7Ø3QØ,Cô	ðˆA�×4Ñ4°UÑ;ð ˆHà�=‰=Ð$Ø—=‘=Ð ä.ØŸ8™8¨%˜8Ó0Ø—;‘;Ø+IØ$;ô	
ð 	
ˆˆDŒMð ˆr/   c                ó.   — | j                   j                  S r„   )rø   rí   rž   s    r%   rL  zChannel.conninfon  s   € à�‰×%Ñ%Ð%r/   c                óB   — | j                   j                  j                  S r„   )rø   rí   r¼   rž   s    r%   r¼   zChannel.transport_optionsr  s   € à�‰×%Ñ%×7Ñ7Ð7r/   c                óT   — | j                   j                  d«      xs | j                  S )Nr²   )r¼   rK   Údefault_visibility_timeoutrž   s    r%   r²   zChannel.visibility_timeoutv  s*   € à×&Ñ&×*Ñ*Ð+?Ó@ò 0Ø×/Ñ/ð	1r/   c                ó:   — | j                   j                  di «      S )z/Map of queue_name to predefined queue settings.rJ   ©r¼   rK   rž   s    r%   rJ   zChannel.predefined_queues{  s   € ð ×%Ñ%×)Ñ)Ð*=¸rÓBÐBr/   c                ó:   — | j                   j                  dd«      S )Nrn   Ú r{  rž   s    r%   rn   zChannel.queue_name_prefix€  s   € à×%Ñ%×)Ñ)Ð*=¸rÓBÐBr/   c                 ó   — y)NFr.   rž   s    r%   Úsupports_fanoutzChannel.supports_fanout„  s   € àr/   c                ó”   — | j                   j                  d«      xs, t        j                  «       j                  xs | j
                  S )NrA  )r¼   rK   r   r?  r7  Údefault_regionrž   s    r%   rA  zChannel.regionˆ  s=   € à×&Ñ&×*Ñ*¨8Ó4ò $Ü—‘“×+Ñ+ò$à×#Ñ#ð	%r/   c                ó8   — | j                   j                  d«      S )NÚ
regioninfor{  rž   s    r%   rƒ  zChannel.regioninfoŽ  s   € à×%Ñ%×)Ñ)¨,Ó7Ð7r/   c                ó8   — | j                   j                  d«      S )Nr@  r{  rž   s    r%   r@  zChannel.is_secure’  s   € à×%Ñ%×)Ñ)¨+Ó6Ð6r/   c                ó8   — | j                   j                  d«      S ©NÚportr{  rž   s    r%   r‡  zChannel.port–  s   € à×%Ñ%×)Ñ)¨&Ó1Ð1r/   c                ó  — | j                   j                  �i| j                  rdnd}| j                   j                  �d| j                   j                  › �}nd}dj	                  || j                   j                  |«      S y )NÚhttpsÚhttpÚ:r}  z	{}://{}{})rL  Úhostnamer@  r‡  rv   )r>   Úschemer‡  s      r%   r<  zChannel.endpoint_urlš  sv   € à�=‰=×!Ñ!Ð-Ø $§¢‘W°FˆFØ�}‰}×!Ñ!Ð-Ø˜4Ÿ=™=×-Ñ-Ð.Ð/‘à�Ø×%Ñ%ØØ—‘×&Ñ&Øóð ð .r/   c                óN   — | j                   j                  d| j                  «      S )NrÒ   )r¼   rK   Údefault_wait_time_secondsrž   s    r%   rÒ   zChannel.wait_time_seconds¨  s)   € à×%Ñ%×)Ñ)Ð*=Ø*.×*HÑ*HóJð 	Jr/   c                ó:   — | j                   j                  dd«      S )NrÐ   Tr{  rž   s    r%   rÐ   zChannel.sqs_base64_encoding­  s   € à×%Ñ%×)Ñ)Ð*?ÀÓFÐFr/   c                ó:   — | j                   j                  dd «      S )NÚfetch_message_attributesr{  rž   s    r%   r’  z Channel.fetch_message_attributes±  s   € à×%Ñ%×)Ñ)Ð*DÀdÓKÐKr/   c                ó4  — d}| j                   }d}d}|�t        |t        «      rg |gdœS t        |t        «      rJdj	                  «       |D �cg c]  }|j	                  «       ‘Œ c}v rdgnt        t        ||gz   «      «      }nät        |t        «      rÔ|j                  dg «      }|j                  dd«      }t        |t        «      rIdj	                  «       |D �cg c]  }|j	                  «       ‘Œ c}v rdgnt        t        ||gz   «      «      }t        |t        «      rG|rEdj	                  «       |D �cg c]  }|j	                  «       ‘Œ c}v rdgnt        t        |«      «      }|rt        |«      ng |rt        |«      dœS |gdœS c c}w c c}w c c}w )aÐ  Get the message attributes to be fetched from SQS.

        Ensures 'ApproximateReceiveCount' is included in system attributes if list is provided.
        - The number of retries is managed by SQS /
            (specifically by the ``ApproximateReceiveCount`` message attribute)
        - See: class QoS(virtual.QoS):
            (method) def extract_task_name_and_number_of_retries

        :return: A dictionary with SQS message attribute fetch config.
        r_   N)rç   ræ   ÚALLræ   rç   )	r’  Ú
isinstancer¢   ÚlistÚlowerÚsetÚdictrK   Úsorted)r>   ÚAPPROXIMATE_RECEIVE_COUNTÚfetchÚmessage_system_attrsÚmessage_attrsÚsÚsystemÚattrss           r%   rê   zChannel.get_message_attributesµ  s¦  € ð %>Ð!Ø×-Ñ-ˆØ#ÐØˆàˆ=œJ u¬cÔ2à)+Ø0IÐ/Jñð ô
 �eœTÔ"Ø.3¯k©k«mÑSXÓ?YÑSXÈaÀÇÁÅ	ÐSXÑ?YÑ.Y E¡7Ü”S˜Ð";Ð!<Ñ<Ó=Ó>ñ !ô ˜œtÔ$Ø—Y‘YÐ<¸bÓAˆFØ—I‘IÐ5°tÓ<ˆEä˜&¤$Ô'Ø27·+±+³-ÑW]ÓC^ÑW]ÐRSÀAÇGÁGÅIÐW]ÑC^Ñ2^¨¡wÜœ˜VÐ'@Ð&AÑAÓBÓCð %ô ˜%¤Ô&©5Ø+0¯;©;«=ÑPUÓ<VÑPUÈ1¸Q¿W¹W½YÐPUÑ<VÑ+V ¡Üœ˜U›Ó$ð ñ
 ?L¤V¨MÔ%:ÐQSá0D”Ð+Ó,ñ
ð 	
ð LeÐJeñ
ð 	
ùò% @Zùò D_ùò
 =Ws   ÁFÃFÄ7Fc                óŒ  — |j                  «       }| j                  j                  |«      €|S 	 t        j                  |d¬«      }t        j                  |«      j                  d«      }||j                  d«      k7  r|S 	 |j                  d«       |S # t
        j                  t        f$ r |cY S w xY w# t        $ r |cY S w xY w)z¤Optionally decode a base64 encoded string.

        :param raw: The raw bytes object to decode.
        :return: Bytes of the optionally decoded raw input.
        T)Úvalidateó   =zutf-8)ÚstripÚ	B64_REGEXÚ	fullmatchÚbase64Ú	b64decodeÚbinasciir  r#   Ú	b64encodeÚrstripr÷   ÚUnicodeDecodeError)r>   ÚrawÚ	candidateÚdecodedÚ	reencodeds        r%   Ú_optional_b64_decodezChannel._optional_b64_decodeê  sÁ   € ð —I‘I“Kˆ	à�>‰>×#Ñ# IÓ.Ð6ØˆJð	Ü×&Ñ& y¸4Ô@ˆGô ×$Ñ$ WÓ-×4Ñ4°TÓ:ˆ	Ø˜	×(Ñ(¨Ó.Ò.ØˆJð	Ø�N‰N˜7Ô#ð ˆøô —‘¤
Ð+ò 	ØŠJð	ûô "ò 	ØŠJð	ús#   ¯B ÂB5 ÂB2Â1B2Â5CÃCc                óh   — t        |t        «      r|j                  «       n|}| j                  |«      S )z¢Decode the message body when needed.

        raw_body: bytes or str
        returns: bytes (decoded Base64 if it looks like Base64, otherwise raw bytes)
        )r•  r¢   rÑ   r²  )r>   Úraw_bodyÚbs      r%   rØ   z#Channel._decode_python_message_body  s,   € ô ",¨H´cÔ!:ˆH�O‰OÔÀˆØ×(Ñ(¨Ó+Ð+r/   c                óp   — 	 t        |«      }t        |t        «      r|S i S # t        t        f$ r i cY S w xY w)z:Try to JSON-decode text into a dict; on failure return {}.)r   r•  r™  r   Ú	TypeError)r>   rÞ   Údatas      r%   rÙ   zChannel._prepare_json_payload  s=   € ð	Ü˜“;ˆDÜ% d¬DÔ1�4Ð9°rÐ9øÜ¤Ð+ò 	ØŠIð	ús   ‚! Ÿ! ¡5´5c                óp   — | j                  |«      }| j                  |¬«      j                  ||d   «       y)z9Move the message over to the new queue URL and delete it.rº   rP   N)rµ   r  r#  )r>   rw   rA   Únew_qs       r%   rÚ   zChannel._delete_message  s3   € à—‘ 
Ó+ˆØ�‰˜:ˆÓ&×5Ñ5Ø�7˜?Ñ+õ	
r/   c                óœ   — d|vr|di idœ}|j                  di «      }|j                  di «      }|j                  ||dœ«       |d   |d<   |S )aˆ  Prepare the payload envelope.

        Ensure we have a dict with 'body' and 'properties.delivery_info',
        then stamp on SQS-specific metadata.

        :param payload: The payload as an object
        :param raw_text: Text that will be set as the payload body.
        :param message: A kombu Message.
        :param q_url: The SQS queue URL.

        :return: Payload object.
        ra   rG   )rÔ   ra   ©r]   r  rP   r?   )Ú
setdefaultr»   )r>   rß   Úraw_textrA   rÃ   ÚpropsÚdis          r%   rÛ   zChannel._envelope_payload  ss   € ð ˜wÑ&à Ø.°Ð3ñˆGð
 ×"Ñ" <°Ó4ˆØ×Ñ˜o¨rÓ2ˆð 	�	‰	Ø"Ø ñ
ô 	ð !(¨Ñ 8ˆˆnÑàˆr/   )NN)r   N)r‰   r¢   rì   r"   rÒ   z
int | Noner„   )r¼  rc   )r   )Úreturnr"   )rÁ  zdict[str, Any])r®  ÚbytesrÁ  rÂ  )Rr*   r+   r,   r-   r�  ry  r�  Údomain_formatru  rt  rO  rK  rR   r˜  r…   r7   ÚreÚcompiler¦  rk   rl   rm   rˆ   r�   r˜   rŸ   ÚCHARS_REPLACE_TABLEr§   r©   r®   rµ   r³   rÄ   rÕ   rà   rä   rñ   ÚSQS_MAX_MESSAGESr›   rþ   r‡   r  rö   r  r  r  r  r  r$  r-  r3  r5  rG  rT   rJ  r`  rT  r[  r  ÚpropertyrL  r¼   r   r²   rJ   rn   r  rA  rƒ  r@  r‡  r<  rÒ   rÐ   r’  rê   r²  rØ   rÙ   rÚ   rÛ   rd   re   s   @r%   rg   rg     s³  ø„ Ùà €NØ!%ÐØ "ÐØ$€MØ€HØ&(Ð#Ø€DØ "ÐØ€LÙ“E€MØ
€Cà�—
‘
Ð_Ó`€Iô9òò(	0ô
ô2ó:ò
ð ':ó 8òEòò2$ò*Hò.	+ò'%òREòLð, '(Ø(,ð	0àð0ð !$ð0ð &ó	0ðB $4¸dó,ò\ó8ò#ð 6Fó 
óó	
ò-ð 59ó

ð )Eõ)õ0ò2Fòôð 9=óEó$ òD
9óòò)ó"ðH ñ&ó ð&ð ñ8ó ð8ð ñ1ó ð1ð ñCó ðCð ñCó ðCð ñó ðð ñ%ó ð%ð
 ñ8ó ð8ð ñ7ó ð7ð ñ2ó ð2ð ñó ðð òJó ðJð ñGó ðGð ñLó ðLð ò.
ó ð.
óhò6,òò
ör/   rg   c                  ó:  — e Zd ZdZeZdZdZdZej                  j                  ej                  ej                  fz   Z
ej                  j                  ej                  fz   ZdZdZej                  j$                  j'                  d edg«      ¬«      Zed	„ «       Zy)
Ú	TransportaJ
  SQS Transport.

    Additional queue attributes can be supplied to SQS during queue
    creation by passing an ``sqs-creation-attributes`` key in
    transport_options. ``sqs-creation-attributes`` must be a dict whose
    key-value pairs correspond with Attributes in the
    `CreateQueue SQS API`_.

    For example, to have SQS queues created with server-side encryption
    enabled using the default Amazon Managed Customer Master Key, you
    can set ``KmsMasterKeyId`` Attribute. When the queue is initially
    created by Kombu, encryption will be enabled.

    .. code-block:: python

        from kombu.transport.SQS import Transport

        transport = Transport(
            ...,
            transport_options={
                'sqs-creation-attributes': {
                    'KmsMasterKeyId': 'alias/aws/sqs',
                },
            }
        )

    .. _CreateQueue SQS API: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_CreateQueue.html#API_CreateQueue_RequestParameters

    .. versionadded:: 5.6
    Queue tags can be applied to SQS queues during creation by passing an
    ``queue_tags`` key in transport_options. ``queue_tags`` must be
    a dict of tag key-value pairs.

    .. code-block:: python

        from kombu.transport.SQS import Transport

        transport = Transport(
            ...,
            transport_options={
                'queue_tags': {
                    'Environment': 'production',
                    'Team': 'backend',
                },
            }
        )

    The ``ApproximateReceiveCount`` message attribute is fetched by this
    transport by default. Requested message attributes can be changed by
    setting ``fetch_message_attributes`` in the transport options.

    .. code-block:: python

        from kombu.transport.SQS import Transport

        transport = Transport(
            ...,
            transport_options={
                'fetch_message_attributes': ["All"],  # Get all of the MessageSystemAttributeNames (formerly AttributeNames)
            }
        )
        # Preferred - A dict specifying system and custom message attributes
        transport = Transport(
            ...,
            transport_options={
                'fetch_message_attributes': {
                    'MessageSystemAttributeNames': ["SenderId", "SentTimestamp"],
                    'MessageAttributeNames': ['S3MessageBodyKey']
                },
            }
        )
    .. _Message Attributes: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html#SQS-ReceiveMessage-request-AttributeNames

    r   r   NrT   TÚdirect)ÚasynchronousÚexchange_typec                ó   — d| j                   iS r†  )Údefault_portrž   s    r%   Údefault_connection_paramsz#Transport.default_connection_paramsž  s   € à˜×)Ñ)Ð*Ð*r/   )r*   r+   r,   r-   rg   Úpolling_intervalrÒ   rÏ  r   rÊ  Úconnection_errorsr   ÚBotoCoreErrorÚsocketÚerrorÚchannel_errorsÚdriver_typeÚdriver_nameÚ
implementsÚextendÚ	frozensetrÈ  rÐ  r.   r/   r%   rÊ  rÊ  >  s¾   „ ñIðV €GàÐØÐØ€Là×Ñ×+Ñ+Ø	×	!Ñ	! 6§<¡<Ð0ñ	1ð ð
 	×Ñ×(Ñ(¨J×,DÑ,DÐ+FÑFð ð €KØ€Kà×"Ñ"×-Ñ-×4Ñ4ØÙ  
Ó+ð 5ó €Jð
 ñ+ó ñ+r/   rÊ  )@r-   Ú
__future__r   r¨  rª  rÄ  rÔ  ÚstringrÎ   r   r   r   Újsonr   r‰   r   Útypingr	   Úbotocore.clientr
   Úbotocore.exceptionsr   Úviner   r   r   Úkombu.asynchronousr   Úkombu.asynchronous.aws.extr   r   Ú%kombu.asynchronous.aws.sqs.connectionr   Ú"kombu.asynchronous.aws.sqs.messager   Ú	kombu.logr   Úkombu.utilsr   Úkombu.utils.encodingr   r   Úkombu.utils.jsonr   r   Úkombu.utils.objectsr   r}  r   r*   ÚloggerÚpunctuationÚordrÆ  rÇ  r&   Ú	Exceptionr(   r1   r3   r5   r7   rg   rÊ  )rZ   s   0r%   Ú<module>rð     s#  ðñGõT #ã Û Û 	Û Û Û ß 2Ñ 2Ý  Ý Ý å "Ý +ß 3Ñ 3å -ß 8Ý DÝ ;Ý  Ý "ß 7ß )Ý /å á	�HÓ	€ð
 !×,Ò,óÙ,�Q°¸²�CˆƒFˆD�LÐ,ñÐ ð !Ð �DÑ ð Ð òôL˜iô LôK˜Iô Kô ô ô- ô -ô0,ˆ'�+‰+ô 0,ôfwˆg�o‰oô wôtb+�×!Ñ!õ b+ùòes   Â+	D9Â5D9