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

Function load

Lib/json/__init__.py:278–301  ·  view source on GitHub ↗

Deserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used inste

(fp, *, cls=None, object_hook=None, parse_float=None,
        parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)

Source from the content-addressed store, hash-verified

276
277
278def load(fp, *, cls=None, object_hook=None, parse_float=None,
279 parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
280 """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
281 a JSON document) to a Python object.
282
283 ``object_hook`` is an optional function that will be called with the
284 result of any object literal decode (a ``dict``). The return value of
285 ``object_hook`` will be used instead of the ``dict``. This feature
286 can be used to implement custom decoders (e.g. JSON-RPC class hinting).
287
288 ``object_pairs_hook`` is an optional function that will be called with
289 the result of any object literal decoded with an ordered list of pairs.
290 The return value of ``object_pairs_hook`` will be used instead of the
291 ``dict``. This feature can be used to implement custom decoders. If
292 ``object_hook`` is also defined, the ``object_pairs_hook`` takes
293 priority.
294
295 To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
296 kwarg; otherwise ``JSONDecoder`` is used.
297 """
298 return loads(fp.read(),
299 cls=cls, object_hook=object_hook,
300 parse_float=parse_float, parse_int=parse_int,
301 parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
302
303
304def loads(s, *, cls=None, object_hook=None, parse_float=None,

Callers

nothing calls this directly

Calls 2

loadsFunction · 0.70
readMethod · 0.45

Tested by

no test coverage detected