Deepwalker / trafaret

Ultimate transformation library that supports validation, contexts and aiohttp.
http://trafaret.readthedocs.org/en/latest/
BSD 2-Clause "Simplified" License
177 stars 31 forks source link

docs: Add more useful example for KeysSubset #96

Open Arfey opened 5 years ago

Arfey commented 5 years ago

Piece of code to think:

def mapping_region(order: Order) -> Dict[str, Any]:
    region = {
        'id': order.get('region_id'),
        'name': order.get('region_name')
    }

    return {'region': region}

KeysSubset('region_id', 'region_name'): mapping_region,
bogdan-zs commented 5 years ago

take this issue