MCPcopy Index your code
hub / github.com/tensorflow/tensorboard / write

Method write

tensorboard/compat/tensorflow_stub/io/gfile.py:751–783  ·  view source on GitHub ↗

Writes string file contents to file, clearing contents of the file on first write and then appending on subsequent calls. Args: file_content: string, the contents

(self, file_content)

Source from the content-addressed store, hash-verified

749 return result
750
751 def write(self, file_content):
752 """Writes string file contents to file, clearing contents of the file
753 on first write and then appending on subsequent calls.
754
755 Args:
756 file_content: string, the contents
757 """
758 if not self.write_mode:
759 raise errors.PermissionDeniedError(
760 None, None, "File not opened in write mode"
761 )
762 if self.closed:
763 raise errors.FailedPreconditionError(
764 None, None, "File already closed"
765 )
766
767 if self.fs_supports_append:
768 if not self.write_started:
769 # write the first chunk to truncate file if it already exists
770 self.fs.write(self.filename, file_content, self.binary_mode)
771 self.write_started = True
772
773 else:
774 # append the later chunks
775 self.fs.append(self.filename, file_content, self.binary_mode)
776 else:
777 # add to temp file, but wait for flush to write to final filesystem
778 if self.write_temp is None:
779 mode = "w+b" if self.binary_mode else "w+"
780 self.write_temp = tempfile.TemporaryFile(mode)
781
782 compatify = compat.as_bytes if self.binary_mode else compat.as_text
783 self.write_temp.write(compatify(file_content))
784
785 def __next__(self):
786 line = None

Callers 15

_stub_tensorboardMethod · 0.45
global_initFunction · 0.45
_run_serve_subcommandMethod · 0.45
handlerMethod · 0.45
_make_data_ingesterMethod · 0.45
print_serving_messageMethod · 0.45
print_serving_messageMethod · 0.45
write_info_fileFunction · 0.45
mainFunction · 0.45
write_svgsMethod · 0.45

Calls 1

appendMethod · 0.45

Tested by 15

_stub_tensorboardMethod · 0.36
write_svgsMethod · 0.36
git_grepFunction · 0.36
create_fileMethod · 0.36
testStatMethod · 0.36
testReadMethod · 0.36
testReadLinesMethod · 0.36
testReadWithOffsetMethod · 0.36
testWriteMethod · 0.36
testOverwriteMethod · 0.36