{ "info": { "author": "Alexander Kozhevnikov", "author_email": "mentalisttraceur@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.3", "Programming Language :: Python :: 2.4", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.0", "Programming Language :: Python :: 3.1", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: IronPython", "Programming Language :: Python :: Implementation :: Jython", "Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: Implementation :: Stackless" ], "description": "totaltimeout\n============\n\nUse one total timeout over many operations.\n\nCorrectly and efficiently spreads one timeout over many steps by\nrecalculating the time remaining after some amount of waiting has\nalready happened, to pass an adjusted timeout to the next call.\n\n\nVersioning\n----------\n\nThis library's version numbers follow the `SemVer 2.0.0 specification\n`_.\n\nThe current version number is available in the variable ``__version__``,\nas is normal for Python modules.\n\n\nInstallation\n------------\n\n::\n\n pip install totaltimeout\n\n\nUsage\n-----\n\nImport the ``Timeout`` class.\n\n.. code:: python\n\n from totaltimeout import Timeout\n\nWaiting in a \"timed loop\" for an API with retries:\n\n.. code:: python\n\n for time_left in Timeout(SOME_NUMBER_OF_SECONDS):\n reply = requests.get(some_flaky_api_url, timeout=time_left)\n if reply.status == 200:\n break\n time.sleep(some_retry_delay)\n\nWaiting for multiple tasks to finish:\n\n.. code:: python\n\n timeout = Timeout(10.0)\n my_thread_foo.join(timeout.time_left())\n my_thread_bar.join(timeout.time_left())\n my_thread_qux.join(timeout.time_left())\n # Waits at most ten seconds total for all three threads, but\n # waits the full ten seconds if *any* thread takes that long.\n\nWaiting for multiple tasks within each iteration of a \"timed loop\"\n(combining the above two examples):\n\n.. code:: python\n\n timeout = Timeout(SOME_NUMBER_OF_SECONDS)\n for time_left in timeout:\n foo.some_work(timeout=time_left)\n # The first timeout can be *either* be the for loop value or\n # the ``time_left()`` method. The rest *have to be* the latter.\n foo.more_work(timeout=timeout.time_left())\n some_other_work(timeout=timeout.time_left())\n\n\nAdvanced Usage Notes\n~~~~~~~~~~~~~~~~~~~~\n\n``Timeout`` uses ``time.monotonic`` as the default time function,\nfalling back to ``time.time`` if ``time.monotonic`` is unavailable.\n\nYou can override this by passing in a callable as the second argument.\n\nFor example, if you've installed the\n`monotonic backport `_:\n\n.. code:: python\n\n from monotonic import monotonic\n\n timeout = Timeout(10.0, now=monotonic)\n\nAny callables that return time in seconds as floating point values\nare supported as part of the interface subject to SemVer backwards\ncompability guarantees.\n\nHowever, **any** callables that return time values that can be\nsubtracted from each other to produce duration values which in turn can\nbe subtracted from each other and compared to zero should work, and\nseconds are expected only because Python's idiomatic unit for timeouts\nis seconds. If the ``timeout``, ``now``, and usage are consistent, any\nchoice that fits these criteria is likely to work.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mentalisttraceur/python-totaltimeout", "keywords": "", "license": "0BSD (BSD Zero Clause License)", "maintainer": "", "maintainer_email": "", "name": "totaltimeout", "package_url": "https://pypi.org/project/totaltimeout/", "platform": "", "project_url": "https://pypi.org/project/totaltimeout/", "project_urls": { "Homepage": "https://github.com/mentalisttraceur/python-totaltimeout" }, "release_url": "https://pypi.org/project/totaltimeout/1.0.1/", "requires_dist": null, "requires_python": "", "summary": "Use one total timeout over many operations", "version": "1.0.1" }, "last_serial": 4311568, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "e23dbe9bd8208823bf1ecd7acde753b9", "sha256": "16a9f28dc883a3cf33f0fc27f12f95916f2e942919dc45038477abf3b45c8167" }, "downloads": -1, "filename": "totaltimeout-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e23dbe9bd8208823bf1ecd7acde753b9", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5888, "upload_time": "2018-09-26T06:48:58", "url": "https://files.pythonhosted.org/packages/15/b5/f5f4fdcb26262536206ed8431c2e8cb6da86ca798e2ee4f8573ba2dd27ac/totaltimeout-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4da6d227f9d3dd5b575a3ed875dd4fd0", "sha256": "351479f550e40e73139395d33b699c8a5a989ffd0485c0a00be156c3a1f17329" }, "downloads": -1, "filename": "totaltimeout-1.0.0.tar.gz", "has_sig": false, "md5_digest": "4da6d227f9d3dd5b575a3ed875dd4fd0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3753, "upload_time": "2018-09-26T06:49:00", "url": "https://files.pythonhosted.org/packages/3a/04/4e69fdf5bc0949bc68727d89d8ae8ee4df50b49c0d256f7e053f5bab4cd8/totaltimeout-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "02e1cb3de739c81d602beabf81462fbd", "sha256": "d8d7be713e64753e5fadf4d25029aca90c9a10de472ccb3bb997498d92bb213a" }, "downloads": -1, "filename": "totaltimeout-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "02e1cb3de739c81d602beabf81462fbd", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5923, "upload_time": "2018-09-26T08:12:11", "url": "https://files.pythonhosted.org/packages/2d/e0/8051d1b5cfb553a37d3b21c515f89a8d106247ae7c946cf24c2edea8d44d/totaltimeout-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e488bebb89f789af0c92e8bf16e25a04", "sha256": "af596d3237f609cef8ff8a7d710801aa757b069c82b605bc1ea2c7947d213271" }, "downloads": -1, "filename": "totaltimeout-1.0.1.tar.gz", "has_sig": false, "md5_digest": "e488bebb89f789af0c92e8bf16e25a04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3767, "upload_time": "2018-09-26T08:12:13", "url": "https://files.pythonhosted.org/packages/ca/a9/e399bd9486f97e1aa5ee87d4d28166480ecefe0fba1c65b19c80234060df/totaltimeout-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "02e1cb3de739c81d602beabf81462fbd", "sha256": "d8d7be713e64753e5fadf4d25029aca90c9a10de472ccb3bb997498d92bb213a" }, "downloads": -1, "filename": "totaltimeout-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "02e1cb3de739c81d602beabf81462fbd", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5923, "upload_time": "2018-09-26T08:12:11", "url": "https://files.pythonhosted.org/packages/2d/e0/8051d1b5cfb553a37d3b21c515f89a8d106247ae7c946cf24c2edea8d44d/totaltimeout-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e488bebb89f789af0c92e8bf16e25a04", "sha256": "af596d3237f609cef8ff8a7d710801aa757b069c82b605bc1ea2c7947d213271" }, "downloads": -1, "filename": "totaltimeout-1.0.1.tar.gz", "has_sig": false, "md5_digest": "e488bebb89f789af0c92e8bf16e25a04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3767, "upload_time": "2018-09-26T08:12:13", "url": "https://files.pythonhosted.org/packages/ca/a9/e399bd9486f97e1aa5ee87d4d28166480ecefe0fba1c65b19c80234060df/totaltimeout-1.0.1.tar.gz" } ] }