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 toobj
: 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 valueobj
: 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
Release history Release notifications | RSS feed
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.0.tar.gz
(14.9 kB
view hashes)
Built Distribution
parviflora-1.0.0-py3-none-any.whl
(14.9 kB
view hashes)
Close
Hashes for parviflora-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdf98e42b48de1151fed7355fc72fd2281cb9508f0de443e067a94572b189260 |
|
MD5 | 3fb911c4ee6f7efa4dad1a90487dff36 |
|
BLAKE2b-256 | d384eff4bead8c29ae20dba4e67b88089ddfa1446620ba640c9e1683f946db1c |