MCPcopy
hub / github.com/pytest-dev/pytest / write_text

Method write_text

src/_pytest/_py/path.py:901–908  ·  view source on GitHub ↗

Write text data into path using the specified encoding. If ensure is True create missing parent directories.

(self, data, encoding, ensure=False)

Source from the content-addressed store, hash-verified

899 f.write(data)
900
901 def write_text(self, data, encoding, ensure=False):
902 """Write text data into path using the specified encoding.
903 If ensure is True create missing parent directories.
904 """
905 if ensure:
906 self.dirpath().ensure(dir=1)
907 with self.open("w", encoding=encoding) as f:
908 f.write(data)
909
910 def write(self, data, mode="w", ensure=False):
911 """Write data into path. If ensure is True create

Callers 15

mainFunction · 0.80
_makefileMethod · 0.80
announceFunction · 0.80
mainFunction · 0.80
dumpsMethod · 0.80
load_and_is_trueMethod · 0.80
test_newfirst_usecaseMethod · 0.80

Calls 4

dirpathMethod · 0.95
openMethod · 0.95
ensureMethod · 0.80
writeMethod · 0.45