You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
3.9 KiB

4 years ago
  1. Metadata-Version: 2.1
  2. Name: async-timeout
  3. Version: 3.0.1
  4. Summary: Timeout context manager for asyncio programs
  5. Home-page: https://github.com/aio-libs/async_timeout/
  6. Author: Andrew Svetlov
  7. Author-email: andrew.svetlov@gmail.com
  8. License: Apache 2
  9. Platform: UNKNOWN
  10. Classifier: License :: OSI Approved :: Apache Software License
  11. Classifier: Intended Audience :: Developers
  12. Classifier: Programming Language :: Python
  13. Classifier: Programming Language :: Python :: 3
  14. Classifier: Programming Language :: Python :: 3.5
  15. Classifier: Programming Language :: Python :: 3.6
  16. Classifier: Topic :: Internet :: WWW/HTTP
  17. Classifier: Framework :: AsyncIO
  18. Requires-Python: >=3.5.3
  19. async-timeout
  20. =============
  21. .. image:: https://travis-ci.org/aio-libs/async-timeout.svg?branch=master
  22. :target: https://travis-ci.org/aio-libs/async-timeout
  23. .. image:: https://codecov.io/gh/aio-libs/async-timeout/branch/master/graph/badge.svg
  24. :target: https://codecov.io/gh/aio-libs/async-timeout
  25. .. image:: https://img.shields.io/pypi/v/async-timeout.svg
  26. :target: https://pypi.python.org/pypi/async-timeout
  27. .. image:: https://badges.gitter.im/Join%20Chat.svg
  28. :target: https://gitter.im/aio-libs/Lobby
  29. :alt: Chat on Gitter
  30. asyncio-compatible timeout context manager.
  31. Usage example
  32. -------------
  33. The context manager is useful in cases when you want to apply timeout
  34. logic around block of code or in cases when ``asyncio.wait_for()`` is
  35. not suitable. Also it's much faster than ``asyncio.wait_for()``
  36. because ``timeout`` doesn't create a new task.
  37. The ``timeout(timeout, *, loop=None)`` call returns a context manager
  38. that cancels a block on *timeout* expiring::
  39. async with timeout(1.5):
  40. await inner()
  41. 1. If ``inner()`` is executed faster than in ``1.5`` seconds nothing
  42. happens.
  43. 2. Otherwise ``inner()`` is cancelled internally by sending
  44. ``asyncio.CancelledError`` into but ``asyncio.TimeoutError`` is
  45. raised outside of context manager scope.
  46. *timeout* parameter could be ``None`` for skipping timeout functionality.
  47. Context manager has ``.expired`` property for check if timeout happens
  48. exactly in context manager::
  49. async with timeout(1.5) as cm:
  50. await inner()
  51. print(cm.expired)
  52. The property is ``True`` if ``inner()`` execution is cancelled by
  53. timeout context manager.
  54. If ``inner()`` call explicitly raises ``TimeoutError`` ``cm.expired``
  55. is ``False``.
  56. Installation
  57. ------------
  58. ::
  59. $ pip install async-timeout
  60. The library is Python 3 only!
  61. Authors and License
  62. -------------------
  63. The module is written by Andrew Svetlov.
  64. It's *Apache 2* licensed and freely available.
  65. CHANGES
  66. =======
  67. 3.0.1 (2018-10-09)
  68. ------------------
  69. - More aggressive typing (#48)
  70. 3.0.0 (2018-05-05)
  71. ------------------
  72. - Drop Python 3.4, the minimal supported version is Python 3.5.3
  73. - Provide type annotations
  74. 2.0.1 (2018-03-13)
  75. ------------------
  76. * Fix ``PendingDeprecationWarning`` on Python 3.7 (#33)
  77. 2.0.0 (2017-10-09)
  78. ------------------
  79. * Changed `timeout <= 0` behaviour
  80. * Backward incompatibility change, prior this version `0` was
  81. shortcut for `None`
  82. * when timeout <= 0 `TimeoutError` raised faster
  83. 1.4.0 (2017-09-09)
  84. ------------------
  85. * Implement `remaining` property (#20)
  86. * If timeout is not started yet or started unconstrained:
  87. `remaining` is `None`
  88. * If timeout is expired: `remaining` is `0.0`
  89. * All others: roughly amount of time before `TimeoutError` is triggered
  90. 1.3.0 (2017-08-23)
  91. ------------------
  92. * Don't suppress nested exception on timeout. Exception context points
  93. on cancelled line with suspended `await` (#13)
  94. * Introduce `.timeout` property (#16)
  95. * Add methods for using as async context manager (#9)
  96. 1.2.1 (2017-05-02)
  97. ------------------
  98. * Support unpublished event loop's "current_task" api.
  99. 1.2.0 (2017-03-11)
  100. ------------------
  101. * Extra check on context manager exit
  102. * 0 is no-op timeout
  103. 1.1.0 (2016-10-20)
  104. ------------------
  105. * Rename to `async-timeout`
  106. 1.0.0 (2016-09-09)
  107. ------------------
  108. * The first release.