class_docstr: Writes inference results to a TextIO as human-readable text.
class_docstr_tok: ["Writes","inference","results","to","a","TextIO","as","human-readable","text","."]
docstr: Factory method to create a `StreamInferenceRenderer` that writes to a file.
docstr_tok: ["Factory","method","to","create","a","`","StreamInferenceRenderer","`","that","writes","to","a","file","."]
code: def file(path: str) -> StreamInferenceRenderer:
      """Factory method to create a `StreamInferenceRenderer` that writes to a file."""
      file_stream = open(path, "w")
      return StreamInferenceRenderer(
          stream=file_stream, close_after_render=True
      )
  
file_path: metricflow/metricflow/inference/renderer/stream.py
imports: from __future__ import annotations
  import sys
  from collections import defaultdict
  from typing import Dict, List, TextIO
  from metricflow.dataflow.sql_table import SqlTable
  from metricflow.inference.models import InferenceResult
  from metricflow.inference.renderer.base import InferenceRenderer
label_desc: Use image node_id 3 for calling the StreamInferenceRenderer obj's underlying member method code with example usage: obj.file(path) and returns: StreamInferenceRenderer