carnot-0.1.1
توضیحات
Module for defining reversible transactions.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | carnot-0.1.1 |
| نام | carnot |
| نسخه کتابخانه | 0.1.1 |
| نگهدارنده | ['jjj999'] |
| ایمیل نگهدارنده | ['jjj999to@gmail.com'] |
| نویسنده | jjj999 |
| ایمیل نویسنده | jjj999to@gmail.com |
| آدرس صفحه اصلی | https://jjj999.github.io/carnot |
| آدرس اینترنتی | https://pypi.org/project/carnot/ |
| مجوز | MIT |
# carnot
`carnot` is a module that enables reversible transactions for general purposes. Reversible transactions may make your codes simpler and have better readability inspite of complicated logics.
## Installing
- Python >= 3.8
```
python -m pip install carnot
```
## Usage
```python
from carnot import reversible_function, transaction
count = 0
@reverse_function
def add(num: int) -> None:
global count
count += num
add.set_args(num)
@add.backward
def _add(num: int) -> None:
global count
count -= num
@transaction
def add_and_emit_error() -> None:
add(2)
raise Exception
if __name__ == "__main__":
try:
add_and_emit_error()
except:
pass
finally:
print(count) # 0
```
نیازمندی
| مقدار | نام |
|---|---|
| >=4.3.0,<5.0.0 | typing-extensions |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8,<4.0 | Python |
نحوه نصب
نصب پکیج whl carnot-0.1.1:
pip install carnot-0.1.1.whl
نصب پکیج tar.gz carnot-0.1.1:
pip install carnot-0.1.1.tar.gz