File: _types.py

package info (click to toggle)
python-jsonpath 2.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,028 kB
  • sloc: python: 9,473; makefile: 6
file content (31 lines) | stat: -rw-r--r-- 818 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from __future__ import annotations

from io import IOBase
from typing import Any
from typing import Mapping
from typing import Sequence
from typing import Union

JSONScalar = Union[str, int, float, bool, None]
"""A scalar JSON-like value.

This includes primitive types that can appear in JSON:
string, number, boolean, or null.
"""

JSON = Union[JSONScalar, Sequence[Any], Mapping[str, Any]]
"""A JSON-like data structure.

This covers scalars, sequences (e.g. lists, tuples), and mappings (e.g.
dictionaries with string keys). Values inside may be untyped (`Any`) rather
than recursively constrained to `JSON` for flexibility.
"""

JSONData = Union[str, IOBase, JSON]
"""Input representing JSON content.

Accepts:
- a JSON-like object (`JSON`),
- a raw JSON string,
- or a file-like object containing JSON data.
"""