MCPcopy
hub / github.com/pallets/flask / dump

Method dump

src/flask/json/provider.py:49–57  ·  view source on GitHub ↗

Serialize data as JSON and write to a file. :param obj: The data to serialize. :param fp: A file opened for writing text. Should use the UTF-8 encoding to be valid JSON. :param kwargs: May be passed to the underlying JSON library.

(self, obj: t.Any, fp: t.IO[str], **kwargs: t.Any)

Source from the content-addressed store, hash-verified

47 raise NotImplementedError
48
49 def dump(self, obj: t.Any, fp: t.IO[str], **kwargs: t.Any) -> None:
50 """Serialize data as JSON and write to a file.
51
52 :param obj: The data to serialize.
53 :param fp: A file opened for writing text. Should use the UTF-8
54 encoding to be valid JSON.
55 :param kwargs: May be passed to the underlying JSON library.
56 """
57 fp.write(self.dumps(obj, **kwargs))
58
59 def loads(self, s: str | bytes, **kwargs: t.Any) -> t.Any:
60 """Deserialize data as JSON.

Callers 2

dumpFunction · 0.80
test_json_dump_to_fileFunction · 0.80

Calls 1

dumpsMethod · 0.95

Tested by 1

test_json_dump_to_fileFunction · 0.64