Ë
    :vžj„  ã                  ó|   — d Z ddlmZ ddlmZmZ ddlZddlmZ	 ddl
mZ 	 	 	 	 	 	 dd„Z G d	„ d
e	e«      ZeZd
dgZy)z0MQ Frame pure Python methods.é    )Úannotations)ÚLiteralÚoverloadN)ÚFrameé   )ÚAttributeSetterc                ó€   — t         j                  j                  | |«       t         j                  st	        d|› �«      ‚y )Nz6libzmq and pyzmq must be built with draft support for )ÚzmqÚerrorÚ_check_versionÚ	DRAFT_APIÚRuntimeError)ÚvÚfeatures     ú`/workspace/moltex-experiments/.pixi/envs/default/lib/python3.12/site-packages/zmq/sugar/frame.pyÚ_draftr      s;   € ô ‡I�I×Ñ˜Q Ô(Ü�=Š=ÜØDÀWÀIÐNó
ð 	
ð ó    c                  óÆ   — e Zd ZdZedd„«       Zedd„«       Zedd„«       Zdd„Zdd„Zedd„«       Zej                  dd„«       Zedd	„«       Z
e
j                  dd
„«       Z
y)r   au  
    A zmq message Frame class for non-copying send/recvs and access to message properties.

    A ``zmq.Frame`` wraps an underlying ``zmq_msg_t``.

    Message *properties* can be accessed by treating a Frame like a dictionary (``frame["User-Id"]``).

    .. versionadded:: 14.4, libzmq 4

        Frames created by ``recv(copy=False)`` can be used to access message properties and attributes,
        such as the CURVE User-Id.

        For example::

            frames = socket.recv_multipart(copy=False)
            user_id = frames[0]["User-Id"]

    This class is used if you want to do non-copying send and recvs.
    When you pass a chunk of bytes to this class, e.g. ``Frame(buf)``, the
    ref-count of `buf` is increased by two: once because the Frame saves `buf` as
    an instance attribute and another because a ZMQ message is created that
    points to the buffer of `buf`. This second ref-count increase makes sure
    that `buf` lives until all messages that use it have been sent.
    Once 0MQ sends all the messages and it doesn't need the buffer of ``buf``,
    0MQ will call ``Py_DECREF(s)``.

    Parameters
    ----------

    data : object, optional
        any object that provides the buffer interface will be used to
        construct the 0MQ message data.
    track : bool
        whether a MessageTracker_ should be created to track this object.
        Tracking a message has a cost at creation, because it creates a threadsafe
        Event object.
    copy : bool
        default: use copy_threshold
        Whether to create a copy of the data to pass to libzmq
        or share the memory with libzmq.
        If unspecified, copy_threshold is used.
    copy_threshold: int
        default: :const:`zmq.COPY_THRESHOLD`
        If copy is unspecified, messages smaller than this many bytes
        will be copied and messages larger than this will be shared with libzmq.
    c                 ó   — y ©N© ©ÚselfÚkeys     r   Ú__getitem__zFrame.__getitem__K   s   € ØDGr   c                 ó   — y r   r   r   s     r   r   zFrame.__getitem__M   s   € ØADr   c                 ó   — y r   r   r   s     r   r   zFrame.__getitem__O   s   € Ø25r   c                ó$   — | j                  |«      S r   )Úgetr   s     r   r   zFrame.__getitem__Q   s   € à�x‰x˜‹}Ðr   c                óf  — t        | «      }d}|dkD  rUt        t        | j                  «      dd «      }|dk\  rd}|dz  }n|dk\  rd}|d	z  }n|d
k\  rd}|d
z  }nd}|}d|d›|› �}n| j                  }| j                  j
                  }|dk(  rd}d|› d| j                  j                  › d|›|› d�S )z#Return the str form of the message.Ú é   Né   g    eÍÍAÚGBi   ÚMBg    €„.Ag     @�@ÚkBÚBz...z.0fzzmq.sugar.framer
   Ú<Ú.Ú(z)>)ÚlenÚbytesÚ
memoryviewÚbufferÚ	__class__Ú
__module__Ú__name__)r   ÚnbytesÚ
msg_suffixÚ	msg_bytesÚunitÚnÚ_modules          r   Ú__repr__zFrame.__repr__U   sÜ   € ä�T“ˆØˆ
Ø�BŠ;Üœj¨¯©Ó5°c°rÐ:Ó;ˆIØ˜Š}Ø�Ø˜c‘M‘Ø˜5’Ø�Ø˜c‘M‘Ø˜3’Ø�Ø˜c‘M‘à�Ø�Ø˜q ˜g d VÐ,‰JàŸ
™
ˆIà—.‘.×+Ñ+ˆØÐ'Ò'ØˆGØ�7�)˜1˜TŸ^™^×4Ñ4Ð5°Q°y°mÀJÀ<ÈrÐRÐRr   c                ó<   — t        dd«       | j                  d«      S )z”The RADIO-DISH group of the message.

        Requires libzmq >= 4.2 and pyzmq built with draft APIs enabled.

        .. versionadded:: 17
        ©é   é   ú
RADIO-DISHÚgroup©r   r   ©r   s    r   r>   zFrame.groupp   s   € ô 	ˆv�|Ô$Ø�x‰x˜Ó Ð r   c                ó@   — t        dd«       | j                  d|«       y )Nr:   r=   r>   ©r   Úset)r   r>   s     r   r>   zFrame.group{   s   € äˆv�|Ô$Ø�‰�˜%Õ r   c                ó<   — t        dd«       | j                  d«      S )zœThe CLIENT-SERVER routing id of the message.

        Requires libzmq >= 4.2 and pyzmq built with draft APIs enabled.

        .. versionadded:: 17
        r:   úCLIENT-SERVERÚ
routing_idr?   r@   s    r   rF   zFrame.routing_id€   s   € ô 	ˆv�Ô'Ø�x‰x˜Ó%Ð%r   c                ó@   — t        dd«       | j                  d|«       y )Nr:   rE   rF   rB   )r   rF   s     r   rF   zFrame.routing_id‹   s   € äˆv�Ô'Ø�‰�˜zÕ*r   N)r   zint | Literal['routing_id']ÚreturnÚint)r   zbytes | Literal['group']rH   Ústr)r   rJ   rH   ú	int | str)r   zint | str | bytesrH   rK   )rH   rJ   )r>   zstr | bytesrH   ÚNone)rH   rI   )rF   rI   rH   rL   )r1   r0   Ú__qualname__Ú__doc__r   r   r8   Úpropertyr>   ÚsetterrF   r   r   r   r   r      s™   „ ñ-ð^ ÚGó ØGØÚDó ØDØÚ5ó Ø5óóSð6 ò!ó ð!ð ‡\�\ò!ó ð!ð ò&ó ð&ð ×Ñò+ó ñ+r   r   ÚMessage)r   z3tuple[int] | tuple[int, int] | tuple[int, int, int]r   rJ   rH   rL   )rN   Ú
__future__r   Útypingr   r   r
   Úzmq.backendr   Ú	FrameBaseÚ	attrsettrr   r   rQ   Ú__all__r   r   r   Ú<module>rX      sZ   ðÙ $õ
 #ç $ã 
Ý *å &ð
Ø:ð
àð
ð 
ó
ôs+ˆI�ô s+ðn €à�IÐ
�r   