GithubHelp home page GithubHelp logo

scott-griffiths / bitformat Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 624 KB

A Python module for creating and parsing file formats, especially at the bit rather than byte level.

Home Page: https://bitformat.readthedocs.io/en/latest/index.html

License: MIT License

Python 100.00%
binary-format bitarray bitstring python

bitformat's Introduction

About me

Currently working at Graphcore in Bristol. We're making chips for AI. It's a cool place to be.


I'm still maintaining and improving the Python bitstring package.

bitstring

CI badge Docs Codacy Badge Dependents (via libraries.io)     Pepy Total Downlods PyPI - Downloads


My new project is a bitwise format parsing and building library called bitformat. I'm aiming for a first alpha release later in 2024.

bitformat

CI badge Docs Codacy Badge Dependents (via libraries.io)     Pepy Total Downlods PyPI - Downloads


I've not got much else on GitHub except my quixotic idea of a clock based on a Go board.

bitformat's People

Contributors

scott-griffiths avatar

Stargazers

 avatar

Watchers

 avatar

bitformat's Issues

Add a fieldtype that represents a series of fields of known length

This is really an efficiency issue, but looking at code like this:

    Repeat(1000, Format([
        'u8 <num1>',
        'uintle24 <num2>',
        'bool <bool1>',
        'u3 <num4>',
        'u4',
        'i8 * 3 <fixedarray1>',
        ]), 'items')

a lot of time is going to be spent parsing lots of small fields that we already know the lengths of.

Perhaps internally we could create a new type (let's call it Blob for now) that represents all the contiguous fields of known length. It also contains the internal lengths and names and can be transparently interrogated as if it's not present.

    Repeat(1000, Format([
        Blob(64, list_of_fields)
    ]), 'items')

but the Blob will print the same as its constituents so will look the same to the user. When being parsed it can just read its whole length for efficiency - it can later still be interrogated for its field information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.