PageRenderTime 35ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/venv/Lib/site-packages/async_timeout-2.0.1.dist-info/DESCRIPTION.rst

https://bitbucket.org/echarles5wits/kioskcommutility
ReStructuredText | 134 lines | 83 code | 51 blank | 0 comment | 0 complexity | fcbaad07d8045b56d515431452491564 MD5 | raw file
  1. async-timeout
  2. =============
  3. .. image:: https://travis-ci.org/aio-libs/async-timeout.svg?branch=master
  4. :target: https://travis-ci.org/aio-libs/async-timeout
  5. .. image:: https://codecov.io/gh/aio-libs/async-timeout/branch/master/graph/badge.svg
  6. :target: https://codecov.io/gh/aio-libs/async-timeout
  7. .. image:: https://img.shields.io/pypi/v/async-timeout.svg
  8. :target: https://pypi.python.org/pypi/async-timeout
  9. .. image:: https://badges.gitter.im/Join%20Chat.svg
  10. :target: https://gitter.im/aio-libs/Lobby
  11. :alt: Chat on Gitter
  12. asyncio-compatible timeout context manager.
  13. Usage example
  14. -------------
  15. The context manager is useful in cases when you want to apply timeout
  16. logic around block of code or in cases when ``asyncio.wait_for()`` is
  17. not suitable. Also it's much faster than ``asyncio.wait_for()``
  18. because ``timeout`` doesn't create a new task.
  19. The ``timeout(timeout, *, loop=None)`` call returns a context manager
  20. that cancels a block on *timeout* expiring::
  21. async with timeout(1.5):
  22. await inner()
  23. 1. If ``inner()`` is executed faster than in ``1.5`` seconds nothing
  24. happens.
  25. 2. Otherwise ``inner()`` is cancelled internally by sending
  26. ``asyncio.CancelledError`` into but ``asyncio.TimeoutError`` is
  27. raised outside of context manager scope.
  28. *timeout* parameter could be ``None`` for skipping timeout functionality.
  29. Context manager has ``.expired`` property for check if timeout happens
  30. exactly in context manager::
  31. async with timeout(1.5) as cm:
  32. await inner()
  33. print(cm.expired)
  34. The property is ``True`` is ``inner()`` execution is cancelled by
  35. timeout context manager.
  36. If ``inner()`` call explicitly raises ``TimeoutError`` ``cm.expired``
  37. is ``False``.
  38. Installation
  39. ------------
  40. ::
  41. $ pip install async-timeout
  42. The library is Python 3 only!
  43. Authors and License
  44. -------------------
  45. The module is written by Andrew Svetlov.
  46. It's *Apache 2* licensed and freely available.
  47. CHANGES
  48. =======
  49. 2.0.1 (2018-03-13)
  50. ------------------
  51. * Fix ``PendingDeprecationWarning`` on Python 3.7 (#33)
  52. 2.0.0 (2017-10-09)
  53. ------------------
  54. * Changed `timeout <= 0` behaviour
  55. * Backward incompatibility change, prior this version `0` was
  56. shortcut for `None`
  57. * when timeout <= 0 `TimeoutError` raised faster
  58. 1.4.0 (2017-09-09)
  59. ------------------
  60. * Implement `remaining` property (#20)
  61. * If timeout is not started yet or started unconstrained:
  62. `remaining` is `None`
  63. * If timeout is expired: `remaining` is `0.0`
  64. * All others: roughly amount of time before `TimeoutError` is triggered
  65. 1.3.0 (2017-08-23)
  66. ------------------
  67. * Don't suppress nested exception on timeout. Exception context points
  68. on cancelled line with suspended `await` (#13)
  69. * Introduce `.timeout` property (#16)
  70. * Add methods for using as async context manager (#9)
  71. 1.2.1 (2017-05-02)
  72. ------------------
  73. * Support unpublished event loop's "current_task" api.
  74. 1.2.0 (2017-03-11)
  75. ------------------
  76. * Extra check on context manager exit
  77. * 0 is no-op timeout
  78. 1.1.0 (2016-10-20)
  79. ------------------
  80. * Rename to `async-timeout`
  81. 1.0.0 (2016-09-09)
  82. ------------------
  83. * The first release.