1. Benjamin Saller
  2. rbtree

Commits

Benjamin Saller  committed c13c2ee

follow more standard package layout

  • Participants
  • Parent commits 980e8d4
  • Branches default
  • Tags RELEASE_0_8_8

Comments (0)

Files changed (9)

File AUTHORS

View file
+Benjamin Saller <bcsaller@gmail.com>

File ChangeLog

View file
+2010-04-25  Benjamin Saller  <bcsaller@gmail.com>
+
+	* setup.py: added download url to metadata
+
+	* rbtree.pyx (__reversed__): added support for efficient revered
+

File MANIFEST

View file
+ChangeLog
 README.txt
 setup.py
 src/rbtree.pyx

File doc/api.txt

View file
+see ../README.txt

File setup.py

View file
                             libraries=[],
                             include_dirs=['./src', ])
                   ],
-    test_suite="test_rbtree",
+    test_suite="tests.test_rbtree",
     zip_safe=False,
     author='Benjamin Saller',
     author_email='bcsaller@gmail.com',

File src/rbtree.c

View file
-/* Generated by Pyrex 0.9.8.5 on Sun Apr 25 11:41:11 2010 */
+/* Generated by Pyrex 0.9.8.5 on Sun Apr 25 11:51:13 2010 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
-static int __Pyx_PrintItem(PyObject *); /*proto*/
-static int __Pyx_PrintNewline(void); /*proto*/
-
 static PyObject *__Pyx_UnpackItem(PyObject *); /*proto*/
 static int __Pyx_EndUnpack(PyObject *); /*proto*/
 
 static char __pyx_k20[] = "start";
 static char __pyx_k21[] = "stop";
 static char __pyx_k22[] = "step";
-static char __pyx_k23[] = "rev";
-static char __pyx_k24[] = "__iter__";
-static char __pyx_k25[] = "itervalues";
-static char __pyx_k26[] = "iteritems";
-static char __pyx_k27[] = "lists and tuples must be of the form [(k, v), ...]";
-static char __pyx_k28[] = "Unsupported type %s for update(need dict/sequence)";
-static char __pyx_k29[] = "append";
-static char __pyx_k30[] = "%r : %r";
-static char __pyx_k31[] = " ";
-static char __pyx_k32[] = ", ";
-static char __pyx_k33[] = "join";
-static char __pyx_k34[] = "";
-static char __pyx_k35[] = "<%s%s>";
-static char __pyx_k36[] = "__name__";
-static char __pyx_k37[] = "Benjamin Saller <bcsaller@gmail.com>";
-static char __pyx_k38[] = "__author__";
-static char __pyx_k39[] = "Benjamin Saller 2010";
-static char __pyx_k40[] = "__copyright__";
-static char __pyx_k41[] = "The GNU Public License 3";
-static char __pyx_k42[] = "__license__";
+static char __pyx_k23[] = "__iter__";
+static char __pyx_k24[] = "itervalues";
+static char __pyx_k25[] = "iteritems";
+static char __pyx_k26[] = "lists and tuples must be of the form [(k, v), ...]";
+static char __pyx_k27[] = "Unsupported type %s for update(need dict/sequence)";
+static char __pyx_k28[] = "append";
+static char __pyx_k29[] = "%r : %r";
+static char __pyx_k30[] = " ";
+static char __pyx_k31[] = ", ";
+static char __pyx_k32[] = "join";
+static char __pyx_k33[] = "";
+static char __pyx_k34[] = "<%s%s>";
+static char __pyx_k35[] = "__name__";
+static char __pyx_k36[] = "Benjamin Saller <bcsaller@gmail.com>";
+static char __pyx_k37[] = "__author__";
+static char __pyx_k38[] = "Benjamin Saller 2010";
+static char __pyx_k39[] = "__copyright__";
+static char __pyx_k40[] = "The GNU Public License 3";
+static char __pyx_k41[] = "__license__";
 
 static PyObject *__pyx_n_ITEMS;
 static PyObject *__pyx_n_KEYS;
 static PyObject *__pyx_n_join;
 static PyObject *__pyx_n_key;
 static PyObject *__pyx_n_next;
-static PyObject *__pyx_n_rev;
 static PyObject *__pyx_n_start;
 static PyObject *__pyx_n_step;
 static PyObject *__pyx_n_stop;
 static PyObject *__pyx_k8p;
 static PyObject *__pyx_k13p;
 static PyObject *__pyx_k16p;
+static PyObject *__pyx_k26p;
 static PyObject *__pyx_k27p;
-static PyObject *__pyx_k28p;
+static PyObject *__pyx_k29p;
 static PyObject *__pyx_k30p;
 static PyObject *__pyx_k31p;
-static PyObject *__pyx_k32p;
+static PyObject *__pyx_k33p;
 static PyObject *__pyx_k34p;
-static PyObject *__pyx_k35p;
-static PyObject *__pyx_k37p;
-static PyObject *__pyx_k39p;
-static PyObject *__pyx_k41p;
+static PyObject *__pyx_k36p;
+static PyObject *__pyx_k38p;
+static PyObject *__pyx_k40p;
 
 static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_ITEMS, 1, __pyx_k9, sizeof(__pyx_k9)},
   {&__pyx_n_KEYS, 1, __pyx_k2, sizeof(__pyx_k2)},
   {&__pyx_n_NODES, 1, __pyx_k6, sizeof(__pyx_k6)},
   {&__pyx_n_VALUES, 1, __pyx_k4, sizeof(__pyx_k4)},
-  {&__pyx_n___author__, 1, __pyx_k38, sizeof(__pyx_k38)},
+  {&__pyx_n___author__, 1, __pyx_k37, sizeof(__pyx_k37)},
   {&__pyx_n___class__, 1, __pyx_k19, sizeof(__pyx_k19)},
-  {&__pyx_n___copyright__, 1, __pyx_k40, sizeof(__pyx_k40)},
+  {&__pyx_n___copyright__, 1, __pyx_k39, sizeof(__pyx_k39)},
   {&__pyx_n___dodeleteslice__, 1, __pyx_k18, sizeof(__pyx_k18)},
   {&__pyx_n___doslice__, 1, __pyx_k17, sizeof(__pyx_k17)},
