← index #648PR #821
Off-topic · high · value 2.264
QUERY · ISSUE

Undefined function in CBOR library

openby Tangerinoopened 2023-04-20updated 2024-10-12
enhancement

In CBOR library there are a couple of unidentified functions such as:

unpack_float16

def decode_float16(decoder):
    payload = decoder.read(2)
    return unpack_float16(payload)

and

undefined

special_decoders = {
    20: lambda self: False,
    21: lambda self: True,
    22: lambda self: None,
    23: lambda self: undefined,
    24: decode_simple_value,
    25: decode_float16,
    26: decode_float32,
    27: decode_float64,
    31: lambda self: break_marker,
}
3 comments
jimmo · 2023-07-21

@iabdalkader hi Ibrahim, would you be able to take a look at this? Thanks

iabdalkader · 2023-07-21

It seems it was not implemented in the original library, I have no idea why, but it should be easy to add.

jonnor · 2024-08-25

Anyone want to make a MR for this functionality? :)

CANDIDATE · PULL REQUEST

Senml/cbor2 update.

mergedby iabdalkaderopened 2024-03-06updated 2024-03-19

This update deprecates the decoder and encoder module, to maintain compatibility with the CPython cbor2 on pypi. The cbor2 module should now be imported and used directly instead of the decoder/encoder modules, for example:

import cbor2
cbor2.dumps(...)

The senml library, which uses cbor2, is updated to use the new API.

1 comment
dpgeorge · 2024-03-19

Thanks, this is a good improvement, to make cbor2 match CPython.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied