Ë
    >Øïi@  ã                   ó  — d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlmZ  ej                  e
«      Z G d„ dej                  «      Z G d	„ d
e«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ dej                  «      Zd„ Zy)z<Frame objects that do the frame demarshaling and marshaling.é    N)Úamqp_object)Ú
exceptions)Úspec)Úbytec                   ó&   — e Zd ZdZd Zd„ Zd„ Zd„ Zy)ÚFramezÝBase Frame object mapping. Defines a behavior for all child classes for
    assignment of core attributes and implementation of the a core _marshal
    method which child classes use to create the binary AMQP frame.

    c                 ó    — || _         || _        y)z�Create a new instance of a frame

        :param int frame_type: The frame type
        :param int channel_number: The channel number for the frame

        N)Ú
frame_typeÚchannel_number)Úselfr
   r   s      úD/var/www/html/aiagents/fe/lib/python3.12/site-packages/pika/frame.pyÚ__init__zFrame.__init__   s   € ð %ˆŒØ,ˆÕó    c                 óÈ   — dj                  |«      }t        j                  d| j                  | j                  t        |«      «      |z   t        t        j                  «      z   S )z]Create the full AMQP wire protocol frame data representation

        :rtype: bytes

        r   z>BHI)	ÚjoinÚstructÚpackr
   r   Úlenr   r   Ú	FRAME_END)r   ÚpiecesÚpayloads      r   Ú_marshalzFrame._marshal   sU   € ð —(‘(˜6Ó"ˆÜ�{‰{˜6 4§?¡?°D×4GÑ4GÜ˜w›<ó)Ø+2ñ3Ü59¼$¿.¹.Ó5IñJð 	Jr   c                 ó   — t         ‚)zKTo be ended by child classes

        :raises NotImplementedError

        )ÚNotImplementedError©r   s    r   ÚmarshalzFrame.marshal)   s
   € ô "Ð!r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚNAMEr   r   r   © r   r   r   r      s   „ ñð
 €Dò-òJó"r   r   c                   ó    — e Zd ZdZdZd„ Zd„ Zy)ÚMethodz“Base Method frame object mapping. AMQP method frames are mapped on top
    of this class for creating or accessing their data and attributes.

    ÚMETHODc                 ó\   — t         j                  | t        j                  |«       || _        y)z¡Create a new instance of a frame

        :param int channel_number: The frame type
        :param pika.Spec.Class.Method method: The AMQP Class.Method

        N)r   r   r   ÚFRAME_METHODÚmethod)r   r   r(   s      r   r   zMethod.__init__9   s!   € ô 	�‰�tœT×.Ñ.°Ô?Øˆ�r   c                 óÌ   — | j                   j                  «       }|j                  dt        j                  d| j                   j
                  «      «       | j                  |«      S )úPReturn the AMQP binary encoded value of the frame

        :rtype: str

        r   ú>I)r(   ÚencodeÚinsertr   r   ÚINDEXr   ©r   r   s     r   r   zMethod.marshalC   sH   € ð —‘×#Ñ#Ó%ˆØ�‰�aœŸ™ T¨4¯;©;×+<Ñ+<Ó=Ô>Ø�}‰}˜VÓ$Ð$r   N©r   r   r   r    r!   r   r   r"   r   r   r$   r$   2   s   „ ñð €Dòó%r   r$   c                   ó    — e Zd ZdZd Zd„ Zd„ Zy)ÚHeaderz–Header frame object mapping. AMQP content header frames are mapped
    on top of this class for creating or accessing their data and attributes.

    c                 ój   — t         j                  | t        j                  |«       || _        || _        y)a
  Create a new instance of a AMQP ContentHeader object

        :param int channel_number: The channel number for the frame
        :param int body_size: The number of bytes for the body
        :param pika.spec.BasicProperties props: Basic.Properties object

        N)r   r   r   ÚFRAME_HEADERÚ	body_sizeÚ
