Skip to main content

py-patterns

A util library for common patterns in python.

Supported patterns

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

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: py-patterns-util-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 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.0.tar.gz
Algorithm Hash digest
SHA256 983e2334322095bcefba5c1c8b6c71c012771a0c1eece02bca7f58382d2214f1
MD5 341c990ddb1fb658d86ff7e007aa1495
BLAKE2b-256 29d26f44a86c8821b4b4dbd406ae40be10b168f68cf43718d6da9daa3d6909e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_patterns_util-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e1efb0cd377f8cc698269cf8ff9a04c37fdd4484a8f6ae3c4b4252e5093e2ac
MD5 a29afb78cc1d7c9c751a79e5d4760ae5
BLAKE2b-256 a01d6ec3eddde27667089825b3b852957c4688ab6462866a767b391b39bdc314

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page