Skip to main content

Implementation of the Permuatio wire format

Project description

parviflora is a binary exchange format

Permuatio uses a binary format called parviflora. This is a python implementation of said format.

Usage

The module exports main 2 methods write_msg and read_msg, as well as their safe (non-exception throwing) counterparts safe_write_msg and safe_read_msg.

Documentation:

write_msg

Takes 2 argumentss

  • file: a BufferedWriter that can have binary values write to
  • obj: one of the types that parviflora can represent, that will be writen

safe_write_msg

Takes 2 argument:

  • filename: a filename that the file should be written to, should there not be issues with writing the value
  • obj: as in above

It also returns 1 value: Either None or str which is an error string

read_msg

Takes 1 argument:

  • file: a BufferedReader that can have binary values read from

It also returns 1 value: an object that has been read from the file.

safe_read_msg

Takes 1 argument:

  • filename: a filename that the file should be read from

It also returns 1 value: an object that has been read from the file or an error.

Example

import binformat

safe_write_msg("hexxy", {
    1: b"Hello world",
    2: [1, 2, 3]
})

with open("hexxy", "rb") as f:
    print(read_msg(f))
    # { 1: b"Hello world", 2: [1, 2, 3] }

Testing

Run tests.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

parviflora-1.0.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parviflora-1.0.1-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file parviflora-1.0.1.tar.gz.

File metadata

  • Download URL: parviflora-1.0.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.9 Darwin/22.2.0

File hashes

Hashes for parviflora-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2ae06cffe90c7a31b4bd9eba9044f34dad89445408a3cc08c54c5556def05930
MD5 c4e12f094d7a496553698d1cec627eb3
BLAKE2b-256 dfe3ab0c5e23394c66a7108e4cd3eb497ebbe54d2ff9ba5c452285509e7e78d5

See more details on using hashes here.

File details

Details for the file parviflora-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: parviflora-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.9 Darwin/22.2.0

File hashes

Hashes for parviflora-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 256b850162c50fb237eeee107ed7ef06eb80827b13838a852672502cd2dd72db
MD5 28d93e33848310d7c44f2d29338f78f9
BLAKE2b-256 df12a5bd2d1076ec99c219f89fdb633d1fcbb6acce9e474d613d5e5304c9d51f

See more details on using hashes here.

Supported by

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