class_docstr: Bracket of rungs for the algorithm Hyperband.
  
  Parameters
  ----------
  owner: `Hyperband` algorithm
      The hyperband algorithm object which this bracket will be part of.
  budgets: list of tuple
      Each tuple gives the (n_trials, resource_budget) for the respective rung.
  repetition_id: int
      The id of hyperband execution this bracket belongs to
docstr: Get a candidate for promotion
  
  Raises
  ------
  TypeError
      If get_candidates is called before the entire rung is completed.
docstr_tok: ["Get","a","candidate","for","promotion","Raises","--","--","--","TypeError","If","get_candidates","is","called","before","the","entire","rung","is","completed","."]
code: def get_candidates(self, rung_id: int) -> list[Trial]:
      """Get a candidate for promotion
  
      Raises
      ------
      TypeError
          If get_candidates is called before the entire rung is completed.
      """
      if self.has_rung_filled(rung_id + 1):
          return []
  
      rung_results = self.rungs[rung_id]["results"]
      next_rung = self.rungs[rung_id + 1]["results"]
      # BUG: https://github.com/Epistimio/orion/issues/858:
      # What if some of the objectives are None? Then comparison between None and floats here
      # will cause an error. During tests, the objectives are all None, so the comparison doesn't
      # fail!
      # Adding this assert to make this assumption more explicit, while we decide if this is
      # normal.
      assert sum(
          objective is not None
          for objective, trial in rung_results.values()
      ) in {
          0,
          len(rung_results),
      }, "Assuming objectives are either all None or all floats."
      rung = sorted(rung_results.values(), key=lambda pair: pair[0])
  
      if not rung:
          return []
  
      should_have_n_trials = self.rungs[rung_id + 1]["n_trials"]
      trials: list[Trial] = []
      i = 0
      while len(trials) + len(next_rung) < should_have_n_trials:
          objective, trial = rung[i]
          assert objective is not None
          _id = self.owner.get_id(
              trial, ignore_fidelity=True, ignore_parent=True
          )
          if _id not in next_rung:
              trials.append(trial)
          i += 1
  
      return trials
  
imports: from __future__ import annotations
  import copy
  import logging
  from collections import OrderedDict
  from typing import Any, Generic, NamedTuple, Sequence, TypeVar
  import numpy
  from tabulate import tabulate
  from orion.algo.base import BaseAlgorithm
  from orion.algo.space import Fidelity, Space
  from orion.core.utils.flatten import flatten
  from orion.core.worker.trial import Trial
label_desc: Use image node_id 12 for calling the HyperbandBracket obj's underlying member method code with example usage: obj.get_candidates(rung_id) and returns: trials, list, list