properties)r   r   r5   Úpropss       r   r   zHeader.__init__U   s(   € ô 	�‰�tœT×.Ñ.°Ô?Ø"ˆŒØˆ�r   c                 óâ   — | j                   j                  «       }|j                  dt        j                  d| j                   j
                  | j                  «      «       | j                  |«      S )r*   r   z>HxxQ)r6   r,   r-   r   r   r.   r5   r   r/   s     r   r   zHeader.marshala   sR   € ð —‘×'Ñ'Ó)ˆØ�‰ØŒv�{‰{˜7 D§O¡O×$9Ñ$9¸4¿>¹>ÓJô	Là�}‰}˜VÓ$Ð$r   Nr0   r"   r   r   r2   r2   N   s   „ ñð €Dò
 ó	%r   r2   c                   ó    — e Zd ZdZd Zd„ Zd„ Zy)ÚBodyzŒBody frame object mapping class. AMQP content body frames are mapped on
    to this base class for getting/setting of attributes/data.

    c                 ó\   — t         j                  | t        j                  |«       || _        y)z_
        Parameters:

        - channel_number: int
        - fragment: unicode or str
        N)r   r   r   Ú
FRAME_BODYÚfragment)r   r   r=   s      r   r   zBody.__init__t   s   € ô 	�‰�tœTŸ_™_¨nÔ=Ø ˆ�r   c                 ó:   — | j                  | j                  g«      S ©r*   )r   r=   r   s    r   r   zBody.marshal~   s   € ð �}‰}˜dŸm™m˜_Ó-Ð-r   Nr0   r"   r   r   r:   r:   m   s   „ ñð €Dò!ó.r   r:   c                   ó    — e Zd ZdZd Zd„ Zd„ Zy)Ú	Heartbeatz¢Heartbeat frame object mapping class. AMQP Heartbeat frames are mapped
    on to this class for a common access structure to the attributes/data
    values.

    c                 óN   — t         j                  | t        j                  d«       y)z,Create a new instance of the Heartbeat framer   N)r   r   r   ÚFRAME_HEARTBEATr   s    r   r   zHeartbeat.__init__�   s   € ä�‰�tœT×1Ñ1°1Õ5r   c                 ó4   — | j                  t        «       «      S r?   )r   Úlistr   s    r   r   zHeartbeat.marshal“   s   € ð �}‰}œT›VÓ$Ð$r   Nr0   r"   r   r   rA   rA   ‡   s   „ ñð
 €Dò6ó%r   rA   c                   ó"   — e Zd ZdZd Zdd„Zd„ Zy)ÚProtocolHeaderzqAMQP Protocol header frame class which provides a pythonic interface
    for creating AMQP Protocol headers

    Nc                 óº   — d| _         |xs t        j                  d   | _        |xs t        j                  d   | _        |xs t        j                  d   | _        y)zÞConstruct a Protocol Header frame object for the specified AMQP
        version

        :param int major: Major version number
        :param int minor: Minor version number
        :param int revision: Revision

        éÿÿÿÿr   é   é   N)r
   r   ÚPROTOCOL_VERSIONÚmajorÚminorÚrevision)r   rM   rN   rO   s       r   r   zProtocolHeader.__init__£   sP   € ð ˆŒØÒ6œd×3Ñ3°AÑ6ˆŒ
ØÒ6œd×3Ñ3°AÑ6ˆŒ
Ø Ò<¤D×$9Ñ$9¸!Ñ$<ˆ�r   c                 óv   — dt        j                  dd| j                  | j                  | j                  «      z   S )zReturn the full AMQP wire protocol frame data representation of the
        ProtocolHeader frame

        :rtype: str

        ó   AMQPÚBBBBr   )r   r   rM   rN   rO   r   s    r   r   zProtocolHeader.marshal±   s3   € ð œŸ™ V¨Q°·
