-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcuckoo.c
1293 lines (1157 loc) · 50.1 KB
/
cuckoo.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Generated by Pyrex 0.9.2.1 on Thu Feb 28 09:37:56 2008 */
#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
#include "../cuckoo_hash/cuckoo_hash.h"
typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
static PyObject *__Pyx_UnpackItem(PyObject *, int); /*proto*/
static int __Pyx_EndUnpack(PyObject *, int); /*proto*/
static int __Pyx_PrintItem(PyObject *); /*proto*/
static int __Pyx_PrintNewline(void); /*proto*/
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static void __Pyx_ReRaise(void); /*proto*/
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
static PyObject *__Pyx_GetExcValue(void); /*proto*/
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/
static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], int nargs, PyObject **args2, PyObject **kwds2); /*proto*/
static void __Pyx_WriteUnraisable(char *name); /*proto*/
static void __Pyx_AddTraceback(char *funcname); /*proto*/
static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/
static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
static int __Pyx_GetVtable(PyObject *dict, void **vtabptr); /*proto*/
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/
static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static int __pyx_lineno;
static char *__pyx_filename;
staticforward char **__pyx_f;
static char __pyx_mdoc[] = "Cuckoo Hash library\n\nThis module provides a simple interface to the Cuckoo Hash,\nan efficient sparse array implementation.\n\nCuckoo Hashing was proposed by Pagh and Rodler (2001). The idea is to\nbuild a dictionary data structure with two hash tables and two different\nhash functions.\n\nSEE ALSO\nRasmus Pagh and Flemming Friche Rodler. 2001. Cuckoo Hashing, Proceedings\nof ESA 2001, Lecture Notes in Computer Science, vol. 2161.\n\nChuleerat Jaruskulchai and Canasai Kruengkrai. 2002. Building Inverted\nFiles Through Efficient Dynamic Hashing. Proceedings of the Fifth National\nComputer Science and Engineering Conference (NCSEC-2002).\n\nL Devroye, P Morin. 2003. Cuckoo hashing: Further analysis. Information \nProcessing Letters.\n\n\nThis Python interface is to CKHash 0.4.2:\n * Copyright (C) 2005-2008 Thai Computational Linguistics Laboratory (TCL),\n * National Institute of Information and Communications Technology (NICT)\n * Written by Canasai Kruengkrai <canasaiREMOVETHIS@gmail.com>\n";
/* Declarations from cuckoo */
staticforward PyTypeObject __pyx_type_6cuckoo_cuckoohash;
struct __pyx_obj_6cuckoo_cuckoohash {
PyObject_HEAD
struct __pyx_vtabstruct_6cuckoo_cuckoohash *__pyx_vtab;
struct CKHash_Table_t (*table);
};
struct __pyx_vtabstruct_6cuckoo_cuckoohash {
PyObject *((*__cuckoo_gather)(struct __pyx_obj_6cuckoo_cuckoohash *,int ((char (*),int ,void (*)))));
};
static struct __pyx_vtabstruct_6cuckoo_cuckoohash *__pyx_vtabptr_6cuckoo_cuckoohash;
static PyTypeObject *__pyx_ptype_6cuckoo_cuckoohash = 0;
static PyObject *__pyx_k6;
static PyObject *__pyx_k7;
static int (__pyx_f_6cuckoo__cuckoo_get_keys(char (*),int ,void (*))); /*proto*/
static int (__pyx_f_6cuckoo__cuckoo_get_values(char (*),int ,void (*))); /*proto*/
static int (__pyx_f_6cuckoo__cuckoo_get_items(char (*),int ,void (*))); /*proto*/
/* Implementation of cuckoo */
char (__pyx_k1[]) = "Jose Nazario <jose@monkey.org>";
char (__pyx_k2[]) = "Copyright (c) 2008 Jose Nazario";
char (__pyx_k4[]) = "";
char (__pyx_k5[]) = "1.0-0.4.2";
static PyObject *__pyx_n___author__;
static PyObject *__pyx_n___copyright__;
static PyObject *__pyx_n___license__;
static PyObject *__pyx_n___url__;
static PyObject *__pyx_n___version__;
static PyObject *__pyx_n_GPL2;
static PyObject *__pyx_k1p;
static PyObject *__pyx_k2p;
static PyObject *__pyx_k4p;
static PyObject *__pyx_k5p;
static PyObject *__pyx_n_append;
static int __pyx_f_6cuckoo__cuckoo_get_keys(char (*__pyx_v_key),int __pyx_v_val,void (*__pyx_v_arg)) {
PyObject *__pyx_v_lst;
int __pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
__pyx_v_lst = Py_None; Py_INCREF(__pyx_v_lst);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":75 */
__pyx_1 = (PyObject *)__pyx_v_arg;
Py_INCREF(__pyx_1);
Py_DECREF(__pyx_v_lst);
__pyx_v_lst = __pyx_1;
__pyx_1 = 0;
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":76 */
__pyx_1 = PyObject_GetAttr(__pyx_v_lst, __pyx_n_append); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
__pyx_2 = PyString_FromString(__pyx_v_key); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
__pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
__pyx_2 = 0;
__pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_WriteUnraisable("cuckoo._cuckoo_get_keys");
__pyx_L0:;
Py_DECREF(__pyx_v_lst);
return __pyx_r;
}
static int __pyx_f_6cuckoo__cuckoo_get_values(char (*__pyx_v_key),int __pyx_v_val,void (*__pyx_v_arg)) {
PyObject *__pyx_v_lst;
int __pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
__pyx_v_lst = Py_None; Py_INCREF(__pyx_v_lst);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":79 */
__pyx_1 = (PyObject *)__pyx_v_arg;
Py_INCREF(__pyx_1);
Py_DECREF(__pyx_v_lst);
__pyx_v_lst = __pyx_1;
__pyx_1 = 0;
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":80 */
__pyx_1 = PyObject_GetAttr(__pyx_v_lst, __pyx_n_append); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
__pyx_2 = (PyObject *)__pyx_v_val;
Py_INCREF(__pyx_2);
__pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
__pyx_2 = 0;
__pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_WriteUnraisable("cuckoo._cuckoo_get_values");
__pyx_L0:;
Py_DECREF(__pyx_v_lst);
return __pyx_r;
}
static int __pyx_f_6cuckoo__cuckoo_get_items(char (*__pyx_v_key),int __pyx_v_val,void (*__pyx_v_arg)) {
PyObject *__pyx_v_lst;
int __pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
__pyx_v_lst = Py_None; Py_INCREF(__pyx_v_lst);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":83 */
__pyx_1 = (PyObject *)__pyx_v_arg;
Py_INCREF(__pyx_1);
Py_DECREF(__pyx_v_lst);
__pyx_v_lst = __pyx_1;
__pyx_1 = 0;
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":84 */
__pyx_1 = PyObject_GetAttr(__pyx_v_lst, __pyx_n_append); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
__pyx_2 = PyString_FromString(__pyx_v_key); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
__pyx_3 = (PyObject *)__pyx_v_val;
Py_INCREF(__pyx_3);
__pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
__pyx_2 = 0;
__pyx_3 = 0;
__pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
__pyx_4 = 0;
__pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
__Pyx_WriteUnraisable("cuckoo._cuckoo_get_items");
__pyx_L0:;
Py_DECREF(__pyx_v_lst);
return __pyx_r;
}
static PyObject *__pyx_n_len;
static PyObject *__pyx_n_insert;
static int __pyx_f_6cuckoo_10cuckoohash___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_6cuckoo_10cuckoohash___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_size = 0;
PyObject *__pyx_v_seq = 0;
PyObject *__pyx_v_k;
PyObject *__pyx_v_v;
int __pyx_r;
int __pyx_1;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
PyObject *__pyx_5 = 0;
static char *__pyx_argnames[] = {"size","seq",0};
__pyx_v_size = __pyx_k6;
__pyx_v_seq = __pyx_k7;
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|OO", __pyx_argnames, &__pyx_v_size, &__pyx_v_seq)) return -1;
Py_INCREF(__pyx_v_self);
Py_INCREF(__pyx_v_size);
Py_INCREF(__pyx_v_seq);
__pyx_v_k = Py_None; Py_INCREF(__pyx_v_k);
__pyx_v_v = Py_None; Py_INCREF(__pyx_v_v);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":102 */
__pyx_1 = PyInt_AsLong(__pyx_v_size); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
((struct __pyx_obj_6cuckoo_cuckoohash *)__pyx_v_self)->table = ckh_construct_table(__pyx_1);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":103 */
__pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;}
__pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;}
Py_INCREF(__pyx_v_seq);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_seq);
__pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;}
if (PyObject_Cmp(__pyx_4, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;}
__pyx_1 = __pyx_1 > 0;
Py_DECREF(__pyx_4); __pyx_4 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (__pyx_1) {
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":104 */
__pyx_3 = PyObject_GetIter(__pyx_v_seq); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
for (;;) {
__pyx_L3:;
__pyx_4 = PyIter_Next(__pyx_3);
if (!__pyx_4) {
if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
break;
}
__pyx_2 = __Pyx_UnpackItem(__pyx_4, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
Py_DECREF(__pyx_v_k);
__pyx_v_k = __pyx_2;
__pyx_2 = 0;
__pyx_5 = __Pyx_UnpackItem(__pyx_4, 1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
Py_DECREF(__pyx_v_v);
__pyx_v_v = __pyx_5;
__pyx_5 = 0;
if (__Pyx_EndUnpack(__pyx_4, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_insert); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
__pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
Py_INCREF(__pyx_v_k);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_k);
Py_INCREF(__pyx_v_v);
PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_v);
__pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_5); __pyx_5 = 0;
}
__pyx_L4:;
Py_DECREF(__pyx_3); __pyx_3 = 0;
goto __pyx_L2;
}
__pyx_L2:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
Py_XDECREF(__pyx_5);
__Pyx_AddTraceback("cuckoo.cuckoohash.__init__");
__pyx_r = -1;
__pyx_L0:;
Py_DECREF(__pyx_v_k);
Py_DECREF(__pyx_v_v);
Py_DECREF(__pyx_v_self);
Py_DECREF(__pyx_v_size);
Py_DECREF(__pyx_v_seq);
return __pyx_r;
}
static PyObject *__pyx_f_6cuckoo_10cuckoohash___del__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6cuckoo_10cuckoohash___del__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_r;
static char *__pyx_argnames[] = {0};
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
Py_INCREF(__pyx_v_self);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":107 */
ckh_destruct_table(((struct __pyx_obj_6cuckoo_cuckoohash *)__pyx_v_self)->table);
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
__Pyx_AddTraceback("cuckoo.cuckoohash.__del__");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static int __pyx_f_6cuckoo_10cuckoohash___len__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_f_6cuckoo_10cuckoohash___len__(PyObject *__pyx_v_self) {
int __pyx_r;
Py_INCREF(__pyx_v_self);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":110 */
__pyx_r = cuckoo_table_size(((struct __pyx_obj_6cuckoo_cuckoohash *)__pyx_v_self)->table);
goto __pyx_L0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1:;
__Pyx_AddTraceback("cuckoo.cuckoohash.__len__");
__pyx_r = -1;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_n_get;
static PyObject *__pyx_f_6cuckoo_10cuckoohash___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_f_6cuckoo_10cuckoohash___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
Py_INCREF(__pyx_v_self);
Py_INCREF(__pyx_v_key);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":113 */
__pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;}
__pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;}
Py_INCREF(__pyx_v_key);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_key);
__pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_r = __pyx_3;
__pyx_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_AddTraceback("cuckoo.cuckoohash.__getitem__");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
Py_DECREF(__pyx_v_key);
return __pyx_r;
}
static int __pyx_f_6cuckoo_10cuckoohash___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static int __pyx_f_6cuckoo_10cuckoohash___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
int __pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
Py_INCREF(__pyx_v_self);
Py_INCREF(__pyx_v_key);
Py_INCREF(__pyx_v_value);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":116 */
__pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_insert); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
__pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
Py_INCREF(__pyx_v_key);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_key);
Py_INCREF(__pyx_v_value);
PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_value);
__pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_AddTraceback("cuckoo.cuckoohash.__setitem__");
__pyx_r = -1;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
Py_DECREF(__pyx_v_key);
Py_DECREF(__pyx_v_value);
return __pyx_r;
}
static PyObject *__pyx_n_delete;
static int __pyx_f_6cuckoo_10cuckoohash___delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_f_6cuckoo_10cuckoohash___delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
int __pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
Py_INCREF(__pyx_v_self);
Py_INCREF(__pyx_v_key);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":119 */
__pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_delete); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
__pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
Py_INCREF(__pyx_v_key);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_key);
__pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_AddTraceback("cuckoo.cuckoohash.__delitem__");
__pyx_r = -1;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
Py_DECREF(__pyx_v_key);
return __pyx_r;
}
static PyObject *__pyx_f_6cuckoo_10cuckoohash_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cuckoo_10cuckoohash_delete[] = "delete(key)\n\n delete the specified key";
static PyObject *__pyx_f_6cuckoo_10cuckoohash_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
char (*__pyx_v_key);
int __pyx_v_ret;
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
static char *__pyx_argnames[] = {"key",0};
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "s", __pyx_argnames, &__pyx_v_key)) return 0;
Py_INCREF(__pyx_v_self);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":126 */
ckh_get(((struct __pyx_obj_6cuckoo_cuckoohash *)__pyx_v_self)->table,__pyx_v_key,(&__pyx_v_ret));
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":127 */
__pyx_1 = PyInt_FromLong(((int )((void (*))__pyx_v_ret))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
Py_DECREF(__pyx_1);
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":128 */
ckh_delete(((struct __pyx_obj_6cuckoo_cuckoohash *)__pyx_v_self)->table,__pyx_v_key);
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("cuckoo.cuckoohash.delete");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_f_6cuckoo_10cuckoohash_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cuckoo_10cuckoohash_lookup[] = "lookup(key)\n\n test to see if the key is present in the hash table";
static PyObject *__pyx_f_6cuckoo_10cuckoohash_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
char (*__pyx_v_key);
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
static char *__pyx_argnames[] = {"key",0};
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "s", __pyx_argnames, &__pyx_v_key)) return 0;
Py_INCREF(__pyx_v_self);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":134 */
__pyx_1 = PyInt_FromLong(ckh_lookup(((struct __pyx_obj_6cuckoo_cuckoohash *)__pyx_v_self)->table,__pyx_v_key)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("cuckoo.cuckoohash.lookup");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_n_lookup;
static PyObject *__pyx_f_6cuckoo_10cuckoohash_has_key(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cuckoo_10cuckoohash_has_key[] = "has_key(key)\n\n a synonym for lookup(key)";
static PyObject *__pyx_f_6cuckoo_10cuckoohash_has_key(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
char (*__pyx_v_key);
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
static char *__pyx_argnames[] = {"key",0};
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "s", __pyx_argnames, &__pyx_v_key)) return 0;
Py_INCREF(__pyx_v_self);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":140 */
__pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_lookup); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
__pyx_2 = PyString_FromString(__pyx_v_key); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
__pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
__pyx_2 = 0;
__pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_r = __pyx_2;
__pyx_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_AddTraceback("cuckoo.cuckoohash.has_key");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_f_6cuckoo_10cuckoohash_insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cuckoo_10cuckoohash_insert[] = "insert(key, val)\n\n insert the key:value pair into the hash table.\n key - a string\n val - any Python object";
static PyObject *__pyx_f_6cuckoo_10cuckoohash_insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
char (*__pyx_v_key);
PyObject *__pyx_v_val = 0;
PyObject *__pyx_r;
static char *__pyx_argnames[] = {"key","val",0};
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "sO", __pyx_argnames, &__pyx_v_key, &__pyx_v_val)) return 0;
Py_INCREF(__pyx_v_self);
Py_INCREF(__pyx_v_val);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":148 */
Py_INCREF(__pyx_v_val);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":149 */
ckh_insert(((struct __pyx_obj_6cuckoo_cuckoohash *)__pyx_v_self)->table,__pyx_v_key,((int )((void (*))__pyx_v_val)));
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
__Pyx_AddTraceback("cuckoo.cuckoohash.insert");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
Py_DECREF(__pyx_v_val);
return __pyx_r;
}
static PyObject *__pyx_f_6cuckoo_10cuckoohash_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cuckoo_10cuckoohash_get[] = "get(key)\n\n retriee the value for the specified key";
static PyObject *__pyx_f_6cuckoo_10cuckoohash_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
char (*__pyx_v_key);
int __pyx_v_ret;
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
static char *__pyx_argnames[] = {"key",0};
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "s", __pyx_argnames, &__pyx_v_key)) return 0;
Py_INCREF(__pyx_v_self);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":156 */
ckh_get(((struct __pyx_obj_6cuckoo_cuckoohash *)__pyx_v_self)->table,__pyx_v_key,(&__pyx_v_ret));
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":157 */
__pyx_1 = (PyObject *)__pyx_v_ret;
Py_INCREF(__pyx_1);
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("cuckoo.cuckoohash.get");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_f_6cuckoo_10cuckoohash___cuckoo_gather(struct __pyx_obj_6cuckoo_cuckoohash *__pyx_v_self,int (__pyx_v_gatherfunc(char (*),int ,void (*)))) {
PyObject *__pyx_v_l;
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
Py_INCREF(__pyx_v_self);
__pyx_v_l = Py_None; Py_INCREF(__pyx_v_l);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":161 */
__pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; goto __pyx_L1;}
Py_DECREF(__pyx_v_l);
__pyx_v_l = __pyx_1;
__pyx_1 = 0;
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":162 */
cuckoo_apply(__pyx_v_self->table,__pyx_v_gatherfunc,((void (*))__pyx_v_l));
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":163 */
Py_INCREF(__pyx_v_l);
__pyx_r = __pyx_v_l;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("cuckoo.cuckoohash.__cuckoo_gather");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_l);
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_f_6cuckoo_10cuckoohash_keys(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cuckoo_10cuckoohash_keys[] = "keys() - the list of keys for the hash table";
static PyObject *__pyx_f_6cuckoo_10cuckoohash_keys(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
static char *__pyx_argnames[] = {0};
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
Py_INCREF(__pyx_v_self);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":167 */
__pyx_1 = ((struct __pyx_vtabstruct_6cuckoo_cuckoohash *)((struct __pyx_obj_6cuckoo_cuckoohash *)__pyx_v_self)->__pyx_vtab)->__cuckoo_gather(((struct __pyx_obj_6cuckoo_cuckoohash *)__pyx_v_self),__pyx_f_6cuckoo__cuckoo_get_keys); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; goto __pyx_L1;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("cuckoo.cuckoohash.keys");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_f_6cuckoo_10cuckoohash_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cuckoo_10cuckoohash_values[] = "values() - the list of values held in the hash table";
static PyObject *__pyx_f_6cuckoo_10cuckoohash_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
static char *__pyx_argnames[] = {0};
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
Py_INCREF(__pyx_v_self);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":171 */
__pyx_1 = ((struct __pyx_vtabstruct_6cuckoo_cuckoohash *)((struct __pyx_obj_6cuckoo_cuckoohash *)__pyx_v_self)->__pyx_vtab)->__cuckoo_gather(((struct __pyx_obj_6cuckoo_cuckoohash *)__pyx_v_self),__pyx_f_6cuckoo__cuckoo_get_values); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("cuckoo.cuckoohash.values");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_f_6cuckoo_10cuckoohash_items(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cuckoo_10cuckoohash_items[] = "C.items() -> list of (key, value) pairs in C";
static PyObject *__pyx_f_6cuckoo_10cuckoohash_items(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
static char *__pyx_argnames[] = {0};
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
Py_INCREF(__pyx_v_self);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":175 */
__pyx_1 = ((struct __pyx_vtabstruct_6cuckoo_cuckoohash *)((struct __pyx_obj_6cuckoo_cuckoohash *)__pyx_v_self)->__pyx_vtab)->__cuckoo_gather(((struct __pyx_obj_6cuckoo_cuckoohash *)__pyx_v_self),__pyx_f_6cuckoo__cuckoo_get_items); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("cuckoo.cuckoohash.items");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_n_iter;
static PyObject *__pyx_n_keys;
static PyObject *__pyx_f_6cuckoo_10cuckoohash___iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6cuckoo_10cuckoohash___iter__(PyObject *__pyx_v_self) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
Py_INCREF(__pyx_v_self);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":178 */
__pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_iter); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
__pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_keys); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
__pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
__pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
__pyx_4 = 0;
__pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_r = __pyx_3;
__pyx_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
__Pyx_AddTraceback("cuckoo.cuckoohash.__iter__");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_n_items;
static PyObject *__pyx_f_6cuckoo_10cuckoohash_iteritems(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cuckoo_10cuckoohash_iteritems[] = "C.iteritems() -> iterate over the (key, value) items in C";
static PyObject *__pyx_f_6cuckoo_10cuckoohash_iteritems(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
static char *__pyx_argnames[] = {0};
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
Py_INCREF(__pyx_v_self);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":182 */
__pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_iter); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;}
__pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_items); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;}
__pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;}
__pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
__pyx_4 = 0;
__pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_r = __pyx_3;
__pyx_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
__Pyx_AddTraceback("cuckoo.cuckoohash.iteritems");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_f_6cuckoo_10cuckoohash_iterkeys(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cuckoo_10cuckoohash_iterkeys[] = "C.iterkeys() -> iterate over the keys in C";
static PyObject *__pyx_f_6cuckoo_10cuckoohash_iterkeys(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
static char *__pyx_argnames[] = {0};
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
Py_INCREF(__pyx_v_self);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":186 */
__pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_iter); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
__pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; 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 = 186; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_r = __pyx_3;
__pyx_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_AddTraceback("cuckoo.cuckoohash.iterkeys");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_n_values;
static PyObject *__pyx_f_6cuckoo_10cuckoohash_itervalues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cuckoo_10cuckoohash_itervalues[] = "C.itervalues() -> iterate over the value in C";
static PyObject *__pyx_f_6cuckoo_10cuckoohash_itervalues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
static char *__pyx_argnames[] = {0};
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
Py_INCREF(__pyx_v_self);
/* "/home/jose/src/ckhash-0.4.2/python/cuckoo.pyx":190 */
__pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_iter); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; goto __pyx_L1;}
__pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_values); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; goto __pyx_L1;}
__pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; goto __pyx_L1;}
__pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
__pyx_4 = 0;
__pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_r = __pyx_3;
__pyx_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
__Pyx_AddTraceback("cuckoo.cuckoohash.itervalues");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static __Pyx_InternTabEntry __pyx_intern_tab[] = {
{&__pyx_n_GPL2, "GPL2"},
{&__pyx_n___author__, "__author__"},
{&__pyx_n___copyright__, "__copyright__"},
{&__pyx_n___license__, "__license__"},
{&__pyx_n___url__, "__url__"},
{&__pyx_n___version__, "__version__"},
{&__pyx_n_append, "append"},
{&__pyx_n_delete, "delete"},
{&__pyx_n_get, "get"},
{&__pyx_n_insert, "insert"},
{&__pyx_n_items, "items"},
{&__pyx_n_iter, "iter"},
{&__pyx_n_keys, "keys"},
{&__pyx_n_len, "len"},
{&__pyx_n_lookup, "lookup"},
{&__pyx_n_values, "values"},
{0, 0}
};
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_k1p, __pyx_k1, sizeof(__pyx_k1)},
{&__pyx_k2p, __pyx_k2, sizeof(__pyx_k2)},
{&__pyx_k4p, __pyx_k4, sizeof(__pyx_k4)},
{&__pyx_k5p, __pyx_k5, sizeof(__pyx_k5)},
{0, 0, 0}
};
static struct __pyx_vtabstruct_6cuckoo_cuckoohash __pyx_vtable_6cuckoo_cuckoohash;
static PyObject *__pyx_tp_new_6cuckoo_cuckoohash(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o = (*t->tp_alloc)(t, 0);
struct __pyx_obj_6cuckoo_cuckoohash *p = (struct __pyx_obj_6cuckoo_cuckoohash *)o;
(struct __pyx_vtabstruct_6cuckoo_cuckoohash *)p->__pyx_vtab = __pyx_vtabptr_6cuckoo_cuckoohash;
return o;
}
static void __pyx_tp_dealloc_6cuckoo_cuckoohash(PyObject *o) {
struct __pyx_obj_6cuckoo_cuckoohash *p = (struct __pyx_obj_6cuckoo_cuckoohash *)o;
(*o->ob_type->tp_free)(o);
}
static int __pyx_tp_traverse_6cuckoo_cuckoohash(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_obj_6cuckoo_cuckoohash *p = (struct __pyx_obj_6cuckoo_cuckoohash *)o;
return 0;
}
static int __pyx_tp_clear_6cuckoo_cuckoohash(PyObject *o) {
struct __pyx_obj_6cuckoo_cuckoohash *p = (struct __pyx_obj_6cuckoo_cuckoohash *)o;
return 0;
}
static PyObject *__pyx_sq_item_6cuckoo_cuckoohash(PyObject *o, int i) {
PyObject *r;
PyObject *x = PyInt_FromLong(i); if(!x) return 0;
r = o->ob_type->tp_as_mapping->mp_subscript(o, x);
Py_DECREF(x);
return r;
}
static int __pyx_mp_ass_subscript_6cuckoo_cuckoohash(PyObject *o, PyObject *i, PyObject *v) {
if (v) {
return __pyx_f_6cuckoo_10cuckoohash___setitem__(o, i, v);
}
else {
return __pyx_f_6cuckoo_10cuckoohash___delitem__(o, i);
}
}
static struct PyMethodDef __pyx_methods_6cuckoo_cuckoohash[] = {
{"__del__", (PyCFunction)__pyx_f_6cuckoo_10cuckoohash___del__, METH_VARARGS|METH_KEYWORDS, 0},
{"delete", (PyCFunction)__pyx_f_6cuckoo_10cuckoohash_delete, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cuckoo_10cuckoohash_delete},
{"lookup", (PyCFunction)__pyx_f_6cuckoo_10cuckoohash_lookup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cuckoo_10cuckoohash_lookup},
{"has_key", (PyCFunction)__pyx_f_6cuckoo_10cuckoohash_has_key, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cuckoo_10cuckoohash_has_key},
{"insert", (PyCFunction)__pyx_f_6cuckoo_10cuckoohash_insert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cuckoo_10cuckoohash_insert},
{"get", (PyCFunction)__pyx_f_6cuckoo_10cuckoohash_get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cuckoo_10cuckoohash_get},
{"keys", (PyCFunction)__pyx_f_6cuckoo_10cuckoohash_keys, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cuckoo_10cuckoohash_keys},
{"values", (PyCFunction)__pyx_f_6cuckoo_10cuckoohash_values, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cuckoo_10cuckoohash_values},
{"items", (PyCFunction)__pyx_f_6cuckoo_10cuckoohash_items, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cuckoo_10cuckoohash_items},
{"iteritems", (PyCFunction)__pyx_f_6cuckoo_10cuckoohash_iteritems, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cuckoo_10cuckoohash_iteritems},
{"iterkeys", (PyCFunction)__pyx_f_6cuckoo_10cuckoohash_iterkeys, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cuckoo_10cuckoohash_iterkeys},
{"itervalues", (PyCFunction)__pyx_f_6cuckoo_10cuckoohash_itervalues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cuckoo_10cuckoohash_itervalues},
{0, 0, 0, 0}
};
static PyNumberMethods __pyx_tp_as_number_cuckoohash = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
0, /*nb_divide*/
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
0, /*nb_coerce*/
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/