A util library for common patterns in python.
Project description
py-patterns
A util library for common patterns in python.
Supported patterns
- Adapters
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.0.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for py_patterns_util-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e1efb0cd377f8cc698269cf8ff9a04c37fdd4484a8f6ae3c4b4252e5093e2ac |
|
MD5 | a29afb78cc1d7c9c751a79e5d4760ae5 |
|
BLAKE2b-256 | a01d6ec3eddde27667089825b3b852957c4688ab6462866a767b391b39bdc314 |