## jict
jict is basically a nested dict.
with some extra features
simple use example :
```python
from jict import jict
jct = jict()
jct['level1']['level2']['level3'] = 'created nested dictionary'
print(jct)
# output :
# {
# "level1": {
# "level2": {
# "level3": "created nested dictionary"
# }}}
# jict to dict
mydict = jct.dict()
```
jict utilities:
```python
from jict import jict
# our jict
jct = jict({
'val': { 'list':[ [{ 'find-me': 'secret' }] ] }
})
# we can easly find the key we need
print(jct.get('find-me'))
# we also can rename the keys
# output : secret
jct.rename('find-me','password')
print(jct.get('find-me'))
# output : None
print(jct.get('password'))
# output : secret
# we also can replace values
jct.replace('password','mypass')
print(jct.get('password'))
# output : mypass
def foo(val):
val[0][0]['name'] = 'jict'
return val
# we also can replace with callbacks and multiple values
jct.replace({
'password':'mypass',
'list': foo,
})
# callbacks also work with this: jct.replace('list' , foo)
print(jct.get('list'))
# output: [[{'password': 'mypass', 'name': 'jict'}]]
```
also you can easly load a .json , .yaml file
```python
from jict import jict
jctj = jict('test.json')
print(jctj)
# output :
# {
# "test": "json-content"
# }
jcty = jict('test.yaml')
print(jctj)
# output :
# {
# "test": "yaml-content"
# }
# if you want to save the modifed values
jctj.save()
jcty.save()
# you can also save to another file
jcty.save('newfile.json')
```
Raw data
{
"_id": null,
"home_page": "https://github.com/y-vas/jict",
"name": "jict",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "nested, jict, defaultdict, dictionary, auto-vivification",
"author": "Vasyl Yovdiy",
"author_email": "yovdiyvasyl@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c0/8e/b203f2d836b091e4b301830448b388baea3638d12933160a0fb84e1525f5/jict-3.0.2.tar.gz",
"platform": null,
"description": "## jict\njict is basically a nested dict. \nwith some extra features \n\nsimple use example :\n\n```python\nfrom jict import jict\n\njct = jict()\njct['level1']['level2']['level3'] = 'created nested dictionary'\n\nprint(jct)\n# output :\n# {\n# \"level1\": {\n# \"level2\": {\n# \"level3\": \"created nested dictionary\"\n# }}}\n\n# jict to dict\nmydict = jct.dict()\n\n```\n\njict utilities:\n```python\nfrom jict import jict\n\n# our jict\njct = jict({\n 'val': { 'list':[ [{ 'find-me': 'secret' }] ] }\n})\n\n# we can easly find the key we need\nprint(jct.get('find-me'))\n\n# we also can rename the keys\n# output : secret\njct.rename('find-me','password')\nprint(jct.get('find-me'))\n# output : None\nprint(jct.get('password'))\n# output : secret\n\n# we also can replace values\njct.replace('password','mypass')\nprint(jct.get('password'))\n# output : mypass\n\n\ndef foo(val):\n val[0][0]['name'] = 'jict'\n return val\n\n# we also can replace with callbacks and multiple values\njct.replace({\n 'password':'mypass',\n 'list': foo,\n})\n\n# callbacks also work with this: jct.replace('list' , foo)\n\nprint(jct.get('list'))\n# output: [[{'password': 'mypass', 'name': 'jict'}]]\n\n\n```\n\nalso you can easly load a .json , .yaml file\n\n```python\nfrom jict import jict\n\njctj = jict('test.json')\nprint(jctj)\n# output :\n# {\n# \"test\": \"json-content\"\n# }\n\njcty = jict('test.yaml')\nprint(jctj)\n# output :\n# {\n# \"test\": \"yaml-content\"\n# }\n\n# if you want to save the modifed values\njctj.save()\njcty.save()\n\n# you can also save to another file\njcty.save('newfile.json')\n```\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python dictionary with automatic and arbitrary levels of nestedness",
"version": "3.0.2",
"project_urls": {
"Homepage": "https://github.com/y-vas/jict"
},
"split_keywords": [
"nested",
" jict",
" defaultdict",
" dictionary",
" auto-vivification"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "03f7b660dfdccd586cbc0bee2ca9d635f48de6cda82546dedae4ee510d07b9ca",
"md5": "5e431e34381e8de352ca2943e611d8c5",
"sha256": "ca1b1ac6e28ac42e6ac27ab493db09a1f39af22458dc2d7023675f2e192e6df2"
},
"downloads": -1,
"filename": "jict-3.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5e431e34381e8de352ca2943e611d8c5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 11961,
"upload_time": "2024-09-10T13:02:09",
"upload_time_iso_8601": "2024-09-10T13:02:09.347278Z",
"url": "https://files.pythonhosted.org/packages/03/f7/b660dfdccd586cbc0bee2ca9d635f48de6cda82546dedae4ee510d07b9ca/jict-3.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c08eb203f2d836b091e4b301830448b388baea3638d12933160a0fb84e1525f5",
"md5": "b6ac1a5b2f3f20ea5f93942e61ff562e",
"sha256": "8dd83db686bff511de593e86fd6209f12ad580890c8a09ee9640e8ce4b1b0431"
},
"downloads": -1,
"filename": "jict-3.0.2.tar.gz",
"has_sig": false,
"md5_digest": "b6ac1a5b2f3f20ea5f93942e61ff562e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 11910,
"upload_time": "2024-09-10T13:02:10",
"upload_time_iso_8601": "2024-09-10T13:02:10.865671Z",
"url": "https://files.pythonhosted.org/packages/c0/8e/b203f2d836b091e4b301830448b388baea3638d12933160a0fb84e1525f5/jict-3.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-10 13:02:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "y-vas",
"github_project": "jict",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "jict"
}