Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/zmq/backend/select.py: 71%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""Import basic exposure of libzmq C API as a backend"""
3# Copyright (C) PyZMQ Developers
4# Distributed under the terms of the Modified BSD License.
6from importlib import import_module
7from typing import Dict
9public_api = [
10 'Context',
11 'Socket',
12 'Frame',
13 'Message',
14 'proxy',
15 'proxy_steerable',
16 'zmq_poll',
17 'strerror',
18 'zmq_errno',
19 'has',
20 'curve_keypair',
21 'curve_public',
22 'zmq_version_info',
23 'IPC_PATH_MAX_LEN',
24 'PYZMQ_DRAFT_API',
25]
28def select_backend(name: str) -> Dict:
29 """Select the pyzmq backend"""
30 try:
31 mod = import_module(name)
32 except ImportError:
33 raise
34 except Exception as e:
35 raise ImportError(f"Importing {name} failed with {e}") from e
36 ns = {
37 # private API
38 'monitored_queue': mod.monitored_queue,
39 }
40 ns.update({key: getattr(mod, key) for key in public_api})
41 return ns