-  {&__pyx_n___iter__, 1, __pyx_k24, sizeof(__pyx_k24)},
-  {&__pyx_n___license__, 1, __pyx_k42, sizeof(__pyx_k42)},
-  {&__pyx_n___name__, 1, __pyx_k36, sizeof(__pyx_k36)},
-  {&__pyx_n_append, 1, __pyx_k29, sizeof(__pyx_k29)},
+  {&__pyx_n___iter__, 1, __pyx_k23, sizeof(__pyx_k23)},
+  {&__pyx_n___license__, 1, __pyx_k41, sizeof(__pyx_k41)},
+  {&__pyx_n___name__, 1, __pyx_k35, sizeof(__pyx_k35)},
+  {&__pyx_n_append, 1, __pyx_k28, sizeof(__pyx_k28)},
   {&__pyx_n_compare, 1, __pyx_k12, sizeof(__pyx_k12)},
   {&__pyx_n_data, 1, __pyx_k11, sizeof(__pyx_k11)},
   {&__pyx_n_direction, 1, __pyx_k1, sizeof(__pyx_k1)},
   {&__pyx_n_item, 1, __pyx_k7, sizeof(__pyx_k7)},
-  {&__pyx_n_iteritems, 1, __pyx_k26, sizeof(__pyx_k26)},
+  {&__pyx_n_iteritems, 1, __pyx_k25, sizeof(__pyx_k25)},
   {&__pyx_n_iternodes, 1, __pyx_k14, sizeof(__pyx_k14)},
-  {&__pyx_n_itervalues, 1, __pyx_k25, sizeof(__pyx_k25)},
-  {&__pyx_n_join, 1, __pyx_k33, sizeof(__pyx_k33)},
+  {&__pyx_n_itervalues, 1, __pyx_k24, sizeof(__pyx_k24)},
+  {&__pyx_n_join, 1, __pyx_k32, sizeof(__pyx_k32)},
   {&__pyx_n_key, 1, __pyx_k3, sizeof(__pyx_k3)},
   {&__pyx_n_next, 1, __pyx_k15, sizeof(__pyx_k15)},
-  {&__pyx_n_rev, 1, __pyx_k23, sizeof(__pyx_k23)},
   {&__pyx_n_start, 1, __pyx_k20, sizeof(__pyx_k20)},
   {&__pyx_n_step, 1, __pyx_k22, sizeof(__pyx_k22)},
   {&__pyx_n_stop, 1, __pyx_k21, sizeof(__pyx_k21)},
   {&__pyx_k8p, 0, __pyx_k8, sizeof(__pyx_k8)},
   {&__pyx_k13p, 0, __pyx_k13, sizeof(__pyx_k13)},
   {&__pyx_k16p, 0, __pyx_k16, sizeof(__pyx_k16)},
+  {&__pyx_k26p, 0, __pyx_k26, sizeof(__pyx_k26)},
   {&__pyx_k27p, 0, __pyx_k27, sizeof(__pyx_k27)},
-  {&__pyx_k28p, 0, __pyx_k28, sizeof(__pyx_k28)},
+  {&__pyx_k29p, 0, __pyx_k29, sizeof(__pyx_k29)},
   {&__pyx_k30p, 0, __pyx_k30, sizeof(__pyx_k30)},
   {&__pyx_k31p, 0, __pyx_k31, sizeof(__pyx_k31)},
-  {&__pyx_k32p, 0, __pyx_k32, sizeof(__pyx_k32)},
+  {&__pyx_k33p, 0, __pyx_k33, sizeof(__pyx_k33)},
   {&__pyx_k34p, 0, __pyx_k34, sizeof(__pyx_k34)},
-  {&__pyx_k35p, 0, __pyx_k35, sizeof(__pyx_k35)},
-  {&__pyx_k37p, 0, __pyx_k37, sizeof(__pyx_k37)},
-  {&__pyx_k39p, 0, __pyx_k39, sizeof(__pyx_k39)},
-  {&__pyx_k41p, 0, __pyx_k41, sizeof(__pyx_k41)},
+  {&__pyx_k36p, 0, __pyx_k36, sizeof(__pyx_k36)},
+  {&__pyx_k38p, 0, __pyx_k38, sizeof(__pyx_k38)},
+  {&__pyx_k40p, 0, __pyx_k40, sizeof(__pyx_k40)},
   {0, 0, 0, 0}
 };
 
   Py_DECREF(__pyx_2); __pyx_2 = 0;
 
   /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":310 */
-  if (__Pyx_PrintItem(__pyx_n_rev) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; goto __pyx_L1;}
-  if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; goto __pyx_L1;}
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":311 */
   Py_INCREF(__pyx_v_i);
   __pyx_r = __pyx_v_i;
   goto __pyx_L0;
   static char *__pyx_argnames[] = {0};
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_KEYS); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_KEYS); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; goto __pyx_L1;}
   Py_INCREF(__pyx_v_self);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self);
   PyTuple_SET_ITEM(__pyx_2, 1, __pyx_1);
   __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_ptype_6rbtree_rbtreeIterator), __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
+  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_ptype_6rbtree_rbtreeIterator), __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
   static char *__pyx_argnames[] = {0};
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_VALUES); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; goto __pyx_L1;}
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_VALUES); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
   Py_INCREF(__pyx_v_self);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self);
   PyTuple_SET_ITEM(__pyx_2, 1, __pyx_1);
   __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_ptype_6rbtree_rbtreeIterator), __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; goto __pyx_L1;}
+  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_ptype_6rbtree_rbtreeIterator), __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
   static char *__pyx_argnames[] = {0};
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_ITEMS); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_ITEMS); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; goto __pyx_L1;}
   Py_INCREF(__pyx_v_self);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self);
   PyTuple_SET_ITEM(__pyx_2, 1, __pyx_1);
   __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_ptype_6rbtree_rbtreeIterator), __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
+  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_ptype_6rbtree_rbtreeIterator), __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
   static char *__pyx_argnames[] = {0};
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_NODES); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; goto __pyx_L1;}
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_NODES); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
   Py_INCREF(__pyx_v_self);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self);
   PyTuple_SET_ITEM(__pyx_2, 1, __pyx_1);
   __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_ptype_6rbtree_rbtreeIterator), __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; goto __pyx_L1;}
+  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_ptype_6rbtree_rbtreeIterator), __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
   static char *__pyx_argnames[] = {0};
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
-  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___iter__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
-  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___iter__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
   __pyx_2 = 0;
-  __pyx_2 = PyObject_CallObject(((PyObject *)(&PyList_Type)), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(((PyObject *)(&PyList_Type)), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   __pyx_r = __pyx_2;
   __pyx_2 = 0;
   static char *__pyx_argnames[] = {0};
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
-  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_itervalues); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}
-  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_itervalues); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
   __pyx_2 = 0;
