cbor2: Deprecate decoder and encoder modules.

Deprecate decoder and encoder modules to maintain compatibility with the
CPython cbor2 module.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
pull/821/head
iabdalkader 2024-03-06 12:04:43 +01:00 zatwierdzone przez Damien George
rodzic 5c7e3fc0bc
commit 8ee876dcd6
5 zmienionych plików z 11 dodań i 7 usunięć

Wyświetl plik

@ -24,5 +24,10 @@ THE SOFTWARE.
""" """
from . import decoder from ._decoder import CBORDecoder
from . import encoder from ._decoder import load
from ._decoder import loads
from ._encoder import CBOREncoder
from ._encoder import dump
from ._encoder import dumps

Wyświetl plik

@ -24,16 +24,15 @@ THE SOFTWARE.
""" """
from cbor2 import encoder import cbor2
from cbor2 import decoder
input = [ input = [
{"bn": "urn:dev:ow:10e2073a01080063", "u": "Cel", "t": 1.276020076e09, "v": 23.5}, {"bn": "urn:dev:ow:10e2073a01080063", "u": "Cel", "t": 1.276020076e09, "v": 23.5},
{"u": "Cel", "t": 1.276020091e09, "v": 23.6}, {"u": "Cel", "t": 1.276020091e09, "v": 23.6},
] ]
data = encoder.dumps(input) data = cbor2.dumps(input)
print(data) print(data)
print(data.hex()) print(data.hex())
text = decoder.loads(data) text = cbor2.loads(data)
print(text) print(text)

Wyświetl plik

@ -1,3 +1,3 @@
metadata(version="0.1.0", pypi="cbor2") metadata(version="1.0.0", pypi="cbor2")
package("cbor2") package("cbor2")