o
    ik                     @   sX   d Z ddlmZmZ ddlmZmZmZ ddlm	Z	 ddlm
Z G dd dZdgZd	S )
zzmq Context class    )EINVAL
IO_THREADS)InterruptedSystemCallZMQError	_check_rc   )ffi)libc                   @   sV   e Zd ZdZdZdZdZdddZedd Z	ed	d
 Z
dd Zdd Zdd ZdS )ContextNTFr   c                 C   sp   |rt d|| _d| _nd| _|dksttt | _| jt jkr)tt	 |s3t
| jt| d| _d S )Nzvoid *TFr   )r   cast_zmq_ctx_shadowr   r   Czmq_ctx_newNULL	zmq_errnozmq_ctx_setr   _closed)self
io_threadsshadow r   S/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/zmq/backend/cffi/context.py__init__   s   

zContext.__init__c                 C   s   t td| jS )z,The address of the underlying libzmq contextsize_t)intr   r   r   r   r   r   r   
underlying#   s   zContext.underlyingc                 C   s   | j S )N)r   r   r   r   r   closed(   s   zContext.closedc                 C   s   t | j||}t| dS )z6set a context option

        see zmq_ctx_set
        N)r   r   r   r   )r   optionvaluercr   r   r   set,   s   zContext.setc                 C   s   t | j|}t|dd |S )z4get context option

        see zmq_ctx_get
        F)error_without_errno)r   zmq_ctx_getr   r   )r   r   r!   r   r   r   get4   s   zContext.getc                 C   sF   | j rd S t| j}zt| W n	 ty   Y nw d | _d| _d S )NT)r   r   zmq_ctx_destroyr   r   r   r   )r   r!   r   r   r   term=   s   
zContext.term)r   N)__name__
__module____qualname__r   
_iothreadsr   r   r   propertyr   r   r"   r%   r'   r   r   r   r   r
      s    


	r
   N)__doc__zmq.constantsr   r   	zmq.errorr   r   r   _cffir   r	   r   r
   __all__r   r   r   r   <module>   s    
@