Mapping data structures
Project description
Magicmapper
Unconventional (?) approach to mapping data from one object to another.
Usage
Check out test_magic.py for some examples. The fundamental idea is that we define a target schema which we can populate using the magicmapper. Consider the following source data
source_data = [
{
"person": {
"name": "foo1"
}
},
{
"person": {
"name": "foo2"
}
},
]
Say we'd like to map this to this
destination_data = [
{
"name": "foo1"
},
{
"name": "foo2"
},
]
This could be done with the following magicmapping
from magicmapper import magic_map, Schema, Value
magic_map([Schema({"name": Value("person") >> Value("name")})], test_source_data)
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 magicmapper-0.9.1.tar.gz.
File metadata
- Download URL: magicmapper-0.9.1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45eb9f2649de152979523e074fc76bab19da94d2b484ac8334c74fa77e7141d7
|
|
| MD5 |
933057d76edbb1f87afc6744dde8a175
|
|
| BLAKE2b-256 |
e4b300ab3a535fa308d667507ec617a8ad57715470691edcfd93c5372c135729
|
File details
Details for the file magicmapper-0.9.1-py3-none-any.whl.
File metadata
- Download URL: magicmapper-0.9.1-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e9d9d19717a4840cbf024d0846e205746f389cd094f9c9b1fbb295550a88f01
|
|
| MD5 |
2c47e9dd17c5314b580813f4a6646bfe
|
|
| BLAKE2b-256 |
eba6ace9ea47bc61460d381e9bb9c6552bbca865e1b76c7e95b48c6743f23dea
|