python-benedict 0.33.2__tar.gz → 0.34.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python-benedict-0.33.2/python_benedict.egg-info → python_benedict-0.34.1}/PKG-INFO +11 -11
- {python-benedict-0.33.2 → python_benedict-0.34.1}/README.md +8 -7
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/keypaths.py +3 -2
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/__init__.py +4 -2
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/keylist/keylist_dict.py +6 -6
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/keypath/keypath_util.py +1 -1
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/metadata.py +1 -1
- {python-benedict-0.33.2 → python_benedict-0.34.1}/pyproject.toml +5 -4
- {python-benedict-0.33.2 → python_benedict-0.34.1/python_benedict.egg-info}/PKG-INFO +11 -11
- {python-benedict-0.33.2 → python_benedict-0.34.1}/LICENSE.txt +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/MANIFEST.in +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/__init__.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/__init__.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/clean.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/clone.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/dump.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/filter.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/find.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/flatten.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/groupby.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/invert.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/items_sorted.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/keylists.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/match.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/merge.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/move.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/nest.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/remove.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/rename.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/search.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/standardize.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/subset.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/swap.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/traverse.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/unflatten.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/core/unique.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/base/__init__.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/base/base_dict.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/io/__init__.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/io/io_dict.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/io/io_util.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/keyattr/__init__.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/keyattr/keyattr_dict.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/keylist/__init__.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/keylist/keylist_util.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/keypath/__init__.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/keypath/keypath_dict.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/parse/__init__.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/parse/parse_dict.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/dicts/parse/parse_util.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/exceptions.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/extras.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/__init__.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/abstract.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/base64.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/cli.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/csv.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/html.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/ini.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/json.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/pickle.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/plist.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/query_string.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/toml.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/xls.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/xml.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/serializers/yaml.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/utils/__init__.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/benedict/utils/type_util.py +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/python_benedict.egg-info/SOURCES.txt +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/python_benedict.egg-info/dependency_links.txt +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/python_benedict.egg-info/requires.txt +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/python_benedict.egg-info/top_level.txt +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/setup.cfg +0 -0
- {python-benedict-0.33.2 → python_benedict-0.34.1}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: python-benedict
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.34.1
|
|
4
4
|
Summary: python-benedict is a dict subclass with keylist/keypath/keyattr support, normalized I/O operations (base64, csv, ini, json, pickle, plist, query-string, toml, xls, xml, yaml) and many utilities... for humans, obviously.
|
|
5
5
|
Author-email: Fabio Caccamo <fabio.caccamo@gmail.com>
|
|
6
6
|
Maintainer-email: Fabio Caccamo <fabio.caccamo@gmail.com>
|
|
@@ -47,11 +47,10 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
47
47
|
Classifier: Natural Language :: English
|
|
48
48
|
Classifier: Operating System :: OS Independent
|
|
49
49
|
Classifier: Programming Language :: Python :: 3
|
|
50
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
51
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
52
50
|
Classifier: Programming Language :: Python :: 3.10
|
|
53
51
|
Classifier: Programming Language :: Python :: 3.11
|
|
54
52
|
Classifier: Programming Language :: Python :: 3.12
|
|
53
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
55
54
|
Classifier: Topic :: Education :: Testing
|
|
56
55
|
Classifier: Topic :: Software Development :: Build Tools
|
|
57
56
|
Classifier: Topic :: System :: Filesystems
|
|
@@ -121,7 +120,7 @@ python-benedict is a dict subclass with **keylist/keypath/keyattr** support, **I
|
|
|
121
120
|
- [Usage](#usage)
|
|
122
121
|
- [Basics](#basics)
|
|
123
122
|
- [Keyattr](#keyattr) `my_dict.x.y.z`
|
|
124
|
-
- [Keylist](#keylist) `my_dict["x", "y", "z"]`
|
|
123
|
+
- [Keylist](#keylist) `my_dict[["x", "y", "z"]]`
|
|
125
124
|
- [Keypath](#keypath) `my_dict["x.y.z"]`
|
|
126
125
|
- [Custom keypath separator](#custom-keypath-separator)
|
|
127
126
|
- [Change keypath separator](#change-keypath-separator)
|
|
@@ -218,22 +217,22 @@ d.keyattr_dynamic = True
|
|
|
218
217
|
> **Warning** - even if this feature is very useful, it has some obvious limitations: it works only for string keys that are *unprotected* (not starting with an `_`) and that don't clash with the currently supported methods names.
|
|
219
218
|
|
|
220
219
|
### Keylist
|
|
221
|
-
Wherever a **key** is used, it is possible to use also a **list
|
|
220
|
+
Wherever a **key** is used, it is possible to use also a **list of keys**.
|
|
222
221
|
|
|
223
222
|
```python
|
|
224
223
|
d = benedict()
|
|
225
224
|
|
|
226
225
|
# set values by keys list
|
|
227
|
-
d["profile", "firstname"] = "Fabio"
|
|
228
|
-
d["profile", "lastname"] = "Caccamo"
|
|
226
|
+
d[["profile", "firstname"]] = "Fabio"
|
|
227
|
+
d[["profile", "lastname"]] = "Caccamo"
|
|
229
228
|
print(d) # -> { "profile":{ "firstname":"Fabio", "lastname":"Caccamo" } }
|
|
230
229
|
print(d["profile"]) # -> { "firstname":"Fabio", "lastname":"Caccamo" }
|
|
231
230
|
|
|
232
231
|
# check if keypath exists in dict
|
|
233
|
-
print(["profile", "lastname"] in d) # -> True
|
|
232
|
+
print([["profile", "lastname"]] in d) # -> True
|
|
234
233
|
|
|
235
234
|
# delete value by keys list
|
|
236
|
-
del d["profile", "lastname"]
|
|
235
|
+
del d[["profile", "lastname"]]
|
|
237
236
|
print(d["profile"]) # -> { "firstname":"Fabio" }
|
|
238
237
|
```
|
|
239
238
|
|
|
@@ -546,7 +545,8 @@ items = d.items_sorted_by_values(reverse=False)
|
|
|
546
545
|
```python
|
|
547
546
|
# Return a list of all keypaths in the dict.
|
|
548
547
|
# If indexes is True, the output will include list values indexes.
|
|
549
|
-
|
|
548
|
+
# If sort is True, the resulting list will be sorted
|
|
549
|
+
k = d.keypaths(indexes=False, sort=True)
|
|
550
550
|
```
|
|
551
551
|
|
|
552
552
|
#### `match`
|
|
@@ -33,7 +33,7 @@ python-benedict is a dict subclass with **keylist/keypath/keyattr** support, **I
|
|
|
33
33
|
- [Usage](#usage)
|
|
34
34
|
- [Basics](#basics)
|
|
35
35
|
- [Keyattr](#keyattr) `my_dict.x.y.z`
|
|
36
|
-
- [Keylist](#keylist) `my_dict["x", "y", "z"]`
|
|
36
|
+
- [Keylist](#keylist) `my_dict[["x", "y", "z"]]`
|
|
37
37
|
- [Keypath](#keypath) `my_dict["x.y.z"]`
|
|
38
38
|
- [Custom keypath separator](#custom-keypath-separator)
|
|
39
39
|
- [Change keypath separator](#change-keypath-separator)
|
|
@@ -130,22 +130,22 @@ d.keyattr_dynamic = True
|
|
|
130
130
|
> **Warning** - even if this feature is very useful, it has some obvious limitations: it works only for string keys that are *unprotected* (not starting with an `_`) and that don't clash with the currently supported methods names.
|
|
131
131
|
|
|
132
132
|
### Keylist
|
|
133
|
-
Wherever a **key** is used, it is possible to use also a **list
|
|
133
|
+
Wherever a **key** is used, it is possible to use also a **list of keys**.
|
|
134
134
|
|
|
135
135
|
```python
|
|
136
136
|
d = benedict()
|
|
137
137
|
|
|
138
138
|
# set values by keys list
|
|
139
|
-
d["profile", "firstname"] = "Fabio"
|
|
140
|
-
d["profile", "lastname"] = "Caccamo"
|
|
139
|
+
d[["profile", "firstname"]] = "Fabio"
|
|
140
|
+
d[["profile", "lastname"]] = "Caccamo"
|
|
141
141
|
print(d) # -> { "profile":{ "firstname":"Fabio", "lastname":"Caccamo" } }
|
|
142
142
|
print(d["profile"]) # -> { "firstname":"Fabio", "lastname":"Caccamo" }
|
|
143
143
|
|
|
144
144
|
# check if keypath exists in dict
|
|
145
|
-
print(["profile", "lastname"] in d) # -> True
|
|
145
|
+
print([["profile", "lastname"]] in d) # -> True
|
|
146
146
|
|
|
147
147
|
# delete value by keys list
|
|
148
|
-
del d["profile", "lastname"]
|
|
148
|
+
del d[["profile", "lastname"]]
|
|
149
149
|
print(d["profile"]) # -> { "firstname":"Fabio" }
|
|
150
150
|
```
|
|
151
151
|
|
|
@@ -458,7 +458,8 @@ items = d.items_sorted_by_values(reverse=False)
|
|
|
458
458
|
```python
|
|
459
459
|
# Return a list of all keypaths in the dict.
|
|
460
460
|
# If indexes is True, the output will include list values indexes.
|
|
461
|
-
|
|
461
|
+
# If sort is True, the resulting list will be sorted
|
|
462
|
+
k = d.keypaths(indexes=False, sort=True)
|
|
462
463
|
```
|
|
463
464
|
|
|
464
465
|
#### `match`
|
|
@@ -2,11 +2,12 @@ from benedict.core.keylists import keylists
|
|
|
2
2
|
from benedict.utils import type_util
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
def keypaths(d, separator=".", indexes=False):
|
|
5
|
+
def keypaths(d, separator=".", indexes=False, sort=True):
|
|
6
6
|
separator = separator or "."
|
|
7
7
|
if not type_util.is_string(separator):
|
|
8
8
|
raise ValueError("separator argument must be a (non-empty) string.")
|
|
9
9
|
kls = keylists(d, indexes=indexes)
|
|
10
10
|
kps = [separator.join([f"{key}" for key in kl]) for kl in kls]
|
|
11
|
-
|
|
11
|
+
if sort:
|
|
12
|
+
kps.sort()
|
|
12
13
|
return kps
|
|
@@ -196,12 +196,14 @@ class benedict(KeyattrDict, KeypathDict, IODict, ParseDict):
|
|
|
196
196
|
"""
|
|
197
197
|
return _items_sorted_by_values(self, reverse=reverse)
|
|
198
198
|
|
|
199
|
-
def keypaths(self, indexes=False):
|
|
199
|
+
def keypaths(self, indexes=False, sort=True):
|
|
200
200
|
"""
|
|
201
201
|
Return a list of all keypaths in the dict.
|
|
202
202
|
If indexes is True, the output will include list values indexes.
|
|
203
203
|
"""
|
|
204
|
-
return _keypaths(
|
|
204
|
+
return _keypaths(
|
|
205
|
+
self, separator=self._keypath_separator, indexes=indexes, sort=sort
|
|
206
|
+
)
|
|
205
207
|
|
|
206
208
|
def match(self, pattern, indexes=True):
|
|
207
209
|
"""
|
|
@@ -8,7 +8,7 @@ class KeylistDict(BaseDict):
|
|
|
8
8
|
super().__init__(*args, **kwargs)
|
|
9
9
|
|
|
10
10
|
def __contains__(self, key):
|
|
11
|
-
if type_util.
|
|
11
|
+
if type_util.is_list(key):
|
|
12
12
|
return self._contains_by_keys(key)
|
|
13
13
|
return super().__contains__(key)
|
|
14
14
|
|
|
@@ -19,7 +19,7 @@ class KeylistDict(BaseDict):
|
|
|
19
19
|
return False
|
|
20
20
|
|
|
21
21
|
def __delitem__(self, key):
|
|
22
|
-
if type_util.
|
|
22
|
+
if type_util.is_list(key):
|
|
23
23
|
self._delitem_by_keys(key)
|
|
24
24
|
return
|
|
25
25
|
super().__delitem__(key)
|
|
@@ -35,7 +35,7 @@ class KeylistDict(BaseDict):
|
|
|
35
35
|
raise KeyError(f"Invalid keys: {keys!r}")
|
|
36
36
|
|
|
37
37
|
def __getitem__(self, key):
|
|
38
|
-
if type_util.
|
|
38
|
+
if type_util.is_list(key):
|
|
39
39
|
return self._getitem_by_keys(key)
|
|
40
40
|
return super().__getitem__(key)
|
|
41
41
|
|
|
@@ -46,7 +46,7 @@ class KeylistDict(BaseDict):
|
|
|
46
46
|
raise KeyError(f"Invalid keys: {keys!r}")
|
|
47
47
|
|
|
48
48
|
def __setitem__(self, key, value):
|
|
49
|
-
if type_util.
|
|
49
|
+
if type_util.is_list(key):
|
|
50
50
|
self._setitem_by_keys(key, value)
|
|
51
51
|
return
|
|
52
52
|
super().__setitem__(key, value)
|
|
@@ -55,7 +55,7 @@ class KeylistDict(BaseDict):
|
|
|
55
55
|
keylist_util.set_item(self, keys, value)
|
|
56
56
|
|
|
57
57
|
def get(self, key, default=None):
|
|
58
|
-
if type_util.
|
|
58
|
+
if type_util.is_list(key):
|
|
59
59
|
return self._get_by_keys(key, default)
|
|
60
60
|
return super().get(key, default)
|
|
61
61
|
|
|
@@ -68,7 +68,7 @@ class KeylistDict(BaseDict):
|
|
|
68
68
|
return default
|
|
69
69
|
|
|
70
70
|
def pop(self, key, *args):
|
|
71
|
-
if type_util.
|
|
71
|
+
if type_util.is_list(key):
|
|
72
72
|
return self._pop_by_keys(key, *args)
|
|
73
73
|
return super().pop(key, *args)
|
|
74
74
|
|
|
@@ -26,7 +26,7 @@ def parse_keys(keypath, separator):
|
|
|
26
26
|
"""
|
|
27
27
|
Parse keys from keylist or keypath using the given separator.
|
|
28
28
|
"""
|
|
29
|
-
if type_util.
|
|
29
|
+
if type_util.is_list(keypath):
|
|
30
30
|
keys = []
|
|
31
31
|
for key in keypath:
|
|
32
32
|
keys += parse_keys(key, separator)
|
|
@@ -77,11 +77,10 @@ classifiers = [
|
|
|
77
77
|
"Natural Language :: English",
|
|
78
78
|
"Operating System :: OS Independent",
|
|
79
79
|
"Programming Language :: Python :: 3",
|
|
80
|
-
"Programming Language :: Python :: 3.8",
|
|
81
|
-
"Programming Language :: Python :: 3.9",
|
|
82
80
|
"Programming Language :: Python :: 3.10",
|
|
83
81
|
"Programming Language :: Python :: 3.11",
|
|
84
82
|
"Programming Language :: Python :: 3.12",
|
|
83
|
+
"Programming Language :: Python :: 3.13",
|
|
85
84
|
"Topic :: Education :: Testing",
|
|
86
85
|
"Topic :: Software Development :: Build Tools",
|
|
87
86
|
"Topic :: System :: Filesystems",
|
|
@@ -167,11 +166,13 @@ exclude = '''
|
|
|
167
166
|
'''
|
|
168
167
|
|
|
169
168
|
[tool.ruff]
|
|
170
|
-
ignore = ["B905", "E501"]
|
|
171
169
|
line-length = 88
|
|
170
|
+
|
|
171
|
+
[tool.ruff.lint]
|
|
172
|
+
ignore = ["B905", "E501"]
|
|
172
173
|
select = ["B", "B9", "C", "E", "F", "W"]
|
|
173
174
|
|
|
174
|
-
[tool.ruff.mccabe]
|
|
175
|
+
[tool.ruff.lint.mccabe]
|
|
175
176
|
max-complexity = 10
|
|
176
177
|
|
|
177
178
|
[tool.setuptools.packages.find]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: python-benedict
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.34.1
|
|
4
4
|
Summary: python-benedict is a dict subclass with keylist/keypath/keyattr support, normalized I/O operations (base64, csv, ini, json, pickle, plist, query-string, toml, xls, xml, yaml) and many utilities... for humans, obviously.
|
|
5
5
|
Author-email: Fabio Caccamo <fabio.caccamo@gmail.com>
|
|
6
6
|
Maintainer-email: Fabio Caccamo <fabio.caccamo@gmail.com>
|
|
@@ -47,11 +47,10 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
47
47
|
Classifier: Natural Language :: English
|
|
48
48
|
Classifier: Operating System :: OS Independent
|
|
49
49
|
Classifier: Programming Language :: Python :: 3
|
|
50
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
51
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
52
50
|
Classifier: Programming Language :: Python :: 3.10
|
|
53
51
|
Classifier: Programming Language :: Python :: 3.11
|
|
54
52
|
Classifier: Programming Language :: Python :: 3.12
|
|
53
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
55
54
|
Classifier: Topic :: Education :: Testing
|
|
56
55
|
Classifier: Topic :: Software Development :: Build Tools
|
|
57
56
|
Classifier: Topic :: System :: Filesystems
|
|
@@ -121,7 +120,7 @@ python-benedict is a dict subclass with **keylist/keypath/keyattr** support, **I
|
|
|
121
120
|
- [Usage](#usage)
|
|
122
121
|
- [Basics](#basics)
|
|
123
122
|
- [Keyattr](#keyattr) `my_dict.x.y.z`
|
|
124
|
-
- [Keylist](#keylist) `my_dict["x", "y", "z"]`
|
|
123
|
+
- [Keylist](#keylist) `my_dict[["x", "y", "z"]]`
|
|
125
124
|
- [Keypath](#keypath) `my_dict["x.y.z"]`
|
|
126
125
|
- [Custom keypath separator](#custom-keypath-separator)
|
|
127
126
|
- [Change keypath separator](#change-keypath-separator)
|
|
@@ -218,22 +217,22 @@ d.keyattr_dynamic = True
|
|
|
218
217
|
> **Warning** - even if this feature is very useful, it has some obvious limitations: it works only for string keys that are *unprotected* (not starting with an `_`) and that don't clash with the currently supported methods names.
|
|
219
218
|
|
|
220
219
|
### Keylist
|
|
221
|
-
Wherever a **key** is used, it is possible to use also a **list
|
|
220
|
+
Wherever a **key** is used, it is possible to use also a **list of keys**.
|
|
222
221
|
|
|
223
222
|
```python
|
|
224
223
|
d = benedict()
|
|
225
224
|
|
|
226
225
|
# set values by keys list
|
|
227
|
-
d["profile", "firstname"] = "Fabio"
|
|
228
|
-
d["profile", "lastname"] = "Caccamo"
|
|
226
|
+
d[["profile", "firstname"]] = "Fabio"
|
|
227
|
+
d[["profile", "lastname"]] = "Caccamo"
|
|
229
228
|
print(d) # -> { "profile":{ "firstname":"Fabio", "lastname":"Caccamo" } }
|
|
230
229
|
print(d["profile"]) # -> { "firstname":"Fabio", "lastname":"Caccamo" }
|
|
231
230
|
|
|
232
231
|
# check if keypath exists in dict
|
|
233
|
-
print(["profile", "lastname"] in d) # -> True
|
|
232
|
+
print([["profile", "lastname"]] in d) # -> True
|
|
234
233
|
|
|
235
234
|
# delete value by keys list
|
|
236
|
-
del d["profile", "lastname"]
|
|
235
|
+
del d[["profile", "lastname"]]
|
|
237
236
|
print(d["profile"]) # -> { "firstname":"Fabio" }
|
|
238
237
|
```
|
|
239
238
|
|
|
@@ -546,7 +545,8 @@ items = d.items_sorted_by_values(reverse=False)
|
|
|
546
545
|
```python
|
|
547
546
|
# Return a list of all keypaths in the dict.
|
|
548
547
|
# If indexes is True, the output will include list values indexes.
|
|
549
|
-
|
|
548
|
+
# If sort is True, the resulting list will be sorted
|
|
549
|
+
k = d.keypaths(indexes=False, sort=True)
|
|
550
550
|
```
|
|
551
551
|
|
|
552
552
|
#### `match`
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python-benedict-0.33.2 → python_benedict-0.34.1}/python_benedict.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|