MCPcopy
hub / github.com/cool-RR/PySnooper / write_text

Method write_text

tests/mini_toolbox/pathlib.py:1416–1425  ·  view source on GitHub ↗

Open the file in text mode, write to it, and close the file.

(self, data, encoding=None, errors=None)

Source from the content-addressed store, hash-verified

1414 return f.write(data)
1415
1416 def write_text(self, data, encoding=None, errors=None):
1417 """
1418 Open the file in text mode, write to it, and close the file.
1419 """
1420 if not isinstance(data, pycompat.text_type):
1421 raise TypeError(
1422 'data must be %s, not %s' %
1423 (pycompat.text_type.__name__, data.__class__.__name__))
1424 with self.open(mode='w', encoding=encoding, errors=errors) as f:
1425 return f.write(data)
1426
1427 def touch(self, mode=0o666, exist_ok=True):
1428 """

Callers 3

test_valid_zipfileFunction · 0.80
test_invalid_zipfileFunction · 0.80

Calls 2

openMethod · 0.95
writeMethod · 0.45

Tested by 3

test_valid_zipfileFunction · 0.64
test_invalid_zipfileFunction · 0.64