https://github.com/gil9red/simple-wait
Simple wait
https://github.com/gil9red/simple-wait
python python-3 wait
Last synced: 8 months ago
JSON representation
Simple wait
- Host: GitHub
- URL: https://github.com/gil9red/simple-wait
- Owner: gil9red
- License: mit
- Created: 2023-05-22T14:22:04.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-26T23:00:32.000Z (almost 3 years ago)
- Last Synced: 2025-06-13T19:45:35.126Z (12 months ago)
- Topics: python, python-3, wait
- Language: Python
- Homepage: https://pypi.org/project/simple-wait/
- Size: 36.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# simple-wait
Simple wait
[](https://github.com/gil9red/simple-wait/actions/workflows/run-tests.yml)
[](https://github.com/gil9red/simple-wait/actions/workflows/python-publish.yml)
[](https://pypi.org/project/simple-wait/)
[](https://pepy.tech/project/simple-wait)
[](https://pypi.org/project/simple-wait/)
[](https://pypi.org/project/black/)
[](https://opensource.org/licenses/MIT)
## Example
```python
from datetime import datetime
from simple_wait import wait
print("Start wait")
wait(seconds=5)
print("Finish wait")
while True:
print()
print("Current datetime:", datetime.now())
print()
wait(minutes=1, seconds=30)
```
```python
import traceback
from simple_wait import wait
while True:
try:
# Process
...
wait(hours=8)
except:
print(traceback.format_exc())
wait(minutes=15)
```
## Installation
You can install with:
```
pip install simple-wait
```
Install or upgrade:
```
pip install --upgrade simple-wait
```
Install or update from github:
```
pip install git+https://github.com/gil9red/simple-wait
```
## Description
Parameters `wait` function:
| Name | Type | Default |
|------------------------|----------------------|------------------------------------------------|
| days | `int` | `0` |
| seconds | `int` | `0` |
| microseconds | `int` | `0` |
| milliseconds | `int` | `0` |
| minutes | `int` | `0` |
| hours | `int` | `0` |
| weeks | `int` | `0` |
| progress_bar | `Iterable[str]` | `("|", "/", "-", "\\")` |
| delay_seconds | `float` | `1` |
| log_pattern_progress | `str` | `"[{progress_bar}] Time left to wait: {left}"` |
| log_pattern_cancel | `str` | `"\nWaiting canceled\n"` |
| log_pattern_clear_line | `str` | `"\r" + " " * 100 + "\r"` |
| log | `TextIOWrapper` | `sys.stdout` |
| is_need_stop | `Callable[[], bool]` | `lambda: False` |