pypacker
Encode / Decode arbitrary data into a string.
Op Codes (type codes):
Int Number i
Float Number f
Character c
String s
Binary b
List a (array) gets encoded as extended
Tuple t gets encoded as extended (x)
Dict d gets encoded as extended (x)
Extended x encoded as new packer string (recursive)
Usage:
arr_of_data = [datax, [ datay], { dataz : valz } ... etc]
formatstr = ""
pb = packbin()
newdata = pb.encode_data(formatstr, arr_of_data)
decdata = pb.decode_data(newdata)
?assert?(decdata == arr_of_data)
Empty format string will use the auto-detected types: (recommended)
newdata = pb.encode_data("", arr_of_data)
Preserves type and data. It is (mostly) 7/8 bit clean on
both python2 and python 3.
Note: python2 'bytes' type is a place holder - avoid encoding bytes on python 2
and decoding bytes on python 3; or at least be aware of the issues. This does
not effect the decoded data, but it does effect the cypher text.
The following comes into play when one encodes data with python 2 and
decodes it in python 3.
Python V2 and V3 str / bytes differences. In python 2 the 'bytes' type is
an alias to the str type. It accommodates the whole palette of numbers in
py2; thus we detect binary by looking at the str and seeing if non printable
characters are present. (the character < ' ' or > 'del')
This works well, however we consider it a work-around; so please be aware.
If you assure both encoder and decoder are the same python version, this
issue does not exist.
History:
Sat 18.Feb.2023 decode binary after done decomposing it
Mon 18.Dec.2023 moved to pypacker dir
Tue 19.Dec.2023 test for python2 python 3 -- note: bytes / v2 v3 differences
Thu 21.Dec.2023 cleanmup, docs, etc ...
Pytest results:
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.0.0
rootdir: /home/peterglen/pgpygtk/pypacker/tests
collected 20 items
test_arr.py .. [ 10%]
test_bin.py .. [ 20%]
test_complex.py .. [ 30%]
test_dict.py . [ 35%]
test_float.py .. [ 45%]
test_int.py .. [ 55%]
test_packer.py ...... [ 85%]
test_str.py ... [100%]
============================== 20 passed in 0.09s ==============================
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.11.0, pluggy-0.13.1
rootdir: /home/peterglen/pgpygtk/pypacker/tests
collected 20 items
test_arr.py .. [ 10%]
test_bin.py .. [ 20%]
test_complex.py .. [ 30%]
test_dict.py . [ 35%]
test_float.py .. [ 45%]
test_int.py .. [ 55%]
test_packer.py ...... [ 85%]
test_str.py ... [100%]
========================== 20 passed in 0.12 seconds ===========================
EOF
Metadata
Release files for pyvpacker 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyvpacker-1.1.tar.gz | 8.6 kB | Without provenance | Details for pyvpacker-1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyvpacker-1.1-py3-none-any.whl | Python 3 | none | any | Details for pyvpacker-1.1-py3-none-any.whl |
Total release size: 16.3 kB
Release files / pyvpacker-1.1.tar.gz
| Download URL | pyvpacker-1.1.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da368d699b55de109b1d8e6af76bfcdc3f93549493153b5a405ecd4e2bd423fd
|
|
BLAKE2b-256 checksum How to use checksums |
6294c15144b17b562ae3bee2c2b78c18f35bc6cb25c8e5e18b076cf7fa10a727
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.28.2 rfc3986/1.5.0 tqdm/4.64.1 urllib3/1.26.5 CPython/3.10.12
|
Release files / pyvpacker-1.1-py3-none-any.whl
| Download URL | pyvpacker-1.1-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2aad4946b6e5ff6fdfb93105eeacfca4d199bea794fe4f2b189d7b59175de115
|
|
BLAKE2b-256 checksum How to use checksums |
a1be431fbf0992f81de75b842d24403fc627f8adfdf05181899398d5f68c13f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.28.2 rfc3986/1.5.0 tqdm/4.64.1 urllib3/1.26.5 CPython/3.10.12
|
Security for pyvpacker 1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.