-
Notifications
You must be signed in to change notification settings - Fork 2
/
json_.py
42 lines (38 loc) · 1.14 KB
/
json_.py
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
32
33
34
35
36
37
38
39
40
41
42
"""
Generate `pyi` from corresponding `rst` docs.
"""
import rst
from rst2pyi import RST2PyI
__author__ = rst.__author__
__copyright__ = rst.__copyright__
__license__ = rst.__license__
__version__ = "7.5.3" # Version set by https://github.com/hlovatt/tag2ver
def json(shed: RST2PyI) -> None:
shed.module(
name="json",
old="JSON encoding and decoding",
post_doc=f"""
from typing import Any, AnyStr
from uio import IOBase
""",
end="Functions",
)
shed.def_(
old=r".. function:: dump(obj, stream, separators=None)",
new="def dump(obj: Any, stream: IOBase[str, Any], separators: tuple[str, str] | None = None, /) -> None",
indent=0,
)
shed.def_(
old=r".. function:: dumps(obj, separators=None)",
new="def dumps(obj: Any, separators: tuple[str, str] | None = None) -> str",
indent=0,
)
shed.def_(
old=r".. function:: load(stream)",
new="def load(stream: IOBase[str, Any]) -> Any",
indent=0,
)
shed.def_(
old=r".. function:: loads(str)", new="def loads(str: AnyStr) -> Any", indent=0,
)
shed.write(u_also=True)