dictppr-1.0.0
توضیحات
Python library for easy-to-read conversion of a dictionary to a string and pretty printing.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | POSIX :: Linux |
| نام فایل | dictppr-1.0.0 |
| نام | dictppr |
| نسخه کتابخانه | 1.0.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Dawid Jach |
| ایمیل نویسنده | jach.developer@protonmail.com |
| آدرس صفحه اصلی | https://github.com/TheFifthLeaf/dictppr |
| آدرس اینترنتی | https://pypi.org/project/dictppr/ |
| مجوز | GNU GPLv3 |
# Dictppr
[](https://github.com/TheFifthLeaf/dictppr/releases)
[](https://www.python.org/downloads/)
[](https://choosealicense.com/licenses/gpl-3.0/)
[](https://www.codefactor.io/repository/github/thefifthleaf/dictppr)
[](https://github.com/TheFifthLeaf/dictppr/actions/workflows/tests.yml)
A package that allows easy-to-read conversion
of a dictionary to a string and pretty printing.
Features
- Convert dictionary to string
- Convert dictionary to dictionary of string
- Pretty print dictionary
## Installation
Download the latest version from `PyPi`
```bash
python -m pip install dictppr
```
Developers should also install tests dependencies
```bash
pip install -r requirements_dev.txt
```
## Testing
Perform the tests with `pytest` (or `Tox`)
```bash
python -m pytest tests
```
To check test coverage
```bash
coverage report -m
```
Current coverage:
| Name | Stmts | Miss | Cover |
|:-------------------------|------:|-----:|------:|
| dictppr\\\_\_init\_\_.py | 3 | 0 | 100% |
| dictppr\dictppr.py | 68 | 1 | 99% |
## Usage
First, you need to import the package:
```python
import dictppr
```
Now, to get string from dictionary:
```python
string = dictppr.get({...})
```
..or to get dictionary of strings:
```python
dictionary = dictppr.convert({...})
```
..or you just want to print it:
```python
dictppr.pprint({...})
```
If you need to check version of dictppr, use:
```python
print(dictppr.__version__)
```
### Examples
You have dictionary like that:
```python
sample = {
"key_1": "val_1",
"key_2": {
"key_3": "val_3",
"key_4": "val_4"
}
}
```
You will get this string with the `get` function:
```python
string = "key_1:val_1, key_2:key_3:val_3, key_4:val_4"
```
You will get this dictionary with the `convert` function:
```python
dictionary = {"key_1": "val_1", "key_2": "key_3:val_3, key_4:val_4"}
```
You will get this stdout with the `pprint` function:
```text
key_1 => val_1
key_2 => key_3:val_3, key_4:val_4
```
## Contributing
Pull requests are welcome!
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl dictppr-1.0.0:
pip install dictppr-1.0.0.whl
نصب پکیج tar.gz dictppr-1.0.0:
pip install dictppr-1.0.0.tar.gz