-  __pyx_2 = PyObject_CallObject(((PyObject *)(&PyList_Type)), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(((PyObject *)(&PyList_Type)), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   __pyx_r = __pyx_2;
   __pyx_2 = 0;
   static char *__pyx_argnames[] = {0};
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
-  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_iteritems); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}
-  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_iteritems); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
   __pyx_2 = 0;
-  __pyx_2 = PyObject_CallObject(((PyObject *)(&PyList_Type)), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(((PyObject *)(&PyList_Type)), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   __pyx_r = __pyx_2;
   __pyx_2 = 0;
   Py_INCREF(__pyx_v_mapping);
   __pyx_v_k = Py_None; Py_INCREF(Py_None);
   __pyx_v_v = Py_None; Py_INCREF(Py_None);
-  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
+  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; goto __pyx_L1;}
   Py_INCREF(((PyObject *)(&PyDict_Type)));
   PyTuple_SET_ITEM(__pyx_1, 0, ((PyObject *)(&PyDict_Type)));
   Py_INCREF(((PyObject *)__pyx_ptype_6rbtree_rbtree));
   PyTuple_SET_ITEM(__pyx_1, 1, ((PyObject *)__pyx_ptype_6rbtree_rbtree));
-  __pyx_2 = PyObject_IsInstance(__pyx_v_mapping,__pyx_1); if (__pyx_2 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
+  __pyx_2 = PyObject_IsInstance(__pyx_v_mapping,__pyx_1); if (__pyx_2 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   if (__pyx_2) {
-    __pyx_1 = PyObject_GetAttr(__pyx_v_mapping, __pyx_n_iteritems); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;}
-    __pyx_3 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;}
+    __pyx_1 = PyObject_GetAttr(__pyx_v_mapping, __pyx_n_iteritems); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
+    __pyx_3 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
     Py_DECREF(__pyx_1); __pyx_1 = 0;
-    __pyx_1 = PyObject_GetIter(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;}
+    __pyx_1 = PyObject_GetIter(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     for (;;) {
       __pyx_3 = PyIter_Next(__pyx_1);
       if (!__pyx_3) {
-        if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;}
+        if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
         break;
       }
-      __pyx_4 = PyObject_GetIter(__pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;}
+      __pyx_4 = PyObject_GetIter(__pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
       Py_DECREF(__pyx_3); __pyx_3 = 0;
-      __pyx_3 = __Pyx_UnpackItem(__pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;}
+      __pyx_3 = __Pyx_UnpackItem(__pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
       Py_DECREF(__pyx_v_k);
       __pyx_v_k = __pyx_3;
       __pyx_3 = 0;
-      __pyx_3 = __Pyx_UnpackItem(__pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;}
+      __pyx_3 = __Pyx_UnpackItem(__pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
       Py_DECREF(__pyx_v_v);
       __pyx_v_v = __pyx_3;
       __pyx_3 = 0;
-      if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;}
+      if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
       Py_DECREF(__pyx_4); __pyx_4 = 0;
-      if (PyObject_SetItem(__pyx_v_self, __pyx_v_k, __pyx_v_v) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; goto __pyx_L1;}
+      if (PyObject_SetItem(__pyx_v_self, __pyx_v_k, __pyx_v_v) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;}
     }
     Py_DECREF(__pyx_1); __pyx_1 = 0;
     goto __pyx_L2;
   }
-  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; goto __pyx_L1;}
   Py_INCREF(((PyObject *)(&PyList_Type)));
   PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)(&PyList_Type)));
   Py_INCREF(((PyObject *)(&PyTuple_Type)));
   PyTuple_SET_ITEM(__pyx_3, 1, ((PyObject *)(&PyTuple_Type)));
-  __pyx_2 = PyObject_IsInstance(__pyx_v_mapping,__pyx_3); if (__pyx_2 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; goto __pyx_L1;}
+  __pyx_2 = PyObject_IsInstance(__pyx_v_mapping,__pyx_3); if (__pyx_2 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   if (__pyx_2) {
     /*try:*/ {
-      __pyx_4 = PyObject_GetIter(__pyx_v_mapping); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L5;}
+      __pyx_4 = PyObject_GetIter(__pyx_v_mapping); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; goto __pyx_L5;}
       for (;;) {
         __pyx_1 = PyIter_Next(__pyx_4);
         if (!__pyx_1) {
-          if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L5;}
+          if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; goto __pyx_L5;}
           break;
         }
-        __pyx_3 = PyObject_GetIter(__pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L5;}
+        __pyx_3 = PyObject_GetIter(__pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; goto __pyx_L5;}
         Py_DECREF(__pyx_1); __pyx_1 = 0;
-        __pyx_1 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L5;}
+        __pyx_1 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; goto __pyx_L5;}
         Py_DECREF(__pyx_v_k);
         __pyx_v_k = __pyx_1;
         __pyx_1 = 0;
-        __pyx_1 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L5;}
+        __pyx_1 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; goto __pyx_L5;}
         Py_DECREF(__pyx_v_v);
         __pyx_v_v = __pyx_1;
         __pyx_1 = 0;
-        if (__Pyx_EndUnpack(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L5;}
+        if (__Pyx_EndUnpack(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; goto __pyx_L5;}
         Py_DECREF(__pyx_3); __pyx_3 = 0;
-        if (PyObject_SetItem(__pyx_v_self, __pyx_v_k, __pyx_v_v) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; goto __pyx_L5;}
+        if (PyObject_SetItem(__pyx_v_self, __pyx_v_k, __pyx_v_v) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L5;}
       }
       Py_DECREF(__pyx_4); __pyx_4 = 0;
     }
     Py_XDECREF(__pyx_3); __pyx_3 = 0;
     Py_XDECREF(__pyx_4); __pyx_4 = 0;
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":331 */
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":330 */
     __pyx_2 = PyErr_ExceptionMatches(PyExc_ValueError);
     if (__pyx_2) {
       __Pyx_AddTraceback("rbtree.update");
-      if (__Pyx_GetException(&__pyx_1, &__pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}
-      __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}
-      Py_INCREF(__pyx_k27p);
-      PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k27p);
-      __pyx_6 = PyObject_CallObject(PyExc_ValueError, __pyx_5); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}
+      if (__Pyx_GetException(&__pyx_1, &__pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; goto __pyx_L1;}
+      __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}
+      Py_INCREF(__pyx_k26p);
+      PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k26p);
+      __pyx_6 = PyObject_CallObject(PyExc_ValueError, __pyx_5); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}
       Py_DECREF(__pyx_5); __pyx_5 = 0;
       __Pyx_Raise(__pyx_6, 0, 0);
       Py_DECREF(__pyx_6); __pyx_6 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}
       Py_DECREF(__pyx_1); __pyx_1 = 0;
       Py_DECREF(__pyx_3); __pyx_3 = 0;
       Py_DECREF(__pyx_4); __pyx_4 = 0;
     goto __pyx_L2;
   }
   /*else*/ {
-    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}
+    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}
     Py_INCREF(__pyx_v_mapping);
     PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_mapping);
