MCPcopy Index your code
hub / github.com/RustPython/RustPython / load

Function load

Lib/tomllib/_parser.py:124–133  ·  view source on GitHub ↗

Parse TOML from a binary file object.

(fp: IO[bytes], /, *, parse_float: ParseFloat = float)

Source from the content-addressed store, hash-verified

122
123
124def load(fp: IO[bytes], /, *, parse_float: ParseFloat = float) -> dict[str, Any]:
125 """Parse TOML from a binary file object."""
126 b = fp.read()
127 try:
128 s = b.decode()
129 except AttributeError:
130 raise TypeError(
131 "File must be opened in binary mode, e.g. use `open('foo.toml', 'rb')`"
132 ) from None
133 return loads(s, parse_float=parse_float)
134
135
136def 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