GithubHelp home page GithubHelp logo

limbs's Introduction

limbs

like mime, but simpler - a simple, human-readable file format

Simple I/O to flat text files with a header (composed of fields) and a body (arbitrary bytes). Ideal for no-hassle storage of some metadata and some large data that doesn't fit nicely into things like JSON (which becomes really hard to edit in a text editor if there's a 2 MB blob of numbers somewhere in it).

While the general format is the same as MIME/"internet messages" and most if not all "internet messages" can be parsed by this module there are a few distinctions. For starters the header is always UTF-8 encoded (which doesn't clash with the 7-bit-ASCII-padded-to-bytes used by internet messages). Field names are mangled to Python identifiers by stripping surrounding whitespace and dashes, turning them all lower case, replacing dashes (-) with underscores (_) and appending another underscore if the result is a reserved Python keyword. If the result of this is not a valid Python identifier, the field name is invalid.

When writing files from objects this translation is reversed (underscores replaced with dashes, surrounding dashes are removed and the result is title-cased).

Values are simple strings.

The optional body of a file is, in contrast to the header, not UTF-8, but rather treated as a byte string. If the body is text-like usage of UTF-8 is strongly advised.

Line endings in the header can be UNIX style (n, preferred) or Windows style (rn). Windows style endings are always converted to UNIX style endings when reading, and only UNIX style endings are written.

Primary APIs are dump, dumps, load and loads.

limbs's People

Contributors

enkore avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

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.