class_docstr: Base class for contexts.
class_docstr_tok: ["Base","class","for","contexts","."]
docstr: Run final processing on a check result which includes validation, conditions processing and sampling        footnote.
docstr_tok: ["Run","final","processing","on","a","check","result","which","includes","validation",",","conditions","processing","and","sampling","footnote","."]
code: def finalize_check_result(
      self, check_result, check, dataset_kind: DatasetKind = None
  ):
      """Run final processing on a check result which includes validation, conditions processing and sampling\
          footnote."""
      # Validate the check result type
      if isinstance(check_result, CheckFailure):
          return
      if not isinstance(check_result, CheckResult):
          raise DeepchecksValueError(
              f"Check {check.name()} expected to return CheckResult but got: "
              + type(check_result).__name__
          )
  
      # Set reference between the check result and check
      check_result.check = check
      # Calculate conditions results
      check_result.process_conditions()
      # Add sampling footnote if needed
      if hasattr(check, "n_samples"):
          n_samples = getattr(check, "n_samples")
          message = ""
          if dataset_kind:
              dataset = self.get_data_by_kind(dataset_kind)
              if dataset.is_sampled(n_samples):
                  message = (
                      f"Data is sampled from the original dataset, running on "
                      f"{dataset.len_when_sampled(n_samples)} samples out of {len(dataset)}."
                  )
          else:
              if self._train is not None and self._train.is_sampled(
                  n_samples
              ):
                  message += (
                      f"Running on {self._train.len_when_sampled(n_samples)} <b>train</b> data samples "
                      f"out of {len(self._train)}."
                  )
              if self._test is not None and self._test.is_sampled(
                  n_samples
              ):
                  if message:
                      message += " "
                  message += (
                      f"Running on {self._test.len_when_sampled(n_samples)} <b>test</b> data samples "
                      f"out of {len(self._test)}."
                  )
  
          if message:
              message = (
                  '<p style="font-size:0.9em;line-height:1;"><i>'
                  f'Note - data sampling: {message} Sample size can be controlled with the "n_samples" '
                  "parameter.</i></p>"
              )
              check_result.display.append(message)
  
file_path: deepchecks/deepchecks/core/context.py
imports: from abc import ABC, abstractmethod
  from deepchecks.core import CheckFailure, CheckResult, DatasetKind
  from deepchecks.core.errors import DeepchecksNotSupportedError, DeepchecksValueError, ModelValidationError
label_desc: Use image node_id 7 for calling the BaseContext obj's underlying member method code with example usage: obj.finalize_check_result(check_result, check, dataset_kind) without return types