# Path: pyczmq/zctx.py
# def shadow(ctx):
# def shadow_zmq_ctx(zmqctx):
# def shadow_pyzmq_ctx(pyzmqctx):
# def destroy(ctx):
# def new():
# def set_iothreads(ctx, iothreads):
# def set_linger(ctx, linger):
# def set_pipehwm(ctx, pipehwm):
# def set_sndhwm(ctx, sndhwm):
# def set_rcvhwm(ctx, rcvhwm):
# def underlying(ctx):
# 
# Path: pyczmq/zmq.py
# IO_THREADS = 1
# MAX_SOCKETS = 2
# IO_THREADS_DFLT = 1
# MAX_SOCKETS_DFLT = 1024
# POLLIN = 1
# POLLOUT = 2
# POLLERR = 4
# EVENT_CONNECTED = 1
# EVENT_CONNECT_DELAYED = 2
# EVENT_CONNECT_RETRIED = 4
# EVENT_LISTENING = 8
# EVENT_BIND_FAILED = 16
# EVENT_ACCEPTED = 32
# EVENT_ACCEPT_FAILED = 64
# EVENT_CLOSED = 128
# EVENT_CLOSE_FAILED = 256
# EVENT_DISCONNECTED = 512
# EVENT_MONITOR_STOPPED = 1024
# EVENT_ALL = (EVENT_CONNECTED | EVENT_CONNECT_DELAYED |
#              EVENT_CONNECT_RETRIED | EVENT_LISTENING |
#              EVENT_BIND_FAILED | EVENT_ACCEPTED |
#              EVENT_ACCEPT_FAILED | EVENT_CLOSED |
#              EVENT_CLOSE_FAILED | EVENT_DISCONNECTED |
#              EVENT_MONITOR_STOPPED)
# PAIR = 0
# PUB = 1
# SUB = 2
# REQ = 3
# REP = 4
# DEALER = 5
# ROUTER = 6
# PULL = 7
# PUSH = 8
# XPUB = 9
# XSUB = 10
# STREAM = 11
# AFFINITY = 4
# IDENTITY = 5
# SUBSCRIBE = 6
# UNSUBSCRIBE = 7
# RATE = 8
# RECOVERY_IVL = 9
# SNDBUF = 11
# RCVBUF = 12
# RCVMORE = 13
# FD = 14
# EVENTS = 15
# TYPE = 16
# LINGER = 17
# RECONNECT_IVL = 18
# BACKLOG = 19
# RECONNECT_IVL_MAX = 21
# MAXMSGSIZE = 22
# SNDHWM = 23
# RCVHWM = 24
# MULTICAST_HOPS = 25
# RCVTIMEO = 27
# SNDTIMEO = 28
# LAST_ENDPOINT = 32
# ROUTER_MANDATORY = 33
# TCP_KEEPALIVE = 34
# TCP_KEEPALIVE_CNT = 35
# TCP_KEEPALIVE_IDLE = 36
# TCP_KEEPALIVE_INTVL = 37
# TCP_ACCEPT_FILTER = 38
# IMMEDIATE = 39
# XPUB_VERBOSE = 40
# ROUTER_RAW = 41
# IPV6 = 42
# MECHANISM = 43
# PLAIN_SERVER = 44
# PLAIN_USERNAME = 45
# PLAIN_PASSWORD = 46
# CURVE_SERVER = 47
# CURVE_PUBLICKEY = 48
# CURVE_SECRETKEY = 49
# CURVE_SERVERKEY = 50
# PROBE_ROUTER = 51
# REQ_CORRELATE = 52
# REQ_RELAXED = 53
# CONFLATE = 54
# ZAP_DOMAIN = 55
# MORE = 1
# DONTWAIT = 1
# SNDMORE = 2
# NULL = 0
# PLAIN = 1
# CURVE = 2
# def errno():
# def version():
# def strerror(num):
# def ctx_new():
# def ctx_term(ctx):
# def ctx_shutdown(ctx):
# def ctx_set(ctx, opt, val):
# def ctx_get(ctx, opt):
# def msg_init(msg):
# def msg_init_size(msg, size):
# def msg_init_data(msg, data, size, ffn, hint):
# def msg_send(msg, s, flags):
# def msg_recv(msg, s, flags):
# def msg_close(msg):
# def msg_move(dest, src):
# def msg_copy(dest, src):
# def msg_data(msg):
# def msg_size(msg):
# def msg_more(msg):
# def msg_get(msg, opt):
# def msg_set(msg, opt, val):
# def socket(ctx, typ):
# def close(sock):
# def setsockopt(sock, opt, val, len):
# def getsockopt(sock, opt, val, len):
# def bind(sock, addr):
# def connect(sock, addr):
# def unbind(sock, addr):
# def disconnect(sock, addr):
# def send(sock, buf, len, flags):
# def recv(sock, buf, len, flags):
# def socket_monitor(sock, addr, events):
# def sendmsg(sock, msg, flags):
# def recvmsg(sock, msg, flags):
# def pollitem(socket=None, fd=0, events=0, revents=0):
# def poll(items, nitem, timeout):
# def proxy(frontend, backend, capture):
# def z85_encode(dest, data, size):
# def z85_decode(dest, string):
# 
# Path: pyczmq/zsocket.py
# DYNFROM = 49152
# DYNTO = 65535
# def destroy(ctx, socket):
# def new(ctx, typ):
# def bind(sock, fmt):
# def unbind(sock, fmt):
# def connect(sock, fmt):
# def disconnect(sock, fmt):
# def poll(sock, msecs):
# def type_str(sock):
# def shadow_pyzmq_socket(pyzmq_socket):


