Skip to main content

bpmappers is a Python moudle that maps Python dictionary values and object properties to different dictionary.

Project description

build-status pypi docs

bpmappers is a Python moudle that maps Python dictionary values and object properties to different dictionary.

Install

Install using pip.

$ pip install bpmappers

Usage

An example of mapping an instance of the Person class to a dictionary:

>>> class Person:
...     def __init__(self, name, age):
...         self.name = name
...         self.age = age
...     def __repr__(self):
...         return "<Person name={}, age={}>".format(self.name, self.age)
...
>>> p = Person("Spam", 25)
>>> p
<Person name=Spam, age=25>
>>> from bpmappers import Mapper, RawField
>>> class PersonMapper(Mapper):
...     mapped_name = RawField('name')
...     mapped_age = RawField('age')
...
>>> PersonMapper(p).as_dict()
OrderedDict([('mapped_name', 'Spam'), ('mapped_age', 25)])

Requirements

  • Target Python version is 3.5, 3.6, 3.7, 3.8

  • Django 2.1, 2.2, 3.0 (When use Django support)

License

This software is licensed under the MIT License.

Documentation

The latest documentation is hosted at Read The Docs.

https://bpmappers.readthedocs.io/ja/stable/

Develop

This project is hosted at Github: https://github.com/beproud/bpmappers

Author

  • BeProud, Inc

Maintainer

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

bpmappers-1.2.tar.gz (263.2 kB view details)

Uploaded Source

Built Distribution

bpmappers-1.2-py2.py3-none-any.whl (8.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file bpmappers-1.2.tar.gz.

File metadata

  • Download URL: bpmappers-1.2.tar.gz
  • Upload date:
  • Size: 263.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.23.0 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.9

File hashes

Hashes for bpmappers-1.2.tar.gz
Algorithm Hash digest
SHA256 31f658a7087859a9455b7b280bc1e1e771eff99262169b861c3fcbfaa4d530c6
MD5 d3e9416071ed4903f9ff8be3c9e5ca8f
BLAKE2b-256 5589f37e8cd41833099d133b62cf2f5e8216b77fea07f9b64ed063565bb8bdba

See more details on using hashes here.

File details

Details for the file bpmappers-1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: bpmappers-1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.23.0 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.9

File hashes

Hashes for bpmappers-1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a6ed2d929f1c86c8c7cfe4004ed68c85678ceef3c985bf7b6a659a4aeb6d9f2a
MD5 514b71b634b4abd63d8147e1d9adf11e
BLAKE2b-256 b08b45c0648d9d98a9da2436e620498d4152673ed2f05312de2a99a4946014f6

See more details on using hashes here.

Supported by

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