ó
L]c           @   sj   d  Z  d d l m Z d d l m Z d d l Z d „  Z d e e f d „  ƒ  YZ e Z d d	 g Z	 d S(
   s   0MQ Frame pure Python methods.i   (   t   AttributeSetteriÿÿÿÿ(   t   FrameNc         C   s3   t  j j |  | ƒ t  j s/ t d | ƒ ‚ n  d  S(   Ns8   libzmq and pyzmq must be built with draft support for %s(   t   zmqt   errort   _check_versiont	   DRAFT_APIt   RuntimeError(   t   vt   feature(    (    s.   lib/python2.7/site-packages/zmq/sugar/frame.pyt   _draft   s    	R   c           B   sY   e  Z d  Z d „  Z e d „  ƒ Z e j d „  ƒ Z e d „  ƒ Z e j d „  ƒ Z RS(   s¾  Frame(data=None, track=False, copy=None, copy_threshold=zmq.COPY_THRESHOLD)

    A zmq message Frame class for non-copy send/recvs.

    This class is only needed if you want to do non-copying send and recvs.
    When you pass a string to this class, like ``Frame(s)``, the 
    ref-count of `s` is increased by two: once because the Frame saves `s` as 
    an instance attribute and another because a ZMQ message is created that
    points to the buffer of `s`. This second ref-count increase makes sure
    that `s` lives until all messages that use it have been sent. Once 0MQ
    sends all the messages and it doesn't need the buffer of s, 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 [default: False]
        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: 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         C   s   |  j  | ƒ S(   N(   t   get(   t   selft   key(    (    s.   lib/python2.7/site-packages/zmq/sugar/frame.pyt   __getitem__1   s    c         C   s   t  d d ƒ |  j d ƒ S(   s”   The RADIO-DISH group of the message.

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

        .. versionadded:: 17
        i   i   s
   RADIO-DISHt   group(   i   i   (   R	   R
   (   R   (    (    s.   lib/python2.7/site-packages/zmq/sugar/frame.pyR   5   s    c         C   s!   t  d d ƒ |  j d | ƒ d  S(   Ni   i   s
   RADIO-DISHR   (   i   i   (   R	   t   set(   R   R   (    (    s.   lib/python2.7/site-packages/zmq/sugar/frame.pyR   @   s    c         C   s   t  d d ƒ |  j d ƒ S(   sœ   The CLIENT-SERVER routing id of the message.

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

        .. versionadded:: 17
        i   i   s   CLIENT-SERVERt
   routing_id(   i   i   (   R	   R
   (   R   (    (    s.   lib/python2.7/site-packages/zmq/sugar/frame.pyR   E   s    c         C   s!   t  d d ƒ |  j d | ƒ d  S(   Ni   i   s   CLIENT-SERVERR   (   i   i   (   R	   R   (   R   R   (    (    s.   lib/python2.7/site-packages/zmq/sugar/frame.pyR   P   s    (   t   __name__t
   __module__t   __doc__R   t   propertyR   t   setterR   (    (    (    s.   lib/python2.7/site-packages/zmq/sugar/frame.pyR      s   	t   Message(
   R   t	   attrsettrR    t   zmq.backendR   t	   FrameBaseR   R	   R   t   __all__(    (    (    s.   lib/python2.7/site-packages/zmq/sugar/frame.pyt   <module>   s   	G