MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / load

Function load

tools/python-3.11.9-amd64/Lib/tomllib/_parser.py:57–66  ·  view source on GitHub ↗

Parse TOML from a binary file object.

(fp: BinaryIO, /, *, parse_float: ParseFloat = float)

Source from the content-addressed store, hash-verified

55
56
57def load(fp: BinaryIO, /, *, parse_float: ParseFloat = float) -> dict[str, Any]:
58 """Parse TOML from a binary file object."""
59 b = fp.read()
60 try:
61 s = b.decode()
62 except AttributeError:
63 raise TypeError(
64 "File must be opened in binary mode, e.g. use `open('foo.toml', 'rb')`"
65 ) from None
66 return loads(s, parse_float=parse_float)
67
68
69def loads(s: str, /, *, parse_float: ParseFloat = float) -> dict[str, Any]: # noqa: C901

Callers

nothing calls this directly

Calls 3

loadsFunction · 0.70
readMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected