File: //lib64/python3.6/site-packages/zmq/backend/cffi/__pycache__/utils.cpython-36.pyc
3
VS�_w � @ sr d Z ddlmZ ddlmZmZ ddlmZmZm Z m
Z
ddlmZ dd� Z
d d
� Zdd� Zd
d� Zdd
dgZdS )z miscellaneous zmq_utils wrapping� )�EINTR� )�ffi�C)�ZMQError�InterruptedSystemCall� _check_rc�_check_version)�unicodec C s, t dd� t| t�r| jd�} ttj| ��S )z|Check for zmq capability by name (e.g. 'ipc', 'curve')
.. versionadded:: libzmq-4.1
.. versionadded:: 14.1
� r zzmq.has�utf8)r r )r �
isinstancer
�encode�boolr Zzmq_has)Z
capability� r �/usr/lib64/python3.6/utils.py�has s
r c C sV t dd� tjd�} tjd�}tj| |�}t|� tj| �dd� tj|�dd� fS )u generate a Z85 keypair for use with zmq.CURVE security
Requires libzmq (≥ 4.0) to have been built with CURVE support.
Returns
-------
(public, secret) : two bytestrings
The public and private keypair as 40 byte z85-encoded bytestrings.
� � �
curve_keypairzchar[64]N�( )r r )r r �newr Zzmq_curve_keypairr �buffer)�public�private�rcr r r r s
r c C sN t | t�r| jd�} tdd� tjd�}tj|| �}t|� tj |�dd� S ) uo Compute the public key corresponding to a private key for use
with zmq.CURVE security
Requires libzmq (≥ 4.2) to have been built with CURVE support.
Parameters
----------
private
The private key as a 40 byte z85-encoded bytestring
Returns
-------
bytestring
The public key as a 40 byte z85-encoded bytestring.
r r r �curve_publiczchar[64]Nr )r r )
r
r
r r r r r Zzmq_curve_publicr r )r r r r r r r - s
r c O s8 x2| |� }yt |� W n tk
r, wY qX P qW dS )z/make a call, retrying if interrupted with EINTRN)r r )�f�args�kwargsr r r r �_retry_sys_callE s r N)�__doc__�errnor Z_cffir r Z zmq.errorr r r r Zzmq.utils.strtypesr
r r r r �__all__r r r r �<module> s