__init__.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # -----------------------------------------------------------------------------
  2. # Copyright (C) 2011-2012 Travis Cline
  3. #
  4. # This file is part of pyzmq
  5. # It is adapted from upstream project zeromq_gevent under the New BSD License
  6. #
  7. # Distributed under the terms of the New BSD License. The full license is in
  8. # the file LICENSE.BSD, distributed as part of this software.
  9. # -----------------------------------------------------------------------------
  10. """zmq.green - gevent compatibility with zeromq.
  11. Usage
  12. -----
  13. Instead of importing zmq directly, do so in the following manner:
  14. ..
  15. import zmq.green as zmq
  16. Any calls that would have blocked the current thread will now only block the
  17. current green thread.
  18. This compatibility is accomplished by ensuring the nonblocking flag is set
  19. before any blocking operation and the ØMQ file descriptor is polled internally
  20. to trigger needed events.
  21. """
  22. from __future__ import annotations
  23. from typing import List
  24. import zmq as _zmq
  25. from zmq import *
  26. from zmq.green.core import _Context, _Socket
  27. from zmq.green.poll import _Poller
  28. Context = _Context # type: ignore
  29. Socket = _Socket # type: ignore
  30. Poller = _Poller # type: ignore
  31. from zmq.green.device import device # type: ignore
  32. __all__: list[str] = []
  33. # adding `__all__` to __init__.pyi gets mypy all confused
  34. __all__.extend(_zmq.__all__) # type: ignore