File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 3737from __future__ import annotations
3838
3939import struct
40- from collections . abc import Buffer
40+ from types import UnionType
4141from typing import Any , Callable , Mapping , Sequence
4242
4343CborType = int | bool | str | bytes | Sequence [Any ] | Mapping [Any , Any ]
4444
45+ # TODO: Requires Python 3.12, replace with collections.abc.Buffer
46+ Buffer = bytes | bytearray | memoryview
47+
4548
4649def _dump_int (data : int , mt : int = 0 ) -> bytes :
4750 if data < 0 :
@@ -90,7 +93,7 @@ def _dump_text(data: str) -> bytes:
9093 return _dump_int (len (data_bytes ), mt = 3 ) + data_bytes
9194
9295
93- _SERIALIZERS : Sequence [tuple [type , Callable [[Any ], bytes ]]] = [
96+ _SERIALIZERS : Sequence [tuple [type | UnionType , Callable [[Any ], bytes ]]] = [
9497 (bool , _dump_bool ),
9598 (int , _dump_int ),
9699 (str , _dump_text ),
You can’t perform that action at this time.
0 commit comments