Coverage for muutils / json_serialize / types.py: 0%
16 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-02-18 02:51 -0700
« prev ^ index » next coverage.py v7.13.4, created at 2026-02-18 02:51 -0700
1"""base types, lets us avoid import cycles"""
3from __future__ import annotations
5from typing import TYPE_CHECKING, List, Literal, Union, Tuple
7if TYPE_CHECKING:
8 from muutils.json_serialize.util import JSONitem
11BaseType = Union[
12 bool,
13 int,
14 float,
15 str,
16 None,
17]
19Hashableitem = Union[BaseType, Tuple["Hashableitem", ...]]
22_FORMAT_KEY: Literal["__muutils_format__"] = "__muutils_format__"
23_REF_KEY: Literal["$ref"] = "$ref"
26# TypedDicts for serialized set/frozenset - using Total=False workaround for 3.8 compat
27# These are used by @overload signatures for better type narrowing
28try:
29 from typing import TypedDict
30except ImportError:
31 from typing_extensions import TypedDict
34class _SerializedSet(TypedDict):
35 """TypedDict for serialized set objects."""
37 __muutils_format__: Literal["set"]
38 data: List["JSONitem"]
41class _SerializedFrozenset(TypedDict):
42 """TypedDict for serialized frozenset objects."""
44 __muutils_format__: Literal["frozenset"]
45 data: List["JSONitem"]