A mapping tool from model to dictionary.
Project description
A mapping tool from model to dictionary.
>>> from bpmappers import Mapper, RawField >>> class SpamMapper(Mapper): ... spam = RawField('foo') ... egg = RawField('bar') ... >>> >>> SpamMapper(dict(foo=123, bar='abc')).as_dict() {'egg': 'abc', 'spam': 123} >>> >>> class FooModel(object): ... def __init__(self, foo, bar): ... self.foo = foo ... self.bar = bar ... >>> SpamMapper(FooModel(foo=123, bar='abc')).as_dict() {'egg': 'abc', 'spam': 123} >>> >>> class HogeMapper(Mapper): ... hoge = RawField('hoge.piyo.fuga') ... >>> HogeMapper({'hoge': {'piyo': {'fuga': 123}}}).as_dict() {'hoge': 123}
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
bpmappers-0.8.tar.gz
(15.7 MB
view details)
Built Distribution
File details
Details for the file bpmappers-0.8.tar.gz
.
File metadata
- Download URL: bpmappers-0.8.tar.gz
- Upload date:
- Size: 15.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9d26ca5766adcba17df0c6dcbd4fe8a177cfda717191f048cbc8d6175966003 |
|
MD5 | 962a335fcdd20f311303d6a0f473830e |
|
BLAKE2b-256 | 4f6976c16663e29babd591ff76d7709133934314a8a86a084f9df1589e1cc6a7 |
File details
Details for the file bpmappers-0.8-py2.py3-none-any.whl
.
File metadata
- Download URL: bpmappers-0.8-py2.py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b64d7f6febb7c09774367ad79de7a8378e2bff457472f946082c1a55937753de |
|
MD5 | 370d7993bac809bcd221ce8d327ed88f |
|
BLAKE2b-256 | e032c335ff0b926182018c146c73fa8772bd07acc5843cbe898cf92a06bea069 |