You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
701 B
Python
26 lines
701 B
Python
from __future__ import annotations
|
|
|
|
from collections.abc import (
|
|
Sequence,
|
|
Mapping,
|
|
)
|
|
from typing import (
|
|
TypeAlias,
|
|
)
|
|
|
|
|
|
JsonMappingKey: TypeAlias = str | int | float
|
|
"""type for use in JSON mappings as key"""
|
|
JsonLeaf: TypeAlias = JsonMappingKey | bool | None
|
|
"""object natively mapping to JSON as values excluding containers"""
|
|
|
|
JsonMapping: TypeAlias = Mapping[JsonMappingKey, "JsonRepr"]
|
|
"""mapping natively mapping to JSON"""
|
|
JsonList: TypeAlias = Sequence["JsonRepr"]
|
|
"""list natively mapping to JSON"""
|
|
JsonContainer: TypeAlias = JsonList | JsonMapping
|
|
"""container natively mapping to JSON"""
|
|
|
|
JsonRepr: TypeAlias = JsonContainer | JsonLeaf
|
|
"""object natively mapping to JSON"""
|