Skip to content

Commit ad86aa5

Browse files
committed
Update README.md
1 parent ddbf139 commit ad86aa5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ To create `KeyValues` instance **from VDF file**:
2121
kv = KeyValues(filename="")
2222
```
2323

24+
Now you can access KeyValues with `dict` interface, i.e. with `kv[key] = value` operations.
25+
2426
When you create `KeyValues` instance from VDF file you can specify these optional parameters:
2527

2628
* `encoding=""` - input VDF file encoding. Default: `utf-8`
@@ -33,10 +35,10 @@ To create `KeyValues` instance **from your own object with `dict` interface** (a
3335
kv = KeyValues(mapper=)
3436
```
3537

36-
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 order; `key_sorter=reversed` for reverse order. Instance's attribute. Default: `None`
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`
3739

3840
### Methods
39-
* `parse(filename)` - parses the VDF file to `dict` interface representation, i.e. KeyValues can be accessed and modified by `mapper[key] = value` operations. Optional arguments:
41+
* `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:
4042
* `encoding=""` - input VDF file encoding. Default: `utf-8`
4143
* `mapper_type=` - [see Instantiation section](README.md#instantiation). This will override the instance's attribute `mapper_type`. Default: `collections.OrderedDict` (stores the keys in the order they have been added)
4244
* `key_modifier=` - [see Instantiation section](README.md#instantiation). This will override the instance's attribute `key_modifier`. Default: `None`
@@ -61,3 +63,7 @@ Of course the class KeyValues also provides the standard `dict` interface method
6163
*example_02.py* - using the optional functions
6264

6365
*example_03.py* - "advanced" uses
66+
67+
# What is missing
68+
69+
Generally the checking of VDF file syntax, i.e. if brackets are closed and so on. The only check is if after `"key"` is a starting bracket `{`.

0 commit comments

Comments
 (0)