from pyczmq import zctx, zmq, zsocket
"""
Replicates czmq test_zctx
"""


def test_zctx():

    # Create and destroy a context without using it
    ctx = zctx.new()
    assert ctx
    del ctx

    # Create a context with many busy sockets, destroy it
    ctx = zctx.new()
    assert ctx

    # call API functions
    zctx.set_iothreads(ctx, 1)
    zctx.set_linger(ctx, 5) # 5 msecs
    zctx.set_pipehwm(ctx, 500)
    zctx.set_sndhwm(ctx, 500)
    zctx.set_rcvhwm(ctx, 500)


# Path: pyczmq/zctx.py
# def shadow(ctx):
# def shadow_zmq_ctx(zmqctx):
# def shadow_pyzmq_ctx(pyzmqctx):
# def destroy(ctx):
# def new():
# def set_iothreads(ctx, iothreads):
# def set_linger(ctx, linger):
# def set_pipehwm(ctx, pipehwm):
# def set_sndhwm(ctx, sndhwm):
# def set_rcvhwm(ctx, rcvhwm):
# def underlying(ctx):
# 
# Path: pyczmq/zmq.py
# IO_THREADS = 1
# MAX_SOCKETS = 2
# IO_THREADS_DFLT = 1
# MAX_SOCKETS_DFLT = 1024
# POLLIN = 1
# POLLOUT = 2
# POLLERR = 4
# EVENT_CONNECTED = 1
# EVENT_CONNECT_DELAYED = 2
# EVENT_CONNECT_RETRIED = 4
# EVENT_LISTENING = 8
# EVENT_BIND_FAILED = 16
# EVENT_ACCEPTED = 32
# EVENT_ACCEPT_FAILED = 64
# EVENT_CLOSED = 128
# EVENT_CLOSE_FAILED = 256
# EVENT_DISCONNECTED = 512
# EVENT_MONITOR_STOPPED = 1024
# EVENT_ALL = (EVENT_CONNECTED | EVENT_CONNECT_DELAYED |
#              EVENT_CONNECT_RETRIED | EVENT_LISTENING |
#              EVENT_BIND_FAILED | EVENT_ACCEPTED |
#              EVENT_ACCEPT_FAILED | EVENT_CLOSED |
#              EVENT_CLOSE_FAILED | EVENT_DISCONNECTED |
#              EVENT_MONITOR_STOPPED)
# PAIR = 0
# PUB = 1
# SUB = 2
# REQ = 3
# REP = 4
# DEALER = 5
# ROUTER = 6
# PULL = 7
# PUSH = 8
# XPUB = 9
# XSUB = 10
# STREAM = 11
# AFFINITY = 4
# IDENTITY = 5
# SUBSCRIBE = 6
# UNSUBSCRIBE = 7
# RATE = 8
# RECOVERY_IVL = 9
# SNDBUF = 11
# RCVBUF = 12
# RCVMORE = 13
# FD = 14
# EVENTS = 15
# TYPE = 16
# LINGER = 17
# RECONNECT_IVL = 18
# BACKLOG = 19
# RECONNECT_IVL_MAX = 21
# MAXMSGSIZE = 22
# SNDHWM = 23
# RCVHWM = 24
# MULTICAST_HOPS = 25
# RCVTIMEO = 27
# SNDTIMEO = 28
# LAST_ENDPOINT = 32
# ROUTER_MANDATORY = 33
# TCP_KEEPALIVE = 34
# TCP_KEEPALIVE_CNT = 35
# TCP_KEEPALIVE_IDLE = 36
# TCP_KEEPALIVE_INTVL = 37
# TCP_ACCEPT_FILTER = 38
# IMMEDIATE = 39
# XPUB_VERBOSE = 40
# ROUTER_RAW = 41
# IPV6 = 42
# MECHANISM = 43
# PLAIN_SERVER = 44
# PLAIN_USERNAME = 45
# PLAIN_PASSWORD = 46
# CURVE_SERVER = 47
# CURVE_PUBLICKEY = 48
# CURVE_SECRETKEY = 49
# CURVE_SERVERKEY = 50
# PROBE_ROUTER = 51
# REQ_CORRELATE = 52
# REQ_RELAXED = 53
# CONFLATE = 54
# ZAP_DOMAIN = 55
# MORE = 1
# DONTWAIT = 1
# SNDMORE = 2
# NULL = 0
# PLAIN = 1
# CURVE = 2
# def errno():
# def version():
# def strerror(num):
# def ctx_new():
# def ctx_term(ctx):
# def ctx_shutdown(ctx):
# def ctx_set(ctx, opt, val):
# def ctx_get(ctx, opt):
# def msg_init(msg):
# def msg_init_size(msg, size):
# def msg_init_data(msg, data, size, ffn, hint):
# def msg_send(msg, s, flags):
# def msg_recv(msg, s, flags):
# def msg_close(msg):
# def msg_move(dest, src):
# def msg_copy(dest, src):
# def msg_data(msg):
# def msg_size(msg):
# def msg_more(msg):
# def msg_get(msg, opt):
# def msg_set(msg, opt, val):
# def socket(ctx, typ):
# def close(sock):
# def setsockopt(sock, opt, val, len):
# def getsockopt(sock, opt, val, len):
# def bind(sock, addr):
# def connect(sock, addr):
# def unbind(sock, addr):
# def disconnect(sock, addr):
# def send(sock, buf, len, flags):
# def recv(sock, buf, len, flags):
# def socket_monitor(sock, addr, events):
# def sendmsg(sock, msg, flags):
# def recvmsg(sock, msg, flags):
# def pollitem(socket=None, fd=0, events=0, revents=0):
# def poll(items, nitem, timeout):
# def proxy(frontend, backend, capture):
# def z85_encode(dest, data, size):
# def z85_decode(dest, string):
# 
# Path: pyczmq/zsocket.py
# DYNFROM = 49152
# DYNTO = 65535
# def destroy(ctx, socket):
# def new(ctx, typ):
# def bind(sock, fmt):
# def unbind(sock, fmt):
# def connect(sock, fmt):
# def disconnect(sock, fmt):
# def poll(sock, msecs):
# def type_str(sock):
# def shadow_pyzmq_socket(pyzmq_socket):


# Path: tests/test_zctx.py
from pyczmq import zctx, zmq, zsocket

"""
Replicates czmq test_zctx
"""


def test_zctx():

    # Create and destroy a context without using it
    ctx = zctx.new()
    assert ctx
    del ctx

    # Create a context with many busy sockets, destroy it
    ctx = zctx.new()
    assert ctx

    # call API functions
    zctx.set_iothreads(ctx, 1)
    zctx.set_linger(ctx, 5) # 5 msecs
    zctx.set_pipehwm(ctx, 500)
    zctx.set_sndhwm(ctx, 500)
    zctx.set_rcvhwm(ctx, 500)


    s1 = zsocket.new(ctx, zmq.PAIR)