This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

dictremapper is remapping dict library

  • ordered (important)
  • support inheritance (of mapper)
  • support nested structure
  • (excludes option of each layer)

simple example

import requests
import json
from dictremapper import Remapper, Path


class SummaryRemapper(Remapper):
    fullname = Path("full_name")
    url = Path("html_url")
    description = Path("description")

url = "https://api.github.com/repos/podhmo/dictremapper"
data = requests.get(url).json()
data = SummaryRemapper()(data)
print(json.dumps(data, indent=2))

output

{
  "fullname": "podhmo/dictremapper",
  "url": "https://github.com/podhmo/dictremapper",
  "description": "remapping dict"
}

support inheritance (of mapper)

from dictremapper import Remapper, Path


class URLRemapper(Remapper):
    url = Path("html_url")


class DescriptionRemapper(Remapper):
    fullname = Path("full_name")
    description = Path("description")


class SummaryRemapper(URLRemapper, DescriptionRemapper):
    star = Path("stargazers_count")

url = "https://api.github.com/repos/podhmo/dictremapper"
data = requests.get(url).json()
remapped = SummaryRemapper()(data)
print(json.dumps(remapped, indent=2))

output

{
  "url": "https://github.com/podhmo/dictremapper",
  "fullname": "podhmo/dictremapper",
  "description": "remapping dict",
  "star": 0
}

If you want to change order. ChangeOrder is helpful, maybe.

from dictremapper import ChangeOrder


class SummaryRemapper2(URLRemapper, DescriptionRemapper):
    url = ChangeOrder(URLRemapper.url)
    description = ChangeOrder(DescriptionRemapper.description)
    star = Path("stargazers_count")

remapped = SummaryRemapper2()(data)
print(json.dumps(remapped, indent=2))

output

{
  "fullname": "podhmo/dictremapper",
  "url": "https://github.com/podhmo/dictremapper",
  "description": "remapping dict",
  "star": 0
}

support nested structure

class MyMapper3(Remapper):
    body = Path("body", callback=MyMapper())
    children = Path("children", callback=MyMapper2(many=True))

excludes option of each layer

 class MyMapper3(Remapper):
     body = Path("body", callback=MyMapper())
     children = Path("children", callback=MyMapper2(many=True, excludes=["object.name", "object.age", "id"]))

MyMapper3(excludes=["children.object.description", "body"])(d)
Release History

Release History

0.0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
dictremapper-0.0.2.tar.gz (3.7 kB) Copy SHA256 Checksum SHA256 Source Nov 23, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting