semvec/pypi-packages huggingface dataset:
todict 0.2.4
Export python objects as dictionnaries so they can then be easily serializable.
License: MIT

Python-todict
#############

Python-todict allows you to easily turn any python object into a dictionary.
It can then be easily serialized, to json for example.
The class of the object you want to convert needs to inherit from two mixin classes and hold an attribute listing the attributes to export.
List, dict, tuple and set attributes are supported and any attribute object that implements the mixins are recursively converted.

Usage
=====

    >>> from todict.mixins import ToDictMixin, FromDictMixin
    >>> class MyClass(ToDictMixin, FromDictMixin):
    ...     TO_SERIALIZE = ["my_attr"]
    ...     def __init__(self):
    ...         self.my_attr = "data"
    ...
    >>> MyClass().to_dict()
    {'my_attr': 'data'}
    >>> restored_obj = MyClass.from_dict({'my_attr': 'test'})
    >>> getattr(restored_obj, "my_attr")
    'test'

Installation
============

Python-todict can be installed with pip:

    $ pip install todict

Launch tests
============

    >>> pip install -r requirements-dev.txt
    >>> tox

* **Python**: 2.7, 3.6.
xweb-router 0.1.1
Router middleware for xweb.
License: MIT

# xweb-router

> Router middleware for [xweb](https://github.com/gaojiuli/xweb)


## Usage

```python
from xweb import App

from xweb_router import Router

app = App()
router = Router()
nested = Router()

app.use(router)


@router.use('/')
async def middleware(ctx, fn):
    """Router Middleware"""
    print('middleware')
    await fn()


@router.post('/')
async def home(ctx):
    ctx.body = "Home"


@router.get('/{name}')
async def hello(ctx):
    """URL parameters"""
    ctx.body = f"Hello {ctx.params.name}"


router.use('/post')(nested)


@nested.get('/index')
async def index(ctx):
    ctx.body = "Nested Index"


if __name__ == '__main__':
    app.listen(8000)

```

## Nested Router

```python

```