docstr: If appropriate (we have a database and have been told to use it),
  try to reload existing examples from the database.
  
  If there are a lot we don't try all of them. We always try the
  smallest example in the database (which is guaranteed to be the
  last failure) and the largest (which is usually the seed example
  which the last failure came from but we don't enforce that). We
  then take a random sampling of the remainder and try those. Any
  examples that are no longer interesting are cleared out.
code: def reuse_existing_examples(self):
      """If appropriate (we have a database and have been told to use it),
      try to reload existing examples from the database.
  
      If there are a lot we don't try all of them. We always try the
      smallest example in the database (which is guaranteed to be the
      last failure) and the largest (which is usually the seed example
      which the last failure came from but we don't enforce that). We
      then take a random sampling of the remainder and try those. Any
      examples that are no longer interesting are cleared out.
      """
      if self.has_existing_examples():
          self.debug("Reusing examples from database")
          # We have to do some careful juggling here. We have two database
          # corpora: The primary and secondary. The primary corpus is a
          # small set of minimized examples each of which has at one point
          # demonstrated a distinct bug. We want to retry all of these.
  
          # We also have a secondary corpus of examples that have at some
          # point demonstrated interestingness (currently only ones that
          # were previously non-minimal examples of a bug, but this will
          # likely expand in future). These are a good source of potentially
          # interesting examples, but there are a lot of them, so we down
          # sample the secondary corpus to a more manageable size.
  
          corpus = sorted(
              self.settings.database.fetch(self.database_key),
              key=sort_key,
          )
          desired_size = max(2, ceil(0.1 * self.settings.max_examples))
  
          if len(corpus) < desired_size:
              extra_corpus = list(
                  self.settings.database.fetch(self.secondary_key)
              )
  
              shortfall = desired_size - len(corpus)
  
              if len(extra_corpus) <= shortfall:
                  extra = extra_corpus
              else:
                  extra = self.random.sample(extra_corpus, shortfall)
              extra.sort(key=sort_key)
              corpus.extend(extra)
  
          for existing in corpus:
              data = self.cached_test_function(existing)
              if data.status != Status.INTERESTING:
                  self.settings.database.delete(
                      self.database_key, existing
                  )
                  self.settings.database.delete(
                      self.secondary_key, existing
                  )
  
          # If we've not found any interesting examples so far we try some of
          # the pareto front from the last run.
          if (
              len(corpus) < desired_size
              and not self.interesting_examples
          ):
              desired_extra = desired_size - len(corpus)
              pareto_corpus = list(
                  self.settings.database.fetch(self.pareto_key)
              )
              if len(pareto_corpus) > desired_extra:
                  pareto_corpus = self.random.sample(
                      pareto_corpus, desired_extra
                  )
              pareto_corpus.sort(key=sort_key)
  
              for existing in pareto_corpus:
                  data = self.cached_test_function(existing)
                  if data not in self.pareto_front:
                      self.settings.database.delete(
                          self.pareto_key, existing
                      )
                  if data.status == Status.INTERESTING:
                      break
  
imports: from __future__ import absolute_import, division, print_function
  from collections import Counter, defaultdict
  from enum import Enum
  from random import Random, getrandbits
  from weakref import WeakKeyDictionary
  import attr
  from hypothesis import HealthCheck, Phase, Verbosity, settings
  from hypothesis._settings import local_settings
  from hypothesis.internal.cache import LRUReusedCache
  from hypothesis.internal.compat import ceil, hbytes, int_from_bytes
  from hypothesis.internal.conjecture.data import ConjectureData, ConjectureResult, DataObserver, Overrun, Status, StopTest
  from hypothesis.internal.conjecture.datatree import DataTree, PreviouslyUnseenBehaviour, TreeRecordingObserver
  from hypothesis.internal.conjecture.junkdrawer import clamp
  from hypothesis.internal.conjecture.pareto import NO_SCORE, ParetoFront, ParetoOptimiser
  from hypothesis.internal.conjecture.shrinker import Shrinker, sort_key
  from hypothesis.internal.healthcheck import fail_health_check
  from hypothesis.reporting import base_report
label_desc: Use image node_id 21 for calling the ConjectureRunner obj's underlying member method code with example usage: obj.reuse_existing_examples() without return types