__init__.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # -*- coding: utf-8 -*-
  2. """
  3. The root of the greenlet package.
  4. """
  5. from __future__ import absolute_import
  6. from __future__ import division
  7. from __future__ import print_function
  8. __all__ = [
  9. '__version__',
  10. '_C_API',
  11. 'GreenletExit',
  12. 'error',
  13. 'getcurrent',
  14. 'greenlet',
  15. 'gettrace',
  16. 'settrace',
  17. ]
  18. # pylint:disable=no-name-in-module
  19. ###
  20. # Metadata
  21. ###
  22. __version__ = '3.1.1'
  23. from ._greenlet import _C_API # pylint:disable=no-name-in-module
  24. ###
  25. # Exceptions
  26. ###
  27. from ._greenlet import GreenletExit
  28. from ._greenlet import error
  29. ###
  30. # greenlets
  31. ###
  32. from ._greenlet import getcurrent
  33. from ._greenlet import greenlet
  34. ###
  35. # tracing
  36. ###
  37. try:
  38. from ._greenlet import gettrace
  39. from ._greenlet import settrace
  40. except ImportError:
  41. # Tracing wasn't supported.
  42. # XXX: The option to disable it was removed in 1.0,
  43. # so this branch should be dead code.
  44. pass
  45. ###
  46. # Constants
  47. # These constants aren't documented and aren't recommended.
  48. # In 1.0, USE_GC and USE_TRACING are always true, and USE_CONTEXT_VARS
  49. # is the same as ``sys.version_info[:2] >= 3.7``
  50. ###
  51. from ._greenlet import GREENLET_USE_CONTEXT_VARS # pylint:disable=unused-import
  52. from ._greenlet import GREENLET_USE_GC # pylint:disable=unused-import
  53. from ._greenlet import GREENLET_USE_TRACING # pylint:disable=unused-import
  54. # Controlling the use of the gc module. Provisional API for this greenlet
  55. # implementation in 2.0.
  56. from ._greenlet import CLOCKS_PER_SEC # pylint:disable=unused-import
  57. from ._greenlet import enable_optional_cleanup # pylint:disable=unused-import
  58. from ._greenlet import get_clocks_used_doing_optional_cleanup # pylint:disable=unused-import
  59. # Other APIS in the _greenlet module are for test support.