enumy-1.0.2
توضیحات
Module to set predefined allowed values for a variable
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | enumy-1.0.2 |
| نام | enumy |
| نسخه کتابخانه | 1.0.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | ByteSentinel |
| ایمیل نویسنده | info@bytesentinel.io |
| آدرس صفحه اصلی | https://github.com/bytesentinel/enumy |
| آدرس اینترنتی | https://pypi.org/project/enumy/ |
| مجوز | - |
# Enumy
The problem with Python's "Enum" module is that it is not a reasonable way to restrict variables to a predefined set of values.
Latest version: `v1.0.2`
## Installation
```shell
pip install --user enumy
```
## Special methods
### `check_type`
Check if a variable matches a certain data type.
```python
var.check_type(str)
```
### `check_value`
Check if a value is present in the allowed values.
```python
text = "ByteSentinel"
var.check_value(text)
```
## Example
```python
from enumy import Enumy
test = Enumy(("Value 1", "Value 2"), str)
test = "Value 2" # Working
test = 123 # Exception
```
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7 | Python |
نحوه نصب
نصب پکیج whl enumy-1.0.2:
pip install enumy-1.0.2.whl
نصب پکیج tar.gz enumy-1.0.2:
pip install enumy-1.0.2.tar.gz