class_docstr:     Records a sequence of strings (from a string buffer). These can then be
      compared to another sequence of strings, and if the two sequences don't
      match a mismatch exception is raised.
  
      Example:
         # Create a Record object and store 'hello world' inside it
         output = cStringIO.StringIO()
         recorder = Record(file_object=output, replay=False)
         recorder.handle_line('hello world 
  ')
  
         # Store the previous output
         output_value = output.getvalue()
         output = cStringIO.StringIO(output_value)
  
         # Create another Record object, now in playback mode, and set
         # it to the previous sequence of strings
         playback_checker = Record(file_object=output,  replay=True)
  
         # Check if it matches the previous one
         playback_checker.handle_line('hello world 
  ')
  
         # Now check if it the next item matches something else. This will
         # throw an exception because there is no next item
         playback_checker.handle_line('hello new world 
  ')
      
class_docstr_tok: ["Records","a","sequence","of","strings","(","from","a","string","buffer",")",".","These","can","then","be","compared","to","another","sequence","of","strings",",","and","if","the","two","sequences","don't","match","a","mismatch","exception","is","raised",".","Example",":","#","Create","a","Record","object","and","store","'hello","world","'","inside","it","output","=","cStringIO.StringIO","(",")","recorder","=","Record","(","file_object=output",",","replay=False",")","recorder.handle_line","(","'hello","world","'",")","#","Store","the","previous","output","output_value","=","output.getvalue","(",")","output","=","cStringIO.StringIO","(","output_value",")","#","Create","another","Record","object",",","now","in","playback","mode",",","and","set","#","it","to","the","previous","sequence","of","strings","playback_checker","=","Record","(","file_object=output",",","replay=True",")","#","Check","if","it","matches","the","previous","one","playback_checker.handle_line","(","'hello","world","'",")","#","Now","check","if","it","the","next","item","matches","something","else",".","This","will","#","throw","an","exception","because","there","is","no","next","item","playback_checker.handle_line","(","'hello","new","world","'",")"]
docstr: Initializes Record object to use file on disc and whether it is in
  replay mode or not.
  
  Parameters
  ----------
  file_object : StringIO
      The input string buffer.
  file_path : string, optional
      File to save Record to.
  replay : bool, optional
      Determines whether or not the object is in playback mode. If not
      in playback mode, the content of record will be written to the
      file. If in playback mode, the content of file is loaded into the
      record.
docstr_tok: ["Initializes","Record","object","to","use","file","on","disc","and","whether","it","is","in","replay","mode","or","not",".","Parameters","--","--","--","--","--","file_object",":","StringIO","The","input","string","buffer",".","file_path",":","string",",","optional","File","to","save","Record","to",".","replay",":","bool",",","optional","Determines","whether","or","not","the","object","is","in","playback","mode",".","If","not","in","playback","mode",",","the","content","of","record","will","be","written","to","the","file",".","If","in","playback","mode",",","the","content","of","file","is","loaded","into","the","record","."]
code: def __init__(self, file_object=None, file_path=None, replay=False):
      """
      Initializes Record object to use file on disc and whether it is in
      replay mode or not.
  
      Parameters
      ----------
      file_object : StringIO
          The input string buffer.
      file_path : string, optional
          File to save Record to.
      replay : bool, optional
          Determines whether or not the object is in playback mode. If not
          in playback mode, the content of record will be written to the
          file. If in playback mode, the content of file is loaded into the
          record.
      """
  
      assert file_object is not None or file_path is not None
  
      if replay and file_object is None:
          self.f = open(file_path, "r")
      elif (not replay) and file_object is None:
          self.f = open(file_path, "w")
      else:
          self.f = file_object
  
      self.__dict__.update(locals())
  
file_path: Theano/theano/tests/record.py
imports: from __future__ import absolute_import, print_function, division
  from theano.compile import Mode
  import theano
  from theano.printing import hex_digest
label_desc: Use image node_id 1 to create a new Record object from inherited base classes: object with example: obj = Record(file_object, file_path, replay)