class_docstr: This object implements a general K-way external merge sort for Python
  objects.
  
  >>> pool = MergePool()
  >>> # Add an unlimited number of items in any order
  >>> for item in my_items:
  ...     pool.add(item)
  ...
  >>> # Get the items back in sorted order
  >>> for item in pool.items():
  ...     print(item)
  
  This class uses the `marshal` module to write the items to temporary files,
  so you can only sort marshal-able types (generally: numbers, strings,
  tuples, lists, and dicts).
class_docstr_tok: ["This","object","implements","a","general","K-way","external","merge","sort","for","Python","objects",".",">",">",">","pool","=","MergePool","(",")",">",">",">","#","Add","an","unlimited","number","of","items","in","any","order",">",">",">","for","item","in","my_items",":","...","pool.add","(","item",")","...",">",">",">","#","Get","the","items","back","in","sorted","order",">",">",">","for","item","in","pool.items","(",")",":","...","print","(","item",")","This","class","uses","the","`","marshal","`","module","to","write","the","items","to","temporary","files",",","so","you","can","only","sort","marshal-able","types","(","generally",":","numbers",",","strings",",","tuples",",","lists",",","and","dicts",")","."]
docstr: :param maxsize: the maximum number of items to keep in memory at once.
  :param tempdir: the path of a directory to use for temporary file
      storage. The default is to use the system's temp directory.
  :param prefix: a prefix to add to temporary filenames.
  :param suffix: a suffix to add to temporary filenames.
docstr_tok: [":","param","maxsize",":","the","maximum","number","of","items","to","keep","in","memory","at","once",".",":","param","tempdir",":","the","path","of","a","directory","to","use","for","temporary","file","storage",".","The","default","is","to","use","the","system","'s","temp","directory",".",":","param","prefix",":","a","prefix","to","add","to","temporary","filenames",".",":","param","suffix",":","a","suffix","to","add","to","temporary","filenames","."]
code: def __init__(
      self, maxsize=1000000, tempdir=None, prefix="", suffix=".run"
  ):
      """
      :param maxsize: the maximum number of items to keep in memory at once.
      :param tempdir: the path of a directory to use for temporary file
          storage. The default is to use the system's temp directory.
      :param prefix: a prefix to add to temporary filenames.
      :param suffix: a suffix to add to temporary filenames.
      """
  
      self.tempdir = tempdir
      if maxsize < 1:
          raise ValueError("maxsize=%s must be >= 1" % maxsize)
      self.maxsize = maxsize
      self.prefix = prefix
      self.suffix = suffix
      # Current run queue
      self.current = []
      # List of run filenames
      self.runs = []
  
file_path: whoosh/src/whoosh/externalsort.py
imports: from __future__ import with_statement
  import os, tempfile
  from heapq import heapify, heappop, heapreplace
  from whoosh.compat import dump, load
label_desc: Use image node_id 1 to create a new SortingPool object from inherited base classes: object with example: obj = SortingPool(maxsize, tempdir, prefix, suffix)