Name | timeout-iterator JSON |
Version |
0.2.2
JSON |
| download |
home_page | None |
Summary | Iterator with timeout |
upload_time | 2025-01-31 17:35:24 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | Copyright 2024-2025 Kitsu Yui
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# python-timeout-iterator
`timeout-iterator` provides a timeout in iteration.
[](https://badge.fury.io/py/timeout-iterator)
[](https://pypi.python.org/pypi/timeout-iterator/)
[](https://codecov.io/gh/kitsuyui/python-timeout-iterator)
[](https://opensource.org/licenses/BSD-3-Clause)
## Installation
```bash
$ pip install timeout-iterator
```
## Usage
### without_terminate
`without_terminate` is a generator that it will not yield after the timeout,
but it will not raise an exception.
```python
from timeout_iterator import without_terminate
results = []
for i in without_terminate(range(10), seconds=0.3):
results.append(i)
time.sleep(0.1)
assert results == [0, 1, 2]
```
### terminate
`terminate` is a generator that it will raise an exception after the timeout.
```python
from timeout_iterator import terminate
try:
results = []
for i in terminate(range(10), seconds=0.3):
results.append(i)
time.sleep(0.1)
except TimeoutError:
pass
assert results == [0, 1, 2]
```
# LICENSE
BSD 3-Clause License
Raw data
{
"_id": null,
"home_page": null,
"name": "timeout-iterator",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Yui KITSU <kitsuyui+github@kitsuyui.com>",
"download_url": "https://files.pythonhosted.org/packages/7f/dd/ac63f04f83ecdf401ab7fbe54ce451ae9df8f65beb918c7ca702526290d4/timeout_iterator-0.2.2.tar.gz",
"platform": null,
"description": "# python-timeout-iterator\n\n`timeout-iterator` provides a timeout in iteration.\n\n[](https://badge.fury.io/py/timeout-iterator)\n[](https://pypi.python.org/pypi/timeout-iterator/)\n[](https://codecov.io/gh/kitsuyui/python-timeout-iterator)\n[](https://opensource.org/licenses/BSD-3-Clause)\n\n## Installation\n\n```bash\n$ pip install timeout-iterator\n```\n\n## Usage\n\n### without_terminate\n\n`without_terminate` is a generator that it will not yield after the timeout,\nbut it will not raise an exception.\n\n```python\nfrom timeout_iterator import without_terminate\nresults = []\nfor i in without_terminate(range(10), seconds=0.3):\n results.append(i)\n time.sleep(0.1)\n\nassert results == [0, 1, 2]\n```\n\n### terminate\n\n`terminate` is a generator that it will raise an exception after the timeout.\n\n```python\nfrom timeout_iterator import terminate\ntry:\n results = []\n for i in terminate(range(10), seconds=0.3):\n results.append(i)\n time.sleep(0.1)\nexcept TimeoutError:\n pass\n\nassert results == [0, 1, 2]\n```\n\n# LICENSE\n\nBSD 3-Clause License\n",
"bugtrack_url": null,
"license": "Copyright 2024-2025 Kitsu Yui\n \n Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n \n 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n \n 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n \n 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n \n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
"summary": "Iterator with timeout",
"version": "0.2.2",
"project_urls": {
"Homepage": "https://github.com/kitsuyui/python-timeout-iterator"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "4634d0f4fb9a7d20c694e4ec3561a344582c68c10472c78a142fac98d4017843",
"md5": "2c4ceb10e0539766439ea882690cc851",
"sha256": "725425bbbcc805dec00fd9a41fde98e1aa2c3f23fc3a8241b031a8e96c05ff01"
},
"downloads": -1,
"filename": "timeout_iterator-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c4ceb10e0539766439ea882690cc851",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 5369,
"upload_time": "2025-01-31T17:35:23",
"upload_time_iso_8601": "2025-01-31T17:35:23.322942Z",
"url": "https://files.pythonhosted.org/packages/46/34/d0f4fb9a7d20c694e4ec3561a344582c68c10472c78a142fac98d4017843/timeout_iterator-0.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7fddac63f04f83ecdf401ab7fbe54ce451ae9df8f65beb918c7ca702526290d4",
"md5": "d35df4117c482def4f8a6c55a355c967",
"sha256": "08198cc131e9ea29e04515b4789799e809ebcd00c140a785eee3fcccc7e87ce1"
},
"downloads": -1,
"filename": "timeout_iterator-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "d35df4117c482def4f8a6c55a355c967",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 31187,
"upload_time": "2025-01-31T17:35:24",
"upload_time_iso_8601": "2025-01-31T17:35:24.838776Z",
"url": "https://files.pythonhosted.org/packages/7f/dd/ac63f04f83ecdf401ab7fbe54ce451ae9df8f65beb918c7ca702526290d4/timeout_iterator-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-31 17:35:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kitsuyui",
"github_project": "python-timeout-iterator",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "timeout-iterator"
}