Skip to main content

A util library for common patterns in python.

Project description

py-patterns

A util library for common patterns in python.

Supported patterns

  1. 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


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 details)

Uploaded Source

Built Distribution

py_patterns_util-0.1.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file py-patterns-util-0.1.1.tar.gz.

File metadata

  • Download URL: py-patterns-util-0.1.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.10 CPython/3.9.7 Darwin/20.6.0

File hashes

Hashes for py-patterns-util-0.1.1.tar.gz
Algorithm Hash digest
SHA256 433e529e52d592a8963e8878b41fdcbfd8ae57d50015915c355201c5c879ecd0
MD5 1d7e7ee08fc6ceaf92448f8b19cc0a65
BLAKE2b-256 0c0a06e8f382851d7f97340ef5e69323e3f2dbc5003be3b0119e83e27ab53218

See more details on using hashes here.

File details

Details for the file py_patterns_util-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: py_patterns_util-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.10 CPython/3.9.7 Darwin/20.6.0

File hashes

Hashes for py_patterns_util-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5e74109da98e312dd1316e06d102c5d45232a154fa761d7c7a891d56921da6a7
MD5 1f7d23593f2ae509cc0e8cef700fa481
BLAKE2b-256 decb6db980a262c78eb59f36c7cc2ec637e611fcff3b491b4422a60fa7443e35

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page