class_docstr: Wrapper around an algorithm that applies some transformation to the trials it suggests.
  
  The inverse transformation is applied to the observed trials before they get passed down to the
  wrapped algorithm's `observe` method.
class_docstr_tok: ["Wrapper","around","an","algorithm","that","applies","some","transformation","to","the","trials","it","suggests",".","The","inverse","transformation","is","applied","to","the","observed","trials","before","they","get","passed","down","to","the","wrapped","algorithm","'s","`","observe","`","method","."]
docstr: Observe evaluated trials.
  
  .. seealso:: `orion.algo.base.BaseAlgorithm.observe`
docstr_tok: ["Observe","evaluated","trials",".","..","seealso",":",":","`","orion.algo.base.BaseAlgorithm.observe","`"]
code: def observe(self, trials: list[Trial]) -> None:
      """Observe evaluated trials.
  
      .. seealso:: `orion.algo.base.BaseAlgorithm.observe`
      """
      # For each trial in the original space, find the suggestions from the algo that match it.
      # Then, we make the wrapped algo observe each equivalent trial, with the updated status.
      for trial in trials:
          # Update the status of this trial in the registry (if it was suggested), otherwise set
          # it in the registry (for example in testing when we force the algo to observe a trial).
          self.register(trial)
  
          # Get the known transformed trials that correspond to this original.
          transformed_trials = self.registry_mapping.get_trials(trial)
  
          # Also transfer the status and results of `trial` to the equivalent transformed trials.
          # NOTE: Preserves the .parent attribute of the transformed trials.
          transformed_trials = [
              _copy_status_and_results(
                  trial_with_status=trial, trial=transformed_trial
              )
              for transformed_trial in transformed_trials
          ]
  
          if not transformed_trials:
              # `trial` is a new, original trial that wasn't suggested by the algorithm. (This
              # might happen when an insertion is done according to @bouthilx)
              transformed_trial = self.transform(trial)
              transformed_trial = _copy_status_and_results(
                  trial_with_status=trial, trial=transformed_trial
              )
              transformed_trials = [transformed_trial]
              logger.debug(
                  f"Observing trial {trial} (transformed as {transformed_trial}), even "
                  f"though it wasn't suggested by the algorithm."
              )
              # NOTE: @lebrice Here we don't want to store the transformed trial in the
              # algo's registry (by either calling `self.algorithm.register(transformed_trial)`
              # or `self.algorithm.registry.register(transformed_trial))`, because some algos
              # can't observe trials that they haven't suggested. We'd also need to perform all
              # the logic that the algo did in `suggest` (e.g. store it in a bracket for
              # HyperBand). Therefore we only register it in the wrapper, and store the
              # equivalence between these two trials in the registry mapping.
              self.register(trial)
              self.registry_mapping.register(trial, transformed_trial)
  
          self.algorithm.observe(transformed_trials)
  
imports: from __future__ import annotations
  import copy
  import typing
  from abc import ABC, abstractmethod
  from logging import getLogger
  from typing import Any, Callable
  from orion.algo.base.registry import Registry, RegistryMapping
  from orion.algo.space import Space
  from orion.core.worker.algo_wrappers.algo_wrapper import AlgoT, AlgoWrapper
  from orion.core.worker.transformer import ReshapedSpace, TransformedSpace
  from orion.core.worker.trial import Trial
label_desc: Use image node_id 5 for calling the TransformWrapper obj's underlying member method code with example usage: obj.observe(trials) without return types