dictop
DICT-OPERATION allow you select data value from a dict-instance with dot separated path, and update.
Install
pip install dictop
Test Passed On Python
- 2.7
- 3.2
- 3.3
- 3.4
- 3.5
- 3.6
- 3.7
- 3.8
- 3.9
- 3.10
- 3.11
Usage
from dictop import update
from dictop import select
data = {}
update(data, "a.b.c", 2)
assert select(data, "a.b.c") == 2
Core Functions
- select
select(target, path, default=None, slient=True)
- update
update(target, path, value)
Unit Tests
# tests.py
import unittest
import dictop
class DictopTest(unittest.TestCase):
def test01(self):
data = {
"a": {
"b": "value",
}
}
assert dictop.select(data, "a.b") == "value"
assert dictop.select(data, "a.c") is None
def test02(self):
data = {
"a": [{
"b": "value",
}]
}
assert dictop.select(data, "a.0.b") == "value"
assert dictop.select(data, "a.1.b") is None
def test03(self):
data = [1,2,3]
assert dictop.select(data, "0") == 1
assert dictop.select(data, "4") is None
def test04(self):
data = {}
dictop.update(data, "a.b.c", "value")
dictop.select(data, "a.b.c") == "value"
def test05(self):
data = []
dictop.update(data, "1.a.b", "value")
assert data[1]["a"]["b"] == "value"
Releases
0.1.0 2018/03/20
- First release.
0.1.1 2018/03/20
0.1.2 2018/04/02
0.1.3 2018/04/18
0.1.4 2019/04/12
- Update.
0.2.1 2022/01/08
- Fix license file missing problem.
0.2.2 2023/09/08
- Add gitlab-ci and tested on all python versions.
0.2.3 2025/10/21
- Doc update.
Release files for dictop 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dictop-0.2.3.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dictop-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.0 kB
Release files / dictop-0.2.3.tar.gz
| Download URL | dictop-0.2.3.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
349519088be38679d7257cd8b4c55c71fafe7f5ad4eb388870bc9d1c11203659
|
|
BLAKE2b-256 checksum How to use checksums |
cb690be28624d4b8bb912698e104234458fe6a6d902742b8655813170720231f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|
Release files / dictop-0.2.3-py3-none-any.whl
| Download URL | dictop-0.2.3-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a329d2bff93a899e661c9d4c4f5f03f090ae3407e059fcebdc405a9e0a4365bc
|
|
BLAKE2b-256 checksum How to use checksums |
5fff716d785ee3dd47a8f2636a6c7ef6b136cfe369cd97d7856a779565d4b07a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|