class_docstr: Callback that calculates metric results.
  Adds the results into the trial repository.
  
  .. seealso::
      :class:`BaseCallback`,
      :class:`MetaCallback`,
      :class:`EarlyStoppingCallback`,
      :class:`IfBestScore`,
      :class:`IfLastStep`,
      :class:`StepSaverCallback`,
      :class:`CallbackList`,
code: def call(
      self,
      trial_split: TrialSplit,
      dact_train: EvalEOTDACT,
      dact_valid: EvalEOTDACT,
      is_finished_and_fitted: bool = False,
  ) -> bool:
      f = self.metric_function
  
      if self.pass_context_to_metric_function:
          train_score: float = f(
              dact_train.eo,
              dact_train.di,
              trial_split.validation_context(),
          )
          if dact_valid is not None:
              valid_score: float = f(
                  dact_valid.eo,
                  dact_valid.di,
                  trial_split.validation_context(),
              )
      else:
          train_score: float = f(dact_train.eo, dact_train.di)
          if dact_valid is not None:
              valid_score: float = f(dact_valid.eo, dact_valid.di)
  
      with trial_split.managed_metric(
          self.name, self.higher_score_is_better
      ) as metric:
          metric: MetricResults = (
              metric  # just a typing comment here for convenience.
          )
  
          metric.add_train_result(train_score)
          if dact_valid is not None:
              metric.add_valid_result(valid_score)
  
      return is_finished_and_fitted
  
imports: from abc import ABC, abstractmethod
  from typing import Callable, List, Optional
  from neuraxle.base import ExecutionContext
  from neuraxle.data_container import ARG_Y_EXPECTED, ARG_Y_PREDICTD, EvalEOTDACT
  from neuraxle.logging.warnings import warn_deprecated_class
  from neuraxle.metaopt.data.aggregates import MetricResults, TrialSplit
label_desc: Use image node_id 2 for calling the MetricCallback obj's underlying member method code with example usage: obj.call(trial_split, dact_train, dact_valid, is_finished_and_fitted) and returns: is_finished_and_fitted