source: trunk/src/allmydata/util/cbor.py

Last change on this file was fced1ab0, checked in by Itamar Turner-Trauring <itamar@…>, at 2024-01-24T18:50:55Z

Switch to using pycddl for CBOR decoding.

  • Property mode set to 100644
File size: 513 bytes
Line 
1"""
2Unified entry point for CBOR encoding and decoding.
3
4Makes it less likely to use ``cbor2.loads()`` by mistake, which we want to avoid.
5"""
6
7# We don't want to use the C extension for loading, at least for now, but using
8# it for dumping should be fine.
9from cbor2 import dumps, dump
10
11def load(*args, **kwargs):
12    """
13    Don't use this!  Here just in case someone uses it by mistake.
14    """
15    raise RuntimeError("Use pycddl for decoding CBOR")
16
17loads = load
18
19__all__ = ["dumps", "loads", "dump", "load"]
Note: See TracBrowser for help on using the repository browser.