cborx 0.2.3__cp315-cp315-win_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cborx/__init__.py ADDED
@@ -0,0 +1,28 @@
1
+ # SPDX-License-Identifier: 0BSD
2
+ """Pure-Python CBOR (RFC 8949) encoder/decoder. No dependencies, no Rust."""
3
+
4
+ from .decoder import CBORDecoder, DuplicateMode, TagHook, load, loads
5
+ from .encoder import CBOREncoder, DefaultCallback, dump, dumps
6
+ from .exceptions import CBORDecodeError, CBOREncodeError, CBORError
7
+ from .types import CBORSimpleValue, CBORTag, UndefinedType, undefined
8
+
9
+ __version__ = "0.2.3"
10
+
11
+ __all__ = [
12
+ "CBORDecodeError",
13
+ "CBORDecoder",
14
+ "CBOREncodeError",
15
+ "CBOREncoder",
16
+ "CBORError",
17
+ "CBORSimpleValue",
18
+ "CBORTag",
19
+ "DefaultCallback",
20
+ "DuplicateMode",
21
+ "TagHook",
22
+ "UndefinedType",
23
+ "dump",
24
+ "dumps",
25
+ "load",
26
+ "loads",
27
+ "undefined",
28
+ ]
cborx/_backend.py ADDED
@@ -0,0 +1,27 @@
1
+ # SPDX-License-Identifier: 0BSD
2
+ """Optional compiled backend selection.
3
+
4
+ The accelerator is imported when available unless CBORX_DISABLE_FAST
5
+ is set. Tests and embedders can force the pure-Python path either with
6
+ the environment variable or by setting this module's fast attribute to
7
+ None.
8
+
9
+ The extension is CPython-only. On PyPy the cpyext emulation layer makes
10
+ native calls slower than the JIT-compiled pure path, so the fallback is
11
+ the right backend there.
12
+ """
13
+
14
+ import os
15
+ import sys
16
+ from typing import Any
17
+
18
+ fast: Any = None
19
+ if sys.implementation.name == "cpython" and not os.environ.get("CBORX_DISABLE_FAST"):
20
+ try:
21
+ from . import ( # type: ignore[attr-defined]
22
+ _fast, # ty: ignore[unresolved-import]
23
+ )
24
+ except ImportError:
25
+ pass
26
+ else:
27
+ fast = _fast