You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
python-benedict is a dict subclass with **keypath** support, **I/O** shortcuts (Base64, JSON, TOML, XML, YAML) and many **utilities**... for humans, obviously.
12
+
python-benedict is a dict subclass with **keypath** support, **I/O** shortcuts (Base64, JSON, TOML, XML, YAML, query-string) and many **utilities**... for humans, obviously.
13
13
14
14
## Index
15
15
-[Features](#features)
@@ -36,14 +36,17 @@ python-benedict is a dict subclass with **keypath** support, **I/O** shortcuts (
36
36
-[`remove`](#remove)
37
37
-[`subset`](#subset)
38
38
-[`swap`](#swap)
39
+
-[`unique`](#unique)
39
40
-[I/O](#io)
40
41
-[`from_base64`](#from_base64)
41
42
-[`from_json`](#from_json)
43
+
-[`from_query_string`](#from_query_string)
42
44
-[`from_toml`](#from_toml)
43
45
-[`from_xml`](#from_xml)
44
46
-[`from_yaml`](#from_yaml)
45
47
-[`to_base64`](#to_base64)
46
48
-[`to_json`](#to_json)
49
+
-[`to_query_string`](#to_query_string)
47
50
-[`to_toml`](#to_toml)
48
51
-[`to_xml`](#to_xml)
49
52
-[`to_yaml`](#to_yaml)
@@ -72,7 +75,7 @@ python-benedict is a dict subclass with **keypath** support, **I/O** shortcuts (
72
75
73
76
## Features
74
77
- Full **keypath** support *(using the dot syntax by default)*
75
-
- Easy **I/O operations** with most common formats: `Base64`, `JSON`, `TOML`, `XML`, `YAML`
78
+
- Easy **I/O operations** with most common formats: `Base64`, `JSON`, `TOML`, `XML`, `YAML`, `query-string`
76
79
- Many **utility** and **parse methods** to retrieve data as needed *(all methods listed below)*
77
80
- Well **tested**, check the badges ;)
78
81
- 100% **backward-compatible***(you can replace existing dicts without pain)*
@@ -97,7 +100,7 @@ d = benedict()
97
100
# or cast an existing dict
98
101
d = benedict(existing_dict)
99
102
100
-
# or create from data source (filepath, url or data-string) in a supported format (base64, json, toml, xml, yaml)
103
+
# or create from data source (filepath, url or data-string) in a supported format (base64, json, toml, xml, yaml, query-string)
101
104
d = benedict('https://localhost:8000/data.json')
102
105
103
106
# or in a Django view
@@ -241,7 +244,7 @@ d.merge(a, b, c)
241
244
```python
242
245
# Move an item from key_src to key_dst.
243
246
# It can be used to rename a key.
244
-
# If key_dst exists, it will be overwritten.
247
+
# If key_dst exists, its value will be overwritten.
245
248
d.move('a', 'b')
246
249
```
247
250
@@ -268,6 +271,13 @@ s = d.subset(['firstname', 'lastname', 'email'])
268
271
d.swap('firstname', 'lastname')
269
272
```
270
273
274
+
-#### unique
275
+
276
+
```python
277
+
# Remove duplicated values from the dict.
278
+
d.unique()
279
+
```
280
+
271
281
### I/O
272
282
273
283
It is possible to create a `benedict` instance directly from data source (filepath, url or data-string) by passing the data source as first argument in the constructor.
@@ -283,15 +293,17 @@ d = benedict('https://localhost:8000/data.xml')
Copy file name to clipboardExpand all lines: benedict/metadata.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,8 @@
2
2
3
3
__author__='Fabio Caccamo'
4
4
__copyright__='Copyright (c) 2019 Fabio Caccamo'
5
-
__description__='python-benedict is a dict subclass with keypath support, I/O shortcuts (json, toml, xml, yaml) and many utilities... for humans, obviously.'
5
+
__description__='python-benedict is a dict subclass with keypath support, I/O shortcuts (Base64, JSON, TOML, XML, YAML, query-string) and many utilities... for humans, obviously.'
0 commit comments