Skip to content

Commit

Permalink
Updated version and README.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocaccamo committed May 20, 2019
1 parent 915d92f commit 6afef2c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 8 deletions.
31 changes: 25 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@
python-benedict is the Python dictionary for humans dealing with evil data.

## Features
- Full **keypath** support *(using the dot syntax)*
- Many **utility methods** to retrieve data as needed *(all methods listed below)*
- Full **keypath** support *(using the dot syntax)*
- Many **utility methods** to retrieve data as needed *(all methods listed below)*
- 100% **backward-compatible** *(you can replace existing dicts without pain)*

## Requirements
- Python 3.4, 3.5, 3.6, 3.7
- Python 3.4, 3.5, 3.6, 3.7

## Installation
- Run `pip install python-benedict`
- Run `pip install python-benedict`

## Testing
- Run `tox` / `python setup.py test`
- Run `tox` / `python setup.py test`

## Usage
`benedict` is a dict subclass, so it is possible to use it as a normal dict *(you can just cast an existing dict)*.
Expand All @@ -39,11 +40,29 @@ print(d['profile']) # -> { 'firstname':'Fabio', 'lastname':'Caccamo' }
print('profile.lastname' in d) # -> True
```

### Extra methods

```python
# Return a deepcopy of the dict.
d.deepcopy()
```

```python
# Return a list of all keypaths in the dict.
d.get_keypaths()
```

### Utility methods

```python
# Get value by key or keypath trying to return it as bool.
# Values like `1`, `true`, `yes`, `on` will be returned as `True`.
# Values like `1`, `true`, `yes`, `on`, `ok` will be returned as `True`.
d.get_bool(key, default=False)
```

```python
# Get value by key or keypath trying to return it as bool.
# Values like `1`, `true`, `yes`, `on`, `ok` will be returned as `True`.
d.get_bool(key, default=False)
```

Expand Down
16 changes: 15 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Features
- Full **keypath** support *(using the dot syntax)*
- Many **utility methods** to retrieve data as needed *(all methods
listed below)*
- 100% **backward-compatible** *(you can replace existing dicts without pain)*

Requirements
------------
Expand Down Expand Up @@ -49,13 +50,26 @@ Basic get/set using keypath
print(d['profile']) # -> { 'firstname':'Fabio', 'lastname':'Caccamo' }
print('profile.lastname' in d) # -> True
Extra methods
^^^^^^^^^^^^^

.. code:: python
# Return a deepcopy of the dict.
d.deepcopy()
.. code:: python
# Return a list of all keypaths in the dict.
d.get_keypaths()
Utility methods
^^^^^^^^^^^^^^^

.. code:: python
# Get value by key or keypath trying to return it as bool.
# Values like `1`, `true`, `yes`, `on` will be returned as `True`.
# Values like `1`, `true`, `yes`, `on`, `ok` will be returned as `True`.
d.get_bool(key, default=False)
.. code:: python
Expand Down
2 changes: 1 addition & 1 deletion benedict/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
__description__ = 'python-benedict is the Python dictionary for humans dealing with evil data.'
__license__ = 'MIT'
__title__ = 'benedict'
__version__ = '0.1.0'
__version__ = '0.2.0'

0 comments on commit 6afef2c

Please sign in to comment.