class_docstr: Helper to allow materialization of PCollection contents.
  
  Materializer is intended to simplify retrieving PCollection contents into
  memory. Internally it is backed by tmp files written to the provided
  directory, which must already exist. To use a Materializer:
  
  m = Materializer(my_path)
  with beam.Pipeline() as p:
    p | SomeOperation(...) | m.writer()
  
  Then, once the pipeline is run
  
  for item in m.reader():
    ...
  
  m.cleanup()
  
  Or to use as a context manager with automated cleanup:
  
  with Materializer(my_path) as m:
    with beam.Pipeline() as p:
      p | SomeOperation(...) | m.writer()
    for item in m.reader():
      ...
  
  The contents of the PCollection passed to writer() must be serializable with
  pickle.
class_docstr_tok: ["Helper","to","allow","materialization","of","PCollection","contents",".","Materializer","is","intended","to","simplify","retrieving","PCollection","contents","into","memory",".","Internally","it","is","backed","by","tmp","files","written","to","the","provided","directory",",","which","must","already","exist",".","To","use","a","Materializer",":","m","=","Materializer","(","my_path",")","with","beam.Pipeline","(",")","as","p",":","p","|","SomeOperation","(","...",")","|","m.writer","(",")","Then",",","once","the","pipeline","is","run","for","item","in","m.reader","(",")",":","...","m.cleanup","(",")","Or","to","use","as","a","context","manager","with","automated","cleanup",":","with","Materializer","(","my_path",")","as","m",":","with","beam.Pipeline","(",")","as","p",":","p","|","SomeOperation","(","...",")","|","m.writer","(",")","for","item","in","m.reader","(",")",":","...","The","contents","of","the","PCollection","passed","to","writer","(",")","must","be","serializable","with","pickle","."]
docstr: Get an iterator over output written to writer().
  
  This function depends on the pipeline being run.
  
  Returns:
    An iterator yielding:
      Contents of the PCollection passed to writer().
docstr_tok: ["Get","an","iterator","over","output","written","to","writer","(",")",".","This","function","depends","on","the","pipeline","being","run",".","Returns",":","An","iterator","yielding",":","Contents","of","the","PCollection","passed","to","writer","(",")","."]
code: def reader(self) -> Iterator[Any]:
      """Get an iterator over output written to writer().
  
      This function depends on the pipeline being run.
  
      Returns:
        An iterator yielding:
          Contents of the PCollection passed to writer().
      """
      if self._deleted:
          raise ValueError(
              "Materializer must not be used after cleanup."
          )
  
      def _iter():
          for path in self._output_files():
              for record in tf.compat.v1.io.tf_record_iterator(path):
                  yield pickle.loads(record)
  
      return _iter()
  
file_path: data-validation/tensorflow_data_validation/utils/io_util.py
imports: import os
  import pickle
  from typing import Any, Iterator, List, Text, Union
  import uuid
  import apache_beam
  import tensorflow
label_desc: Use image node_id 6 for calling the Materializer obj's underlying member method code with example usage: obj.reader() and returns: _iter