<commit_before>structpack
==========

A Python library for serializing and deserializing object trees to JSON-compatable values (dicts, lists, strings, ints, floats, bools).


Installation
------------

The recommended way to install structpack is with [pip](http://pypi.python.org/pypi/pip/):

    pip install structpack


Examples
========

`structpack` is designed to be a base class (`msg`) that you inherit from and add properties to (`bool`, `int`, `float`, `string`, `list`, and `dict`).

The `msg` class adds methods `pack` and `load` which convert your object to and from native types, respectively.

The following is a trivial example of how to make a `Point` type using structpack

    import structpack
    class Point(structpack.msg):
        x = structpack.float
        y = structpack.float
        z = structpack.float
        def __init__(self, x, y, z):
            self.x = x
            self.y = y
            self.z = z

    >>> p1 = Point(1., 2., 3.)<commit_msg>add badges<commit_after>structpack
==========

A Python library for serializing and deserializing object trees to JSON-compatable values (dicts, lists, strings, ints, floats, bools).

[![Build Status](https://travis-ci.org/Knio/structpack.svg?branch=master)](https://travis-ci.org/Knio/structpack)
[![Coverage Status](https://coveralls.io/repos/Knio/structpack/badge.png)](https://coveralls.io/r/Knio/structpack)


Installation
------------

The recommended way to install structpack is with [pip](http://pypi.python.org/pypi/pip/):

    pip install structpack

[![PyPI version](https://badge.fury.io/py/structpack.png)](http://badge.fury.io/py/structpack)


Examples
========

`structpack` is designed to be a base class (`msg`) that you inherit from and add properties to (`bool`, `int`, `float`, `string`, `list`, and `dict`).

The `msg` class adds methods `pack` and `load` which convert your object to and from native types, respectively.

The following is a trivial example of how to make a `Point` type using structpack

    import structpack
    class Point(structpack.msg):
        x = structpack.float
        y = structpack.float
        z = structpack.float
        def __init__(self, x, y, z):
            self.x = x
            self.y = y
            self.z = z

    >>> p1 = Point(1., 2., 3.)
{'fraction_non_alphanumeric': 0.140986468790921, 'fraction_numerical': 0.003491924923614142, 'mean_word_length': 3.10752688172043, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3885181', 'n_tokens_mistral': 713, 'n_tokens_neox': 677, 'n_words': 236}