-    __pyx_6 = PyObject_CallObject(((PyObject *)(&PyType_Type)), __pyx_5); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}
+    __pyx_6 = PyObject_CallObject(((PyObject *)(&PyType_Type)), __pyx_5); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}
     Py_DECREF(__pyx_5); __pyx_5 = 0;
-    __pyx_1 = PyNumber_Remainder(__pyx_k28p, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}
+    __pyx_1 = PyNumber_Remainder(__pyx_k27p, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}
     Py_DECREF(__pyx_6); __pyx_6 = 0;
     __Pyx_Raise(PyExc_TypeError, __pyx_1, 0);
     Py_DECREF(__pyx_1); __pyx_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}
   }
   __pyx_L2:;
 
   __pyx_v_key = Py_None; Py_INCREF(Py_None);
   __pyx_v_v = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":337 */
-  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___iter__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}
-  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":336 */
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___iter__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_next); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_next); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_v_key);
   __pyx_v_key = __pyx_2;
   __pyx_2 = 0;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":338 */
-  __pyx_1 = PyObject_GetItem(__pyx_v_self, __pyx_v_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":337 */
+  __pyx_1 = PyObject_GetItem(__pyx_v_self, __pyx_v_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}
   Py_DECREF(__pyx_v_v);
   __pyx_v_v = __pyx_1;
   __pyx_1 = 0;
 
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":338 */
+  if (PyObject_DelItem(__pyx_v_self, __pyx_v_key) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; goto __pyx_L1;}
+
   /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":339 */
-  if (PyObject_DelItem(__pyx_v_self, __pyx_v_key) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; goto __pyx_L1;}
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":340 */
   Py_INCREF(__pyx_v_v);
   __pyx_r = __pyx_v_v;
   goto __pyx_L0;
   static char *__pyx_argnames[] = {0};
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
-  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; goto __pyx_L1;}
   Py_INCREF(__pyx_v_self);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self);
-  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   __pyx_r = __pyx_3;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":346 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":345 */
   rbtree_dealloc(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":347 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":346 */
   rbtree_free(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":348 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":347 */
   ((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree = rbtree_alloc();
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":349 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":348 */
   rbtree_init(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree);
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   Py_INCREF(__pyx_v_key);
   Py_INCREF(__pyx_v_default);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":352 */
-  __pyx_1 = PySequence_Contains(__pyx_v_self, __pyx_v_key); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":351 */
+  __pyx_1 = PySequence_Contains(__pyx_v_self, __pyx_v_key); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; goto __pyx_L1;}
   __pyx_1 = !__pyx_1;
   if (__pyx_1) {
 
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":352 */
+    if (PyObject_SetItem(__pyx_v_self, __pyx_v_key, __pyx_v_default) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; goto __pyx_L1;}
+
     /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":353 */
-    if (PyObject_SetItem(__pyx_v_self, __pyx_v_key, __pyx_v_default) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; goto __pyx_L1;}
-
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":354 */
     Py_INCREF(__pyx_v_default);
     __pyx_r = __pyx_v_default;
     goto __pyx_L0;
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":355 */
-  __pyx_2 = PyObject_GetItem(__pyx_v_self, __pyx_v_key); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":354 */
+  __pyx_2 = PyObject_GetItem(__pyx_v_self, __pyx_v_key); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; goto __pyx_L1;}
   __pyx_r = __pyx_2;
   __pyx_2 = 0;
   goto __pyx_L0;
   __pyx_v_forward = Py_None; Py_INCREF(Py_None);
   __pyx_v_i = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":360 */
-  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; goto __pyx_L1;}
-  if (PyObject_Cmp(__pyx_v_offset, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":359 */
+  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; goto __pyx_L1;}
+  if (PyObject_Cmp(__pyx_v_offset, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; goto __pyx_L1;}
   __pyx_2 = __pyx_2 >= 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   if (__pyx_2) {
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":361 */
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":360 */
     __pyx_v_n = tree_min(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree,NULL);
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":362 */
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":361 */
     Py_INCREF(Py_True);
     Py_DECREF(__pyx_v_forward);
     __pyx_v_forward = Py_True;
   }
   /*else*/ {
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":364 */
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":363 */
     __pyx_v_n = tree_max(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree,NULL);
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":365 */
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":364 */
     Py_INCREF(Py_False);
     Py_DECREF(__pyx_v_forward);
     __pyx_v_forward = Py_False;
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":366 */
-    __pyx_1 = PyNumber_Absolute(__pyx_v_offset); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; goto __pyx_L1;}
-    __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; goto __pyx_L1;}
-    __pyx_4 = PyNumber_Subtract(__pyx_1, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; goto __pyx_L1;}
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":365 */
+    __pyx_1 = PyNumber_Absolute(__pyx_v_offset); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; goto __pyx_L1;}
+    __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; goto __pyx_L1;}
+    __pyx_4 = PyNumber_Subtract(__pyx_1, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; goto __pyx_L1;}
     Py_DECREF(__pyx_1); __pyx_1 = 0;
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_v_offset);
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":368 */
-  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":367 */
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; goto __pyx_L1;}
   Py_INCREF(__pyx_v_offset);
   PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_offset);
