Skip to main content

gencbor

This is a simple generic CBOR (RFC8949) encoder / decoder which will not look at any tag values.

How to use

>>> import gencbor
>>> gencbor.encode(gencbor.Tag(0x1001, [3, 4, 5]))
b'\xd9\x10\x01\x83\x03\x04\x05'
>>> gencbor.decode(b'\xd9\x10\x01\x83\x03\x04\x05')
Tag(4097, (3, 4, 5))
>>> gencbor.encode(gencbor.Map([(0, 'int'), (0.0, 'float')]))
b'\xa2\x00cint\xf9\x00\x00efloat'
>>> gencbor.decode(gencbor.encode(gencbor.Map([(0, 'int'), (0.0, 'float')])))
Map({0: int, 0.0: float})
>>> gencbor.decode(gencbor.encode([gencbor.SimpleValue(i) for i in range(18, 24)]))
(SimpleValue(18), SimpleValue(19), False, True, None, undefined)
>>> 

General

  • The library is will treat 0 and 0.0 as distinct, i.e. both values can be in keys in the same map.

  • The library is also supposed to treat different nan values as different, but currently there is a bug when encoding non-standard nan values.

  • The library will check for well-formed-ness and for basic validity. It will not check for tag validity.

  • false, true and null will by default be decoded to False, True and None.

Release files for gencbor 0.1.2

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

Source distribution (sdist)

Source distribution for gencbor 0.1.2
File Size Uploaded
gencbor-0.1.2.tar.gz 12.3 kB Details

Built distribution (wheel)

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

Total release size: 20.1 kB

Release files / gencbor-0.1.2.tar.gz

Download URL gencbor-0.1.2.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
72df9b915ff1fc95365708941f42a655f9c45edb398dc669dbe0289dc87e9e5c
BLAKE2b-256 checksum
How to use checksums
034db026c3c3a72b2ecebf12b41eeeebb8b73791b78f423ce3314ab09a6c07b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.2

Release files / gencbor-0.1.2-py3-none-any.whl

Download URL gencbor-0.1.2-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
224c3cbb2849d02d5326b881948b77a430778f6ef14e2b742452cc70db1e6b20
BLAKE2b-256 checksum
How to use checksums
6676120b04ed7f2f5251a948163f1cc09d090bb84afcdb866a2f51b45412388d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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