code: def testLoad_detectFileReplacement_statFailsTransiently_shouldRecover(
      self,
  ):
      self._append_record(_make_event(wall_time=1.0))
      loader = self._make_loader(detect_file_replacement=True)
      self._append_record(_make_event(wall_time=2.0))
      self.assertEventWallTimes(loader.Load(), [1.0, 2.0])
      with mock.patch.object(tf.io.gfile, "stat") as mock_stat:
          mock_stat.side_effect = tf.errors.DeadlineExceededError(
              None, None, "transient failure"
          )
          # Stat call fails; we fall back to polling, which shows no new data.
          self.assertEventWallTimes(loader.Load(), [])
          mock_stat.assert_called_once()
          mock_stat.reset_mock()
          # Simulate file growing via replacement.
          os.remove(self._get_filename())
          self._append_record(_make_event(wall_time=1.0))
          self._append_record(_make_event(wall_time=2.0))
          self._append_record(_make_event(wall_time=3.0))
          # Stat call fails again; since we're polling; still no new data.
          self.assertEventWallTimes(loader.Load(), [])
          mock_stat.assert_called_once()
          mock_stat.reset_mock()
      # Removing the mock and getting a successful stat result triggers
      # reopening the file, and we see the new data.
      self.assertEventWallTimes(loader.Load(), [3.0])
  
imports: import abc
  import io
  import os
  import unittest
  from unittest import mock
  from tensorboard import test
  from tensorboard.backend.event_processing import event_file_loader
  from tensorboard.compat import tf
  from tensorboard.compat.proto import event_pb2
  from tensorboard.summary.writer import record_writer
label_desc: Use image node_id 14 for calling the EventFileLoaderTestBase obj's underlying member method code with example usage: obj.testLoad_detectFileReplacement_statFailsTransiently_shouldRecover() without return types