-  __pyx_3 = PyObject_CallObject(((PyObject *)(&PyRange_Type)), __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(((PyObject *)(&PyRange_Type)), __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_4 = PyObject_GetIter(__pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetIter(__pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   for (;;) {
     __pyx_1 = PyIter_Next(__pyx_4);
     if (!__pyx_1) {
-      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;}
+      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; goto __pyx_L1;}
       break;
     }
     Py_DECREF(__pyx_v_i);
     __pyx_v_i = __pyx_1;
     __pyx_1 = 0;
-    __pyx_2 = PyObject_IsTrue(__pyx_v_forward); if (__pyx_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; goto __pyx_L1;}
+    __pyx_2 = PyObject_IsTrue(__pyx_v_forward); if (__pyx_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;}
     if (__pyx_2) {
       __pyx_v_n = tree_successor(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree,__pyx_v_n);
       goto __pyx_L5;
   }
   Py_DECREF(__pyx_4); __pyx_4 = 0;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":374 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":373 */
   Py_INCREF(((PyObject *)__pyx_v_n->key));
   __pyx_r = ((PyObject *)__pyx_v_n->key);
   goto __pyx_L0;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":378 */
-  __pyx_1 = PyObject_Length(__pyx_v_self); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":377 */
+  __pyx_1 = PyObject_Length(__pyx_v_self); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; goto __pyx_L1;}
   __pyx_2 = (__pyx_1 == 0);
   if (__pyx_2) {
     Py_INCREF(Py_None);
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":380 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":379 */
   Py_INCREF(((PyObject *)tree_min(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree,NULL)->key));
   __pyx_r = ((PyObject *)tree_min(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree,NULL)->key);
   goto __pyx_L0;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":384 */
-  __pyx_1 = PyObject_Length(__pyx_v_self); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":383 */
+  __pyx_1 = PyObject_Length(__pyx_v_self); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; goto __pyx_L1;}
   __pyx_2 = (__pyx_1 == 0);
   if (__pyx_2) {
     Py_INCREF(Py_None);
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":386 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":385 */
   Py_INCREF(((PyObject *)tree_max(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree,NULL)->key));
   __pyx_r = ((PyObject *)tree_max(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree,NULL)->key);
   goto __pyx_L0;
   __pyx_v_k = Py_None; Py_INCREF(Py_None);
   __pyx_v_v = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":389 */
-  __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":388 */
+  __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}
   Py_DECREF(__pyx_v_res);
   __pyx_v_res = __pyx_1;
   __pyx_1 = 0;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":390 */
-  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_iteritems); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}
-  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":389 */
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_iteritems); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyObject_GetIter(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetIter(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   for (;;) {
     __pyx_2 = PyIter_Next(__pyx_1);
     if (!__pyx_2) {
-      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}
+      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; goto __pyx_L1;}
       break;
     }
-    __pyx_3 = PyObject_GetIter(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetIter(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __pyx_2 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}
+    __pyx_2 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; goto __pyx_L1;}
     Py_DECREF(__pyx_v_k);
     __pyx_v_k = __pyx_2;
     __pyx_2 = 0;
-    __pyx_2 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}
+    __pyx_2 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; goto __pyx_L1;}
     Py_DECREF(__pyx_v_v);
     __pyx_v_v = __pyx_2;
     __pyx_2 = 0;
-    if (__Pyx_EndUnpack(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}
+    if (__Pyx_EndUnpack(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    __pyx_2 = PyObject_GetAttr(__pyx_v_res, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}
-    __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}
+    __pyx_2 = PyObject_GetAttr(__pyx_v_res, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}
     Py_INCREF(__pyx_v_k);
     PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_k);
     Py_INCREF(__pyx_v_v);
     PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_v);
-    __pyx_4 = PyNumber_Remainder(__pyx_k30p, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}
+    __pyx_4 = PyNumber_Remainder(__pyx_k29p, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}
     PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
     __pyx_4 = 0;
-    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}
+    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_4); __pyx_4 = 0;
   }
   Py_DECREF(__pyx_1); __pyx_1 = 0;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":392 */
-  __pyx_5 = PyObject_Length(__pyx_v_res); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":391 */
+  __pyx_5 = PyObject_Length(__pyx_v_res); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}
   if (__pyx_5) {
-    __pyx_2 = PyObject_GetAttr(__pyx_k32p, __pyx_n_join); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}
-    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}
+    __pyx_2 = PyObject_GetAttr(__pyx_k31p, __pyx_n_join); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}
     Py_INCREF(__pyx_v_res);
     PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_res);
-    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}
+    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    __pyx_1 = PyNumber_Add(__pyx_k31p, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}
+    __pyx_1 = PyNumber_Add(__pyx_k30p, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}
     Py_DECREF(__pyx_4); __pyx_4 = 0;
     Py_DECREF(__pyx_v_res);
     __pyx_v_res = __pyx_1;
     goto __pyx_L4;
   }
   /*else*/ {
-    Py_INCREF(__pyx_k34p);
+    Py_INCREF(__pyx_k33p);
     Py_DECREF(__pyx_v_res);
-    __pyx_v_res = __pyx_k34p;
+    __pyx_v_res = __pyx_k33p;
   }
   __pyx_L4:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":396 */
-  __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n___name__); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":395 */
+  __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n___name__); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; goto __pyx_L1;}
+  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
   Py_INCREF(__pyx_v_res);
   PyTuple_SET_ITEM(__pyx_4, 1, __pyx_v_res);
   __pyx_3 = 0;
-  __pyx_1 = PyNumber_Remainder(__pyx_k35p, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; goto __pyx_L1;}
+  __pyx_1 = PyNumber_Remainder(__pyx_k34p, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
   __pyx_ptype_6rbtree_rbtreeIterator = &__pyx_type_6rbtree_rbtreeIterator;
 
   /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":8 */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n___author__, __pyx_k37p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n___author__, __pyx_k36p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
 
   /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":9 */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n___copyright__, __pyx_k39p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n___copyright__, __pyx_k38p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
 
   /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":10 */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n___license__, __pyx_k41p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n___license__, __pyx_k40p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
 
   /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":68 */
   __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
   Py_INCREF(Py_None);
   __pyx_d4 = Py_None;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":388 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":387 */
   return;
   __pyx_L1:;
   Py_XDECREF(__pyx_1);
     return -1;
 }
 
-static PyObject *__Pyx_GetStdout(void) {
-    PyObject *f = PySys_GetObject("stdout");
-    if (!f) {
-        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
-    }
-    return f;
-}
-
-static int __Pyx_PrintItem(PyObject *v) {
-    PyObject *f;
-    
-    if (!(f = __Pyx_GetStdout()))
-        return -1;
-    if (PyFile_SoftSpace(f, 1)) {
-        if (PyFile_WriteString(" ", f) < 0)
-            return -1;
-    }
-    if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
-        return -1;
-    if (PyString_Check(v)) {
-        char *s = PyString_AsString(v);
-        Py_ssize_t len = PyString_Size(v);
-        if (len > 0 &&
-            isspace(Py_CHARMASK(s[len-1])) &&
-            s[len-1] != ' ')
-                PyFile_SoftSpace(f, 0);
-    }
-    return 0;
-}
-
-static int __Pyx_PrintNewline(void) {
-    PyObject *f;
-    
-    if (!(f = __Pyx_GetStdout()))
-        return -1;
-    if (PyFile_WriteString("\n", f) < 0)
-        return -1;
-    PyFile_SoftSpace(f, 0);
-    return 0;
-}
-
 static void __Pyx_UnpackError(void) {
     PyErr_SetString(PyExc_ValueError, "unpack sequence of wrong size");
 }

