Skip to content

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

License

Notifications You must be signed in to change notification settings

beproud/bpmappers

Repository files navigation

bpmappers

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.6, 3.7, 3.8, 3.9
  • Django 2.2, 3.0, 3.1 (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

Author

  • BeProud, Inc

Maintainer

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages