bpmappers is a Python moudle that maps Python dictionary values and object properties to different dictionary.
Project description
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, 3.8
Django 1.11, 2.0, 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.
Develop
This project is hosted at Github: https://github.com/beproud/bpmappers
Maintainer
Shinya Okano <tokibito@gmail.com>
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bpmappers-1.1.tar.gz.
File metadata
- Download URL: bpmappers-1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
099b6a838759852d6e10278cb5e58f802181653b189e925dc2b130beb6c9185a
|
|
| MD5 |
223d5735bf4efdf08b7b9e8baec1c5c3
|
|
| BLAKE2b-256 |
fdcd7000f9a409f864021e174074398db4901f30a3a15d5a119de3fc4cb9e046
|
File details
Details for the file bpmappers-1.1-py2.py3-none-any.whl.
File metadata
- Download URL: bpmappers-1.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9e251199b9b4e4dbbd4f55c39dc7cfe5de9aad03da801053aec7c1303efe361
|
|
| MD5 |
6b79af582d26f67477395f0227806b6a
|
|
| BLAKE2b-256 |
23a51620b023f3c3ca9abed55b4a5703e73131bc43f183c01b7125bac1e45750
|