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
*`mapper_type=` - mapper type for storing KeyValues. It must have the `dict` interface, i.e. allow to do `mapper[key] = value` operations. For example you can use the `dict` type. Instance's attribute. Default: `collections.OrderedDict` (stores the keys in the order they have been added)
30
-
*`key_modifier=` - functions for modifying the key before its additions. For example `key_modifier=str.lower` will make all the keys to be lowercase. Instance's attribute. Default: `None`
29
+
*`mapper_type=` - mapper type for storing KeyValues. It must have the `dict` interface, i.e. allow to do `mapper[key] = value` operations. For example you can use the `dict` type. **Instance's attribute**. Default: `collections.OrderedDict` (stores the keys in the order they have been added)
30
+
*`key_modifier=` - functions for modifying the key before its additions. For example `key_modifier=str.lower` will make all the keys to be lowercase. **Instance's attribute**. Default: `None`
31
31
32
-
To create `KeyValues` instance **from your own object with `dict` interface** (and instance's attribute `mapper_type` will be set to type of passed `mapper=` object):
32
+
To create `KeyValues` instance **from your own object with `dict` interface**:
33
33
34
34
```python
35
35
kv = KeyValues(mapper=)
36
36
```
37
37
38
-
All these instantiation variants have common optional parameter `key_sorter=`. It's a sorting function which will be applied to keys when you use methods `dump()` or `write()` (or `print(kv)`, which is in fact shortcut for `print(kv.dump())`). For example you can use `key_sorter=sorted` and keys will be represented in alphabetical ascending order; `key_sorter=reversed` for reverse order. Instance's attribute. Default: `None`
38
+
Instance's attribute `mapper_type` will be set to type of passed `mapper=` object.
39
+
40
+
All these instantiation variants have common optional parameter `key_sorter=`. It's a sorting function which will be applied to keys when you use methods `dump()` or `write()` (or `print(kv)`, which is in fact shortcut for `print(kv.dump())`). For example you can use `key_sorter=sorted` and keys will be represented in alphabetical ascending order; `key_sorter=reversed` for reverse order. **Instance's attribute**. Default: `None`
39
41
40
42
### Methods
41
43
*`parse(filename)` - parses the VDF file to `dict` interface representation, i.e. KeyValues can be accessed and modified by `kv[key] = value` operations. Optional arguments:
0 commit comments