±
¸D¿J¹JØ%)§]¡]ó4ñ 4ð 	4r   )NNNr0   r"   r   r   rG   rG   œ   s   „ ñð €Dó=ó4r   rG   c                 óZ  — 	 | dd dk(  r*t        j                  d| d«      \  }}}dt        |||«      fS 	 	 t        j
                  d| dd	 «      \  }}}t        j                  |z   t        j                  z   }|t        | «      kD  ry| |d
z
  | t        t        j                  «      k7  rt        j                  d«      ‚| t        j                  |d
z
   }|t        j                  k(  rPt        j                  d|«      d   }	t        j                  |	   «       }
|
j!                  |d«       |t#        ||
«      fS |t        j$                  k(  rTt        j                  d|«      \  }}}t        j&                  |   «       }|j!                  |dd «      }|t)        |||«      fS |t        j*                  k(  r|t-        ||«      fS |t        j.                  k(  r|t1        «       fS t        j                  d|z  «      ‚# t        t         j                  f$ r Y yw xY w# t         j                  $ r Y yw xY w)a   Receives raw socket data and attempts to turn it into a frame.
    Returns bytes used to make the frame and the frame

    :param str data_in: The raw data stream
    :rtype: tuple(bytes consumed, frame)
    :raises: pika.exceptions.InvalidFrameError

    r   é   rQ   ÚBBBé   é   )r   Nz>BHLé   rJ   zInvalid FRAME_END markerr+   z>HHQé   NzUnknown frame type: %i)r   Úunpack_fromrG   Ú
IndexErrorÚerrorÚunpackr   ÚFRAME_HEADER_SIZEÚFRAME_END_SIZEr   r   r   r   ÚInvalidFrameErrorr'   ÚmethodsÚdecoder$   r4   r7   r2   r<   r:   rC   rA   )Údata_inrM   rN   rO   r
   r   Ú
frame_sizeÚ	frame_endÚ
frame_dataÚ	method_idr(   Úclass_idÚweightr5   r6   Úouts                   r   Údecode_framerk   ¼   s5  € ðØ�1�Qˆ<˜7Ò"Ü%+×%7Ñ%7¸¸wÈÓ%JÑ"ˆE�5˜(Ø”n U¨E°8Ó<Ð<Ð<ð #ðÜ39·=±=Ø�G˜A˜a�Ló4"Ñ0ˆ�^ Zô ×&Ñ&¨Ñ3´d×6IÑ6IÑI€Ið ”3�w“<ÒØð ˆy˜1‰}˜YÐ'¬4´·±Ó+?Ò?Ü×*Ñ*Ð+EÓFÐFð œ×/Ñ/°	¸A±Ð>€Jà”T×&Ñ&Ò&ô ×&Ñ& t¨ZÓ8¸Ñ;ˆ	ô —‘˜iÑ(Ó*ˆð 	�‰�j !Ô$ð œ& °Ó8Ð8Ð8à	”t×(Ñ(Ò	(ô '-×&8Ñ&8¸ÀÓ&LÑ#ˆ�&˜)ô —Z‘Z Ñ)Ó+ˆ
ð ×Ñ 
¨2¨3 Ó0ˆð œ& °¸JÓGÐGÐGà	”t—‘Ò	&ð œ$˜~¨zÓ:Ð:Ð:à	”t×+Ñ+Ò	+ð œ)›+Ð%Ð%ä
×
&Ñ
&Ð'?À*Ñ'LÓ
MÐMøô} œŸ™Ð%ò Ùðûô �<‰<ò Ùðús"   ‚1G5 ¶H Ç5HÈHÈH*È)H*)r    Úloggingr   Úpikar   r   r   Úpika.compatr   Ú	getLoggerr   ÚLOGGERÚ
AMQPObjectr   r$   r2   r:   rA   rG   rk   r"   r   r   ú<module>rr      s‰   ðÙ BÛ Û å Ý Ý Ý à	ˆ×	Ñ	˜8Ó	$€ô""ˆK×"Ñ"ô ""ôJ%ˆUô %ô8%ˆUô %ô>.ˆ5ô .ô4%�ô %ô*4�[×+Ñ+ô 4ó@LNr   