async-helper-0.0.3
توضیحات
A bridge between the asynchronous and synchronous world
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | async-helper-0.0.3 |
| نام | async-helper |
| نسخه کتابخانه | 0.0.3 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Sebastian Steins |
| ایمیل نویسنده | opensource@seb.st |
| آدرس صفحه اصلی | https://github.com/sebst/async-helper |
| آدرس اینترنتی | https://pypi.org/project/async-helper/ |
| مجوز | - |
# async-helper
*async-helper by [Sebastian Steins](https://seb.st/)*
Licence: MIT
## Usage
```
import time, random
from async_helper import first_parallel_result
def time_consuming_function(i):
print("I consume a lot of time")
time.sleep(random.randint(1, 10))
return i
candidates = [
lambda: time_consuming_function(1),
lambda: time_consuming_function(2),
]
best_effort_result = first_parallel_result(candidates)
print(best_effort_result)
```
## Giving preference
```
import time, random
from async_helper import first_parallel_result
def time_consuming_function(i):
print("I consume a lot of time")
time.sleep(random.randint(1, 10))
return i
candidates = [
0, lambda: time_consuming_function(1), # This callable will start immediately.
1, lambda: time_consuming_function(2), # This callable will start with `1` sec delay.
]
best_effort_result = first_parallel_result(candidates)
print(best_effort_result)
```
___
© 2021 [Sebastian Steins](https://seb.st/)
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl async-helper-0.0.3:
pip install async-helper-0.0.3.whl
نصب پکیج tar.gz async-helper-0.0.3:
pip install async-helper-0.0.3.tar.gz