class_docstr: A shrinker that tries to make a sequence more sorted.
  
  Will not change the length or the contents, only tries to reorder
  the elements of the sequence.
class_docstr_tok: ["A","shrinker","that","tries","to","make","a","sequence","more","sorted",".","Will","not","change","the","length","or","the","contents",",","only","tries","to","reorder","the","elements","of","the","sequence","."]
docstr: Guarantees that for each i we have tried to swap index i with
  index i + 2.
  
  This uses an adaptive algorithm that works by sorting contiguous
  regions centered on each element, where that element is treated as
  fixed and the elements around it are sorted..
docstr_tok: ["Guarantees","that","for","each","i","we","have","tried","to","swap","index","i","with","index","i","+","2",".","This","uses","an","adaptive","algorithm","that","works","by","sorting","contiguous","regions","centered","on","each","element",",","where","that","element","is","treated","as","fixed","and","the","elements","around","it","are","sorted",".."]
code: def sort_regions_with_gaps(self):
      """Guarantees that for each i we have tried to swap index i with
      index i + 2.
  
      This uses an adaptive algorithm that works by sorting contiguous
      regions centered on each element, where that element is treated as
      fixed and the elements around it are sorted..
      """
      for i in hrange(1, len(self.current) - 1):
          if (
              self.current[i - 1]
              <= self.current[i]
              <= self.current[i + 1]
          ):
              continue
  
          def can_sort(a, b):
              if a < 0 or b > len(self.current):
                  return False
              assert a <= i < b
              split = i - a
              values = sorted(
                  self.current[a:i] + self.current[i + 1 : b]
              )
              return self.consider(
                  list(self.current[:a])
                  + values[:split]
                  + [self.current[i]]
                  + values[split:]
                  + list(self.current[b:])
              )
  
          left = i
          right = i + 1
          right += find_integer(lambda k: can_sort(left, right + k))
          find_integer(lambda k: can_sort(left - k, right))
  
file_path: catboost/contrib/python/hypothesis/py2/hypothesis/internal/conjecture/shrinking/ordering.py
imports: from __future__ import absolute_import, division, print_function
  from hypothesis.internal.compat import hrange
  from hypothesis.internal.conjecture.shrinking.common import Shrinker, find_integer
label_desc: Use image node_id 8 for calling the Ordering obj's underlying member method code with example usage: obj.sort_regions_with_gaps() and returns: self, False