MCPcopy Index your code
hub / github.com/python/cpython / load

Function load

Lib/tomllib/_parser.py:125–134  ·  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

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

Callers

nothing calls this directly

Calls 3

loadsFunction · 0.70
readMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…