def TestFileContent(self, file_stat):
    # Content regex check
    try:

      data = ""
      with vfs.VFSOpen(file_stat.pathspec,
                       progress_callback=self.Progress) as fd:
        # Only read this much data from the file.
        while fd.Tell() < self.request.max_data:
          data_read = fd.read(1024000)
          if not data_read: break
          data += data_read

          # Got it.
          if self.request.data_regex.Search(data):
            return True

          # Keep a bit of context from the last buffer to ensure we dont miss a
          # match broken by buffer. We do not expect regex's to match something
          # larger than about 100 chars.
          data = data[-100:]

    except (IOError, KeyError):
      pass

    return False
Checks the file for the presence of the regular expression.
dataset/ETHPy150Open google/grr/grr/client/client_actions/searching.py/Find.TestFileContent