def split(self, n):
    """Evenly split this range into contiguous, non overlapping subranges.

    Args:
      n: number of splits.

    Returns:
      a list of contiguous, non overlapping sub PropertyRanges. Maybe less than
    n when not enough subranges.
    """
    new_range_filters = []
    name = self.start[0]
    prop_cls = self.prop.__class__
    if prop_cls in _DISCRETE_PROPERTY_SPLIT_FUNCTIONS:
      splitpoints = _DISCRETE_PROPERTY_SPLIT_FUNCTIONS[prop_cls](
          self.start[2], self.end[2], n,
          self.start[1] == ">=", self.end[1] == "<=")
      start_filter = (name, ">=", splitpoints[0])
      for p in splitpoints[1:]:
        end_filter = (name, "<", p)
        new_range_filters.append([start_filter, end_filter])
        start_filter = (name, ">=", p)
    else:
      splitpoints = _CONTINUOUS_PROPERTY_SPLIT_FUNCTIONS[prop_cls](
          self.start[2], self.end[2], n)
      start_filter = self.start
      for p in splitpoints:
        end_filter = (name, "<", p)
        new_range_filters.append([start_filter, end_filter])
        start_filter = (name, ">=", p)
      new_range_filters.append([start_filter, self.end])

    for f in new_range_filters:
      f.extend(self._equality_filters)

    return [self.__class__(f, self.model_class_path) for f in new_range_filters]
def split ( self , n ) : new_range_filters = [ ] name = self . start [ 0 ] prop_cls = self . prop . __class__ if prop_cls in _DISCRETE_PROPERTY_SPLIT_FUNCTIONS : splitpoints = _DISCRETE_PROPERTY_SPLIT_FUNCTIONS [ prop_cls ] ( self . start [ 2 ] , self . end [ 2 ] , n , self . start [ 1 ] == ">=" , self . end [ 1 ] == "<=" ) start_filter = ( name , ">=" , splitpoints [ 0 ] ) for p in splitpoints [ 1 : ] : end_filter = ( name , "<" , p ) new_range_filters . append ( [ start_filter , end_filter ] ) start_filter = ( name , ">=" , p ) else : splitpoints = _CONTINUOUS_PROPERTY_SPLIT_FUNCTIONS [ prop_cls ] ( self . start [ 2 ] , self . end [ 2 ] , n ) start_filter = self . start for p in splitpoints : end_filter = ( name , "<" , p ) new_range_filters . append ( [ start_filter , end_filter ] ) start_filter = ( name , ">=" , p ) new_range_filters . append ( [ start_filter , self . end ] ) for f in new_range_filters : f . extend ( self . _equality_filters ) return [ self . __class__ ( f , self . model_class_path ) for f in new_range_filters ]
Evenly split this range into contiguous, non overlapping subranges.

    Args:
      n: number of splits.

    Returns:
      a list of contiguous, non overlapping sub PropertyRanges. Maybe less than
    n when not enough subranges.