Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/zmq/sugar/__pycache__/socket.cpython-39.pyc
Ðазад
a a�h�c � @ s d Z ddlZddlZddlZddlZddlZddlmZ ddl m Z ddlmZ ddl mZ ddlmZmZ dd lmZ dd lmZmZmZ ddlmZmZmZmZmZmZmZ zddlZeZ W n dZddl Z Y n0 z e j!Z!W n e"y� e j#Z!Y n0 G dd � d ee�Zd gZ$dS )z0MQ Socket pure Python methods.� N)�Socket� )�Poller)� constants)�AttributeSetter)�ZMQError�ZMQBindError)�jsonapi)�bytes�unicode� basestring)�SNDMORE�ENOTSUP�POLLIN�int64_sockopt_names�int_sockopt_names�bytes_sockopt_names�fd_sockopt_namesc s� e Zd ZdZdZdZ� fdd�Zdd� Zdd � Zd d� Z dMdd �Z e Zedd� �Z dN� fdd� Zedd� �Zdd� ZejZejZ� fdd�Zdd� Zdd� Zdd� ZdOdd �Ze ZZdPd!d"�Ze ZZ dQd&d'�Z!d(d)� Z"d*d+� Z#ee"e#d,�Z$dR� fd/d0� Z%dSd1d2�Z&dTd3d4�Z'd5d6� Z(dUd7d8�Z)dVd9d:�Z*dWd;d<�Z+e+Z,dXd=d>�Z-e-Z.d-e/fd?d@�Z0dYdAdB�Z1dZdCdD�Z2d[dEdF�Z3e4Z5de6fdGdH�Z7d\dIdJ�Z8dKdL� Z9� Z:S )]r z�The ZMQ socket object To create a Socket, first create a Context:: ctx = zmq.Context.instance() then call ``ctx.socket(socket_type)``:: s = ctx.socket(zmq.ROUTER) FNc s0 t t| �j|i |�� d|v r&d| _nd| _d S )N�shadowTF)�superr �__init__�_shadow)�self�a�kw�� __class__� ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/zmq/sugar/socket.pyr : s zSocket.__init__c C s | j s| �� d S �N)r �close�r r r r �__del__A s zSocket.__del__c C s | S )zMSockets are context managers .. versionadded:: 14.4 r r! r r r � __enter__F s zSocket.__enter__c O s | � � d S r )r )r �args�kwargsr r r �__exit__M s zSocket.__exit__c C s | j �| j�S )z&Copying a Socket creates a shadow copy)r r Z underlying)r �memor r r �__copy__T s zSocket.__copy__c C s ddl m} ||�}| |d�S )z�Shadow an existing libzmq socket address is the integer address of the libzmq socket or an FFI pointer to it. .. versionadded:: 14.1 r )� cast_int_addr)r )Zzmq.utils.interopr) )�cls�addressr) r r r r Z s z Socket.shadowc s( | j r| j �| � tt| �j|d� dS )a8 Close the socket. If linger is specified, LINGER sockopt will be set prior to closing. Note: closing a zmq Socket may not close the underlying sockets if there are undelivered messages. Only after all messages are delivered or discarded by reaching the socket's LINGER timeout (default: forever) will the underlying sockets be closed. This can be called to close the socket by hand. If this is not called, the socket will automatically be closed when it is garbage collected. )�lingerN)�contextZ _rm_socketr r r )r r, r r r r g s zSocket.closec C s t �dt� | jS )Nz1Socket.socket_type is deprecated, use Socket.type)�warnings�warn�DeprecationWarning�typer! r r r �socket_type s �zSocket.socket_typec C s* t | j�}ttttfD ]}|�|� q|S r )�dirr r r r r �extend)r �keysZ collectionr r r �__dir__� s �zSocket.__dir__c s� || j v rt�| ||� dS |�� }|dv rjt|t�r@|�d�}|dkrX| �tj |� n| �tj |� dS tt| ��||� dS )zROverride to allow setting zmq.[UN]SUBSCRIBE even though we have a subscribe methodN)� subscribe�unsubscribe�utf8r7 ) �__dict__�object�__setattr__�lower� isinstancer �encode�set�zmq� SUBSCRIBE�UNSUBSCRIBEr r )r �key�value�_keyr r r r<