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 log_trial_result(
      self, iteration: int, trial: "Trial", result: Dict
  ):
      if trial not in self._trial_files:
          self._setup_trial(trial)
  
      tmp = result.copy()
      tmp.pop("config", None)
      result = flatten_dict(tmp, delimiter="/")
  
      if not self._trial_csv[trial]:
          self._trial_csv[trial] = csv.DictWriter(
              self._trial_files[trial], result.keys()
          )
          if not self._trial_continue[trial]:
              self._trial_csv[trial].writeheader()
  
      self._trial_csv[trial].writerow(
          {
              k: v
              for k, v in result.items()
              if k in self._trial_csv[trial].fieldnames
          }
      )
      self._trial_files[trial].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 CSVLoggerCallback obj's underlying member method code with example usage: obj.log_trial_result(iteration, trial, result) without return types