File test_rbtree.py

-import unittest
-import doctest
-from rbtree import rbtree
-from rbtree import (KEYS, VALUES, ITEMS, NODES)
-
-
-class Test(unittest.TestCase):
-    def supply_words(self, ds):
-        for word in open('/usr/share/dict/words', 'r'):
-            word = word.strip()
-            ds[word] = True
-
-    def sample_data(self):
-        r = rbtree()
-        self.supply_words(r)
-        return r
-
-    def test_create(self):
-        r = rbtree()
-        assert len(r) == 0
-
-    def test_create_mapping(self):
-        r = rbtree({'a': 'b'})
-        assert len(r) == 1
-        assert r['a'] == 'b'
-
-    def test_dict(self):
-        r = rbtree({'a': 'b'})
-        d = dict(r)
-        assert d['a'] == 'b'
-
-    def test_create_sequence(self):
-        r = rbtree((('a', 'b'), ('c', 'd')))
-        assert len(r) == 2
-        assert r['a'] == 'b'
-        assert r['c'] == 'd'
-
-    def test_missing(self):
-        r = rbtree({'a': 'b'})
-        assert r['a']
-        try:
-            print r['missing']
-        except KeyError:
-            pass
-        else:
-            raise KeyError("Able to find missing key")
-
-    def test_iteration(self):
-        r = self.sample_data()
-        i1 = iter(r)
-        i2 = iter(r)
-        for word in i1:
-            assert i2.next() == word
-
-    def test_axes(self):
-        r = rbtree(dict(zip(range(10), range(1, 11))))
-        assert r.keys() == range(10)
-        assert r.values() == range(1, 11)
-        assert r.items() == zip(range(10), range(1, 11))
-
-    def test_slicing(self):
-        r = self.sample_data()
-        # This should return all matches between b and c in the wordlist
-        slice = r['b':'c']
-        assert len(slice)
-        assert slice.keys()
-        del slice
-        # Empty slices return empty trees
-        r = rbtree()
-        assert len(r[0:100]) == 0
-
-    def test_slicing_stepping(self):
-        r = rbtree(dict(zip(range(10), range(10))))
-        assert r[0:8:2].keys() == [0, 2, 4, 6]
-        assert r[1:8:3].keys() == [1, 4, 7]
-        # neg slice stride makes no sense with cmp ordered keys
-        assert r[0:8:-2].keys() == [0, 2, 4, 6]
-
-    def test_slice_partial(self):
-        r = rbtree(dict(zip(range(10), range(10))))
-        assert r[8:]
-
-    def test_iter_refcount(self):
-        r = rbtree(dict(zip(range(10), range(1, 11))))
-        i = iter(r)
-        del r
-        assert list(i) == range(10)
-
-    def test_pop(self):
-        r = rbtree(dict(zip(range(10), range(1, 11))))
-        assert len(r) == 10
-        # Pops the values, not the keys
-        assert r.pop() == 1
-        assert r.pop() == 2
-        assert len(r) == 8
-
-    def test_random_insert(self):
-        import random
-        r = rbtree()
-        nums = range(1000)
-        random.shuffle(nums)
-        for i in nums:
-            r[i] = True
-
-        assert r.keys() == range(1000)
-        assert r[800:810].keys() == range(800, 810)
-
-    def test_contains(self):
-        r = rbtree(dict(zip(range(10), range(1, 11))))
-        assert 5 in r
-        assert 42 not in r
-
-    def test_copy(self):
-        r = rbtree(dict(zip(range(10), range(1, 11))))
-        c = r.copy()
-        assert 5 in r
-        assert 5 in c
-        del r[5]
-        assert 5 not in r
-        assert 5 in c
-
-    def test_clear(self):
-        r = rbtree(dict(zip(range(10), range(1, 11))))
-        r.clear()
-        assert len(r) == 0
-        assert 5 not in r
-
-    def test_setdefault(self):
-        r = rbtree()
-        r.setdefault('f', 'foo')
-        assert r['f'] == 'foo'
-
-    def test_cmp(self):
-        reverse = lambda x, y: cmp(x, y) * -1
-        r = rbtree(dict(zip(range(10), range(10))),
-                          cmp=reverse)
-        assert r.keys() == list(reversed(range(10)))
-
-        badcmp = lambda x, y: 'z'
-        try:
-            r = rbtree(dict(zip(range(10), range(10))),
-                              cmp=badcmp)
-        except TypeError: pass
-        else:
-            raise TypeError("Allowed Cmp that returns string?")
-
-    def test_minmax(self):
-        r = rbtree(dict(zip(range(10), range(10))))
-        assert r.min() == 0
-        assert r.max() == 9
-
-    def test_reversed(self):
-        # invokes the __reversed__ method
-        r = rbtree(dict(zip(range(10), range(10))))
-        assert list(reversed(r)) == range(10)[::-1]
-
-    def test_offset(self):
-        r = rbtree(dict(zip(range(10), range(10))))
-        # get keys by offset
-        assert r.byOffset(2) == 2
-        assert r.byOffset(1) == 1
-        assert r.byOffset(0) == 0
-        assert r.byOffset(-1) == 9
-        assert r.byOffset(-2) == 8
-
-    def test_stopiteration(self):
-        r = rbtree({'a': 'b', 'c': 'd'})
-        i = iter(r)
-        # iterate the whole set
-        list(i)
-        # now each call should raise StopIteration to complie with the
-        # protocol
-        try:
-            i.next()
-        except StopIteration:
-            pass
-        else:
-            raise NotImplementedError()
-
-        try:
-            i.next()
-        except StopIteration:
-            pass
-        else:
-            raise NotImplementedError()
-
-    def test_iterdirection(self):
-        r = rbtree(dict(zip(range(10), range(10))))
-        i = iter(r)
-        assert i.next() == 0
-        assert i.next() == 1
-        assert i.next() == 2
-        i.direction = -1
-        assert i.next() == 1
-        assert i.next() == 0
-
-        i = iter(r)
-        i.direction = -1
-        assert i.next() == 9
-
-    def test_itergoto(self):
-        r = rbtree(dict(zip(range(10), range(10))))
-        i = iter(r)
-        i.goto(5)
-        assert i.next() == 6
-        assert i.next() == 7
-
-        # Just to key 5 and walk backwards getting the items tuple
-        i2 = r.iteritems()
-        i2.goto(5)
-        i2.direction = -1
-        assert i2.next() == (4, 4)
-
-        # Now goto a missing key
-        try:
-            i2.goto('missing')
-        except KeyError:
-            pass
-        else:
-            raise KeyError("Found Missing key in iter")
-
-    def test_replace(self):
-        r = rbtree()
-        r[1] = 2
-        assert r[1] == 2
-        r[1] = 3
-        assert r[1] == 3
-        assert len(r) == 1
-
-    def test_multikey_compare(self):
-        # use a cmp function that allows for key matches
-        def multicmp(x, y):
-            x = cmp(x, y)
-            if x == 0: return 1
-            return x
-        r = rbtree(cmp=multicmp)
-        r[1] = 2
-        r[1] = 3
-        assert len(r) == 2
-        assert 2 in r.values()
-        assert 3 in r.values()
-
-        i = iter(r)
-        i.next()
-        i.delete()
-        assert len(r) == 1
-
-    def test_iterprev(self):
-        r = rbtree([(chr(i), True) for i in range(ord('a'),
-                                                  ord('z') + 1)])
-        i = r.iternodes()
-        i.goto('c')
-        assert i.key == 'c'
-        i.prev()
-        assert i.key == 'b'
-        i.next()
-        assert i.key == 'c'
-
-        # Now we flip the base direction
-        i.direction = -1
-        i.next()
-        assert i.key == 'b'
-        i.prev()
-        assert i.key == 'c'
-
-    def test_pickle(self):
-        import pickle
-        r = rbtree([(chr(i), True) for i in range(ord('a'),
-                                                  ord('z') + 1)])
-        s = pickle.dumps(r, protocol=-1)
-        t = pickle.loads(s)
-        assert t.keys() == [chr(i) for i in
-                            range(ord('a'), ord('z') + 1)]
-
-        # and with a custom cmp function, this has to be module global
-        # to work because of pickle
-        global ncmp
-
-        def ncmp(a, b):
-            return cmp(a.lower(), b.lower())
-
-        r = rbtree({'a': 1, 'A': 2}, ncmp)
-        s = pickle.dumps(r, protocol=-1)
-        t = pickle.loads(s)
-        assert t == r
-
-    def test_slice_endcase(self):
-        r = rbtree((('x', 1), ('y', 1), ('z', 1)))
-        assert r['y':].keys() == ['y', 'z']
-
-    def test_delslice(self):
-        r = rbtree([(chr(i), True) for i in range(ord('a'),
-                                                  ord('z') + 1)])
-        del r['a':'x']
-        assert r.keys() == ['x', 'y', 'z']
-        del r['y':]
-        assert r.keys() == ['x']
-
-    def test_itermode(self):
-        r = rbtree([(chr(i), True) for i in range(ord('a'),
-                                                  ord('z') + 1)])
-        it = r.iternodes()
-        for n in it:
-            n.get(KEYS)
-            n.get(VALUES)
-            n.get(ITEMS)
-            n.get(NODES)
-
-    def test_invalid_sequence(self):
-        self.assertRaises(ValueError, rbtree, [['a', 'b', 'c'], ['c', 'd']])
-
-
-if __name__ == "__main__":
-    suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(Test))
-    suite.addTest(doctest.DocFileSuite('README.txt'))
-    runner = unittest.TextTestRunner(verbosity=1)
-    runner.run(suite)
-

