Skip to main content

The tool for creating notes

Project description

https://travis-ci.org/Krukov/reformer.svg?branch=master https://img.shields.io/coveralls/Krukov/reformer.svg

Simple and beautiful library for data formatting/convert/serialize

Installation

pip install reformer

How to use

To define schema you need to create Reformer base class:

from reformer import Reformer, link

class Schema(Reformer):

    fullname = link.name.replace('_', '-')  + ' ' + link.surname

The main abstraction of the reformer is a link. It represent access to the target object. You can manipulate fields as you would do it with a real object, except a few operations that have alias in link object. This methods are: iter_, in_, contains_, to_, choice_, call_:

from reformer import Reformer, link, item

class Schema(Reformer):

    admin = link.username.in_(['admin', 'root'])
    welcome = link.username.choice_(
        {'admin': 'Hi bro', 'root': 'God?'},
        default='who are you?'
    )

item - another child abstraction as link, but for item of iterated object:

from reformer import Reformer, link, item

class Schema(Reformer):

    fullname = link.name + ' ' + link.surname
    posts_titles = link.posts.iter_([item.title])

FUTURE

  • errors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reformer-0.0.3.tar.gz (3.6 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page