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 2.7, 3.4, 3.5, 3.6, 3.7

  • Django>=1.11 (If 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/en/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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

bpmappers-1.0.1-py2.py3-none-any.whl (7.9 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for bpmappers-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e2be5917e93881a75aeb21e6968e5af974a0d3dbefac10a4f93b409c18ee01e0
MD5 552a758e4f8a51e35ff5342ac6fa79c4
BLAKE2b-256 c946d73c61ee8e21054f00bc722f192befbe6b2350a73ab195862012f28daf3c

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