class_docstr: Logs results to progress.csv under the trial directory.
  
  Automatically flattens nested dicts in the result dict before writing
  to csv:
  
      {"a": {"b": 1, "c": 2}} -> {"a/b": 1, "a/c": 2}
class_docstr_tok: ["Logs","results","to","progress.csv","under","the","trial","directory",".","Automatically","flattens","nested","dicts","in","the","result","dict","before","writing","to","csv",":","{","``","a","''",":","{","``","b","''",":","1",",","``","c","''",":","2","}","}","-",">","{","``","a\/b","''",":","1",",","``","a\/c","''",":","2","}"]
code: def on_result(self, result: Dict):
      self._maybe_init()
  
      tmp = result.copy()
      if "config" in tmp:
          del tmp["config"]
      result = flatten_dict(tmp, delimiter="/")
      if self._csv_out is None:
          self._csv_out = csv.DictWriter(self._file, result.keys())
          if not self._continuing:
              self._csv_out.writeheader()
      self._csv_out.writerow(
          {
              k: v
              for k, v in result.items()
              if k in self._csv_out.fieldnames
          }
      )
      self._file.flush()
  
imports: import csv
  import logging
  import os
  from typing import TYPE_CHECKING, Dict, TextIO
  from ray.air.constants import EXPR_PROGRESS_FILE
  from ray.tune.logger.logger import _LOGGER_DEPRECATION_WARNING, Logger, LoggerCallback
  from ray.tune.utils import flatten_dict
  from ray.util.annotations import Deprecated, PublicAPI
label_desc: Use image node_id 3 for calling the CSVLogger obj's underlying member method code with example usage: obj.on_result(result) without return types