A util library for common patterns in python.
Project description
py-patterns
A util library for common patterns in python.
Supported patterns
- Adapters
Install
pip install py-patterns-util
Example
from py_patterns.adapters import Field, Adapter
class PersonAdapter(Adapter):
last_name = Field(source="person.last_name", dtype=str)
first_name = Field(source="person.first_name", dtype=str)
age = Field(source="person.age", dtype=int)
source_data = {"person": {"last_name": "Smith", "first_name": "John", "age": 30}}
# {"last_name": "Smith", "first_name": "John", "age": 30}
converted_data = PersonAdapter(source_data=source_data).convert()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-patterns-util-0.1.1.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for py_patterns_util-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e74109da98e312dd1316e06d102c5d45232a154fa761d7c7a891d56921da6a7 |
|
MD5 | 1f7d23593f2ae509cc0e8cef700fa481 |
|
BLAKE2b-256 | decb6db980a262c78eb59f36c7cc2ec637e611fcff3b491b4422a60fa7443e35 |