datadict-1.0.0
توضیحات
Add dictionary-like capabilities to dataclasses
| ویژگی | مقدار |
|---|---|
| سیستم عامل | POSIX :: Linux |
| نام فایل | datadict-1.0.0 |
| نام | datadict |
| نسخه کتابخانه | 1.0.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | Geir Arne Hjelle <geirarne@gmail.com> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/datadict/ |
| مجوز | - |
# DataDict
_Treat dataclasses like dictionaries_
[](https://pypi.org/project/datadict/)
[](https://pypi.org/project/datadict/)
[](https://github.com/realpython/codetiming/actions)
[](https://github.com/psf/black)
[](https://interrogate.readthedocs.io/)
## Installing DataDict
DataDict is available at [PyPI](https://pypi.org/project/datadict/). You can install it using Pip:
$ python -m pip install datadict
## Using DataDict
You can use a DataDict `dataclass` as a drop-in replacement for `dataclasses.dataclass` in the standard library:
```python
from datadict import dataclass
@dataclass(order=True)
class Point:
x: int
y: int
```
For instances of the new data class, you can access attributes using square brackets, similar to dictionary access:
```python
>>> point = Point(1, 2)
>>> point
Point(x=1, y=2)
>>> point.x
1
>>> point["x"]
1
>>> point["y"] = 3
>>> point
Point(x=1, y=3)
```
You can also convert the dataclass instance to a proper dictionary:
```python
>>> point.asdict()
{'x': 1, 'y': 3}
```
## Installing From Source
You can always download the [latest version of DataDict from GitHub](https://github.com/gahjelle/datadict). DataDict uses [Flit](https://flit.pypa.io/) as a build tool.
To install DataDict from the downloaded source, run Flit through `pip`:
$ python -m pip install .
If you want to change and play with the DataDict source code, you should install it in editable mode:
$ python -m pip install -w .[dev,test]
نیازمندی
| مقدار | نام |
|---|---|
| - | typing_extensions |
| - | black |
| - | bumpversion |
| - | flake8 |
| - | flit |
| - | interrogate |
| - | isort |
| - | mypy |
| - | pre-commit |
| - | pyright |
| - | mkdocs |
| - | black |
| - | flake8 |
| - | interrogate |
| - | isort |
| - | mypy |
| - | pyright |
| - | pytest |
| - | pytest-cov |
| - | tox |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7 | Python |
نحوه نصب
نصب پکیج whl datadict-1.0.0:
pip install datadict-1.0.0.whl
نصب پکیج tar.gz datadict-1.0.0:
pip install datadict-1.0.0.tar.gz