Skip to main content

uvarint

Unsigned variable-length integers. A type of variable-length quantity.

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]
uvarint.cut(0, multiple)                # Slice(integers=[], rest=b'd\xc8\x01\xac\x02')
uvarint.cut(1, multiple)                # Slice(integers=[100], rest=b'\xc8\x01\xac\x02')
uvarint.cut(2, multiple)                # Slice(integers=[100, 200], rest=b'\xac\x02')
uvarint.cut(3, multiple)                # Slice(integers=[100, 200, 300], rest=b'')

References

License

This module is licensed under the MIT license.

Metadata

Release files for uvarint 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uvarint 1.2.0
File Size Uploaded Provenance Actions
uvarint-1.2.0.tar.gz 3.4 kB Without provenance Details for uvarint-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for uvarint 1.2.0
File Interpreter ABI Platform Actions
uvarint-1.2.0-py3-none-any.whl Python 3 none any Details for uvarint-1.2.0-py3-none-any.whl

Total release size: 7.8 kB

Release files / uvarint-1.2.0.tar.gz

Download URL uvarint-1.2.0.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7cc17481c9af8ebe3978f5357412b57ff93ce8b14712236338f782cc8ae9a989
BLAKE2b-256 checksum
How to use checksums
faec8ef0e69448c879b4319337aa2deb49bf493f3b42d930fcc8bf71c4cf30ea
Upload date
Uploaded using Trusted Publishing?
What is 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.1 CPython/3.8.0

Release files / uvarint-1.2.0-py3-none-any.whl

Download URL uvarint-1.2.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dcc98ad92b642c57494bed9370c4f93479d2d36223b2c3702823f0aa8b1a9a3
BLAKE2b-256 checksum
How to use checksums
306fc51f9f0d9c5345121c73de882ae22a7206ecb8e5b072c217a90f4abdea06
Upload date
Uploaded using Trusted Publishing?
What is 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.1 CPython/3.8.0

Security for uvarint 1.2.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page