Skip to content

Commit 95cf96c

Browse files
committed
Update README.md
1 parent 5bb9763 commit 95cf96c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,18 @@ Now you can access KeyValues with `dict` interface, i.e. with `kv[key] = value`
2626
When you create `KeyValues` instance from VDF file you can specify these optional parameters:
2727

2828
* `encoding=""` - input VDF file encoding. Default: `utf-8`
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`
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`
3131

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**:
3333

3434
```python
3535
kv = KeyValues(mapper=)
3636
```
3737

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`
3941

4042
### Methods
4143
* `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

Comments
 (0)