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

Python package for mapping objects to binary data. It works with Python 2.7+

Installation

Binmapper is available from https://pypi.python.org/pypi/binmapper and can be installed using pip

pip install binmapper

Example usage

import binmapper
import textwrap

definition = u"""\
    bintype BinX:
        field: uint8
    bintype Bin:
        fieldX: BinX
    """
definition = textwrap.dedent(definition)
binmap = binmapper.compile(definition)
bin = binmap.Bin()
input = io.BytesIO("\x01")
bin.parse(input)
print(bin.fieldX.field)

Data types

Type Byte Size Description
uint8 1 Unsigned byte
uint16 2 Unsigned short
uint32 4 Unsigned short
sint8 1 Signed byte
sint16 2 Signed short
sint32 4 Signed word
float 4 Floating point with single-precision
string n String
array n Array

Common class template

bintype CLASS_NAME:
    FIELD_NAME : FIELD_TYPE &FIELD_ATTRIBUTE
    ...
    &CLASS_ATTRIBUTE = CLASS_ATTRIBUTE_VALUE
    ...
    &LET_FIELD_NAME = EXPRESSION
    ...

Fields

Byteorder

Value Description
littlendian Increasing numeric significance with increasing memory addresses
bigendian Decreasing numeric significance with increasing memory addresses

Byteorder can be specified 3-way

  • Field attribute

    field: uint8 &byteorder=littlendian

    Apply only to field

  • BinType attribute

    :::python
    field: uint8
    &byteorder=littlendian
    

    Apply to all fields in BinType, except having attribute byteorder

  • Parse argument

    :::python
    bin.parse(input, byteorder='littlendian')
    

    Apply to all parsed data, except having attribute byteorder or BinType byteorder

Byteorder apply order:

`field byteorder > class byteorder > parse byteorder`

Class Usage

Array Usage

String Usage

Let Field Usage

Change elements in runtime

Release History

Release History

0.1a5

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.1a4

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.1a3

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.1a2

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.1a1

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.1a0

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
binmapper-0.1a5.zip (50.5 kB) Copy SHA256 Checksum SHA256 Source Jan 17, 2016

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