Unsigned variable-length integers
Project description
uvarint
Unsigned variable-length integers.
Usage
import uvarint
buffer = uvarint.encode(16384) # b'\x80\x80\x01'
integer, bytes_read = uvarint.decode(buffer) # 16384
big = uvarint.encode(2 ** 63)
uvarint.decode(big) # Raises OverflowError; decoder limited to 9 bytes by default
uvarint.decode(big, limit=16) # Success; use math.inf for unlimited decoding
multiple = uvarint.encode(100)
multiple += uvarint.encode(200)
multiple += uvarint.encode(300)
uvarint.expect(3, multiple).integers # [100, 200, 300]
References
License
This module is licensed under the MIT license.
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
uvarint-1.0.0.tar.gz
(3.0 kB
view details)
Built Distribution
File details
Details for the file uvarint-1.0.0.tar.gz
.
File metadata
- Download URL: uvarint-1.0.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b54d51b981391c22009fb176065f98cf5e0b88fd5d31136cce592de04bda526 |
|
MD5 | 945c797ccbc67dfa78702e858a781acc |
|
BLAKE2b-256 | 7372d0f9ba7ee26bb3e45b3df0ba9164ce2af8a5f930c18da805b648b3300731 |
Provenance
File details
Details for the file uvarint-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: uvarint-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a92b8ea70443d43a6b218dae70c9fd81b4087b107d83244232c36f3174c05a50 |
|
MD5 | a035080a7513cf4cebdd4dadfa2775eb |
|
BLAKE2b-256 | 270e9f69b05f1f22095ec156513f02e4c7bf5cf0d035eb6e9f5502de56165e7a |