class_docstr: A source of nondeterminism for use in shrink passes.
class_docstr_tok: ["A","source","of","nondeterminism","for","use","in","shrink","passes","."]
docstr: Return some element of values satisfying the condition
  that will not lead to an exhausted branch, or raise DeadBranch
  if no such element exist".
docstr_tok: ["Return","some","element","of","values","satisfying","the","condition","that","will","not","lead","to","an","exhausted","branch",",","or","raise","DeadBranch","if","no","such","element","exist","''","."]
code: def choose(self, values, condition=lambda x: True):
      """Return some element of values satisfying the condition
      that will not lead to an exhausted branch, or raise DeadBranch
      if no such element exist".
      """
      assert not self.__finished
      node = self.__node_trail[-1]
      if node.live_child_count is None:
          node.live_child_count = len(values)
          node.n = len(values)
  
      assert node.live_child_count > 0 or len(values) == 0
  
      depth = len(self.__choices)
  
      if depth < len(self.__prefix):
          i = self.__prefix[depth]
          if i >= len(values):
              i = 0
      else:
          i = 0
  
      count = 0
      while node.live_child_count > 0:
          count += 1
          assert count <= len(values)
          if not node.children[i].exhausted:
              v = values[i]
              if condition(v):
                  self.__choices.append(i)
                  self.__node_trail.append(node.children[i])
                  return v
              else:
                  node.children[i] = DeadNode
                  node.live_child_count -= 1
          i = (i + 1) % len(values)
      raise DeadBranch()
  
file_path: catboost/contrib/python/hypothesis/py2/hypothesis/internal/conjecture/choicetree.py
imports: from __future__ import absolute_import, division, print_function
  from collections import defaultdict
  from hypothesis.internal.compat import hrange
label_desc: Use image node_id 2 for calling the Chooser obj's underlying member method code with example usage: obj.choose(values, condition) and returns: v