Skip to main content

Unpacking from bytes and packing into bytes, with an object interface.

Project description

ByteStory

Unpacking from bytes and packing into bytes, with an object interface.

Install

pip install bytestory

Usage

Unpacking from bytes

import bytestory

class OneByte(bytestory.ByteStory):
    a = bytestory.Char

one_byte = OneByte(b'\x11')

assert one_byte.a == 0x11

Packing into bytes

import bytestory

class OneByte(bytestory.ByteStory):
    a = bytestory.Char

one_byte = OneByte(a=0x11)

assert one_byte.pack() == b'\x11'

More examples at tests/test_bytestory.py.

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

bytestory-0.1.0.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

bytestory-0.1.0-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page