File tests/__init__.py

Empty file added.

File tests/test_rbtree.py

View file
+import unittest
+import doctest
+from rbtree import rbtree
+from rbtree import (KEYS, VALUES, ITEMS, NODES)
+
+
+class Test(unittest.TestCase):
+    def supply_words(self, ds):
+        for word in open('/usr/share/dict/words', 'r'):
+            word = word.strip()
+            ds[word] = True
+
+    def sample_data(self):
+        r = rbtree()
+        self.supply_words(r)
+        return r
+
+    def test_create(self):
+        r = rbtree()
+        assert len(r) == 0
+
+    def test_create_mapping(self):
+        r = rbtree({'a': 'b'})
+        assert len(r) == 1
+        assert r['a'] == 'b'
+
+    def test_dict(self):
+        r = rbtree({'a': 'b'})
+        d = dict(r)
+        assert d['a'] == 'b'
+
+    def test_create_sequence(self):
+        r = rbtree((('a', 'b'), ('c', 'd')))
+        assert len(r) == 2
+        assert r['a'] == 'b'
+        assert r['c'] == 'd'
+
+    def test_missing(self):
+        r = rbtree({'a': 'b'})
+        assert r['a']
+        try:
+            print r['missing']
+        except KeyError:
+            pass
+        else:
+            raise KeyError("Able to find missing key")
+
+    def test_iteration(self):
+        r = self.sample_data()
+        i1 = iter(r)
+        i2 = iter(r)
+        for word in i1:
+            assert i2.next() == word
+
+    def test_axes(self):
+        r = rbtree(dict(zip(range(10), range(1, 11))))
+        assert r.keys() == range(10)
+        assert r.values() == range(1, 11)
+        assert r.items() == zip(range(10), range(1, 11))
+
+    def test_slicing(self):
+        r = self.sample_data()
+        # This should return all matches between b and c in the wordlist
+        slice = r['b':'c']
+        assert len(slice)
+        assert slice.keys()
+        del slice
+        # Empty slices return empty trees
+        r = rbtree()
+        assert len(r[0:100]) == 0
+
+    def test_slicing_stepping(self):
+        r = rbtree(dict(zip(range(10), range(10))))
+        assert r[0:8:2].keys() == [0, 2, 4, 6]
+        assert r[1:8:3].keys() == [1, 4, 7]
+        # neg slice stride makes no sense with cmp ordered keys
+        assert r[0:8:-2].keys() == [0, 2, 4, 6]
+
+    def test_slice_partial(self):
+        r = rbtree(dict(zip(range(10), range(10))))
+        assert r[8:]
+
+    def test_iter_refcount(self):
+        r = rbtree(dict(zip(range(10), range(1, 11))))
+        i = iter(r)
+        del r
+        assert list(i) == range(10)
+
+    def test_pop(self):
+        r = rbtree(dict(zip(range(10), range(1, 11))))
+        assert len(r) == 10
+        # Pops the values, not the keys
+        assert r.pop() == 1
+        assert r.pop() == 2
+        assert len(r) == 8
+
+    def test_random_insert(self):
+        import random
+        r = rbtree()
+        nums = range(1000)
+        random.shuffle(nums)
+        for i in nums:
+            r[i] = True
+
+        assert r.keys() == range(1000)
+        assert r[800:810].keys() == range(800, 810)
+
+    def test_contains(self):
+        r = rbtree(dict(zip(range(10), range(1, 11))))
+        assert 5 in r
+        assert 42 not in r
+
+    def test_copy(self):
+        r = rbtree(dict(zip(range(10), range(1, 11))))
+        c = r.copy()
+        assert 5 in r
+        assert 5 in c
+        del r[5]
+        assert 5 not in r
+        assert 5 in c
+
+    def test_clear(self):
+        r = rbtree(dict(zip(range(10), range(1, 11))))
+        r.clear()
+        assert len(r) == 0
+        assert 5 not in r
+
+    def test_setdefault(self):
+        r = rbtree()
+        r.setdefault('f', 'foo')
+        assert r['f'] == 'foo'
+
+    def test_cmp(self):
+        reverse = lambda x, y: cmp(x, y) * -1
+        r = rbtree(dict(zip(range(10), range(10))),
+                          cmp=reverse)
+        assert r.keys() == list(reversed(range(10)))
+
+        badcmp = lambda x, y: 'z'
+        try:
+            r = rbtree(dict(zip(range(10), range(10))),
+                              cmp=badcmp)
+        except TypeError: pass
+        else:
+            raise TypeError("Allowed Cmp that returns string?")
+
+    def test_minmax(self):
+        r = rbtree(dict(zip(range(10), range(10))))
+        assert r.min() == 0
+        assert r.max() == 9
+
+    def test_reversed(self):
+        # invokes the __reversed__ method
+        r = rbtree(dict(zip(range(10), range(10))))
+        assert list(reversed(r)) == range(10)[::-1]
+
+    def test_offset(self):
+        r = rbtree(dict(zip(range(10), range(10))))
+        # get keys by offset
+        assert r.byOffset(2) == 2
+        assert r.byOffset(1) == 1
+        assert r.byOffset(0) == 0
+        assert r.byOffset(-1) == 9
+        assert r.byOffset(-2) == 8
+
+    def test_stopiteration(self):
+        r = rbtree({'a': 'b', 'c': 'd'})
+        i = iter(r)
+        # iterate the whole set
+        list(i)
+        # now each call should raise StopIteration to complie with the
+        # protocol
+        try:
+            i.next()
+        except StopIteration:
+            pass
+        else:
+            raise NotImplementedError()
+
+        try:
+            i.next()
+        except StopIteration:
+            pass
+        else:
+            raise NotImplementedError()
+
+    def test_iterdirection(self):
+        r = rbtree(dict(zip(range(10), range(10))))
+        i = iter(r)
+        assert i.next() == 0
+        assert i.next() == 1
+        assert i.next() == 2
+        i.direction = -1
+        assert i.next() == 1
+        assert i.next() == 0
+
+        i = iter(r)
+        i.direction = -1
+        assert i.next() == 9
+
+    def test_itergoto(self):
+        r = rbtree(dict(zip(range(10), range(10))))
+        i = iter(r)
+        i.goto(5)
+        assert i.next() == 6
+        assert i.next() == 7
+
+        # Just to key 5 and walk backwards getting the items tuple
+        i2 = r.iteritems()
+        i2.goto(5)
+        i2.direction = -1
+        assert i2.next() == (4, 4)
+
+        # Now goto a missing key
+        try:
+            i2.goto('missing')
+        except KeyError:
+            pass
+        else:
+            raise KeyError("Found Missing key in iter")
+
+    def test_replace(self):
+        r = rbtree()
+        r[1] = 2
+        assert r[1] == 2
+        r[1] = 3
+        assert r[1] == 3
+        assert len(r) == 1
+
+    def test_multikey_compare(self):
+        # use a cmp function that allows for key matches
+        def multicmp(x, y):
+            x = cmp(x, y)
+            if x == 0: return 1
+            return x
+        r = rbtree(cmp=multicmp)
+        r[1] = 2
+        r[1] = 3
+        assert len(r) == 2
+        assert 2 in r.values()
+        assert 3 in r.values()
+
+        i = iter(r)
+        i.next()
+        i.delete()
+        assert len(r) == 1
+
+    def test_iterprev(self):
+        r = rbtree([(chr(i), True) for i in range(ord('a'),
+                                                  ord('z') + 1)])
+        i = r.iternodes()
+        i.goto('c')
+        assert i.key == 'c'
+        i.prev()
+        assert i.key == 'b'
+        i.next()
+        assert i.key == 'c'
+
+        # Now we flip the base direction
+        i.direction = -1
+        i.next()
+        assert i.key == 'b'
+        i.prev()
+        assert i.key == 'c'
+
+    def test_pickle(self):
+        import pickle
+        r = rbtree([(chr(i), True) for i in range(ord('a'),
+                                                  ord('z') + 1)])
+        s = pickle.dumps(r, protocol=-1)
+        t = pickle.loads(s)
+        assert t.keys() == [chr(i) for i in
+                            range(ord('a'), ord('z') + 1)]
+
+        # and with a custom cmp function, this has to be module global
+        # to work because of pickle
+        global ncmp
+
+        def ncmp(a, b):
+            return cmp(a.lower(), b.lower())
+
+        r = rbtree({'a': 1, 'A': 2}, ncmp)
+        s = pickle.dumps(r, protocol=-1)
+        t = pickle.loads(s)
+        assert t == r
+
+    def test_slice_endcase(self):
+        r = rbtree((('x', 1), ('y', 1), ('z', 1)))
+        assert r['y':].keys() == ['y', 'z']
+
+    def test_delslice(self):
+        r = rbtree([(chr(i), True) for i in range(ord('a'),
+                                                  ord('z') + 1)])
+        del r['a':'x']
+        assert r.keys() == ['x', 'y', 'z']
+        del r['y':]
+        assert r.keys() == ['x']
+
+    def test_itermode(self):
+        r = rbtree([(chr(i), True) for i in range(ord('a'),
+                                                  ord('z') + 1)])
+        it = r.iternodes()
+        for n in it:
+            n.get(KEYS)
+            n.get(VALUES)
+            n.get(ITEMS)
+            n.get(NODES)
+
+    def test_invalid_sequence(self):
+        self.assertRaises(ValueError, rbtree, [['a', 'b', 'c'], ['c', 'd']])
+
+
+if __name__ == "__main__":
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(Test))
+    suite.addTest(doctest.DocFileSuite('README.txt'))
+    runner = unittest.TextTestRunner(verbosity=1)
+    runner.run(suite)
+