1 /* Generated by Cython 0.29.23 */
2
3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
5 #endif /* PY_SSIZE_T_CLEAN */
6 #include "Python.h"
7 #ifndef Py_PYTHON_H
8 #error Python headers needed to compile C extensions, please install development version of Python.
9 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
10 #error Cython requires Python 2.6+ or Python 3.3+.
11 #else
12 #define CYTHON_ABI "0_29_23"
13 #define CYTHON_HEX_VERSION 0x001D17F0
14 #define CYTHON_FUTURE_DIVISION 1
15 #include <stddef.h>
16 #ifndef offsetof
17 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
18 #endif
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
20 #ifndef __stdcall
21 #define __stdcall
22 #endif
23 #ifndef __cdecl
24 #define __cdecl
25 #endif
26 #ifndef __fastcall
27 #define __fastcall
28 #endif
29 #endif
30 #ifndef DL_IMPORT
31 #define DL_IMPORT(t) t
32 #endif
33 #ifndef DL_EXPORT
34 #define DL_EXPORT(t) t
35 #endif
36 #define __PYX_COMMA ,
37 #ifndef HAVE_LONG_LONG
38 #if PY_VERSION_HEX >= 0x02070000
39 #define HAVE_LONG_LONG
40 #endif
41 #endif
42 #ifndef PY_LONG_LONG
43 #define PY_LONG_LONG LONG_LONG
44 #endif
45 #ifndef Py_HUGE_VAL
46 #define Py_HUGE_VAL HUGE_VAL
47 #endif
48 #ifdef PYPY_VERSION
49 #define CYTHON_COMPILING_IN_PYPY 1
50 #define CYTHON_COMPILING_IN_PYSTON 0
51 #define CYTHON_COMPILING_IN_CPYTHON 0
52 #undef CYTHON_USE_TYPE_SLOTS
53 #define CYTHON_USE_TYPE_SLOTS 0
54 #undef CYTHON_USE_PYTYPE_LOOKUP
55 #define CYTHON_USE_PYTYPE_LOOKUP 0
56 #if PY_VERSION_HEX < 0x03050000
57 #undef CYTHON_USE_ASYNC_SLOTS
58 #define CYTHON_USE_ASYNC_SLOTS 0
59 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
60 #define CYTHON_USE_ASYNC_SLOTS 1
61 #endif
62 #undef CYTHON_USE_PYLIST_INTERNALS
63 #define CYTHON_USE_PYLIST_INTERNALS 0
64 #undef CYTHON_USE_UNICODE_INTERNALS
65 #define CYTHON_USE_UNICODE_INTERNALS 0
66 #undef CYTHON_USE_UNICODE_WRITER
67 #define CYTHON_USE_UNICODE_WRITER 0
68 #undef CYTHON_USE_PYLONG_INTERNALS
69 #define CYTHON_USE_PYLONG_INTERNALS 0
70 #undef CYTHON_AVOID_BORROWED_REFS
71 #define CYTHON_AVOID_BORROWED_REFS 1
72 #undef CYTHON_ASSUME_SAFE_MACROS
73 #define CYTHON_ASSUME_SAFE_MACROS 0
74 #undef CYTHON_UNPACK_METHODS
75 #define CYTHON_UNPACK_METHODS 0
76 #undef CYTHON_FAST_THREAD_STATE
77 #define CYTHON_FAST_THREAD_STATE 0
78 #undef CYTHON_FAST_PYCALL
79 #define CYTHON_FAST_PYCALL 0
80 #undef CYTHON_PEP489_MULTI_PHASE_INIT
81 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
82 #undef CYTHON_USE_TP_FINALIZE
83 #define CYTHON_USE_TP_FINALIZE 0
84 #undef CYTHON_USE_DICT_VERSIONS
85 #define CYTHON_USE_DICT_VERSIONS 0
86 #undef CYTHON_USE_EXC_INFO_STACK
87 #define CYTHON_USE_EXC_INFO_STACK 0
88 #elif defined(PYSTON_VERSION)
89 #define CYTHON_COMPILING_IN_PYPY 0
90 #define CYTHON_COMPILING_IN_PYSTON 1
91 #define CYTHON_COMPILING_IN_CPYTHON 0
92 #ifndef CYTHON_USE_TYPE_SLOTS
93 #define CYTHON_USE_TYPE_SLOTS 1
94 #endif
95 #undef CYTHON_USE_PYTYPE_LOOKUP
96 #define CYTHON_USE_PYTYPE_LOOKUP 0
97 #undef CYTHON_USE_ASYNC_SLOTS
98 #define CYTHON_USE_ASYNC_SLOTS 0
99 #undef CYTHON_USE_PYLIST_INTERNALS
100 #define CYTHON_USE_PYLIST_INTERNALS 0
101 #ifndef CYTHON_USE_UNICODE_INTERNALS
102 #define CYTHON_USE_UNICODE_INTERNALS 1
103 #endif
104 #undef CYTHON_USE_UNICODE_WRITER
105 #define CYTHON_USE_UNICODE_WRITER 0
106 #undef CYTHON_USE_PYLONG_INTERNALS
107 #define CYTHON_USE_PYLONG_INTERNALS 0
108 #ifndef CYTHON_AVOID_BORROWED_REFS
109 #define CYTHON_AVOID_BORROWED_REFS 0
110 #endif
111 #ifndef CYTHON_ASSUME_SAFE_MACROS
112 #define CYTHON_ASSUME_SAFE_MACROS 1
113 #endif
114 #ifndef CYTHON_UNPACK_METHODS
115 #define CYTHON_UNPACK_METHODS 1
116 #endif
117 #undef CYTHON_FAST_THREAD_STATE
118 #define CYTHON_FAST_THREAD_STATE 0
119 #undef CYTHON_FAST_PYCALL
120 #define CYTHON_FAST_PYCALL 0
121 #undef CYTHON_PEP489_MULTI_PHASE_INIT
122 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
123 #undef CYTHON_USE_TP_FINALIZE
124 #define CYTHON_USE_TP_FINALIZE 0
125 #undef CYTHON_USE_DICT_VERSIONS
126 #define CYTHON_USE_DICT_VERSIONS 0
127 #undef CYTHON_USE_EXC_INFO_STACK
128 #define CYTHON_USE_EXC_INFO_STACK 0
129 #else
130 #define CYTHON_COMPILING_IN_PYPY 0
131 #define CYTHON_COMPILING_IN_PYSTON 0
132 #define CYTHON_COMPILING_IN_CPYTHON 1
133 #ifndef CYTHON_USE_TYPE_SLOTS
134 #define CYTHON_USE_TYPE_SLOTS 1
135 #endif
136 #if PY_VERSION_HEX < 0x02070000
137 #undef CYTHON_USE_PYTYPE_LOOKUP
138 #define CYTHON_USE_PYTYPE_LOOKUP 0
139 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
140 #define CYTHON_USE_PYTYPE_LOOKUP 1
141 #endif
142 #if PY_MAJOR_VERSION < 3
143 #undef CYTHON_USE_ASYNC_SLOTS
144 #define CYTHON_USE_ASYNC_SLOTS 0
145 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
146 #define CYTHON_USE_ASYNC_SLOTS 1
147 #endif
148 #if PY_VERSION_HEX < 0x02070000
149 #undef CYTHON_USE_PYLONG_INTERNALS
150 #define CYTHON_USE_PYLONG_INTERNALS 0
151 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
152 #define CYTHON_USE_PYLONG_INTERNALS 1
153 #endif
154 #ifndef CYTHON_USE_PYLIST_INTERNALS
155 #define CYTHON_USE_PYLIST_INTERNALS 1
156 #endif
157 #ifndef CYTHON_USE_UNICODE_INTERNALS
158 #define CYTHON_USE_UNICODE_INTERNALS 1
159 #endif
160 #if PY_VERSION_HEX < 0x030300F0
161 #undef CYTHON_USE_UNICODE_WRITER
162 #define CYTHON_USE_UNICODE_WRITER 0
163 #elif !defined(CYTHON_USE_UNICODE_WRITER)
164 #define CYTHON_USE_UNICODE_WRITER 1
165 #endif
166 #ifndef CYTHON_AVOID_BORROWED_REFS
167 #define CYTHON_AVOID_BORROWED_REFS 0
168 #endif
169 #ifndef CYTHON_ASSUME_SAFE_MACROS
170 #define CYTHON_ASSUME_SAFE_MACROS 1
171 #endif
172 #ifndef CYTHON_UNPACK_METHODS
173 #define CYTHON_UNPACK_METHODS 1
174 #endif
175 #ifndef CYTHON_FAST_THREAD_STATE
176 #define CYTHON_FAST_THREAD_STATE 1
177 #endif
178 #ifndef CYTHON_FAST_PYCALL
179 #define CYTHON_FAST_PYCALL 1
180 #endif
181 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
182 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
183 #endif
184 #ifndef CYTHON_USE_TP_FINALIZE
185 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
186 #endif
187 #ifndef CYTHON_USE_DICT_VERSIONS
188 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
189 #endif
190 #ifndef CYTHON_USE_EXC_INFO_STACK
191 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
192 #endif
193 #endif
194 #if !defined(CYTHON_FAST_PYCCALL)
195 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
196 #endif
197 #if CYTHON_USE_PYLONG_INTERNALS
198 #include "longintrepr.h"
199 #undef SHIFT
200 #undef BASE
201 #undef MASK
202 #ifdef SIZEOF_VOID_P
203 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
204 #endif
205 #endif
206 #ifndef __has_attribute
207 #define __has_attribute(x) 0
208 #endif
209 #ifndef __has_cpp_attribute
210 #define __has_cpp_attribute(x) 0
211 #endif
212 #ifndef CYTHON_RESTRICT
213 #if defined(__GNUC__)
214 #define CYTHON_RESTRICT __restrict__
215 #elif defined(_MSC_VER) && _MSC_VER >= 1400
216 #define CYTHON_RESTRICT __restrict
217 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
218 #define CYTHON_RESTRICT restrict
219 #else
220 #define CYTHON_RESTRICT
221 #endif
222 #endif
223 #ifndef CYTHON_UNUSED
224 # if defined(__GNUC__)
225 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
226 # define CYTHON_UNUSED __attribute__ ((__unused__))
227 # else
228 # define CYTHON_UNUSED
229 # endif
230 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
231 # define CYTHON_UNUSED __attribute__ ((__unused__))
232 # else
233 # define CYTHON_UNUSED
234 # endif
235 #endif
236 #ifndef CYTHON_MAYBE_UNUSED_VAR
237 # if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)238 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
239 # else
240 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
241 # endif
242 #endif
243 #ifndef CYTHON_NCP_UNUSED
244 # if CYTHON_COMPILING_IN_CPYTHON
245 # define CYTHON_NCP_UNUSED
246 # else
247 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
248 # endif
249 #endif
250 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
251 #ifdef _MSC_VER
252 #ifndef _MSC_STDINT_H_
253 #if _MSC_VER < 1300
254 typedef unsigned char uint8_t;
255 typedef unsigned int uint32_t;
256 #else
257 typedef unsigned __int8 uint8_t;
258 typedef unsigned __int32 uint32_t;
259 #endif
260 #endif
261 #else
262 #include <stdint.h>
263 #endif
264 #ifndef CYTHON_FALLTHROUGH
265 #if defined(__cplusplus) && __cplusplus >= 201103L
266 #if __has_cpp_attribute(fallthrough)
267 #define CYTHON_FALLTHROUGH [[fallthrough]]
268 #elif __has_cpp_attribute(clang::fallthrough)
269 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
270 #elif __has_cpp_attribute(gnu::fallthrough)
271 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
272 #endif
273 #endif
274 #ifndef CYTHON_FALLTHROUGH
275 #if __has_attribute(fallthrough)
276 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
277 #else
278 #define CYTHON_FALLTHROUGH
279 #endif
280 #endif
281 #if defined(__clang__ ) && defined(__apple_build_version__)
282 #if __apple_build_version__ < 7000000
283 #undef CYTHON_FALLTHROUGH
284 #define CYTHON_FALLTHROUGH
285 #endif
286 #endif
287 #endif
288
289 #ifndef CYTHON_INLINE
290 #if defined(__clang__)
291 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
292 #elif defined(__GNUC__)
293 #define CYTHON_INLINE __inline__
294 #elif defined(_MSC_VER)
295 #define CYTHON_INLINE __inline
296 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
297 #define CYTHON_INLINE inline
298 #else
299 #define CYTHON_INLINE
300 #endif
301 #endif
302
303 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
304 #define Py_OptimizeFlag 0
305 #endif
306 #define __PYX_BUILD_PY_SSIZE_T "n"
307 #define CYTHON_FORMAT_SSIZE_T "z"
308 #if PY_MAJOR_VERSION < 3
309 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
310 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
311 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
312 #define __Pyx_DefaultClassType PyClass_Type
313 #else
314 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
315 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
316 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
317 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
318 #else
319 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
320 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
321 #endif
322 #define __Pyx_DefaultClassType PyType_Type
323 #endif
324 #ifndef Py_TPFLAGS_CHECKTYPES
325 #define Py_TPFLAGS_CHECKTYPES 0
326 #endif
327 #ifndef Py_TPFLAGS_HAVE_INDEX
328 #define Py_TPFLAGS_HAVE_INDEX 0
329 #endif
330 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
331 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
332 #endif
333 #ifndef Py_TPFLAGS_HAVE_FINALIZE
334 #define Py_TPFLAGS_HAVE_FINALIZE 0
335 #endif
336 #ifndef METH_STACKLESS
337 #define METH_STACKLESS 0
338 #endif
339 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
340 #ifndef METH_FASTCALL
341 #define METH_FASTCALL 0x80
342 #endif
343 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
344 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
345 Py_ssize_t nargs, PyObject *kwnames);
346 #else
347 #define __Pyx_PyCFunctionFast _PyCFunctionFast
348 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
349 #endif
350 #if CYTHON_FAST_PYCCALL
351 #define __Pyx_PyFastCFunction_Check(func)\
352 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
353 #else
354 #define __Pyx_PyFastCFunction_Check(func) 0
355 #endif
356 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
357 #define PyObject_Malloc(s) PyMem_Malloc(s)
358 #define PyObject_Free(p) PyMem_Free(p)
359 #define PyObject_Realloc(p) PyMem_Realloc(p)
360 #endif
361 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
362 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
363 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
364 #define PyMem_RawFree(p) PyMem_Free(p)
365 #endif
366 #if CYTHON_COMPILING_IN_PYSTON
367 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
368 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
369 #else
370 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
371 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
372 #endif
373 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
374 #define __Pyx_PyThreadState_Current PyThreadState_GET()
375 #elif PY_VERSION_HEX >= 0x03060000
376 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
377 #elif PY_VERSION_HEX >= 0x03000000
378 #define __Pyx_PyThreadState_Current PyThreadState_GET()
379 #else
380 #define __Pyx_PyThreadState_Current _PyThreadState_Current
381 #endif
382 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
383 #include "pythread.h"
384 #define Py_tss_NEEDS_INIT 0
385 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)386 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
387 *key = PyThread_create_key();
388 return 0;
389 }
PyThread_tss_alloc(void)390 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
391 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
392 *key = Py_tss_NEEDS_INIT;
393 return key;
394 }
PyThread_tss_free(Py_tss_t * key)395 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
396 PyObject_Free(key);
397 }
PyThread_tss_is_created(Py_tss_t * key)398 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
399 return *key != Py_tss_NEEDS_INIT;
400 }
PyThread_tss_delete(Py_tss_t * key)401 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
402 PyThread_delete_key(*key);
403 *key = Py_tss_NEEDS_INIT;
404 }
PyThread_tss_set(Py_tss_t * key,void * value)405 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
406 return PyThread_set_key_value(*key, value);
407 }
PyThread_tss_get(Py_tss_t * key)408 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
409 return PyThread_get_key_value(*key);
410 }
411 #endif
412 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
413 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
414 #else
415 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
416 #endif
417 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
418 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
419 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
420 #else
421 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
422 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
423 #endif
424 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
425 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
426 #else
427 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
428 #endif
429 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
430 #define CYTHON_PEP393_ENABLED 1
431 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
432 0 : _PyUnicode_Ready((PyObject *)(op)))
433 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
434 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
435 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
436 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
437 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
438 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
439 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
440 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
441 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
442 #else
443 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
444 #endif
445 #else
446 #define CYTHON_PEP393_ENABLED 0
447 #define PyUnicode_1BYTE_KIND 1
448 #define PyUnicode_2BYTE_KIND 2
449 #define PyUnicode_4BYTE_KIND 4
450 #define __Pyx_PyUnicode_READY(op) (0)
451 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
452 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
453 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
454 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
455 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
456 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
457 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
458 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
459 #endif
460 #if CYTHON_COMPILING_IN_PYPY
461 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
462 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
463 #else
464 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
465 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
466 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
467 #endif
468 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
469 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
470 #endif
471 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
472 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
473 #endif
474 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
475 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
476 #endif
477 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
478 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
479 #if PY_MAJOR_VERSION >= 3
480 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
481 #else
482 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
483 #endif
484 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
485 #define PyObject_ASCII(o) PyObject_Repr(o)
486 #endif
487 #if PY_MAJOR_VERSION >= 3
488 #define PyBaseString_Type PyUnicode_Type
489 #define PyStringObject PyUnicodeObject
490 #define PyString_Type PyUnicode_Type
491 #define PyString_Check PyUnicode_Check
492 #define PyString_CheckExact PyUnicode_CheckExact
493 #ifndef PyObject_Unicode
494 #define PyObject_Unicode PyObject_Str
495 #endif
496 #endif
497 #if PY_MAJOR_VERSION >= 3
498 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
499 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
500 #else
501 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
502 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
503 #endif
504 #ifndef PySet_CheckExact
505 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
506 #endif
507 #if PY_VERSION_HEX >= 0x030900A4
508 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
509 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
510 #else
511 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
512 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
513 #endif
514 #if CYTHON_ASSUME_SAFE_MACROS
515 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
516 #else
517 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
518 #endif
519 #if PY_MAJOR_VERSION >= 3
520 #define PyIntObject PyLongObject
521 #define PyInt_Type PyLong_Type
522 #define PyInt_Check(op) PyLong_Check(op)
523 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
524 #define PyInt_FromString PyLong_FromString
525 #define PyInt_FromUnicode PyLong_FromUnicode
526 #define PyInt_FromLong PyLong_FromLong
527 #define PyInt_FromSize_t PyLong_FromSize_t
528 #define PyInt_FromSsize_t PyLong_FromSsize_t
529 #define PyInt_AsLong PyLong_AsLong
530 #define PyInt_AS_LONG PyLong_AS_LONG
531 #define PyInt_AsSsize_t PyLong_AsSsize_t
532 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
533 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
534 #define PyNumber_Int PyNumber_Long
535 #endif
536 #if PY_MAJOR_VERSION >= 3
537 #define PyBoolObject PyLongObject
538 #endif
539 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
540 #ifndef PyUnicode_InternFromString
541 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
542 #endif
543 #endif
544 #if PY_VERSION_HEX < 0x030200A4
545 typedef long Py_hash_t;
546 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
547 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
548 #else
549 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
550 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
551 #endif
552 #if PY_MAJOR_VERSION >= 3
553 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
554 #else
555 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
556 #endif
557 #if CYTHON_USE_ASYNC_SLOTS
558 #if PY_VERSION_HEX >= 0x030500B1
559 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
560 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
561 #else
562 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
563 #endif
564 #else
565 #define __Pyx_PyType_AsAsync(obj) NULL
566 #endif
567 #ifndef __Pyx_PyAsyncMethodsStruct
568 typedef struct {
569 unaryfunc am_await;
570 unaryfunc am_aiter;
571 unaryfunc am_anext;
572 } __Pyx_PyAsyncMethodsStruct;
573 #endif
574
575 #if defined(WIN32) || defined(MS_WINDOWS)
576 #define _USE_MATH_DEFINES
577 #endif
578 #include <math.h>
579 #ifdef NAN
580 #define __PYX_NAN() ((float) NAN)
581 #else
__PYX_NAN()582 static CYTHON_INLINE float __PYX_NAN() {
583 float value;
584 memset(&value, 0xFF, sizeof(value));
585 return value;
586 }
587 #endif
588 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
589 #define __Pyx_truncl trunc
590 #else
591 #define __Pyx_truncl truncl
592 #endif
593
594 #define __PYX_MARK_ERR_POS(f_index, lineno) \
595 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
596 #define __PYX_ERR(f_index, lineno, Ln_error) \
597 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
598
599 #ifndef __PYX_EXTERN_C
600 #ifdef __cplusplus
601 #define __PYX_EXTERN_C extern "C"
602 #else
603 #define __PYX_EXTERN_C extern
604 #endif
605 #endif
606
607 #define __PYX_HAVE__borg__hashindex
608 #define __PYX_HAVE_API__borg__hashindex
609 /* Early includes */
610 #include <stdint.h>
611 #include <errno.h>
612 #include <string.h>
613 #include <stdio.h>
614 #include "_hashindex.c"
615 #include "cache_sync/cache_sync.c"
616 #ifdef _OPENMP
617 #include <omp.h>
618 #endif /* _OPENMP */
619
620 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
621 #define CYTHON_WITHOUT_ASSERTIONS
622 #endif
623
624 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
625 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
626
627 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
628 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
629 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
630 #define __PYX_DEFAULT_STRING_ENCODING ""
631 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
632 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
633 #define __Pyx_uchar_cast(c) ((unsigned char)c)
634 #define __Pyx_long_cast(x) ((long)x)
635 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
636 (sizeof(type) < sizeof(Py_ssize_t)) ||\
637 (sizeof(type) > sizeof(Py_ssize_t) &&\
638 likely(v < (type)PY_SSIZE_T_MAX ||\
639 v == (type)PY_SSIZE_T_MAX) &&\
640 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
641 v == (type)PY_SSIZE_T_MIN))) ||\
642 (sizeof(type) == sizeof(Py_ssize_t) &&\
643 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
644 v == (type)PY_SSIZE_T_MAX))) )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)645 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
646 return (size_t) i < (size_t) limit;
647 }
648 #if defined (__cplusplus) && __cplusplus >= 201103L
649 #include <cstdlib>
650 #define __Pyx_sst_abs(value) std::abs(value)
651 #elif SIZEOF_INT >= SIZEOF_SIZE_T
652 #define __Pyx_sst_abs(value) abs(value)
653 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
654 #define __Pyx_sst_abs(value) labs(value)
655 #elif defined (_MSC_VER)
656 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
657 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
658 #define __Pyx_sst_abs(value) llabs(value)
659 #elif defined (__GNUC__)
660 #define __Pyx_sst_abs(value) __builtin_llabs(value)
661 #else
662 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
663 #endif
664 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
665 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
666 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
667 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
668 #define __Pyx_PyBytes_FromString PyBytes_FromString
669 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
670 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
671 #if PY_MAJOR_VERSION < 3
672 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
673 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
674 #else
675 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
676 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
677 #endif
678 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
679 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
680 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
681 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
682 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
683 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
684 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
685 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
686 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
687 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
688 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
689 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
690 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
691 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
692 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
693 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)694 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
695 const Py_UNICODE *u_end = u;
696 while (*u_end++) ;
697 return (size_t)(u_end - u - 1);
698 }
699 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
700 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
701 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
702 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
703 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
704 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
705 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
706 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
707 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
708 #define __Pyx_PySequence_Tuple(obj)\
709 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
710 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
711 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
712 #if CYTHON_ASSUME_SAFE_MACROS
713 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
714 #else
715 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
716 #endif
717 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
718 #if PY_MAJOR_VERSION >= 3
719 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
720 #else
721 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
722 #endif
723 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
724 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
725 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)726 static int __Pyx_init_sys_getdefaultencoding_params(void) {
727 PyObject* sys;
728 PyObject* default_encoding = NULL;
729 PyObject* ascii_chars_u = NULL;
730 PyObject* ascii_chars_b = NULL;
731 const char* default_encoding_c;
732 sys = PyImport_ImportModule("sys");
733 if (!sys) goto bad;
734 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
735 Py_DECREF(sys);
736 if (!default_encoding) goto bad;
737 default_encoding_c = PyBytes_AsString(default_encoding);
738 if (!default_encoding_c) goto bad;
739 if (strcmp(default_encoding_c, "ascii") == 0) {
740 __Pyx_sys_getdefaultencoding_not_ascii = 0;
741 } else {
742 char ascii_chars[128];
743 int c;
744 for (c = 0; c < 128; c++) {
745 ascii_chars[c] = c;
746 }
747 __Pyx_sys_getdefaultencoding_not_ascii = 1;
748 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
749 if (!ascii_chars_u) goto bad;
750 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
751 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
752 PyErr_Format(
753 PyExc_ValueError,
754 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
755 default_encoding_c);
756 goto bad;
757 }
758 Py_DECREF(ascii_chars_u);
759 Py_DECREF(ascii_chars_b);
760 }
761 Py_DECREF(default_encoding);
762 return 0;
763 bad:
764 Py_XDECREF(default_encoding);
765 Py_XDECREF(ascii_chars_u);
766 Py_XDECREF(ascii_chars_b);
767 return -1;
768 }
769 #endif
770 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
771 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
772 #else
773 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
774 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
775 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)776 static int __Pyx_init_sys_getdefaultencoding_params(void) {
777 PyObject* sys;
778 PyObject* default_encoding = NULL;
779 char* default_encoding_c;
780 sys = PyImport_ImportModule("sys");
781 if (!sys) goto bad;
782 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
783 Py_DECREF(sys);
784 if (!default_encoding) goto bad;
785 default_encoding_c = PyBytes_AsString(default_encoding);
786 if (!default_encoding_c) goto bad;
787 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
788 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
789 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
790 Py_DECREF(default_encoding);
791 return 0;
792 bad:
793 Py_XDECREF(default_encoding);
794 return -1;
795 }
796 #endif
797 #endif
798
799
800 /* Test for GCC > 2.95 */
801 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
802 #define likely(x) __builtin_expect(!!(x), 1)
803 #define unlikely(x) __builtin_expect(!!(x), 0)
804 #else /* !__GNUC__ or GCC < 2.95 */
805 #define likely(x) (x)
806 #define unlikely(x) (x)
807 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)808 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
809
810 static PyObject *__pyx_m = NULL;
811 static PyObject *__pyx_d;
812 static PyObject *__pyx_b;
813 static PyObject *__pyx_cython_runtime = NULL;
814 static PyObject *__pyx_empty_tuple;
815 static PyObject *__pyx_empty_bytes;
816 static PyObject *__pyx_empty_unicode;
817 static int __pyx_lineno;
818 static int __pyx_clineno = 0;
819 static const char * __pyx_cfilenm= __FILE__;
820 static const char *__pyx_filename;
821
822
823 static const char *__pyx_f[] = {
824 "src/borg/hashindex.pyx",
825 "stringsource",
826 "type.pxd",
827 };
828
829 /*--- Type declarations ---*/
830 struct __pyx_obj_4borg_9hashindex_IndexBase;
831 struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex;
832 struct __pyx_obj_4borg_9hashindex_NSIndex;
833 struct __pyx_obj_4borg_9hashindex_NSKeyIterator;
834 struct __pyx_obj_4borg_9hashindex_ChunkIndex;
835 struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator;
836 struct __pyx_obj_4borg_9hashindex_CacheSynchronizer;
837
838 /* "borg/hashindex.pyx":84
839 *
840 * @cython.internal
841 * cdef class IndexBase: # <<<<<<<<<<<<<<
842 * cdef HashIndex *index
843 * cdef int key_size
844 */
845 struct __pyx_obj_4borg_9hashindex_IndexBase {
846 PyObject_HEAD
847 HashIndex *index;
848 int key_size;
849 };
850
851
852 /* "borg/hashindex.pyx":169
853 *
854 *
855 * cdef class FuseVersionsIndex(IndexBase): # <<<<<<<<<<<<<<
856 * # 4 byte version + 16 byte file contents hash
857 * value_size = 20
858 */
859 struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex {
860 struct __pyx_obj_4borg_9hashindex_IndexBase __pyx_base;
861 };
862
863
864 /* "borg/hashindex.pyx":199
865 *
866 *
867 * cdef class NSIndex(IndexBase): # <<<<<<<<<<<<<<
868 *
869 * value_size = 8
870 */
871 struct __pyx_obj_4borg_9hashindex_NSIndex {
872 struct __pyx_obj_4borg_9hashindex_IndexBase __pyx_base;
873 };
874
875
876 /* "borg/hashindex.pyx":244
877 *
878 *
879 * cdef class NSKeyIterator: # <<<<<<<<<<<<<<
880 * cdef NSIndex idx
881 * cdef HashIndex *index
882 */
883 struct __pyx_obj_4borg_9hashindex_NSKeyIterator {
884 PyObject_HEAD
885 struct __pyx_obj_4borg_9hashindex_NSIndex *idx;
886 HashIndex *index;
887 void const *key;
888 int key_size;
889 int exhausted;
890 };
891
892
893 /* "borg/hashindex.pyx":275
894 *
895 *
896 * cdef class ChunkIndex(IndexBase): # <<<<<<<<<<<<<<
897 * """
898 * Mapping of 32 byte keys to (refcount, size, csize), which are all 32-bit unsigned.
899 */
900 struct __pyx_obj_4borg_9hashindex_ChunkIndex {
901 struct __pyx_obj_4borg_9hashindex_IndexBase __pyx_base;
902 struct __pyx_vtabstruct_4borg_9hashindex_ChunkIndex *__pyx_vtab;
903 };
904
905
906 /* "borg/hashindex.pyx":474
907 *
908 *
909 * cdef class ChunkKeyIterator: # <<<<<<<<<<<<<<
910 * cdef ChunkIndex idx
911 * cdef HashIndex *index
912 */
913 struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator {
914 PyObject_HEAD
915 struct __pyx_obj_4borg_9hashindex_ChunkIndex *idx;
916 HashIndex *index;
917 void const *key;
918 int key_size;
919 int exhausted;
920 };
921
922
923 /* "borg/hashindex.pyx":508
924 *
925 *
926 * cdef class CacheSynchronizer: # <<<<<<<<<<<<<<
927 * cdef ChunkIndex chunks
928 * cdef CacheSyncCtx *sync
929 */
930 struct __pyx_obj_4borg_9hashindex_CacheSynchronizer {
931 PyObject_HEAD
932 struct __pyx_obj_4borg_9hashindex_ChunkIndex *chunks;
933 CacheSyncCtx *sync;
934 };
935
936
937
938 /* "borg/hashindex.pyx":275
939 *
940 *
941 * cdef class ChunkIndex(IndexBase): # <<<<<<<<<<<<<<
942 * """
943 * Mapping of 32 byte keys to (refcount, size, csize), which are all 32-bit unsigned.
944 */
945
946 struct __pyx_vtabstruct_4borg_9hashindex_ChunkIndex {
947 PyObject *(*_add)(struct __pyx_obj_4borg_9hashindex_ChunkIndex *, void *, uint32_t *);
948 };
949 static struct __pyx_vtabstruct_4borg_9hashindex_ChunkIndex *__pyx_vtabptr_4borg_9hashindex_ChunkIndex;
950
951 /* --- Runtime support code (head) --- */
952 /* Refnanny.proto */
953 #ifndef CYTHON_REFNANNY
954 #define CYTHON_REFNANNY 0
955 #endif
956 #if CYTHON_REFNANNY
957 typedef struct {
958 void (*INCREF)(void*, PyObject*, int);
959 void (*DECREF)(void*, PyObject*, int);
960 void (*GOTREF)(void*, PyObject*, int);
961 void (*GIVEREF)(void*, PyObject*, int);
962 void* (*SetupContext)(const char*, int, const char*);
963 void (*FinishContext)(void**);
964 } __Pyx_RefNannyAPIStruct;
965 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
966 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
967 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
968 #ifdef WITH_THREAD
969 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
970 if (acquire_gil) {\
971 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
972 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
973 PyGILState_Release(__pyx_gilstate_save);\
974 } else {\
975 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
976 }
977 #else
978 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
979 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
980 #endif
981 #define __Pyx_RefNannyFinishContext()\
982 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
983 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
984 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
985 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
986 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
987 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
988 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
989 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
990 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
991 #else
992 #define __Pyx_RefNannyDeclarations
993 #define __Pyx_RefNannySetupContext(name, acquire_gil)
994 #define __Pyx_RefNannyFinishContext()
995 #define __Pyx_INCREF(r) Py_INCREF(r)
996 #define __Pyx_DECREF(r) Py_DECREF(r)
997 #define __Pyx_GOTREF(r)
998 #define __Pyx_GIVEREF(r)
999 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1000 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1001 #define __Pyx_XGOTREF(r)
1002 #define __Pyx_XGIVEREF(r)
1003 #endif
1004 #define __Pyx_XDECREF_SET(r, v) do {\
1005 PyObject *tmp = (PyObject *) r;\
1006 r = v; __Pyx_XDECREF(tmp);\
1007 } while (0)
1008 #define __Pyx_DECREF_SET(r, v) do {\
1009 PyObject *tmp = (PyObject *) r;\
1010 r = v; __Pyx_DECREF(tmp);\
1011 } while (0)
1012 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1013 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1014
1015 /* PyObjectGetAttrStr.proto */
1016 #if CYTHON_USE_TYPE_SLOTS
1017 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1018 #else
1019 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1020 #endif
1021
1022 /* GetBuiltinName.proto */
1023 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1024
1025 /* RaiseDoubleKeywords.proto */
1026 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1027
1028 /* ParseKeywords.proto */
1029 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1030 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1031 const char* function_name);
1032
1033 /* RaiseArgTupleInvalid.proto */
1034 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1035 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1036
1037 /* PyObjectCall.proto */
1038 #if CYTHON_COMPILING_IN_CPYTHON
1039 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1040 #else
1041 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1042 #endif
1043
1044 /* PyObjectLookupSpecial.proto */
1045 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_LookupSpecial(PyObject * obj,PyObject * attr_name)1046 static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
1047 PyObject *res;
1048 PyTypeObject *tp = Py_TYPE(obj);
1049 #if PY_MAJOR_VERSION < 3
1050 if (unlikely(PyInstance_Check(obj)))
1051 return __Pyx_PyObject_GetAttrStr(obj, attr_name);
1052 #endif
1053 res = _PyType_Lookup(tp, attr_name);
1054 if (likely(res)) {
1055 descrgetfunc f = Py_TYPE(res)->tp_descr_get;
1056 if (!f) {
1057 Py_INCREF(res);
1058 } else {
1059 res = f(res, obj, (PyObject *)tp);
1060 }
1061 } else {
1062 PyErr_SetObject(PyExc_AttributeError, attr_name);
1063 }
1064 return res;
1065 }
1066 #else
1067 #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
1068 #endif
1069
1070 /* PyFunctionFastCall.proto */
1071 #if CYTHON_FAST_PYCALL
1072 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1073 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1074 #if 1 || PY_VERSION_HEX < 0x030600B1
1075 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1076 #else
1077 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1078 #endif
1079 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1080 (sizeof(char [1 - 2*!(cond)]) - 1)
1081 #ifndef Py_MEMBER_SIZE
1082 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1083 #endif
1084 static size_t __pyx_pyframe_localsplus_offset = 0;
1085 #include "frameobject.h"
1086 #define __Pxy_PyFrame_Initialize_Offsets()\
1087 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1088 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1089 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1090 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1091 #endif
1092
1093 /* PyObjectCallMethO.proto */
1094 #if CYTHON_COMPILING_IN_CPYTHON
1095 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1096 #endif
1097
1098 /* PyObjectCallNoArg.proto */
1099 #if CYTHON_COMPILING_IN_CPYTHON
1100 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1101 #else
1102 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1103 #endif
1104
1105 /* PyCFunctionFastCall.proto */
1106 #if CYTHON_FAST_PYCCALL
1107 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1108 #else
1109 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1110 #endif
1111
1112 /* PyObjectCallOneArg.proto */
1113 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1114
1115 /* GetTopmostException.proto */
1116 #if CYTHON_USE_EXC_INFO_STACK
1117 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1118 #endif
1119
1120 /* PyThreadStateGet.proto */
1121 #if CYTHON_FAST_THREAD_STATE
1122 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1123 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1124 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1125 #else
1126 #define __Pyx_PyThreadState_declare
1127 #define __Pyx_PyThreadState_assign
1128 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1129 #endif
1130
1131 /* SaveResetException.proto */
1132 #if CYTHON_FAST_THREAD_STATE
1133 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1134 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1135 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1136 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1137 #else
1138 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1139 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1140 #endif
1141
1142 /* GetException.proto */
1143 #if CYTHON_FAST_THREAD_STATE
1144 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1145 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1146 #else
1147 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1148 #endif
1149
1150 /* PyErrFetchRestore.proto */
1151 #if CYTHON_FAST_THREAD_STATE
1152 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1153 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1154 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1155 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1156 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1157 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1158 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1159 #if CYTHON_COMPILING_IN_CPYTHON
1160 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1161 #else
1162 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1163 #endif
1164 #else
1165 #define __Pyx_PyErr_Clear() PyErr_Clear()
1166 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1167 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1168 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1169 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1170 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1171 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1172 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1173 #endif
1174
1175 /* RaiseException.proto */
1176 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1177
1178 /* PySequenceContains.proto */
__Pyx_PySequence_ContainsTF(PyObject * item,PyObject * seq,int eq)1179 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
1180 int result = PySequence_Contains(seq, item);
1181 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1182 }
1183
1184 /* GetItemInt.proto */
1185 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1186 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1187 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1188 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1189 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1190 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1191 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1192 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1193 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1194 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1195 int wraparound, int boundscheck);
1196 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1197 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1198 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1199 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1200 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1201 int wraparound, int boundscheck);
1202 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1203 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1204 int is_list, int wraparound, int boundscheck);
1205
1206 /* ObjectGetItem.proto */
1207 #if CYTHON_USE_TYPE_SLOTS
1208 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1209 #else
1210 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1211 #endif
1212
1213 /* PyErrExceptionMatches.proto */
1214 #if CYTHON_FAST_THREAD_STATE
1215 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1216 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1217 #else
1218 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1219 #endif
1220
1221 /* PyDictVersioning.proto */
1222 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1223 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1224 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1225 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1226 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1227 (cache_var) = (value);
1228 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1229 static PY_UINT64_T __pyx_dict_version = 0;\
1230 static PyObject *__pyx_dict_cached_value = NULL;\
1231 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1232 (VAR) = __pyx_dict_cached_value;\
1233 } else {\
1234 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1235 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1236 }\
1237 }
1238 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1239 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1240 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1241 #else
1242 #define __PYX_GET_DICT_VERSION(dict) (0)
1243 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1244 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1245 #endif
1246
1247 /* GetModuleGlobalName.proto */
1248 #if CYTHON_USE_DICT_VERSIONS
1249 #define __Pyx_GetModuleGlobalName(var, name) {\
1250 static PY_UINT64_T __pyx_dict_version = 0;\
1251 static PyObject *__pyx_dict_cached_value = NULL;\
1252 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1253 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1254 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1255 }
1256 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1257 PY_UINT64_T __pyx_dict_version;\
1258 PyObject *__pyx_dict_cached_value;\
1259 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1260 }
1261 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1262 #else
1263 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1264 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1265 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1266 #endif
1267
1268 /* ArgTypeTest.proto */
1269 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1270 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1271 __Pyx__ArgTypeTest(obj, type, name, exact))
1272 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1273
1274 /* ListAppend.proto */
1275 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1276 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1277 PyListObject* L = (PyListObject*) list;
1278 Py_ssize_t len = Py_SIZE(list);
1279 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1280 Py_INCREF(x);
1281 PyList_SET_ITEM(list, len, x);
1282 __Pyx_SET_SIZE(list, len + 1);
1283 return 0;
1284 }
1285 return PyList_Append(list, x);
1286 }
1287 #else
1288 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1289 #endif
1290
1291 /* ExtTypeTest.proto */
1292 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1293
1294 /* IncludeStringH.proto */
1295 #include <string.h>
1296
1297 /* decode_c_string_utf16.proto */
__Pyx_PyUnicode_DecodeUTF16(const char * s,Py_ssize_t size,const char * errors)1298 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1299 int byteorder = 0;
1300 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1301 }
__Pyx_PyUnicode_DecodeUTF16LE(const char * s,Py_ssize_t size,const char * errors)1302 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1303 int byteorder = -1;
1304 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1305 }
__Pyx_PyUnicode_DecodeUTF16BE(const char * s,Py_ssize_t size,const char * errors)1306 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1307 int byteorder = 1;
1308 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1309 }
1310
1311 /* decode_c_string.proto */
1312 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1313 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1314 const char* encoding, const char* errors,
1315 PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1316
1317 /* PyObject_GenericGetAttrNoDict.proto */
1318 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1319 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1320 #else
1321 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1322 #endif
1323
1324 /* PyObject_GenericGetAttr.proto */
1325 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1326 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1327 #else
1328 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1329 #endif
1330
1331 /* PyObjectGetAttrStrNoError.proto */
1332 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1333
1334 /* SetupReduce.proto */
1335 static int __Pyx_setup_reduce(PyObject* type_obj);
1336
1337 /* SetVTable.proto */
1338 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1339
1340 /* TypeImport.proto */
1341 #ifndef __PYX_HAVE_RT_ImportType_proto
1342 #define __PYX_HAVE_RT_ImportType_proto
1343 enum __Pyx_ImportType_CheckSize {
1344 __Pyx_ImportType_CheckSize_Error = 0,
1345 __Pyx_ImportType_CheckSize_Warn = 1,
1346 __Pyx_ImportType_CheckSize_Ignore = 2
1347 };
1348 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1349 #endif
1350
1351 /* Import.proto */
1352 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1353
1354 /* ImportFrom.proto */
1355 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1356
1357 /* None.proto */
1358 static CYTHON_INLINE long __Pyx_mod_long(long, long);
1359
1360 /* ClassMethod.proto */
1361 #include "descrobject.h"
1362 static CYTHON_UNUSED PyObject* __Pyx_Method_ClassMethod(PyObject *method);
1363
1364 /* GetNameInClass.proto */
1365 #define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name)
1366 static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);
1367
1368 /* CLineInTraceback.proto */
1369 #ifdef CYTHON_CLINE_IN_TRACEBACK
1370 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1371 #else
1372 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1373 #endif
1374
1375 /* CodeObjectCache.proto */
1376 typedef struct {
1377 PyCodeObject* code_object;
1378 int code_line;
1379 } __Pyx_CodeObjectCacheEntry;
1380 struct __Pyx_CodeObjectCache {
1381 int count;
1382 int max_count;
1383 __Pyx_CodeObjectCacheEntry* entries;
1384 };
1385 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1386 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1387 static PyCodeObject *__pyx_find_code_object(int code_line);
1388 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1389
1390 /* AddTraceback.proto */
1391 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1392 int py_line, const char *filename);
1393
1394 /* GCCDiagnostics.proto */
1395 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1396 #define __Pyx_HAS_GCC_DIAGNOSTIC
1397 #endif
1398
1399 /* CIntToPy.proto */
1400 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value);
1401
1402 /* CIntFromPy.proto */
1403 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1404
1405 /* CIntToPy.proto */
1406 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1407
1408 /* CIntToPy.proto */
1409 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value);
1410
1411 /* CIntToPy.proto */
1412 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1413
1414 /* CIntFromPy.proto */
1415 static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *);
1416
1417 /* CIntFromPy.proto */
1418 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1419
1420 /* FastTypeChecks.proto */
1421 #if CYTHON_COMPILING_IN_CPYTHON
1422 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1423 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1424 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1425 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1426 #else
1427 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1428 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1429 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1430 #endif
1431 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1432
1433 /* CheckBinaryVersion.proto */
1434 static int __Pyx_check_binary_version(void);
1435
1436 /* InitStrings.proto */
1437 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1438
1439 static PyObject *__pyx_f_4borg_9hashindex_10ChunkIndex__add(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, void *__pyx_v_key, uint32_t *__pyx_v_data); /* proto*/
1440
1441 /* Module declarations from 'cython' */
1442
1443 /* Module declarations from 'libc.stdint' */
1444
1445 /* Module declarations from 'libc.errno' */
1446
1447 /* Module declarations from 'libc.string' */
1448
1449 /* Module declarations from 'libc.stdio' */
1450
1451 /* Module declarations from '__builtin__' */
1452
1453 /* Module declarations from 'cpython.type' */
1454 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1455
1456 /* Module declarations from 'cpython' */
1457
1458 /* Module declarations from 'cpython.object' */
1459
1460 /* Module declarations from 'cpython.exc' */
1461
1462 /* Module declarations from 'cpython.buffer' */
1463
1464 /* Module declarations from 'cpython.bytes' */
1465
1466 /* Module declarations from 'borg.hashindex' */
1467 static PyTypeObject *__pyx_ptype_4borg_9hashindex_IndexBase = 0;
1468 static PyTypeObject *__pyx_ptype_4borg_9hashindex_FuseVersionsIndex = 0;
1469 static PyTypeObject *__pyx_ptype_4borg_9hashindex_NSIndex = 0;
1470 static PyTypeObject *__pyx_ptype_4borg_9hashindex_NSKeyIterator = 0;
1471 static PyTypeObject *__pyx_ptype_4borg_9hashindex_ChunkIndex = 0;
1472 static PyTypeObject *__pyx_ptype_4borg_9hashindex_ChunkKeyIterator = 0;
1473 static PyTypeObject *__pyx_ptype_4borg_9hashindex_CacheSynchronizer = 0;
1474 static PyObject *__pyx_v_4borg_9hashindex__NoDefault = 0;
1475 static Py_buffer __pyx_f_4borg_9hashindex_ro_buffer(PyObject *); /*proto*/
1476 #define __Pyx_MODULE_NAME "borg.hashindex"
1477 extern int __pyx_module_is_main_borg__hashindex;
1478 int __pyx_module_is_main_borg__hashindex = 0;
1479
1480 /* Implementation of 'borg.hashindex' */
1481 static PyObject *__pyx_builtin_object;
1482 static PyObject *__pyx_builtin_open;
1483 static PyObject *__pyx_builtin_KeyError;
1484 static PyObject *__pyx_builtin_TypeError;
1485 static PyObject *__pyx_builtin_IndexError;
1486 static PyObject *__pyx_builtin_StopIteration;
1487 static PyObject *__pyx_builtin_ValueError;
1488 static const char __pyx_k_os[] = "os";
1489 static const char __pyx_k_rb[] = "rb";
1490 static const char __pyx_k_wb[] = "wb";
1491 static const char __pyx_k_key[] = "key";
1492 static const char __pyx_k_exit[] = "__exit__";
1493 static const char __pyx_k_main[] = "__main__";
1494 static const char __pyx_k_name[] = "__name__";
1495 static const char __pyx_k_open[] = "open";
1496 static const char __pyx_k_path[] = "path";
1497 static const char __pyx_k_read[] = "read";
1498 static const char __pyx_k_refs[] = "refs";
1499 static const char __pyx_k_size[] = "size";
1500 static const char __pyx_k_test[] = "__test__";
1501 static const char __pyx_k_csize[] = "csize";
1502 static const char __pyx_k_enter[] = "__enter__";
1503 static const char __pyx_k_value[] = "value";
1504 static const char __pyx_k_1_1_07[] = "1.1_07";
1505 static const char __pyx_k_chunks[] = "chunks";
1506 static const char __pyx_k_import[] = "__import__";
1507 static const char __pyx_k_locale[] = "locale";
1508 static const char __pyx_k_marker[] = "marker";
1509 static const char __pyx_k_object[] = "object";
1510 static const char __pyx_k_reduce[] = "__reduce__";
1511 static const char __pyx_k_NSIndex[] = "NSIndex";
1512 static const char __pyx_k_default[] = "default";
1513 static const char __pyx_k_KeyError[] = "KeyError";
1514 static const char __pyx_k_capacity[] = "capacity";
1515 static const char __pyx_k_getstate[] = "__getstate__";
1516 static const char __pyx_k_key_size[] = "_key_size";
1517 static const char __pyx_k_setstate[] = "__setstate__";
1518 static const char __pyx_k_MAX_VALUE[] = "MAX_VALUE";
1519 static const char __pyx_k_TypeError[] = "TypeError";
1520 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1521 static const char __pyx_k_ChunkIndex[] = "ChunkIndex";
1522 static const char __pyx_k_IndexError[] = "IndexError";
1523 static const char __pyx_k_ValueError[] = "ValueError";
1524 static const char __pyx_k_key_size_2[] = "key_size";
1525 static const char __pyx_k_namedtuple[] = "namedtuple";
1526 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1527 static const char __pyx_k_value_size[] = "value_size";
1528 static const char __pyx_k_API_VERSION[] = "API_VERSION";
1529 static const char __pyx_k_collections[] = "collections";
1530 static const char __pyx_k_NSKeyIterator[] = "NSKeyIterator";
1531 static const char __pyx_k_StopIteration[] = "StopIteration";
1532 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1533 static const char __pyx_k_permit_compact[] = "permit_compact";
1534 static const char __pyx_k_ChunkIndexEntry[] = "ChunkIndexEntry";
1535 static const char __pyx_k_MAX_LOAD_FACTOR[] = "MAX_LOAD_FACTOR";
1536 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1537 static const char __pyx_k_ChunkKeyIterator[] = "ChunkKeyIterator";
1538 static const char __pyx_k_CacheSynchronizer[] = "CacheSynchronizer";
1539 static const char __pyx_k_FuseVersionsIndex[] = "FuseVersionsIndex";
1540 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1541 static const char __pyx_k_refcount_size_csize[] = "refcount size csize";
1542 static const char __pyx_k_hashindex_set_failed[] = "hashindex_set failed";
1543 static const char __pyx_k_hashindex_init_failed[] = "hashindex_init failed";
1544 static const char __pyx_k_cache_sync_feed_failed[] = "cache_sync_feed failed: ";
1545 static const char __pyx_k_cache_sync_init_failed[] = "cache_sync_init failed";
1546 static const char __pyx_k_hashindex_delete_failed[] = "hashindex_delete failed";
1547 static const char __pyx_k_invalid_reference_count[] = "invalid reference count";
1548 static const char __pyx_k_Expected_bytes_of_length_16_for[] = "Expected bytes of length 16 for second value";
1549 static const char __pyx_k_hashindex_read_returned_NULL_wit[] = "hashindex_read() returned NULL with no exception set";
1550 static const char __pyx_k_maximum_number_of_segments_reach[] = "maximum number of segments reached";
1551 static const char __pyx_k_maximum_number_of_versions_reach[] = "maximum number of versions reached";
1552 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
1553 static const char __pyx_k_stats_against_key_contained_in_s[] = "stats_against: key contained in self but not in master_index.";
1554 static PyObject *__pyx_kp_u_1_1_07;
1555 static PyObject *__pyx_n_s_API_VERSION;
1556 static PyObject *__pyx_n_s_CacheSynchronizer;
1557 static PyObject *__pyx_n_s_ChunkIndex;
1558 static PyObject *__pyx_n_s_ChunkIndexEntry;
1559 static PyObject *__pyx_n_u_ChunkIndexEntry;
1560 static PyObject *__pyx_n_s_ChunkKeyIterator;
1561 static PyObject *__pyx_kp_u_Expected_bytes_of_length_16_for;
1562 static PyObject *__pyx_n_s_FuseVersionsIndex;
1563 static PyObject *__pyx_n_s_IndexError;
1564 static PyObject *__pyx_n_s_KeyError;
1565 static PyObject *__pyx_n_s_MAX_LOAD_FACTOR;
1566 static PyObject *__pyx_n_s_MAX_VALUE;
1567 static PyObject *__pyx_n_s_NSIndex;
1568 static PyObject *__pyx_n_s_NSKeyIterator;
1569 static PyObject *__pyx_n_s_StopIteration;
1570 static PyObject *__pyx_n_s_TypeError;
1571 static PyObject *__pyx_n_s_ValueError;
1572 static PyObject *__pyx_kp_u_cache_sync_feed_failed;
1573 static PyObject *__pyx_kp_u_cache_sync_init_failed;
1574 static PyObject *__pyx_n_s_capacity;
1575 static PyObject *__pyx_n_s_chunks;
1576 static PyObject *__pyx_n_s_cline_in_traceback;
1577 static PyObject *__pyx_n_s_collections;
1578 static PyObject *__pyx_n_s_csize;
1579 static PyObject *__pyx_n_s_default;
1580 static PyObject *__pyx_n_s_enter;
1581 static PyObject *__pyx_n_s_exit;
1582 static PyObject *__pyx_n_s_getstate;
1583 static PyObject *__pyx_kp_u_hashindex_delete_failed;
1584 static PyObject *__pyx_kp_u_hashindex_init_failed;
1585 static PyObject *__pyx_kp_u_hashindex_read_returned_NULL_wit;
1586 static PyObject *__pyx_kp_u_hashindex_set_failed;
1587 static PyObject *__pyx_n_s_import;
1588 static PyObject *__pyx_kp_u_invalid_reference_count;
1589 static PyObject *__pyx_n_s_key;
1590 static PyObject *__pyx_n_s_key_size;
1591 static PyObject *__pyx_n_s_key_size_2;
1592 static PyObject *__pyx_n_s_locale;
1593 static PyObject *__pyx_n_s_main;
1594 static PyObject *__pyx_n_s_marker;
1595 static PyObject *__pyx_kp_u_maximum_number_of_segments_reach;
1596 static PyObject *__pyx_kp_u_maximum_number_of_versions_reach;
1597 static PyObject *__pyx_n_s_name;
1598 static PyObject *__pyx_n_s_namedtuple;
1599 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
1600 static PyObject *__pyx_n_s_object;
1601 static PyObject *__pyx_n_s_open;
1602 static PyObject *__pyx_n_s_os;
1603 static PyObject *__pyx_n_s_path;
1604 static PyObject *__pyx_n_s_permit_compact;
1605 static PyObject *__pyx_n_s_pyx_vtable;
1606 static PyObject *__pyx_n_u_rb;
1607 static PyObject *__pyx_n_s_read;
1608 static PyObject *__pyx_n_s_reduce;
1609 static PyObject *__pyx_n_s_reduce_cython;
1610 static PyObject *__pyx_n_s_reduce_ex;
1611 static PyObject *__pyx_kp_u_refcount_size_csize;
1612 static PyObject *__pyx_n_s_refs;
1613 static PyObject *__pyx_n_s_setstate;
1614 static PyObject *__pyx_n_s_setstate_cython;
1615 static PyObject *__pyx_n_s_size;
1616 static PyObject *__pyx_kp_u_stats_against_key_contained_in_s;
1617 static PyObject *__pyx_n_s_test;
1618 static PyObject *__pyx_n_s_value;
1619 static PyObject *__pyx_n_s_value_size;
1620 static PyObject *__pyx_n_u_wb;
1621 static int __pyx_pf_4borg_9hashindex_9IndexBase___cinit__(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self, PyObject *__pyx_v_capacity, PyObject *__pyx_v_path, PyObject *__pyx_v_permit_compact); /* proto */
1622 static void __pyx_pf_4borg_9hashindex_9IndexBase_2__dealloc__(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self); /* proto */
1623 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_4read(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_path, PyObject *__pyx_v_permit_compact); /* proto */
1624 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_6write(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self, PyObject *__pyx_v_path); /* proto */
1625 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_8clear(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self); /* proto */
1626 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_10setdefault(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
1627 static int __pyx_pf_4borg_9hashindex_9IndexBase_12__delitem__(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
1628 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_14get(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
1629 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_16pop(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
1630 static Py_ssize_t __pyx_pf_4borg_9hashindex_9IndexBase_18__len__(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self); /* proto */
1631 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_20size(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self); /* proto */
1632 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_22compact(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self); /* proto */
1633 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_24__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self); /* proto */
1634 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_26__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1635 static PyObject *__pyx_pf_4borg_9hashindex_17FuseVersionsIndex___getitem__(struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
1636 static int __pyx_pf_4borg_9hashindex_17FuseVersionsIndex_2__setitem__(struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
1637 static int __pyx_pf_4borg_9hashindex_17FuseVersionsIndex_4__contains__(struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
1638 static PyObject *__pyx_pf_4borg_9hashindex_17FuseVersionsIndex_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *__pyx_v_self); /* proto */
1639 static PyObject *__pyx_pf_4borg_9hashindex_17FuseVersionsIndex_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1640 static PyObject *__pyx_pf_4borg_9hashindex_7NSIndex___getitem__(struct __pyx_obj_4borg_9hashindex_NSIndex *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
1641 static int __pyx_pf_4borg_9hashindex_7NSIndex_2__setitem__(struct __pyx_obj_4borg_9hashindex_NSIndex *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
1642 static int __pyx_pf_4borg_9hashindex_7NSIndex_4__contains__(struct __pyx_obj_4borg_9hashindex_NSIndex *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
1643 static PyObject *__pyx_pf_4borg_9hashindex_7NSIndex_6iteritems(struct __pyx_obj_4borg_9hashindex_NSIndex *__pyx_v_self, PyObject *__pyx_v_marker); /* proto */
1644 static PyObject *__pyx_pf_4borg_9hashindex_7NSIndex_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_NSIndex *__pyx_v_self); /* proto */
1645 static PyObject *__pyx_pf_4borg_9hashindex_7NSIndex_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_NSIndex *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1646 static int __pyx_pf_4borg_9hashindex_13NSKeyIterator___cinit__(struct __pyx_obj_4borg_9hashindex_NSKeyIterator *__pyx_v_self, PyObject *__pyx_v_key_size); /* proto */
1647 static PyObject *__pyx_pf_4borg_9hashindex_13NSKeyIterator_2__iter__(struct __pyx_obj_4borg_9hashindex_NSKeyIterator *__pyx_v_self); /* proto */
1648 static PyObject *__pyx_pf_4borg_9hashindex_13NSKeyIterator_4__next__(struct __pyx_obj_4borg_9hashindex_NSKeyIterator *__pyx_v_self); /* proto */
1649 static PyObject *__pyx_pf_4borg_9hashindex_13NSKeyIterator_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_NSKeyIterator *__pyx_v_self); /* proto */
1650 static PyObject *__pyx_pf_4borg_9hashindex_13NSKeyIterator_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_NSKeyIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1651 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex___getitem__(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
1652 static int __pyx_pf_4borg_9hashindex_10ChunkIndex_2__setitem__(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
1653 static int __pyx_pf_4borg_9hashindex_10ChunkIndex_4__contains__(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
1654 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_6incref(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
1655 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_8decref(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
1656 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_10iteritems(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, PyObject *__pyx_v_marker); /* proto */
1657 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_12summarize(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self); /* proto */
1658 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_14stats_against(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_master_index); /* proto */
1659 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_16add(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_refs, PyObject *__pyx_v_size, PyObject *__pyx_v_csize); /* proto */
1660 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_18merge(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_other); /* proto */
1661 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_20zero_csize_ids(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self); /* proto */
1662 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self); /* proto */
1663 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1664 static int __pyx_pf_4borg_9hashindex_16ChunkKeyIterator___cinit__(struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *__pyx_v_self, PyObject *__pyx_v_key_size); /* proto */
1665 static PyObject *__pyx_pf_4borg_9hashindex_16ChunkKeyIterator_2__iter__(struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *__pyx_v_self); /* proto */
1666 static PyObject *__pyx_pf_4borg_9hashindex_16ChunkKeyIterator_4__next__(struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *__pyx_v_self); /* proto */
1667 static PyObject *__pyx_pf_4borg_9hashindex_16ChunkKeyIterator_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *__pyx_v_self); /* proto */
1668 static PyObject *__pyx_pf_4borg_9hashindex_16ChunkKeyIterator_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1669 static int __pyx_pf_4borg_9hashindex_17CacheSynchronizer___cinit__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self, PyObject *__pyx_v_chunks); /* proto */
1670 static void __pyx_pf_4borg_9hashindex_17CacheSynchronizer_2__dealloc__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self); /* proto */
1671 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_4feed(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self, PyObject *__pyx_v_chunk); /* proto */
1672 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_16num_files_totals___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self); /* proto */
1673 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_15num_files_parts___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self); /* proto */
1674 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_11size_totals___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self); /* proto */
1675 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_10size_parts___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self); /* proto */
1676 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_12csize_totals___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self); /* proto */
1677 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_11csize_parts___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self); /* proto */
1678 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self); /* proto */
1679 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1680 static PyObject *__pyx_tp_new_4borg_9hashindex_IndexBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1681 static PyObject *__pyx_tp_new_4borg_9hashindex_FuseVersionsIndex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1682 static PyObject *__pyx_tp_new_4borg_9hashindex_NSIndex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1683 static PyObject *__pyx_tp_new_4borg_9hashindex_NSKeyIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1684 static PyObject *__pyx_tp_new_4borg_9hashindex_ChunkIndex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1685 static PyObject *__pyx_tp_new_4borg_9hashindex_ChunkKeyIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1686 static PyObject *__pyx_tp_new_4borg_9hashindex_CacheSynchronizer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1687 static PyObject *__pyx_int_0;
1688 static PyObject *__pyx_int_8;
1689 static PyObject *__pyx_int_12;
1690 static PyObject *__pyx_int_16;
1691 static PyObject *__pyx_int_20;
1692 static PyObject *__pyx_int_32;
1693 static PyObject *__pyx_int_4294967295;
1694 static PyObject *__pyx_k__4;
1695 static PyObject *__pyx_tuple_;
1696 static PyObject *__pyx_tuple__2;
1697 static PyObject *__pyx_tuple__3;
1698 static PyObject *__pyx_tuple__5;
1699 static PyObject *__pyx_tuple__6;
1700 static PyObject *__pyx_tuple__7;
1701 static PyObject *__pyx_tuple__8;
1702 static PyObject *__pyx_tuple__9;
1703 static PyObject *__pyx_tuple__10;
1704 static PyObject *__pyx_tuple__11;
1705 static PyObject *__pyx_tuple__12;
1706 static PyObject *__pyx_tuple__13;
1707 static PyObject *__pyx_tuple__14;
1708 static PyObject *__pyx_tuple__15;
1709 static PyObject *__pyx_tuple__16;
1710 static PyObject *__pyx_tuple__17;
1711 static PyObject *__pyx_tuple__18;
1712 static PyObject *__pyx_tuple__19;
1713 static PyObject *__pyx_tuple__20;
1714 static PyObject *__pyx_tuple__21;
1715 static PyObject *__pyx_tuple__22;
1716 static PyObject *__pyx_tuple__23;
1717 /* Late includes */
1718
1719 /* "borg/hashindex.pyx":93
1720 * MAX_VALUE = _MAX_VALUE
1721 *
1722 * def __cinit__(self, capacity=0, path=None, permit_compact=False): # <<<<<<<<<<<<<<
1723 * self.key_size = self._key_size
1724 * if path:
1725 */
1726
1727 /* Python wrapper */
1728 static int __pyx_pw_4borg_9hashindex_9IndexBase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4borg_9hashindex_9IndexBase_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)1729 static int __pyx_pw_4borg_9hashindex_9IndexBase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1730 PyObject *__pyx_v_capacity = 0;
1731 PyObject *__pyx_v_path = 0;
1732 PyObject *__pyx_v_permit_compact = 0;
1733 int __pyx_lineno = 0;
1734 const char *__pyx_filename = NULL;
1735 int __pyx_clineno = 0;
1736 int __pyx_r;
1737 __Pyx_RefNannyDeclarations
1738 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
1739 {
1740 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_capacity,&__pyx_n_s_path,&__pyx_n_s_permit_compact,0};
1741 PyObject* values[3] = {0,0,0};
1742 values[0] = ((PyObject *)__pyx_int_0);
1743 values[1] = ((PyObject *)Py_None);
1744 values[2] = ((PyObject *)Py_False);
1745 if (unlikely(__pyx_kwds)) {
1746 Py_ssize_t kw_args;
1747 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1748 switch (pos_args) {
1749 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1750 CYTHON_FALLTHROUGH;
1751 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1752 CYTHON_FALLTHROUGH;
1753 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1754 CYTHON_FALLTHROUGH;
1755 case 0: break;
1756 default: goto __pyx_L5_argtuple_error;
1757 }
1758 kw_args = PyDict_Size(__pyx_kwds);
1759 switch (pos_args) {
1760 case 0:
1761 if (kw_args > 0) {
1762 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_capacity);
1763 if (value) { values[0] = value; kw_args--; }
1764 }
1765 CYTHON_FALLTHROUGH;
1766 case 1:
1767 if (kw_args > 0) {
1768 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path);
1769 if (value) { values[1] = value; kw_args--; }
1770 }
1771 CYTHON_FALLTHROUGH;
1772 case 2:
1773 if (kw_args > 0) {
1774 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_permit_compact);
1775 if (value) { values[2] = value; kw_args--; }
1776 }
1777 }
1778 if (unlikely(kw_args > 0)) {
1779 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 93, __pyx_L3_error)
1780 }
1781 } else {
1782 switch (PyTuple_GET_SIZE(__pyx_args)) {
1783 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1784 CYTHON_FALLTHROUGH;
1785 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1786 CYTHON_FALLTHROUGH;
1787 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1788 CYTHON_FALLTHROUGH;
1789 case 0: break;
1790 default: goto __pyx_L5_argtuple_error;
1791 }
1792 }
1793 __pyx_v_capacity = values[0];
1794 __pyx_v_path = values[1];
1795 __pyx_v_permit_compact = values[2];
1796 }
1797 goto __pyx_L4_argument_unpacking_done;
1798 __pyx_L5_argtuple_error:;
1799 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 93, __pyx_L3_error)
1800 __pyx_L3_error:;
1801 __Pyx_AddTraceback("borg.hashindex.IndexBase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1802 __Pyx_RefNannyFinishContext();
1803 return -1;
1804 __pyx_L4_argument_unpacking_done:;
1805 __pyx_r = __pyx_pf_4borg_9hashindex_9IndexBase___cinit__(((struct __pyx_obj_4borg_9hashindex_IndexBase *)__pyx_v_self), __pyx_v_capacity, __pyx_v_path, __pyx_v_permit_compact);
1806
1807 /* function exit code */
1808 __Pyx_RefNannyFinishContext();
1809 return __pyx_r;
1810 }
1811
__pyx_pf_4borg_9hashindex_9IndexBase___cinit__(struct __pyx_obj_4borg_9hashindex_IndexBase * __pyx_v_self,PyObject * __pyx_v_capacity,PyObject * __pyx_v_path,PyObject * __pyx_v_permit_compact)1812 static int __pyx_pf_4borg_9hashindex_9IndexBase___cinit__(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self, PyObject *__pyx_v_capacity, PyObject *__pyx_v_path, PyObject *__pyx_v_permit_compact) {
1813 PyObject *__pyx_v_fd = NULL;
1814 int __pyx_r;
1815 __Pyx_RefNannyDeclarations
1816 PyObject *__pyx_t_1 = NULL;
1817 int __pyx_t_2;
1818 int __pyx_t_3;
1819 int __pyx_t_4;
1820 int __pyx_t_5;
1821 PyObject *__pyx_t_6 = NULL;
1822 PyObject *__pyx_t_7 = NULL;
1823 PyObject *__pyx_t_8 = NULL;
1824 PyObject *__pyx_t_9 = NULL;
1825 PyObject *__pyx_t_10 = NULL;
1826 PyObject *__pyx_t_11 = NULL;
1827 PyObject *__pyx_t_12 = NULL;
1828 HashIndex *__pyx_t_13;
1829 PyObject *__pyx_t_14 = NULL;
1830 int __pyx_t_15;
1831 int __pyx_lineno = 0;
1832 const char *__pyx_filename = NULL;
1833 int __pyx_clineno = 0;
1834 __Pyx_RefNannySetupContext("__cinit__", 0);
1835
1836 /* "borg/hashindex.pyx":94
1837 *
1838 * def __cinit__(self, capacity=0, path=None, permit_compact=False):
1839 * self.key_size = self._key_size # <<<<<<<<<<<<<<
1840 * if path:
1841 * if isinstance(path, (str, bytes)):
1842 */
1843 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_key_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
1844 __Pyx_GOTREF(__pyx_t_1);
1845 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L1_error)
1846 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1847 __pyx_v_self->key_size = __pyx_t_2;
1848
1849 /* "borg/hashindex.pyx":95
1850 * def __cinit__(self, capacity=0, path=None, permit_compact=False):
1851 * self.key_size = self._key_size
1852 * if path: # <<<<<<<<<<<<<<
1853 * if isinstance(path, (str, bytes)):
1854 * with open(path, 'rb') as fd:
1855 */
1856 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_path); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 95, __pyx_L1_error)
1857 if (__pyx_t_3) {
1858
1859 /* "borg/hashindex.pyx":96
1860 * self.key_size = self._key_size
1861 * if path:
1862 * if isinstance(path, (str, bytes)): # <<<<<<<<<<<<<<
1863 * with open(path, 'rb') as fd:
1864 * self.index = hashindex_read(fd, permit_compact)
1865 */
1866 __pyx_t_4 = PyUnicode_Check(__pyx_v_path);
1867 __pyx_t_5 = (__pyx_t_4 != 0);
1868 if (!__pyx_t_5) {
1869 } else {
1870 __pyx_t_3 = __pyx_t_5;
1871 goto __pyx_L5_bool_binop_done;
1872 }
1873 __pyx_t_5 = PyBytes_Check(__pyx_v_path);
1874 __pyx_t_4 = (__pyx_t_5 != 0);
1875 __pyx_t_3 = __pyx_t_4;
1876 __pyx_L5_bool_binop_done:;
1877 __pyx_t_4 = (__pyx_t_3 != 0);
1878 if (__pyx_t_4) {
1879
1880 /* "borg/hashindex.pyx":97
1881 * if path:
1882 * if isinstance(path, (str, bytes)):
1883 * with open(path, 'rb') as fd: # <<<<<<<<<<<<<<
1884 * self.index = hashindex_read(fd, permit_compact)
1885 * else:
1886 */
1887 /*with:*/ {
1888 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
1889 __Pyx_GOTREF(__pyx_t_1);
1890 __Pyx_INCREF(__pyx_v_path);
1891 __Pyx_GIVEREF(__pyx_v_path);
1892 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_path);
1893 __Pyx_INCREF(__pyx_n_u_rb);
1894 __Pyx_GIVEREF(__pyx_n_u_rb);
1895 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_u_rb);
1896 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error)
1897 __Pyx_GOTREF(__pyx_t_6);
1898 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1899 __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_6, __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __pyx_L1_error)
1900 __Pyx_GOTREF(__pyx_t_7);
1901 __pyx_t_8 = __Pyx_PyObject_LookupSpecial(__pyx_t_6, __pyx_n_s_enter); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 97, __pyx_L7_error)
1902 __Pyx_GOTREF(__pyx_t_8);
1903 __pyx_t_9 = NULL;
1904 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
1905 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
1906 if (likely(__pyx_t_9)) {
1907 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
1908 __Pyx_INCREF(__pyx_t_9);
1909 __Pyx_INCREF(function);
1910 __Pyx_DECREF_SET(__pyx_t_8, function);
1911 }
1912 }
1913 __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
1914 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
1915 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L7_error)
1916 __Pyx_GOTREF(__pyx_t_1);
1917 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
1918 __pyx_t_8 = __pyx_t_1;
1919 __pyx_t_1 = 0;
1920 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1921 /*try:*/ {
1922 {
1923 __Pyx_PyThreadState_declare
1924 __Pyx_PyThreadState_assign
1925 __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
1926 __Pyx_XGOTREF(__pyx_t_10);
1927 __Pyx_XGOTREF(__pyx_t_11);
1928 __Pyx_XGOTREF(__pyx_t_12);
1929 /*try:*/ {
1930 __pyx_v_fd = __pyx_t_8;
1931 __pyx_t_8 = 0;
1932
1933 /* "borg/hashindex.pyx":98
1934 * if isinstance(path, (str, bytes)):
1935 * with open(path, 'rb') as fd:
1936 * self.index = hashindex_read(fd, permit_compact) # <<<<<<<<<<<<<<
1937 * else:
1938 * self.index = hashindex_read(path, permit_compact)
1939 */
1940 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_permit_compact); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L11_error)
1941 __pyx_t_13 = hashindex_read(__pyx_v_fd, __pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L11_error)
1942 __pyx_v_self->index = __pyx_t_13;
1943
1944 /* "borg/hashindex.pyx":97
1945 * if path:
1946 * if isinstance(path, (str, bytes)):
1947 * with open(path, 'rb') as fd: # <<<<<<<<<<<<<<
1948 * self.index = hashindex_read(fd, permit_compact)
1949 * else:
1950 */
1951 }
1952 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
1953 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
1954 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
1955 goto __pyx_L16_try_end;
1956 __pyx_L11_error:;
1957 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
1958 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
1959 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
1960 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
1961 /*except:*/ {
1962 __Pyx_AddTraceback("borg.hashindex.IndexBase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1963 if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(0, 97, __pyx_L13_except_error)
1964 __Pyx_GOTREF(__pyx_t_8);
1965 __Pyx_GOTREF(__pyx_t_6);
1966 __Pyx_GOTREF(__pyx_t_1);
1967 __pyx_t_9 = PyTuple_Pack(3, __pyx_t_8, __pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L13_except_error)
1968 __Pyx_GOTREF(__pyx_t_9);
1969 __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL);
1970 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
1971 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
1972 if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 97, __pyx_L13_except_error)
1973 __Pyx_GOTREF(__pyx_t_14);
1974 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_14);
1975 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
1976 if (__pyx_t_4 < 0) __PYX_ERR(0, 97, __pyx_L13_except_error)
1977 __pyx_t_3 = ((!(__pyx_t_4 != 0)) != 0);
1978 if (__pyx_t_3) {
1979 __Pyx_GIVEREF(__pyx_t_8);
1980 __Pyx_GIVEREF(__pyx_t_6);
1981 __Pyx_XGIVEREF(__pyx_t_1);
1982 __Pyx_ErrRestoreWithState(__pyx_t_8, __pyx_t_6, __pyx_t_1);
1983 __pyx_t_8 = 0; __pyx_t_6 = 0; __pyx_t_1 = 0;
1984 __PYX_ERR(0, 97, __pyx_L13_except_error)
1985 }
1986 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
1987 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
1988 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
1989 goto __pyx_L12_exception_handled;
1990 }
1991 __pyx_L13_except_error:;
1992 __Pyx_XGIVEREF(__pyx_t_10);
1993 __Pyx_XGIVEREF(__pyx_t_11);
1994 __Pyx_XGIVEREF(__pyx_t_12);
1995 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
1996 goto __pyx_L1_error;
1997 __pyx_L12_exception_handled:;
1998 __Pyx_XGIVEREF(__pyx_t_10);
1999 __Pyx_XGIVEREF(__pyx_t_11);
2000 __Pyx_XGIVEREF(__pyx_t_12);
2001 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
2002 __pyx_L16_try_end:;
2003 }
2004 }
2005 /*finally:*/ {
2006 /*normal exit:*/{
2007 if (__pyx_t_7) {
2008 __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple_, NULL);
2009 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2010 if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 97, __pyx_L1_error)
2011 __Pyx_GOTREF(__pyx_t_12);
2012 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
2013 }
2014 goto __pyx_L10;
2015 }
2016 __pyx_L10:;
2017 }
2018 goto __pyx_L20;
2019 __pyx_L7_error:;
2020 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2021 goto __pyx_L1_error;
2022 __pyx_L20:;
2023 }
2024
2025 /* "borg/hashindex.pyx":96
2026 * self.key_size = self._key_size
2027 * if path:
2028 * if isinstance(path, (str, bytes)): # <<<<<<<<<<<<<<
2029 * with open(path, 'rb') as fd:
2030 * self.index = hashindex_read(fd, permit_compact)
2031 */
2032 goto __pyx_L4;
2033 }
2034
2035 /* "borg/hashindex.pyx":100
2036 * self.index = hashindex_read(fd, permit_compact)
2037 * else:
2038 * self.index = hashindex_read(path, permit_compact) # <<<<<<<<<<<<<<
2039 * assert self.index, 'hashindex_read() returned NULL with no exception set'
2040 * else:
2041 */
2042 /*else*/ {
2043 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_permit_compact); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L1_error)
2044 __pyx_t_13 = hashindex_read(__pyx_v_path, __pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L1_error)
2045 __pyx_v_self->index = __pyx_t_13;
2046 }
2047 __pyx_L4:;
2048
2049 /* "borg/hashindex.pyx":101
2050 * else:
2051 * self.index = hashindex_read(path, permit_compact)
2052 * assert self.index, 'hashindex_read() returned NULL with no exception set' # <<<<<<<<<<<<<<
2053 * else:
2054 * self.index = hashindex_init(capacity, self.key_size, self.value_size)
2055 */
2056 #ifndef CYTHON_WITHOUT_ASSERTIONS
2057 if (unlikely(!Py_OptimizeFlag)) {
2058 if (unlikely(!(__pyx_v_self->index != 0))) {
2059 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_hashindex_read_returned_NULL_wit);
2060 __PYX_ERR(0, 101, __pyx_L1_error)
2061 }
2062 }
2063 #endif
2064
2065 /* "borg/hashindex.pyx":95
2066 * def __cinit__(self, capacity=0, path=None, permit_compact=False):
2067 * self.key_size = self._key_size
2068 * if path: # <<<<<<<<<<<<<<
2069 * if isinstance(path, (str, bytes)):
2070 * with open(path, 'rb') as fd:
2071 */
2072 goto __pyx_L3;
2073 }
2074
2075 /* "borg/hashindex.pyx":103
2076 * assert self.index, 'hashindex_read() returned NULL with no exception set'
2077 * else:
2078 * self.index = hashindex_init(capacity, self.key_size, self.value_size) # <<<<<<<<<<<<<<
2079 * if not self.index:
2080 * raise Exception('hashindex_init failed')
2081 */
2082 /*else*/ {
2083 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_capacity); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error)
2084 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_value_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error)
2085 __Pyx_GOTREF(__pyx_t_1);
2086 __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error)
2087 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2088 __pyx_v_self->index = hashindex_init(__pyx_t_2, __pyx_v_self->key_size, __pyx_t_15);
2089
2090 /* "borg/hashindex.pyx":104
2091 * else:
2092 * self.index = hashindex_init(capacity, self.key_size, self.value_size)
2093 * if not self.index: # <<<<<<<<<<<<<<
2094 * raise Exception('hashindex_init failed')
2095 *
2096 */
2097 __pyx_t_3 = ((!(__pyx_v_self->index != 0)) != 0);
2098 if (unlikely(__pyx_t_3)) {
2099
2100 /* "borg/hashindex.pyx":105
2101 * self.index = hashindex_init(capacity, self.key_size, self.value_size)
2102 * if not self.index:
2103 * raise Exception('hashindex_init failed') # <<<<<<<<<<<<<<
2104 *
2105 * def __dealloc__(self):
2106 */
2107 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error)
2108 __Pyx_GOTREF(__pyx_t_1);
2109 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
2110 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2111 __PYX_ERR(0, 105, __pyx_L1_error)
2112
2113 /* "borg/hashindex.pyx":104
2114 * else:
2115 * self.index = hashindex_init(capacity, self.key_size, self.value_size)
2116 * if not self.index: # <<<<<<<<<<<<<<
2117 * raise Exception('hashindex_init failed')
2118 *
2119 */
2120 }
2121 }
2122 __pyx_L3:;
2123
2124 /* "borg/hashindex.pyx":93
2125 * MAX_VALUE = _MAX_VALUE
2126 *
2127 * def __cinit__(self, capacity=0, path=None, permit_compact=False): # <<<<<<<<<<<<<<
2128 * self.key_size = self._key_size
2129 * if path:
2130 */
2131
2132 /* function exit code */
2133 __pyx_r = 0;
2134 goto __pyx_L0;
2135 __pyx_L1_error:;
2136 __Pyx_XDECREF(__pyx_t_1);
2137 __Pyx_XDECREF(__pyx_t_6);
2138 __Pyx_XDECREF(__pyx_t_8);
2139 __Pyx_XDECREF(__pyx_t_9);
2140 __Pyx_AddTraceback("borg.hashindex.IndexBase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2141 __pyx_r = -1;
2142 __pyx_L0:;
2143 __Pyx_XDECREF(__pyx_v_fd);
2144 __Pyx_RefNannyFinishContext();
2145 return __pyx_r;
2146 }
2147
2148 /* "borg/hashindex.pyx":107
2149 * raise Exception('hashindex_init failed')
2150 *
2151 * def __dealloc__(self): # <<<<<<<<<<<<<<
2152 * if self.index:
2153 * hashindex_free(self.index)
2154 */
2155
2156 /* Python wrapper */
2157 static void __pyx_pw_4borg_9hashindex_9IndexBase_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4borg_9hashindex_9IndexBase_3__dealloc__(PyObject * __pyx_v_self)2158 static void __pyx_pw_4borg_9hashindex_9IndexBase_3__dealloc__(PyObject *__pyx_v_self) {
2159 __Pyx_RefNannyDeclarations
2160 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
2161 __pyx_pf_4borg_9hashindex_9IndexBase_2__dealloc__(((struct __pyx_obj_4borg_9hashindex_IndexBase *)__pyx_v_self));
2162
2163 /* function exit code */
2164 __Pyx_RefNannyFinishContext();
2165 }
2166
__pyx_pf_4borg_9hashindex_9IndexBase_2__dealloc__(struct __pyx_obj_4borg_9hashindex_IndexBase * __pyx_v_self)2167 static void __pyx_pf_4borg_9hashindex_9IndexBase_2__dealloc__(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self) {
2168 __Pyx_RefNannyDeclarations
2169 int __pyx_t_1;
2170 __Pyx_RefNannySetupContext("__dealloc__", 0);
2171
2172 /* "borg/hashindex.pyx":108
2173 *
2174 * def __dealloc__(self):
2175 * if self.index: # <<<<<<<<<<<<<<
2176 * hashindex_free(self.index)
2177 *
2178 */
2179 __pyx_t_1 = (__pyx_v_self->index != 0);
2180 if (__pyx_t_1) {
2181
2182 /* "borg/hashindex.pyx":109
2183 * def __dealloc__(self):
2184 * if self.index:
2185 * hashindex_free(self.index) # <<<<<<<<<<<<<<
2186 *
2187 * @classmethod
2188 */
2189 hashindex_free(__pyx_v_self->index);
2190
2191 /* "borg/hashindex.pyx":108
2192 *
2193 * def __dealloc__(self):
2194 * if self.index: # <<<<<<<<<<<<<<
2195 * hashindex_free(self.index)
2196 *
2197 */
2198 }
2199
2200 /* "borg/hashindex.pyx":107
2201 * raise Exception('hashindex_init failed')
2202 *
2203 * def __dealloc__(self): # <<<<<<<<<<<<<<
2204 * if self.index:
2205 * hashindex_free(self.index)
2206 */
2207
2208 /* function exit code */
2209 __Pyx_RefNannyFinishContext();
2210 }
2211
2212 /* "borg/hashindex.pyx":112
2213 *
2214 * @classmethod
2215 * def read(cls, path, permit_compact=False): # <<<<<<<<<<<<<<
2216 * return cls(path=path, permit_compact=permit_compact)
2217 *
2218 */
2219
2220 /* Python wrapper */
2221 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_5read(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4borg_9hashindex_9IndexBase_5read(PyObject * __pyx_v_cls,PyObject * __pyx_args,PyObject * __pyx_kwds)2222 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_5read(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2223 PyObject *__pyx_v_path = 0;
2224 PyObject *__pyx_v_permit_compact = 0;
2225 int __pyx_lineno = 0;
2226 const char *__pyx_filename = NULL;
2227 int __pyx_clineno = 0;
2228 PyObject *__pyx_r = 0;
2229 __Pyx_RefNannyDeclarations
2230 __Pyx_RefNannySetupContext("read (wrapper)", 0);
2231 {
2232 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_permit_compact,0};
2233 PyObject* values[2] = {0,0};
2234 values[1] = ((PyObject *)Py_False);
2235 if (unlikely(__pyx_kwds)) {
2236 Py_ssize_t kw_args;
2237 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2238 switch (pos_args) {
2239 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2240 CYTHON_FALLTHROUGH;
2241 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2242 CYTHON_FALLTHROUGH;
2243 case 0: break;
2244 default: goto __pyx_L5_argtuple_error;
2245 }
2246 kw_args = PyDict_Size(__pyx_kwds);
2247 switch (pos_args) {
2248 case 0:
2249 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
2250 else goto __pyx_L5_argtuple_error;
2251 CYTHON_FALLTHROUGH;
2252 case 1:
2253 if (kw_args > 0) {
2254 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_permit_compact);
2255 if (value) { values[1] = value; kw_args--; }
2256 }
2257 }
2258 if (unlikely(kw_args > 0)) {
2259 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) __PYX_ERR(0, 112, __pyx_L3_error)
2260 }
2261 } else {
2262 switch (PyTuple_GET_SIZE(__pyx_args)) {
2263 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2264 CYTHON_FALLTHROUGH;
2265 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2266 break;
2267 default: goto __pyx_L5_argtuple_error;
2268 }
2269 }
2270 __pyx_v_path = values[0];
2271 __pyx_v_permit_compact = values[1];
2272 }
2273 goto __pyx_L4_argument_unpacking_done;
2274 __pyx_L5_argtuple_error:;
2275 __Pyx_RaiseArgtupleInvalid("read", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 112, __pyx_L3_error)
2276 __pyx_L3_error:;
2277 __Pyx_AddTraceback("borg.hashindex.IndexBase.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
2278 __Pyx_RefNannyFinishContext();
2279 return NULL;
2280 __pyx_L4_argument_unpacking_done:;
2281 __pyx_r = __pyx_pf_4borg_9hashindex_9IndexBase_4read(((PyTypeObject*)__pyx_v_cls), __pyx_v_path, __pyx_v_permit_compact);
2282
2283 /* function exit code */
2284 __Pyx_RefNannyFinishContext();
2285 return __pyx_r;
2286 }
2287
__pyx_pf_4borg_9hashindex_9IndexBase_4read(PyTypeObject * __pyx_v_cls,PyObject * __pyx_v_path,PyObject * __pyx_v_permit_compact)2288 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_4read(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_path, PyObject *__pyx_v_permit_compact) {
2289 PyObject *__pyx_r = NULL;
2290 __Pyx_RefNannyDeclarations
2291 PyObject *__pyx_t_1 = NULL;
2292 PyObject *__pyx_t_2 = NULL;
2293 int __pyx_lineno = 0;
2294 const char *__pyx_filename = NULL;
2295 int __pyx_clineno = 0;
2296 __Pyx_RefNannySetupContext("read", 0);
2297
2298 /* "borg/hashindex.pyx":113
2299 * @classmethod
2300 * def read(cls, path, permit_compact=False):
2301 * return cls(path=path, permit_compact=permit_compact) # <<<<<<<<<<<<<<
2302 *
2303 * def write(self, path):
2304 */
2305 __Pyx_XDECREF(__pyx_r);
2306 __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
2307 __Pyx_GOTREF(__pyx_t_1);
2308 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_path, __pyx_v_path) < 0) __PYX_ERR(0, 113, __pyx_L1_error)
2309 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_permit_compact, __pyx_v_permit_compact) < 0) __PYX_ERR(0, 113, __pyx_L1_error)
2310 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_cls), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
2311 __Pyx_GOTREF(__pyx_t_2);
2312 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2313 __pyx_r = __pyx_t_2;
2314 __pyx_t_2 = 0;
2315 goto __pyx_L0;
2316
2317 /* "borg/hashindex.pyx":112
2318 *
2319 * @classmethod
2320 * def read(cls, path, permit_compact=False): # <<<<<<<<<<<<<<
2321 * return cls(path=path, permit_compact=permit_compact)
2322 *
2323 */
2324
2325 /* function exit code */
2326 __pyx_L1_error:;
2327 __Pyx_XDECREF(__pyx_t_1);
2328 __Pyx_XDECREF(__pyx_t_2);
2329 __Pyx_AddTraceback("borg.hashindex.IndexBase.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
2330 __pyx_r = NULL;
2331 __pyx_L0:;
2332 __Pyx_XGIVEREF(__pyx_r);
2333 __Pyx_RefNannyFinishContext();
2334 return __pyx_r;
2335 }
2336
2337 /* "borg/hashindex.pyx":115
2338 * return cls(path=path, permit_compact=permit_compact)
2339 *
2340 * def write(self, path): # <<<<<<<<<<<<<<
2341 * if isinstance(path, (str, bytes)):
2342 * with open(path, 'wb') as fd:
2343 */
2344
2345 /* Python wrapper */
2346 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_7write(PyObject *__pyx_v_self, PyObject *__pyx_v_path); /*proto*/
__pyx_pw_4borg_9hashindex_9IndexBase_7write(PyObject * __pyx_v_self,PyObject * __pyx_v_path)2347 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_7write(PyObject *__pyx_v_self, PyObject *__pyx_v_path) {
2348 PyObject *__pyx_r = 0;
2349 __Pyx_RefNannyDeclarations
2350 __Pyx_RefNannySetupContext("write (wrapper)", 0);
2351 __pyx_r = __pyx_pf_4borg_9hashindex_9IndexBase_6write(((struct __pyx_obj_4borg_9hashindex_IndexBase *)__pyx_v_self), ((PyObject *)__pyx_v_path));
2352
2353 /* function exit code */
2354 __Pyx_RefNannyFinishContext();
2355 return __pyx_r;
2356 }
2357
__pyx_pf_4borg_9hashindex_9IndexBase_6write(struct __pyx_obj_4borg_9hashindex_IndexBase * __pyx_v_self,PyObject * __pyx_v_path)2358 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_6write(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self, PyObject *__pyx_v_path) {
2359 PyObject *__pyx_v_fd = NULL;
2360 PyObject *__pyx_r = NULL;
2361 __Pyx_RefNannyDeclarations
2362 int __pyx_t_1;
2363 int __pyx_t_2;
2364 int __pyx_t_3;
2365 PyObject *__pyx_t_4 = NULL;
2366 PyObject *__pyx_t_5 = NULL;
2367 PyObject *__pyx_t_6 = NULL;
2368 PyObject *__pyx_t_7 = NULL;
2369 PyObject *__pyx_t_8 = NULL;
2370 PyObject *__pyx_t_9 = NULL;
2371 PyObject *__pyx_t_10 = NULL;
2372 PyObject *__pyx_t_11 = NULL;
2373 PyObject *__pyx_t_12 = NULL;
2374 int __pyx_lineno = 0;
2375 const char *__pyx_filename = NULL;
2376 int __pyx_clineno = 0;
2377 __Pyx_RefNannySetupContext("write", 0);
2378
2379 /* "borg/hashindex.pyx":116
2380 *
2381 * def write(self, path):
2382 * if isinstance(path, (str, bytes)): # <<<<<<<<<<<<<<
2383 * with open(path, 'wb') as fd:
2384 * hashindex_write(self.index, fd)
2385 */
2386 __pyx_t_2 = PyUnicode_Check(__pyx_v_path);
2387 __pyx_t_3 = (__pyx_t_2 != 0);
2388 if (!__pyx_t_3) {
2389 } else {
2390 __pyx_t_1 = __pyx_t_3;
2391 goto __pyx_L4_bool_binop_done;
2392 }
2393 __pyx_t_3 = PyBytes_Check(__pyx_v_path);
2394 __pyx_t_2 = (__pyx_t_3 != 0);
2395 __pyx_t_1 = __pyx_t_2;
2396 __pyx_L4_bool_binop_done:;
2397 __pyx_t_2 = (__pyx_t_1 != 0);
2398 if (__pyx_t_2) {
2399
2400 /* "borg/hashindex.pyx":117
2401 * def write(self, path):
2402 * if isinstance(path, (str, bytes)):
2403 * with open(path, 'wb') as fd: # <<<<<<<<<<<<<<
2404 * hashindex_write(self.index, fd)
2405 * else:
2406 */
2407 /*with:*/ {
2408 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error)
2409 __Pyx_GOTREF(__pyx_t_4);
2410 __Pyx_INCREF(__pyx_v_path);
2411 __Pyx_GIVEREF(__pyx_v_path);
2412 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_path);
2413 __Pyx_INCREF(__pyx_n_u_wb);
2414 __Pyx_GIVEREF(__pyx_n_u_wb);
2415 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_u_wb);
2416 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 117, __pyx_L1_error)
2417 __Pyx_GOTREF(__pyx_t_5);
2418 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2419 __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_5, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 117, __pyx_L1_error)
2420 __Pyx_GOTREF(__pyx_t_6);
2421 __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_5, __pyx_n_s_enter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 117, __pyx_L6_error)
2422 __Pyx_GOTREF(__pyx_t_7);
2423 __pyx_t_8 = NULL;
2424 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
2425 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
2426 if (likely(__pyx_t_8)) {
2427 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
2428 __Pyx_INCREF(__pyx_t_8);
2429 __Pyx_INCREF(function);
2430 __Pyx_DECREF_SET(__pyx_t_7, function);
2431 }
2432 }
2433 __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
2434 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2435 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L6_error)
2436 __Pyx_GOTREF(__pyx_t_4);
2437 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2438 __pyx_t_7 = __pyx_t_4;
2439 __pyx_t_4 = 0;
2440 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2441 /*try:*/ {
2442 {
2443 __Pyx_PyThreadState_declare
2444 __Pyx_PyThreadState_assign
2445 __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
2446 __Pyx_XGOTREF(__pyx_t_9);
2447 __Pyx_XGOTREF(__pyx_t_10);
2448 __Pyx_XGOTREF(__pyx_t_11);
2449 /*try:*/ {
2450 __pyx_v_fd = __pyx_t_7;
2451 __pyx_t_7 = 0;
2452
2453 /* "borg/hashindex.pyx":118
2454 * if isinstance(path, (str, bytes)):
2455 * with open(path, 'wb') as fd:
2456 * hashindex_write(self.index, fd) # <<<<<<<<<<<<<<
2457 * else:
2458 * hashindex_write(self.index, path)
2459 */
2460 hashindex_write(__pyx_v_self->index, __pyx_v_fd); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L10_error)
2461
2462 /* "borg/hashindex.pyx":117
2463 * def write(self, path):
2464 * if isinstance(path, (str, bytes)):
2465 * with open(path, 'wb') as fd: # <<<<<<<<<<<<<<
2466 * hashindex_write(self.index, fd)
2467 * else:
2468 */
2469 }
2470 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
2471 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
2472 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
2473 goto __pyx_L15_try_end;
2474 __pyx_L10_error:;
2475 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2476 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2477 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2478 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2479 /*except:*/ {
2480 __Pyx_AddTraceback("borg.hashindex.IndexBase.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
2481 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 117, __pyx_L12_except_error)
2482 __Pyx_GOTREF(__pyx_t_7);
2483 __Pyx_GOTREF(__pyx_t_5);
2484 __Pyx_GOTREF(__pyx_t_4);
2485 __pyx_t_8 = PyTuple_Pack(3, __pyx_t_7, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 117, __pyx_L12_except_error)
2486 __Pyx_GOTREF(__pyx_t_8);
2487 __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL);
2488 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2489 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2490 if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 117, __pyx_L12_except_error)
2491 __Pyx_GOTREF(__pyx_t_12);
2492 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_12);
2493 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
2494 if (__pyx_t_2 < 0) __PYX_ERR(0, 117, __pyx_L12_except_error)
2495 __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
2496 if (__pyx_t_1) {
2497 __Pyx_GIVEREF(__pyx_t_7);
2498 __Pyx_GIVEREF(__pyx_t_5);
2499 __Pyx_XGIVEREF(__pyx_t_4);
2500 __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_5, __pyx_t_4);
2501 __pyx_t_7 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0;
2502 __PYX_ERR(0, 117, __pyx_L12_except_error)
2503 }
2504 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2505 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2506 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2507 goto __pyx_L11_exception_handled;
2508 }
2509 __pyx_L12_except_error:;
2510 __Pyx_XGIVEREF(__pyx_t_9);
2511 __Pyx_XGIVEREF(__pyx_t_10);
2512 __Pyx_XGIVEREF(__pyx_t_11);
2513 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
2514 goto __pyx_L1_error;
2515 __pyx_L11_exception_handled:;
2516 __Pyx_XGIVEREF(__pyx_t_9);
2517 __Pyx_XGIVEREF(__pyx_t_10);
2518 __Pyx_XGIVEREF(__pyx_t_11);
2519 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
2520 __pyx_L15_try_end:;
2521 }
2522 }
2523 /*finally:*/ {
2524 /*normal exit:*/{
2525 if (__pyx_t_6) {
2526 __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple_, NULL);
2527 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2528 if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 117, __pyx_L1_error)
2529 __Pyx_GOTREF(__pyx_t_11);
2530 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
2531 }
2532 goto __pyx_L9;
2533 }
2534 __pyx_L9:;
2535 }
2536 goto __pyx_L19;
2537 __pyx_L6_error:;
2538 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2539 goto __pyx_L1_error;
2540 __pyx_L19:;
2541 }
2542
2543 /* "borg/hashindex.pyx":116
2544 *
2545 * def write(self, path):
2546 * if isinstance(path, (str, bytes)): # <<<<<<<<<<<<<<
2547 * with open(path, 'wb') as fd:
2548 * hashindex_write(self.index, fd)
2549 */
2550 goto __pyx_L3;
2551 }
2552
2553 /* "borg/hashindex.pyx":120
2554 * hashindex_write(self.index, fd)
2555 * else:
2556 * hashindex_write(self.index, path) # <<<<<<<<<<<<<<
2557 *
2558 * def clear(self):
2559 */
2560 /*else*/ {
2561 hashindex_write(__pyx_v_self->index, __pyx_v_path); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L1_error)
2562 }
2563 __pyx_L3:;
2564
2565 /* "borg/hashindex.pyx":115
2566 * return cls(path=path, permit_compact=permit_compact)
2567 *
2568 * def write(self, path): # <<<<<<<<<<<<<<
2569 * if isinstance(path, (str, bytes)):
2570 * with open(path, 'wb') as fd:
2571 */
2572
2573 /* function exit code */
2574 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2575 goto __pyx_L0;
2576 __pyx_L1_error:;
2577 __Pyx_XDECREF(__pyx_t_4);
2578 __Pyx_XDECREF(__pyx_t_5);
2579 __Pyx_XDECREF(__pyx_t_7);
2580 __Pyx_XDECREF(__pyx_t_8);
2581 __Pyx_AddTraceback("borg.hashindex.IndexBase.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
2582 __pyx_r = NULL;
2583 __pyx_L0:;
2584 __Pyx_XDECREF(__pyx_v_fd);
2585 __Pyx_XGIVEREF(__pyx_r);
2586 __Pyx_RefNannyFinishContext();
2587 return __pyx_r;
2588 }
2589
2590 /* "borg/hashindex.pyx":122
2591 * hashindex_write(self.index, path)
2592 *
2593 * def clear(self): # <<<<<<<<<<<<<<
2594 * hashindex_free(self.index)
2595 * self.index = hashindex_init(0, self.key_size, self.value_size)
2596 */
2597
2598 /* Python wrapper */
2599 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_9clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4borg_9hashindex_9IndexBase_9clear(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)2600 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_9clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2601 PyObject *__pyx_r = 0;
2602 __Pyx_RefNannyDeclarations
2603 __Pyx_RefNannySetupContext("clear (wrapper)", 0);
2604 __pyx_r = __pyx_pf_4borg_9hashindex_9IndexBase_8clear(((struct __pyx_obj_4borg_9hashindex_IndexBase *)__pyx_v_self));
2605
2606 /* function exit code */
2607 __Pyx_RefNannyFinishContext();
2608 return __pyx_r;
2609 }
2610
__pyx_pf_4borg_9hashindex_9IndexBase_8clear(struct __pyx_obj_4borg_9hashindex_IndexBase * __pyx_v_self)2611 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_8clear(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self) {
2612 PyObject *__pyx_r = NULL;
2613 __Pyx_RefNannyDeclarations
2614 PyObject *__pyx_t_1 = NULL;
2615 int __pyx_t_2;
2616 int __pyx_t_3;
2617 int __pyx_lineno = 0;
2618 const char *__pyx_filename = NULL;
2619 int __pyx_clineno = 0;
2620 __Pyx_RefNannySetupContext("clear", 0);
2621
2622 /* "borg/hashindex.pyx":123
2623 *
2624 * def clear(self):
2625 * hashindex_free(self.index) # <<<<<<<<<<<<<<
2626 * self.index = hashindex_init(0, self.key_size, self.value_size)
2627 * if not self.index:
2628 */
2629 hashindex_free(__pyx_v_self->index);
2630
2631 /* "borg/hashindex.pyx":124
2632 * def clear(self):
2633 * hashindex_free(self.index)
2634 * self.index = hashindex_init(0, self.key_size, self.value_size) # <<<<<<<<<<<<<<
2635 * if not self.index:
2636 * raise Exception('hashindex_init failed')
2637 */
2638 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_value_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
2639 __Pyx_GOTREF(__pyx_t_1);
2640 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 124, __pyx_L1_error)
2641 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2642 __pyx_v_self->index = hashindex_init(0, __pyx_v_self->key_size, __pyx_t_2);
2643
2644 /* "borg/hashindex.pyx":125
2645 * hashindex_free(self.index)
2646 * self.index = hashindex_init(0, self.key_size, self.value_size)
2647 * if not self.index: # <<<<<<<<<<<<<<
2648 * raise Exception('hashindex_init failed')
2649 *
2650 */
2651 __pyx_t_3 = ((!(__pyx_v_self->index != 0)) != 0);
2652 if (unlikely(__pyx_t_3)) {
2653
2654 /* "borg/hashindex.pyx":126
2655 * self.index = hashindex_init(0, self.key_size, self.value_size)
2656 * if not self.index:
2657 * raise Exception('hashindex_init failed') # <<<<<<<<<<<<<<
2658 *
2659 * def setdefault(self, key, value):
2660 */
2661 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
2662 __Pyx_GOTREF(__pyx_t_1);
2663 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
2664 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2665 __PYX_ERR(0, 126, __pyx_L1_error)
2666
2667 /* "borg/hashindex.pyx":125
2668 * hashindex_free(self.index)
2669 * self.index = hashindex_init(0, self.key_size, self.value_size)
2670 * if not self.index: # <<<<<<<<<<<<<<
2671 * raise Exception('hashindex_init failed')
2672 *
2673 */
2674 }
2675
2676 /* "borg/hashindex.pyx":122
2677 * hashindex_write(self.index, path)
2678 *
2679 * def clear(self): # <<<<<<<<<<<<<<
2680 * hashindex_free(self.index)
2681 * self.index = hashindex_init(0, self.key_size, self.value_size)
2682 */
2683
2684 /* function exit code */
2685 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2686 goto __pyx_L0;
2687 __pyx_L1_error:;
2688 __Pyx_XDECREF(__pyx_t_1);
2689 __Pyx_AddTraceback("borg.hashindex.IndexBase.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
2690 __pyx_r = NULL;
2691 __pyx_L0:;
2692 __Pyx_XGIVEREF(__pyx_r);
2693 __Pyx_RefNannyFinishContext();
2694 return __pyx_r;
2695 }
2696
2697 /* "borg/hashindex.pyx":128
2698 * raise Exception('hashindex_init failed')
2699 *
2700 * def setdefault(self, key, value): # <<<<<<<<<<<<<<
2701 * if not key in self:
2702 * self[key] = value
2703 */
2704
2705 /* Python wrapper */
2706 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_11setdefault(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4borg_9hashindex_9IndexBase_11setdefault(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2707 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_11setdefault(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2708 PyObject *__pyx_v_key = 0;
2709 PyObject *__pyx_v_value = 0;
2710 int __pyx_lineno = 0;
2711 const char *__pyx_filename = NULL;
2712 int __pyx_clineno = 0;
2713 PyObject *__pyx_r = 0;
2714 __Pyx_RefNannyDeclarations
2715 __Pyx_RefNannySetupContext("setdefault (wrapper)", 0);
2716 {
2717 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_value,0};
2718 PyObject* values[2] = {0,0};
2719 if (unlikely(__pyx_kwds)) {
2720 Py_ssize_t kw_args;
2721 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2722 switch (pos_args) {
2723 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2724 CYTHON_FALLTHROUGH;
2725 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2726 CYTHON_FALLTHROUGH;
2727 case 0: break;
2728 default: goto __pyx_L5_argtuple_error;
2729 }
2730 kw_args = PyDict_Size(__pyx_kwds);
2731 switch (pos_args) {
2732 case 0:
2733 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
2734 else goto __pyx_L5_argtuple_error;
2735 CYTHON_FALLTHROUGH;
2736 case 1:
2737 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
2738 else {
2739 __Pyx_RaiseArgtupleInvalid("setdefault", 1, 2, 2, 1); __PYX_ERR(0, 128, __pyx_L3_error)
2740 }
2741 }
2742 if (unlikely(kw_args > 0)) {
2743 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setdefault") < 0)) __PYX_ERR(0, 128, __pyx_L3_error)
2744 }
2745 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2746 goto __pyx_L5_argtuple_error;
2747 } else {
2748 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2749 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2750 }
2751 __pyx_v_key = values[0];
2752 __pyx_v_value = values[1];
2753 }
2754 goto __pyx_L4_argument_unpacking_done;
2755 __pyx_L5_argtuple_error:;
2756 __Pyx_RaiseArgtupleInvalid("setdefault", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 128, __pyx_L3_error)
2757 __pyx_L3_error:;
2758 __Pyx_AddTraceback("borg.hashindex.IndexBase.setdefault", __pyx_clineno, __pyx_lineno, __pyx_filename);
2759 __Pyx_RefNannyFinishContext();
2760 return NULL;
2761 __pyx_L4_argument_unpacking_done:;
2762 __pyx_r = __pyx_pf_4borg_9hashindex_9IndexBase_10setdefault(((struct __pyx_obj_4borg_9hashindex_IndexBase *)__pyx_v_self), __pyx_v_key, __pyx_v_value);
2763
2764 /* function exit code */
2765 __Pyx_RefNannyFinishContext();
2766 return __pyx_r;
2767 }
2768
__pyx_pf_4borg_9hashindex_9IndexBase_10setdefault(struct __pyx_obj_4borg_9hashindex_IndexBase * __pyx_v_self,PyObject * __pyx_v_key,PyObject * __pyx_v_value)2769 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_10setdefault(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
2770 PyObject *__pyx_r = NULL;
2771 __Pyx_RefNannyDeclarations
2772 int __pyx_t_1;
2773 int __pyx_t_2;
2774 int __pyx_lineno = 0;
2775 const char *__pyx_filename = NULL;
2776 int __pyx_clineno = 0;
2777 __Pyx_RefNannySetupContext("setdefault", 0);
2778
2779 /* "borg/hashindex.pyx":129
2780 *
2781 * def setdefault(self, key, value):
2782 * if not key in self: # <<<<<<<<<<<<<<
2783 * self[key] = value
2784 *
2785 */
2786 __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, ((PyObject *)__pyx_v_self), Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 129, __pyx_L1_error)
2787 __pyx_t_2 = (__pyx_t_1 != 0);
2788 if (__pyx_t_2) {
2789
2790 /* "borg/hashindex.pyx":130
2791 * def setdefault(self, key, value):
2792 * if not key in self:
2793 * self[key] = value # <<<<<<<<<<<<<<
2794 *
2795 * def __delitem__(self, key):
2796 */
2797 if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_key, __pyx_v_value) < 0)) __PYX_ERR(0, 130, __pyx_L1_error)
2798
2799 /* "borg/hashindex.pyx":129
2800 *
2801 * def setdefault(self, key, value):
2802 * if not key in self: # <<<<<<<<<<<<<<
2803 * self[key] = value
2804 *
2805 */
2806 }
2807
2808 /* "borg/hashindex.pyx":128
2809 * raise Exception('hashindex_init failed')
2810 *
2811 * def setdefault(self, key, value): # <<<<<<<<<<<<<<
2812 * if not key in self:
2813 * self[key] = value
2814 */
2815
2816 /* function exit code */
2817 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2818 goto __pyx_L0;
2819 __pyx_L1_error:;
2820 __Pyx_AddTraceback("borg.hashindex.IndexBase.setdefault", __pyx_clineno, __pyx_lineno, __pyx_filename);
2821 __pyx_r = NULL;
2822 __pyx_L0:;
2823 __Pyx_XGIVEREF(__pyx_r);
2824 __Pyx_RefNannyFinishContext();
2825 return __pyx_r;
2826 }
2827
2828 /* "borg/hashindex.pyx":132
2829 * self[key] = value
2830 *
2831 * def __delitem__(self, key): # <<<<<<<<<<<<<<
2832 * assert len(key) == self.key_size
2833 * rc = hashindex_delete(self.index, <char *>key)
2834 */
2835
2836 /* Python wrapper */
2837 static int __pyx_pw_4borg_9hashindex_9IndexBase_13__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
__pyx_pw_4borg_9hashindex_9IndexBase_13__delitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_key)2838 static int __pyx_pw_4borg_9hashindex_9IndexBase_13__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
2839 int __pyx_r;
2840 __Pyx_RefNannyDeclarations
2841 __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
2842 __pyx_r = __pyx_pf_4borg_9hashindex_9IndexBase_12__delitem__(((struct __pyx_obj_4borg_9hashindex_IndexBase *)__pyx_v_self), ((PyObject *)__pyx_v_key));
2843
2844 /* function exit code */
2845 __Pyx_RefNannyFinishContext();
2846 return __pyx_r;
2847 }
2848
__pyx_pf_4borg_9hashindex_9IndexBase_12__delitem__(struct __pyx_obj_4borg_9hashindex_IndexBase * __pyx_v_self,PyObject * __pyx_v_key)2849 static int __pyx_pf_4borg_9hashindex_9IndexBase_12__delitem__(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self, PyObject *__pyx_v_key) {
2850 int __pyx_v_rc;
2851 int __pyx_r;
2852 __Pyx_RefNannyDeclarations
2853 Py_ssize_t __pyx_t_1;
2854 char *__pyx_t_2;
2855 int __pyx_t_3;
2856 PyObject *__pyx_t_4 = NULL;
2857 int __pyx_lineno = 0;
2858 const char *__pyx_filename = NULL;
2859 int __pyx_clineno = 0;
2860 __Pyx_RefNannySetupContext("__delitem__", 0);
2861
2862 /* "borg/hashindex.pyx":133
2863 *
2864 * def __delitem__(self, key):
2865 * assert len(key) == self.key_size # <<<<<<<<<<<<<<
2866 * rc = hashindex_delete(self.index, <char *>key)
2867 * if rc == 1:
2868 */
2869 #ifndef CYTHON_WITHOUT_ASSERTIONS
2870 if (unlikely(!Py_OptimizeFlag)) {
2871 __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 133, __pyx_L1_error)
2872 if (unlikely(!((__pyx_t_1 == __pyx_v_self->key_size) != 0))) {
2873 PyErr_SetNone(PyExc_AssertionError);
2874 __PYX_ERR(0, 133, __pyx_L1_error)
2875 }
2876 }
2877 #endif
2878
2879 /* "borg/hashindex.pyx":134
2880 * def __delitem__(self, key):
2881 * assert len(key) == self.key_size
2882 * rc = hashindex_delete(self.index, <char *>key) # <<<<<<<<<<<<<<
2883 * if rc == 1:
2884 * return # success
2885 */
2886 __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L1_error)
2887 __pyx_v_rc = hashindex_delete(__pyx_v_self->index, ((char *)__pyx_t_2));
2888
2889 /* "borg/hashindex.pyx":135
2890 * assert len(key) == self.key_size
2891 * rc = hashindex_delete(self.index, <char *>key)
2892 * if rc == 1: # <<<<<<<<<<<<<<
2893 * return # success
2894 * if rc == -1:
2895 */
2896 __pyx_t_3 = ((__pyx_v_rc == 1) != 0);
2897 if (__pyx_t_3) {
2898
2899 /* "borg/hashindex.pyx":136
2900 * rc = hashindex_delete(self.index, <char *>key)
2901 * if rc == 1:
2902 * return # success # <<<<<<<<<<<<<<
2903 * if rc == -1:
2904 * raise KeyError(key)
2905 */
2906 __pyx_r = 0;
2907 goto __pyx_L0;
2908
2909 /* "borg/hashindex.pyx":135
2910 * assert len(key) == self.key_size
2911 * rc = hashindex_delete(self.index, <char *>key)
2912 * if rc == 1: # <<<<<<<<<<<<<<
2913 * return # success
2914 * if rc == -1:
2915 */
2916 }
2917
2918 /* "borg/hashindex.pyx":137
2919 * if rc == 1:
2920 * return # success
2921 * if rc == -1: # <<<<<<<<<<<<<<
2922 * raise KeyError(key)
2923 * if rc == 0:
2924 */
2925 __pyx_t_3 = ((__pyx_v_rc == -1L) != 0);
2926 if (unlikely(__pyx_t_3)) {
2927
2928 /* "borg/hashindex.pyx":138
2929 * return # success
2930 * if rc == -1:
2931 * raise KeyError(key) # <<<<<<<<<<<<<<
2932 * if rc == 0:
2933 * raise Exception('hashindex_delete failed')
2934 */
2935 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error)
2936 __Pyx_GOTREF(__pyx_t_4);
2937 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
2938 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2939 __PYX_ERR(0, 138, __pyx_L1_error)
2940
2941 /* "borg/hashindex.pyx":137
2942 * if rc == 1:
2943 * return # success
2944 * if rc == -1: # <<<<<<<<<<<<<<
2945 * raise KeyError(key)
2946 * if rc == 0:
2947 */
2948 }
2949
2950 /* "borg/hashindex.pyx":139
2951 * if rc == -1:
2952 * raise KeyError(key)
2953 * if rc == 0: # <<<<<<<<<<<<<<
2954 * raise Exception('hashindex_delete failed')
2955 *
2956 */
2957 __pyx_t_3 = ((__pyx_v_rc == 0) != 0);
2958 if (unlikely(__pyx_t_3)) {
2959
2960 /* "borg/hashindex.pyx":140
2961 * raise KeyError(key)
2962 * if rc == 0:
2963 * raise Exception('hashindex_delete failed') # <<<<<<<<<<<<<<
2964 *
2965 * def get(self, key, default=None):
2966 */
2967 __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 140, __pyx_L1_error)
2968 __Pyx_GOTREF(__pyx_t_4);
2969 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
2970 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2971 __PYX_ERR(0, 140, __pyx_L1_error)
2972
2973 /* "borg/hashindex.pyx":139
2974 * if rc == -1:
2975 * raise KeyError(key)
2976 * if rc == 0: # <<<<<<<<<<<<<<
2977 * raise Exception('hashindex_delete failed')
2978 *
2979 */
2980 }
2981
2982 /* "borg/hashindex.pyx":132
2983 * self[key] = value
2984 *
2985 * def __delitem__(self, key): # <<<<<<<<<<<<<<
2986 * assert len(key) == self.key_size
2987 * rc = hashindex_delete(self.index, <char *>key)
2988 */
2989
2990 /* function exit code */
2991 __pyx_r = 0;
2992 goto __pyx_L0;
2993 __pyx_L1_error:;
2994 __Pyx_XDECREF(__pyx_t_4);
2995 __Pyx_AddTraceback("borg.hashindex.IndexBase.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2996 __pyx_r = -1;
2997 __pyx_L0:;
2998 __Pyx_RefNannyFinishContext();
2999 return __pyx_r;
3000 }
3001
3002 /* "borg/hashindex.pyx":142
3003 * raise Exception('hashindex_delete failed')
3004 *
3005 * def get(self, key, default=None): # <<<<<<<<<<<<<<
3006 * try:
3007 * return self[key]
3008 */
3009
3010 /* Python wrapper */
3011 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_15get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4borg_9hashindex_9IndexBase_15get(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3012 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_15get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3013 PyObject *__pyx_v_key = 0;
3014 PyObject *__pyx_v_default = 0;
3015 int __pyx_lineno = 0;
3016 const char *__pyx_filename = NULL;
3017 int __pyx_clineno = 0;
3018 PyObject *__pyx_r = 0;
3019 __Pyx_RefNannyDeclarations
3020 __Pyx_RefNannySetupContext("get (wrapper)", 0);
3021 {
3022 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
3023 PyObject* values[2] = {0,0};
3024 values[1] = ((PyObject *)Py_None);
3025 if (unlikely(__pyx_kwds)) {
3026 Py_ssize_t kw_args;
3027 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3028 switch (pos_args) {
3029 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3030 CYTHON_FALLTHROUGH;
3031 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3032 CYTHON_FALLTHROUGH;
3033 case 0: break;
3034 default: goto __pyx_L5_argtuple_error;
3035 }
3036 kw_args = PyDict_Size(__pyx_kwds);
3037 switch (pos_args) {
3038 case 0:
3039 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
3040 else goto __pyx_L5_argtuple_error;
3041 CYTHON_FALLTHROUGH;
3042 case 1:
3043 if (kw_args > 0) {
3044 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_default);
3045 if (value) { values[1] = value; kw_args--; }
3046 }
3047 }
3048 if (unlikely(kw_args > 0)) {
3049 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) __PYX_ERR(0, 142, __pyx_L3_error)
3050 }
3051 } else {
3052 switch (PyTuple_GET_SIZE(__pyx_args)) {
3053 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3054 CYTHON_FALLTHROUGH;
3055 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3056 break;
3057 default: goto __pyx_L5_argtuple_error;
3058 }
3059 }
3060 __pyx_v_key = values[0];
3061 __pyx_v_default = values[1];
3062 }
3063 goto __pyx_L4_argument_unpacking_done;
3064 __pyx_L5_argtuple_error:;
3065 __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 142, __pyx_L3_error)
3066 __pyx_L3_error:;
3067 __Pyx_AddTraceback("borg.hashindex.IndexBase.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
3068 __Pyx_RefNannyFinishContext();
3069 return NULL;
3070 __pyx_L4_argument_unpacking_done:;
3071 __pyx_r = __pyx_pf_4borg_9hashindex_9IndexBase_14get(((struct __pyx_obj_4borg_9hashindex_IndexBase *)__pyx_v_self), __pyx_v_key, __pyx_v_default);
3072
3073 /* function exit code */
3074 __Pyx_RefNannyFinishContext();
3075 return __pyx_r;
3076 }
3077
__pyx_pf_4borg_9hashindex_9IndexBase_14get(struct __pyx_obj_4borg_9hashindex_IndexBase * __pyx_v_self,PyObject * __pyx_v_key,PyObject * __pyx_v_default)3078 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_14get(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
3079 PyObject *__pyx_r = NULL;
3080 __Pyx_RefNannyDeclarations
3081 PyObject *__pyx_t_1 = NULL;
3082 PyObject *__pyx_t_2 = NULL;
3083 PyObject *__pyx_t_3 = NULL;
3084 PyObject *__pyx_t_4 = NULL;
3085 int __pyx_t_5;
3086 PyObject *__pyx_t_6 = NULL;
3087 PyObject *__pyx_t_7 = NULL;
3088 int __pyx_lineno = 0;
3089 const char *__pyx_filename = NULL;
3090 int __pyx_clineno = 0;
3091 __Pyx_RefNannySetupContext("get", 0);
3092
3093 /* "borg/hashindex.pyx":143
3094 *
3095 * def get(self, key, default=None):
3096 * try: # <<<<<<<<<<<<<<
3097 * return self[key]
3098 * except KeyError:
3099 */
3100 {
3101 __Pyx_PyThreadState_declare
3102 __Pyx_PyThreadState_assign
3103 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
3104 __Pyx_XGOTREF(__pyx_t_1);
3105 __Pyx_XGOTREF(__pyx_t_2);
3106 __Pyx_XGOTREF(__pyx_t_3);
3107 /*try:*/ {
3108
3109 /* "borg/hashindex.pyx":144
3110 * def get(self, key, default=None):
3111 * try:
3112 * return self[key] # <<<<<<<<<<<<<<
3113 * except KeyError:
3114 * return default
3115 */
3116 __Pyx_XDECREF(__pyx_r);
3117 __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 144, __pyx_L3_error)
3118 __Pyx_GOTREF(__pyx_t_4);
3119 __pyx_r = __pyx_t_4;
3120 __pyx_t_4 = 0;
3121 goto __pyx_L7_try_return;
3122
3123 /* "borg/hashindex.pyx":143
3124 *
3125 * def get(self, key, default=None):
3126 * try: # <<<<<<<<<<<<<<
3127 * return self[key]
3128 * except KeyError:
3129 */
3130 }
3131 __pyx_L3_error:;
3132 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3133
3134 /* "borg/hashindex.pyx":145
3135 * try:
3136 * return self[key]
3137 * except KeyError: # <<<<<<<<<<<<<<
3138 * return default
3139 *
3140 */
3141 __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
3142 if (__pyx_t_5) {
3143 __Pyx_AddTraceback("borg.hashindex.IndexBase.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
3144 if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 145, __pyx_L5_except_error)
3145 __Pyx_GOTREF(__pyx_t_4);
3146 __Pyx_GOTREF(__pyx_t_6);
3147 __Pyx_GOTREF(__pyx_t_7);
3148
3149 /* "borg/hashindex.pyx":146
3150 * return self[key]
3151 * except KeyError:
3152 * return default # <<<<<<<<<<<<<<
3153 *
3154 * def pop(self, key, default=_NoDefault):
3155 */
3156 __Pyx_XDECREF(__pyx_r);
3157 __Pyx_INCREF(__pyx_v_default);
3158 __pyx_r = __pyx_v_default;
3159 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3160 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3161 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3162 goto __pyx_L6_except_return;
3163 }
3164 goto __pyx_L5_except_error;
3165 __pyx_L5_except_error:;
3166
3167 /* "borg/hashindex.pyx":143
3168 *
3169 * def get(self, key, default=None):
3170 * try: # <<<<<<<<<<<<<<
3171 * return self[key]
3172 * except KeyError:
3173 */
3174 __Pyx_XGIVEREF(__pyx_t_1);
3175 __Pyx_XGIVEREF(__pyx_t_2);
3176 __Pyx_XGIVEREF(__pyx_t_3);
3177 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
3178 goto __pyx_L1_error;
3179 __pyx_L7_try_return:;
3180 __Pyx_XGIVEREF(__pyx_t_1);
3181 __Pyx_XGIVEREF(__pyx_t_2);
3182 __Pyx_XGIVEREF(__pyx_t_3);
3183 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
3184 goto __pyx_L0;
3185 __pyx_L6_except_return:;
3186 __Pyx_XGIVEREF(__pyx_t_1);
3187 __Pyx_XGIVEREF(__pyx_t_2);
3188 __Pyx_XGIVEREF(__pyx_t_3);
3189 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
3190 goto __pyx_L0;
3191 }
3192
3193 /* "borg/hashindex.pyx":142
3194 * raise Exception('hashindex_delete failed')
3195 *
3196 * def get(self, key, default=None): # <<<<<<<<<<<<<<
3197 * try:
3198 * return self[key]
3199 */
3200
3201 /* function exit code */
3202 __pyx_L1_error:;
3203 __Pyx_XDECREF(__pyx_t_4);
3204 __Pyx_XDECREF(__pyx_t_6);
3205 __Pyx_XDECREF(__pyx_t_7);
3206 __Pyx_AddTraceback("borg.hashindex.IndexBase.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
3207 __pyx_r = NULL;
3208 __pyx_L0:;
3209 __Pyx_XGIVEREF(__pyx_r);
3210 __Pyx_RefNannyFinishContext();
3211 return __pyx_r;
3212 }
3213
3214 /* "borg/hashindex.pyx":148
3215 * return default
3216 *
3217 * def pop(self, key, default=_NoDefault): # <<<<<<<<<<<<<<
3218 * try:
3219 * value = self[key]
3220 */
3221
3222 /* Python wrapper */
3223 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_17pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4borg_9hashindex_9IndexBase_17pop(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3224 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_17pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3225 PyObject *__pyx_v_key = 0;
3226 PyObject *__pyx_v_default = 0;
3227 int __pyx_lineno = 0;
3228 const char *__pyx_filename = NULL;
3229 int __pyx_clineno = 0;
3230 PyObject *__pyx_r = 0;
3231 __Pyx_RefNannyDeclarations
3232 __Pyx_RefNannySetupContext("pop (wrapper)", 0);
3233 {
3234 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
3235 PyObject* values[2] = {0,0};
3236 values[1] = __pyx_k__4;
3237 if (unlikely(__pyx_kwds)) {
3238 Py_ssize_t kw_args;
3239 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3240 switch (pos_args) {
3241 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3242 CYTHON_FALLTHROUGH;
3243 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3244 CYTHON_FALLTHROUGH;
3245 case 0: break;
3246 default: goto __pyx_L5_argtuple_error;
3247 }
3248 kw_args = PyDict_Size(__pyx_kwds);
3249 switch (pos_args) {
3250 case 0:
3251 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
3252 else goto __pyx_L5_argtuple_error;
3253 CYTHON_FALLTHROUGH;
3254 case 1:
3255 if (kw_args > 0) {
3256 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_default);
3257 if (value) { values[1] = value; kw_args--; }
3258 }
3259 }
3260 if (unlikely(kw_args > 0)) {
3261 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pop") < 0)) __PYX_ERR(0, 148, __pyx_L3_error)
3262 }
3263 } else {
3264 switch (PyTuple_GET_SIZE(__pyx_args)) {
3265 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3266 CYTHON_FALLTHROUGH;
3267 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3268 break;
3269 default: goto __pyx_L5_argtuple_error;
3270 }
3271 }
3272 __pyx_v_key = values[0];
3273 __pyx_v_default = values[1];
3274 }
3275 goto __pyx_L4_argument_unpacking_done;
3276 __pyx_L5_argtuple_error:;
3277 __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 148, __pyx_L3_error)
3278 __pyx_L3_error:;
3279 __Pyx_AddTraceback("borg.hashindex.IndexBase.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
3280 __Pyx_RefNannyFinishContext();
3281 return NULL;
3282 __pyx_L4_argument_unpacking_done:;
3283 __pyx_r = __pyx_pf_4borg_9hashindex_9IndexBase_16pop(((struct __pyx_obj_4borg_9hashindex_IndexBase *)__pyx_v_self), __pyx_v_key, __pyx_v_default);
3284
3285 /* function exit code */
3286 __Pyx_RefNannyFinishContext();
3287 return __pyx_r;
3288 }
3289
__pyx_pf_4borg_9hashindex_9IndexBase_16pop(struct __pyx_obj_4borg_9hashindex_IndexBase * __pyx_v_self,PyObject * __pyx_v_key,PyObject * __pyx_v_default)3290 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_16pop(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
3291 PyObject *__pyx_v_value = NULL;
3292 PyObject *__pyx_r = NULL;
3293 __Pyx_RefNannyDeclarations
3294 PyObject *__pyx_t_1 = NULL;
3295 PyObject *__pyx_t_2 = NULL;
3296 PyObject *__pyx_t_3 = NULL;
3297 PyObject *__pyx_t_4 = NULL;
3298 int __pyx_t_5;
3299 PyObject *__pyx_t_6 = NULL;
3300 PyObject *__pyx_t_7 = NULL;
3301 PyObject *__pyx_t_8 = NULL;
3302 int __pyx_t_9;
3303 int __pyx_lineno = 0;
3304 const char *__pyx_filename = NULL;
3305 int __pyx_clineno = 0;
3306 __Pyx_RefNannySetupContext("pop", 0);
3307
3308 /* "borg/hashindex.pyx":149
3309 *
3310 * def pop(self, key, default=_NoDefault):
3311 * try: # <<<<<<<<<<<<<<
3312 * value = self[key]
3313 * del self[key]
3314 */
3315 {
3316 __Pyx_PyThreadState_declare
3317 __Pyx_PyThreadState_assign
3318 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
3319 __Pyx_XGOTREF(__pyx_t_1);
3320 __Pyx_XGOTREF(__pyx_t_2);
3321 __Pyx_XGOTREF(__pyx_t_3);
3322 /*try:*/ {
3323
3324 /* "borg/hashindex.pyx":150
3325 * def pop(self, key, default=_NoDefault):
3326 * try:
3327 * value = self[key] # <<<<<<<<<<<<<<
3328 * del self[key]
3329 * return value
3330 */
3331 __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L3_error)
3332 __Pyx_GOTREF(__pyx_t_4);
3333 __pyx_v_value = __pyx_t_4;
3334 __pyx_t_4 = 0;
3335
3336 /* "borg/hashindex.pyx":151
3337 * try:
3338 * value = self[key]
3339 * del self[key] # <<<<<<<<<<<<<<
3340 * return value
3341 * except KeyError:
3342 */
3343 if (unlikely(PyObject_DelItem(((PyObject *)__pyx_v_self), __pyx_v_key) < 0)) __PYX_ERR(0, 151, __pyx_L3_error)
3344
3345 /* "borg/hashindex.pyx":152
3346 * value = self[key]
3347 * del self[key]
3348 * return value # <<<<<<<<<<<<<<
3349 * except KeyError:
3350 * if default != _NoDefault:
3351 */
3352 __Pyx_XDECREF(__pyx_r);
3353 __Pyx_INCREF(__pyx_v_value);
3354 __pyx_r = __pyx_v_value;
3355 goto __pyx_L7_try_return;
3356
3357 /* "borg/hashindex.pyx":149
3358 *
3359 * def pop(self, key, default=_NoDefault):
3360 * try: # <<<<<<<<<<<<<<
3361 * value = self[key]
3362 * del self[key]
3363 */
3364 }
3365 __pyx_L3_error:;
3366 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3367
3368 /* "borg/hashindex.pyx":153
3369 * del self[key]
3370 * return value
3371 * except KeyError: # <<<<<<<<<<<<<<
3372 * if default != _NoDefault:
3373 * return default
3374 */
3375 __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
3376 if (__pyx_t_5) {
3377 __Pyx_AddTraceback("borg.hashindex.IndexBase.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
3378 if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 153, __pyx_L5_except_error)
3379 __Pyx_GOTREF(__pyx_t_4);
3380 __Pyx_GOTREF(__pyx_t_6);
3381 __Pyx_GOTREF(__pyx_t_7);
3382
3383 /* "borg/hashindex.pyx":154
3384 * return value
3385 * except KeyError:
3386 * if default != _NoDefault: # <<<<<<<<<<<<<<
3387 * return default
3388 * raise
3389 */
3390 __pyx_t_8 = PyObject_RichCompare(__pyx_v_default, __pyx_v_4borg_9hashindex__NoDefault, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 154, __pyx_L5_except_error)
3391 __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 154, __pyx_L5_except_error)
3392 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3393 if (__pyx_t_9) {
3394
3395 /* "borg/hashindex.pyx":155
3396 * except KeyError:
3397 * if default != _NoDefault:
3398 * return default # <<<<<<<<<<<<<<
3399 * raise
3400 *
3401 */
3402 __Pyx_XDECREF(__pyx_r);
3403 __Pyx_INCREF(__pyx_v_default);
3404 __pyx_r = __pyx_v_default;
3405 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3406 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3407 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3408 goto __pyx_L6_except_return;
3409
3410 /* "borg/hashindex.pyx":154
3411 * return value
3412 * except KeyError:
3413 * if default != _NoDefault: # <<<<<<<<<<<<<<
3414 * return default
3415 * raise
3416 */
3417 }
3418
3419 /* "borg/hashindex.pyx":156
3420 * if default != _NoDefault:
3421 * return default
3422 * raise # <<<<<<<<<<<<<<
3423 *
3424 * def __len__(self):
3425 */
3426 __Pyx_GIVEREF(__pyx_t_4);
3427 __Pyx_GIVEREF(__pyx_t_6);
3428 __Pyx_XGIVEREF(__pyx_t_7);
3429 __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_6, __pyx_t_7);
3430 __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0;
3431 __PYX_ERR(0, 156, __pyx_L5_except_error)
3432 }
3433 goto __pyx_L5_except_error;
3434 __pyx_L5_except_error:;
3435
3436 /* "borg/hashindex.pyx":149
3437 *
3438 * def pop(self, key, default=_NoDefault):
3439 * try: # <<<<<<<<<<<<<<
3440 * value = self[key]
3441 * del self[key]
3442 */
3443 __Pyx_XGIVEREF(__pyx_t_1);
3444 __Pyx_XGIVEREF(__pyx_t_2);
3445 __Pyx_XGIVEREF(__pyx_t_3);
3446 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
3447 goto __pyx_L1_error;
3448 __pyx_L7_try_return:;
3449 __Pyx_XGIVEREF(__pyx_t_1);
3450 __Pyx_XGIVEREF(__pyx_t_2);
3451 __Pyx_XGIVEREF(__pyx_t_3);
3452 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
3453 goto __pyx_L0;
3454 __pyx_L6_except_return:;
3455 __Pyx_XGIVEREF(__pyx_t_1);
3456 __Pyx_XGIVEREF(__pyx_t_2);
3457 __Pyx_XGIVEREF(__pyx_t_3);
3458 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
3459 goto __pyx_L0;
3460 }
3461
3462 /* "borg/hashindex.pyx":148
3463 * return default
3464 *
3465 * def pop(self, key, default=_NoDefault): # <<<<<<<<<<<<<<
3466 * try:
3467 * value = self[key]
3468 */
3469
3470 /* function exit code */
3471 __pyx_L1_error:;
3472 __Pyx_XDECREF(__pyx_t_4);
3473 __Pyx_XDECREF(__pyx_t_6);
3474 __Pyx_XDECREF(__pyx_t_7);
3475 __Pyx_XDECREF(__pyx_t_8);
3476 __Pyx_AddTraceback("borg.hashindex.IndexBase.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
3477 __pyx_r = NULL;
3478 __pyx_L0:;
3479 __Pyx_XDECREF(__pyx_v_value);
3480 __Pyx_XGIVEREF(__pyx_r);
3481 __Pyx_RefNannyFinishContext();
3482 return __pyx_r;
3483 }
3484
3485 /* "borg/hashindex.pyx":158
3486 * raise
3487 *
3488 * def __len__(self): # <<<<<<<<<<<<<<
3489 * return hashindex_len(self.index)
3490 *
3491 */
3492
3493 /* Python wrapper */
3494 static Py_ssize_t __pyx_pw_4borg_9hashindex_9IndexBase_19__len__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4borg_9hashindex_9IndexBase_19__len__(PyObject * __pyx_v_self)3495 static Py_ssize_t __pyx_pw_4borg_9hashindex_9IndexBase_19__len__(PyObject *__pyx_v_self) {
3496 Py_ssize_t __pyx_r;
3497 __Pyx_RefNannyDeclarations
3498 __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
3499 __pyx_r = __pyx_pf_4borg_9hashindex_9IndexBase_18__len__(((struct __pyx_obj_4borg_9hashindex_IndexBase *)__pyx_v_self));
3500
3501 /* function exit code */
3502 __Pyx_RefNannyFinishContext();
3503 return __pyx_r;
3504 }
3505
__pyx_pf_4borg_9hashindex_9IndexBase_18__len__(struct __pyx_obj_4borg_9hashindex_IndexBase * __pyx_v_self)3506 static Py_ssize_t __pyx_pf_4borg_9hashindex_9IndexBase_18__len__(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self) {
3507 Py_ssize_t __pyx_r;
3508 __Pyx_RefNannyDeclarations
3509 __Pyx_RefNannySetupContext("__len__", 0);
3510
3511 /* "borg/hashindex.pyx":159
3512 *
3513 * def __len__(self):
3514 * return hashindex_len(self.index) # <<<<<<<<<<<<<<
3515 *
3516 * def size(self):
3517 */
3518 __pyx_r = hashindex_len(__pyx_v_self->index);
3519 goto __pyx_L0;
3520
3521 /* "borg/hashindex.pyx":158
3522 * raise
3523 *
3524 * def __len__(self): # <<<<<<<<<<<<<<
3525 * return hashindex_len(self.index)
3526 *
3527 */
3528
3529 /* function exit code */
3530 __pyx_L0:;
3531 __Pyx_RefNannyFinishContext();
3532 return __pyx_r;
3533 }
3534
3535 /* "borg/hashindex.pyx":161
3536 * return hashindex_len(self.index)
3537 *
3538 * def size(self): # <<<<<<<<<<<<<<
3539 * """Return size (bytes) of hash table."""
3540 * return hashindex_size(self.index)
3541 */
3542
3543 /* Python wrapper */
3544 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_21size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3545 static char __pyx_doc_4borg_9hashindex_9IndexBase_20size[] = "Return size (bytes) of hash table.";
__pyx_pw_4borg_9hashindex_9IndexBase_21size(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3546 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_21size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3547 PyObject *__pyx_r = 0;
3548 __Pyx_RefNannyDeclarations
3549 __Pyx_RefNannySetupContext("size (wrapper)", 0);
3550 __pyx_r = __pyx_pf_4borg_9hashindex_9IndexBase_20size(((struct __pyx_obj_4borg_9hashindex_IndexBase *)__pyx_v_self));
3551
3552 /* function exit code */
3553 __Pyx_RefNannyFinishContext();
3554 return __pyx_r;
3555 }
3556
__pyx_pf_4borg_9hashindex_9IndexBase_20size(struct __pyx_obj_4borg_9hashindex_IndexBase * __pyx_v_self)3557 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_20size(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self) {
3558 PyObject *__pyx_r = NULL;
3559 __Pyx_RefNannyDeclarations
3560 PyObject *__pyx_t_1 = NULL;
3561 int __pyx_lineno = 0;
3562 const char *__pyx_filename = NULL;
3563 int __pyx_clineno = 0;
3564 __Pyx_RefNannySetupContext("size", 0);
3565
3566 /* "borg/hashindex.pyx":163
3567 * def size(self):
3568 * """Return size (bytes) of hash table."""
3569 * return hashindex_size(self.index) # <<<<<<<<<<<<<<
3570 *
3571 * def compact(self):
3572 */
3573 __Pyx_XDECREF(__pyx_r);
3574 __pyx_t_1 = __Pyx_PyInt_From_int(hashindex_size(__pyx_v_self->index)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
3575 __Pyx_GOTREF(__pyx_t_1);
3576 __pyx_r = __pyx_t_1;
3577 __pyx_t_1 = 0;
3578 goto __pyx_L0;
3579
3580 /* "borg/hashindex.pyx":161
3581 * return hashindex_len(self.index)
3582 *
3583 * def size(self): # <<<<<<<<<<<<<<
3584 * """Return size (bytes) of hash table."""
3585 * return hashindex_size(self.index)
3586 */
3587
3588 /* function exit code */
3589 __pyx_L1_error:;
3590 __Pyx_XDECREF(__pyx_t_1);
3591 __Pyx_AddTraceback("borg.hashindex.IndexBase.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
3592 __pyx_r = NULL;
3593 __pyx_L0:;
3594 __Pyx_XGIVEREF(__pyx_r);
3595 __Pyx_RefNannyFinishContext();
3596 return __pyx_r;
3597 }
3598
3599 /* "borg/hashindex.pyx":165
3600 * return hashindex_size(self.index)
3601 *
3602 * def compact(self): # <<<<<<<<<<<<<<
3603 * return hashindex_compact(self.index)
3604 *
3605 */
3606
3607 /* Python wrapper */
3608 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_23compact(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4borg_9hashindex_9IndexBase_23compact(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3609 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_23compact(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3610 PyObject *__pyx_r = 0;
3611 __Pyx_RefNannyDeclarations
3612 __Pyx_RefNannySetupContext("compact (wrapper)", 0);
3613 __pyx_r = __pyx_pf_4borg_9hashindex_9IndexBase_22compact(((struct __pyx_obj_4borg_9hashindex_IndexBase *)__pyx_v_self));
3614
3615 /* function exit code */
3616 __Pyx_RefNannyFinishContext();
3617 return __pyx_r;
3618 }
3619
__pyx_pf_4borg_9hashindex_9IndexBase_22compact(struct __pyx_obj_4borg_9hashindex_IndexBase * __pyx_v_self)3620 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_22compact(struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self) {
3621 PyObject *__pyx_r = NULL;
3622 __Pyx_RefNannyDeclarations
3623 PyObject *__pyx_t_1 = NULL;
3624 int __pyx_lineno = 0;
3625 const char *__pyx_filename = NULL;
3626 int __pyx_clineno = 0;
3627 __Pyx_RefNannySetupContext("compact", 0);
3628
3629 /* "borg/hashindex.pyx":166
3630 *
3631 * def compact(self):
3632 * return hashindex_compact(self.index) # <<<<<<<<<<<<<<
3633 *
3634 *
3635 */
3636 __Pyx_XDECREF(__pyx_r);
3637 __pyx_t_1 = __Pyx_PyInt_From_uint64_t(hashindex_compact(__pyx_v_self->index)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
3638 __Pyx_GOTREF(__pyx_t_1);
3639 __pyx_r = __pyx_t_1;
3640 __pyx_t_1 = 0;
3641 goto __pyx_L0;
3642
3643 /* "borg/hashindex.pyx":165
3644 * return hashindex_size(self.index)
3645 *
3646 * def compact(self): # <<<<<<<<<<<<<<
3647 * return hashindex_compact(self.index)
3648 *
3649 */
3650
3651 /* function exit code */
3652 __pyx_L1_error:;
3653 __Pyx_XDECREF(__pyx_t_1);
3654 __Pyx_AddTraceback("borg.hashindex.IndexBase.compact", __pyx_clineno, __pyx_lineno, __pyx_filename);
3655 __pyx_r = NULL;
3656 __pyx_L0:;
3657 __Pyx_XGIVEREF(__pyx_r);
3658 __Pyx_RefNannyFinishContext();
3659 return __pyx_r;
3660 }
3661
3662 /* "(tree fragment)":1
3663 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
3664 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3665 * def __setstate_cython__(self, __pyx_state):
3666 */
3667
3668 /* Python wrapper */
3669 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_25__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4borg_9hashindex_9IndexBase_25__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3670 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_25__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3671 PyObject *__pyx_r = 0;
3672 __Pyx_RefNannyDeclarations
3673 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
3674 __pyx_r = __pyx_pf_4borg_9hashindex_9IndexBase_24__reduce_cython__(((struct __pyx_obj_4borg_9hashindex_IndexBase *)__pyx_v_self));
3675
3676 /* function exit code */
3677 __Pyx_RefNannyFinishContext();
3678 return __pyx_r;
3679 }
3680
__pyx_pf_4borg_9hashindex_9IndexBase_24__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_IndexBase * __pyx_v_self)3681 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_24__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self) {
3682 PyObject *__pyx_r = NULL;
3683 __Pyx_RefNannyDeclarations
3684 PyObject *__pyx_t_1 = NULL;
3685 int __pyx_lineno = 0;
3686 const char *__pyx_filename = NULL;
3687 int __pyx_clineno = 0;
3688 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
3689
3690 /* "(tree fragment)":2
3691 * def __reduce_cython__(self):
3692 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
3693 * def __setstate_cython__(self, __pyx_state):
3694 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3695 */
3696 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
3697 __Pyx_GOTREF(__pyx_t_1);
3698 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3699 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3700 __PYX_ERR(1, 2, __pyx_L1_error)
3701
3702 /* "(tree fragment)":1
3703 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
3704 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3705 * def __setstate_cython__(self, __pyx_state):
3706 */
3707
3708 /* function exit code */
3709 __pyx_L1_error:;
3710 __Pyx_XDECREF(__pyx_t_1);
3711 __Pyx_AddTraceback("borg.hashindex.IndexBase.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3712 __pyx_r = NULL;
3713 __Pyx_XGIVEREF(__pyx_r);
3714 __Pyx_RefNannyFinishContext();
3715 return __pyx_r;
3716 }
3717
3718 /* "(tree fragment)":3
3719 * def __reduce_cython__(self):
3720 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3721 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
3722 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3723 */
3724
3725 /* Python wrapper */
3726 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_27__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_4borg_9hashindex_9IndexBase_27__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)3727 static PyObject *__pyx_pw_4borg_9hashindex_9IndexBase_27__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3728 PyObject *__pyx_r = 0;
3729 __Pyx_RefNannyDeclarations
3730 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
3731 __pyx_r = __pyx_pf_4borg_9hashindex_9IndexBase_26__setstate_cython__(((struct __pyx_obj_4borg_9hashindex_IndexBase *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
3732
3733 /* function exit code */
3734 __Pyx_RefNannyFinishContext();
3735 return __pyx_r;
3736 }
3737
__pyx_pf_4borg_9hashindex_9IndexBase_26__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_IndexBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)3738 static PyObject *__pyx_pf_4borg_9hashindex_9IndexBase_26__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_IndexBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
3739 PyObject *__pyx_r = NULL;
3740 __Pyx_RefNannyDeclarations
3741 PyObject *__pyx_t_1 = NULL;
3742 int __pyx_lineno = 0;
3743 const char *__pyx_filename = NULL;
3744 int __pyx_clineno = 0;
3745 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
3746
3747 /* "(tree fragment)":4
3748 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3749 * def __setstate_cython__(self, __pyx_state):
3750 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
3751 */
3752 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
3753 __Pyx_GOTREF(__pyx_t_1);
3754 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3755 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3756 __PYX_ERR(1, 4, __pyx_L1_error)
3757
3758 /* "(tree fragment)":3
3759 * def __reduce_cython__(self):
3760 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3761 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
3762 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3763 */
3764
3765 /* function exit code */
3766 __pyx_L1_error:;
3767 __Pyx_XDECREF(__pyx_t_1);
3768 __Pyx_AddTraceback("borg.hashindex.IndexBase.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3769 __pyx_r = NULL;
3770 __Pyx_XGIVEREF(__pyx_r);
3771 __Pyx_RefNannyFinishContext();
3772 return __pyx_r;
3773 }
3774
3775 /* "borg/hashindex.pyx":174
3776 * _key_size = 16
3777 *
3778 * def __getitem__(self, key): # <<<<<<<<<<<<<<
3779 * cdef FuseVersionsElement *data
3780 * assert len(key) == self.key_size
3781 */
3782
3783 /* Python wrapper */
3784 static PyObject *__pyx_pw_4borg_9hashindex_17FuseVersionsIndex_1__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
__pyx_pw_4borg_9hashindex_17FuseVersionsIndex_1__getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_key)3785 static PyObject *__pyx_pw_4borg_9hashindex_17FuseVersionsIndex_1__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
3786 PyObject *__pyx_r = 0;
3787 __Pyx_RefNannyDeclarations
3788 __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
3789 __pyx_r = __pyx_pf_4borg_9hashindex_17FuseVersionsIndex___getitem__(((struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key));
3790
3791 /* function exit code */
3792 __Pyx_RefNannyFinishContext();
3793 return __pyx_r;
3794 }
3795
__pyx_pf_4borg_9hashindex_17FuseVersionsIndex___getitem__(struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex * __pyx_v_self,PyObject * __pyx_v_key)3796 static PyObject *__pyx_pf_4borg_9hashindex_17FuseVersionsIndex___getitem__(struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *__pyx_v_self, PyObject *__pyx_v_key) {
3797 FuseVersionsElement *__pyx_v_data;
3798 PyObject *__pyx_r = NULL;
3799 __Pyx_RefNannyDeclarations
3800 Py_ssize_t __pyx_t_1;
3801 char *__pyx_t_2;
3802 int __pyx_t_3;
3803 PyObject *__pyx_t_4 = NULL;
3804 PyObject *__pyx_t_5 = NULL;
3805 PyObject *__pyx_t_6 = NULL;
3806 int __pyx_lineno = 0;
3807 const char *__pyx_filename = NULL;
3808 int __pyx_clineno = 0;
3809 __Pyx_RefNannySetupContext("__getitem__", 0);
3810
3811 /* "borg/hashindex.pyx":176
3812 * def __getitem__(self, key):
3813 * cdef FuseVersionsElement *data
3814 * assert len(key) == self.key_size # <<<<<<<<<<<<<<
3815 * data = <FuseVersionsElement *>hashindex_get(self.index, <char *>key)
3816 * if data == NULL:
3817 */
3818 #ifndef CYTHON_WITHOUT_ASSERTIONS
3819 if (unlikely(!Py_OptimizeFlag)) {
3820 __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 176, __pyx_L1_error)
3821 if (unlikely(!((__pyx_t_1 == __pyx_v_self->__pyx_base.key_size) != 0))) {
3822 PyErr_SetNone(PyExc_AssertionError);
3823 __PYX_ERR(0, 176, __pyx_L1_error)
3824 }
3825 }
3826 #endif
3827
3828 /* "borg/hashindex.pyx":177
3829 * cdef FuseVersionsElement *data
3830 * assert len(key) == self.key_size
3831 * data = <FuseVersionsElement *>hashindex_get(self.index, <char *>key) # <<<<<<<<<<<<<<
3832 * if data == NULL:
3833 * raise KeyError(key)
3834 */
3835 __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L1_error)
3836 __pyx_v_data = ((FuseVersionsElement *)hashindex_get(__pyx_v_self->__pyx_base.index, ((char *)__pyx_t_2)));
3837
3838 /* "borg/hashindex.pyx":178
3839 * assert len(key) == self.key_size
3840 * data = <FuseVersionsElement *>hashindex_get(self.index, <char *>key)
3841 * if data == NULL: # <<<<<<<<<<<<<<
3842 * raise KeyError(key)
3843 * return _le32toh(data.version), PyBytes_FromStringAndSize(data.hash, 16)
3844 */
3845 __pyx_t_3 = ((__pyx_v_data == NULL) != 0);
3846 if (unlikely(__pyx_t_3)) {
3847
3848 /* "borg/hashindex.pyx":179
3849 * data = <FuseVersionsElement *>hashindex_get(self.index, <char *>key)
3850 * if data == NULL:
3851 * raise KeyError(key) # <<<<<<<<<<<<<<
3852 * return _le32toh(data.version), PyBytes_FromStringAndSize(data.hash, 16)
3853 *
3854 */
3855 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 179, __pyx_L1_error)
3856 __Pyx_GOTREF(__pyx_t_4);
3857 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3858 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3859 __PYX_ERR(0, 179, __pyx_L1_error)
3860
3861 /* "borg/hashindex.pyx":178
3862 * assert len(key) == self.key_size
3863 * data = <FuseVersionsElement *>hashindex_get(self.index, <char *>key)
3864 * if data == NULL: # <<<<<<<<<<<<<<
3865 * raise KeyError(key)
3866 * return _le32toh(data.version), PyBytes_FromStringAndSize(data.hash, 16)
3867 */
3868 }
3869
3870 /* "borg/hashindex.pyx":180
3871 * if data == NULL:
3872 * raise KeyError(key)
3873 * return _le32toh(data.version), PyBytes_FromStringAndSize(data.hash, 16) # <<<<<<<<<<<<<<
3874 *
3875 * def __setitem__(self, key, value):
3876 */
3877 __Pyx_XDECREF(__pyx_r);
3878 __pyx_t_4 = __Pyx_PyInt_From_uint32_t(_le32toh(__pyx_v_data->version)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 180, __pyx_L1_error)
3879 __Pyx_GOTREF(__pyx_t_4);
3880 __pyx_t_5 = PyBytes_FromStringAndSize(__pyx_v_data->hash, 16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 180, __pyx_L1_error)
3881 __Pyx_GOTREF(__pyx_t_5);
3882 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 180, __pyx_L1_error)
3883 __Pyx_GOTREF(__pyx_t_6);
3884 __Pyx_GIVEREF(__pyx_t_4);
3885 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
3886 __Pyx_GIVEREF(__pyx_t_5);
3887 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
3888 __pyx_t_4 = 0;
3889 __pyx_t_5 = 0;
3890 __pyx_r = __pyx_t_6;
3891 __pyx_t_6 = 0;
3892 goto __pyx_L0;
3893
3894 /* "borg/hashindex.pyx":174
3895 * _key_size = 16
3896 *
3897 * def __getitem__(self, key): # <<<<<<<<<<<<<<
3898 * cdef FuseVersionsElement *data
3899 * assert len(key) == self.key_size
3900 */
3901
3902 /* function exit code */
3903 __pyx_L1_error:;
3904 __Pyx_XDECREF(__pyx_t_4);
3905 __Pyx_XDECREF(__pyx_t_5);
3906 __Pyx_XDECREF(__pyx_t_6);
3907 __Pyx_AddTraceback("borg.hashindex.FuseVersionsIndex.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3908 __pyx_r = NULL;
3909 __pyx_L0:;
3910 __Pyx_XGIVEREF(__pyx_r);
3911 __Pyx_RefNannyFinishContext();
3912 return __pyx_r;
3913 }
3914
3915 /* "borg/hashindex.pyx":182
3916 * return _le32toh(data.version), PyBytes_FromStringAndSize(data.hash, 16)
3917 *
3918 * def __setitem__(self, key, value): # <<<<<<<<<<<<<<
3919 * cdef FuseVersionsElement data
3920 * assert len(key) == self.key_size
3921 */
3922
3923 /* Python wrapper */
3924 static int __pyx_pw_4borg_9hashindex_17FuseVersionsIndex_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_4borg_9hashindex_17FuseVersionsIndex_3__setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_key,PyObject * __pyx_v_value)3925 static int __pyx_pw_4borg_9hashindex_17FuseVersionsIndex_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
3926 int __pyx_r;
3927 __Pyx_RefNannyDeclarations
3928 __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
3929 __pyx_r = __pyx_pf_4borg_9hashindex_17FuseVersionsIndex_2__setitem__(((struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));
3930
3931 /* function exit code */
3932 __Pyx_RefNannyFinishContext();
3933 return __pyx_r;
3934 }
3935
__pyx_pf_4borg_9hashindex_17FuseVersionsIndex_2__setitem__(struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex * __pyx_v_self,PyObject * __pyx_v_key,PyObject * __pyx_v_value)3936 static int __pyx_pf_4borg_9hashindex_17FuseVersionsIndex_2__setitem__(struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
3937 FuseVersionsElement __pyx_v_data;
3938 int __pyx_r;
3939 __Pyx_RefNannyDeclarations
3940 Py_ssize_t __pyx_t_1;
3941 PyObject *__pyx_t_2 = NULL;
3942 uint32_t __pyx_t_3;
3943 int __pyx_t_4;
3944 int __pyx_t_5;
3945 char *__pyx_t_6;
3946 int __pyx_lineno = 0;
3947 const char *__pyx_filename = NULL;
3948 int __pyx_clineno = 0;
3949 __Pyx_RefNannySetupContext("__setitem__", 0);
3950
3951 /* "borg/hashindex.pyx":184
3952 * def __setitem__(self, key, value):
3953 * cdef FuseVersionsElement data
3954 * assert len(key) == self.key_size # <<<<<<<<<<<<<<
3955 * data.version = value[0]
3956 * assert data.version <= _MAX_VALUE, "maximum number of versions reached"
3957 */
3958 #ifndef CYTHON_WITHOUT_ASSERTIONS
3959 if (unlikely(!Py_OptimizeFlag)) {
3960 __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 184, __pyx_L1_error)
3961 if (unlikely(!((__pyx_t_1 == __pyx_v_self->__pyx_base.key_size) != 0))) {
3962 PyErr_SetNone(PyExc_AssertionError);
3963 __PYX_ERR(0, 184, __pyx_L1_error)
3964 }
3965 }
3966 #endif
3967
3968 /* "borg/hashindex.pyx":185
3969 * cdef FuseVersionsElement data
3970 * assert len(key) == self.key_size
3971 * data.version = value[0] # <<<<<<<<<<<<<<
3972 * assert data.version <= _MAX_VALUE, "maximum number of versions reached"
3973 * if not PyBytes_CheckExact(value[1]) or PyBytes_GET_SIZE(value[1]) != 16:
3974 */
3975 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error)
3976 __Pyx_GOTREF(__pyx_t_2);
3977 __pyx_t_3 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_3 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error)
3978 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3979 __pyx_v_data.version = __pyx_t_3;
3980
3981 /* "borg/hashindex.pyx":186
3982 * assert len(key) == self.key_size
3983 * data.version = value[0]
3984 * assert data.version <= _MAX_VALUE, "maximum number of versions reached" # <<<<<<<<<<<<<<
3985 * if not PyBytes_CheckExact(value[1]) or PyBytes_GET_SIZE(value[1]) != 16:
3986 * raise TypeError("Expected bytes of length 16 for second value")
3987 */
3988 #ifndef CYTHON_WITHOUT_ASSERTIONS
3989 if (unlikely(!Py_OptimizeFlag)) {
3990 if (unlikely(!((__pyx_v_data.version <= _MAX_VALUE) != 0))) {
3991 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_maximum_number_of_versions_reach);
3992 __PYX_ERR(0, 186, __pyx_L1_error)
3993 }
3994 }
3995 #endif
3996
3997 /* "borg/hashindex.pyx":187
3998 * data.version = value[0]
3999 * assert data.version <= _MAX_VALUE, "maximum number of versions reached"
4000 * if not PyBytes_CheckExact(value[1]) or PyBytes_GET_SIZE(value[1]) != 16: # <<<<<<<<<<<<<<
4001 * raise TypeError("Expected bytes of length 16 for second value")
4002 * memcpy(data.hash, PyBytes_AS_STRING(value[1]), 16)
4003 */
4004 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error)
4005 __Pyx_GOTREF(__pyx_t_2);
4006 __pyx_t_5 = ((!(PyBytes_CheckExact(__pyx_t_2) != 0)) != 0);
4007 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4008 if (!__pyx_t_5) {
4009 } else {
4010 __pyx_t_4 = __pyx_t_5;
4011 goto __pyx_L4_bool_binop_done;
4012 }
4013 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error)
4014 __Pyx_GOTREF(__pyx_t_2);
4015 __pyx_t_5 = ((PyBytes_GET_SIZE(__pyx_t_2) != 16) != 0);
4016 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4017 __pyx_t_4 = __pyx_t_5;
4018 __pyx_L4_bool_binop_done:;
4019 if (unlikely(__pyx_t_4)) {
4020
4021 /* "borg/hashindex.pyx":188
4022 * assert data.version <= _MAX_VALUE, "maximum number of versions reached"
4023 * if not PyBytes_CheckExact(value[1]) or PyBytes_GET_SIZE(value[1]) != 16:
4024 * raise TypeError("Expected bytes of length 16 for second value") # <<<<<<<<<<<<<<
4025 * memcpy(data.hash, PyBytes_AS_STRING(value[1]), 16)
4026 * data.version = _htole32(data.version)
4027 */
4028 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error)
4029 __Pyx_GOTREF(__pyx_t_2);
4030 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
4031 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4032 __PYX_ERR(0, 188, __pyx_L1_error)
4033
4034 /* "borg/hashindex.pyx":187
4035 * data.version = value[0]
4036 * assert data.version <= _MAX_VALUE, "maximum number of versions reached"
4037 * if not PyBytes_CheckExact(value[1]) or PyBytes_GET_SIZE(value[1]) != 16: # <<<<<<<<<<<<<<
4038 * raise TypeError("Expected bytes of length 16 for second value")
4039 * memcpy(data.hash, PyBytes_AS_STRING(value[1]), 16)
4040 */
4041 }
4042
4043 /* "borg/hashindex.pyx":189
4044 * if not PyBytes_CheckExact(value[1]) or PyBytes_GET_SIZE(value[1]) != 16:
4045 * raise TypeError("Expected bytes of length 16 for second value")
4046 * memcpy(data.hash, PyBytes_AS_STRING(value[1]), 16) # <<<<<<<<<<<<<<
4047 * data.version = _htole32(data.version)
4048 * if not hashindex_set(self.index, <char *>key, <void *> &data):
4049 */
4050 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error)
4051 __Pyx_GOTREF(__pyx_t_2);
4052 (void)(memcpy(__pyx_v_data.hash, PyBytes_AS_STRING(__pyx_t_2), 16));
4053 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4054
4055 /* "borg/hashindex.pyx":190
4056 * raise TypeError("Expected bytes of length 16 for second value")
4057 * memcpy(data.hash, PyBytes_AS_STRING(value[1]), 16)
4058 * data.version = _htole32(data.version) # <<<<<<<<<<<<<<
4059 * if not hashindex_set(self.index, <char *>key, <void *> &data):
4060 * raise Exception('hashindex_set failed')
4061 */
4062 __pyx_v_data.version = _htole32(__pyx_v_data.version);
4063
4064 /* "borg/hashindex.pyx":191
4065 * memcpy(data.hash, PyBytes_AS_STRING(value[1]), 16)
4066 * data.version = _htole32(data.version)
4067 * if not hashindex_set(self.index, <char *>key, <void *> &data): # <<<<<<<<<<<<<<
4068 * raise Exception('hashindex_set failed')
4069 *
4070 */
4071 __pyx_t_6 = __Pyx_PyObject_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L1_error)
4072 __pyx_t_4 = ((!(hashindex_set(__pyx_v_self->__pyx_base.index, ((char *)__pyx_t_6), ((void *)(&__pyx_v_data))) != 0)) != 0);
4073 if (unlikely(__pyx_t_4)) {
4074
4075 /* "borg/hashindex.pyx":192
4076 * data.version = _htole32(data.version)
4077 * if not hashindex_set(self.index, <char *>key, <void *> &data):
4078 * raise Exception('hashindex_set failed') # <<<<<<<<<<<<<<
4079 *
4080 * def __contains__(self, key):
4081 */
4082 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
4083 __Pyx_GOTREF(__pyx_t_2);
4084 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
4085 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4086 __PYX_ERR(0, 192, __pyx_L1_error)
4087
4088 /* "borg/hashindex.pyx":191
4089 * memcpy(data.hash, PyBytes_AS_STRING(value[1]), 16)
4090 * data.version = _htole32(data.version)
4091 * if not hashindex_set(self.index, <char *>key, <void *> &data): # <<<<<<<<<<<<<<
4092 * raise Exception('hashindex_set failed')
4093 *
4094 */
4095 }
4096
4097 /* "borg/hashindex.pyx":182
4098 * return _le32toh(data.version), PyBytes_FromStringAndSize(data.hash, 16)
4099 *
4100 * def __setitem__(self, key, value): # <<<<<<<<<<<<<<
4101 * cdef FuseVersionsElement data
4102 * assert len(key) == self.key_size
4103 */
4104
4105 /* function exit code */
4106 __pyx_r = 0;
4107 goto __pyx_L0;
4108 __pyx_L1_error:;
4109 __Pyx_XDECREF(__pyx_t_2);
4110 __Pyx_AddTraceback("borg.hashindex.FuseVersionsIndex.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4111 __pyx_r = -1;
4112 __pyx_L0:;
4113 __Pyx_RefNannyFinishContext();
4114 return __pyx_r;
4115 }
4116
4117 /* "borg/hashindex.pyx":194
4118 * raise Exception('hashindex_set failed')
4119 *
4120 * def __contains__(self, key): # <<<<<<<<<<<<<<
4121 * assert len(key) == self.key_size
4122 * return hashindex_get(self.index, <char *>key) != NULL
4123 */
4124
4125 /* Python wrapper */
4126 static int __pyx_pw_4borg_9hashindex_17FuseVersionsIndex_5__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
__pyx_pw_4borg_9hashindex_17FuseVersionsIndex_5__contains__(PyObject * __pyx_v_self,PyObject * __pyx_v_key)4127 static int __pyx_pw_4borg_9hashindex_17FuseVersionsIndex_5__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
4128 int __pyx_r;
4129 __Pyx_RefNannyDeclarations
4130 __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
4131 __pyx_r = __pyx_pf_4borg_9hashindex_17FuseVersionsIndex_4__contains__(((struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key));
4132
4133 /* function exit code */
4134 __Pyx_RefNannyFinishContext();
4135 return __pyx_r;
4136 }
4137
__pyx_pf_4borg_9hashindex_17FuseVersionsIndex_4__contains__(struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex * __pyx_v_self,PyObject * __pyx_v_key)4138 static int __pyx_pf_4borg_9hashindex_17FuseVersionsIndex_4__contains__(struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *__pyx_v_self, PyObject *__pyx_v_key) {
4139 int __pyx_r;
4140 __Pyx_RefNannyDeclarations
4141 Py_ssize_t __pyx_t_1;
4142 char *__pyx_t_2;
4143 int __pyx_lineno = 0;
4144 const char *__pyx_filename = NULL;
4145 int __pyx_clineno = 0;
4146 __Pyx_RefNannySetupContext("__contains__", 0);
4147
4148 /* "borg/hashindex.pyx":195
4149 *
4150 * def __contains__(self, key):
4151 * assert len(key) == self.key_size # <<<<<<<<<<<<<<
4152 * return hashindex_get(self.index, <char *>key) != NULL
4153 *
4154 */
4155 #ifndef CYTHON_WITHOUT_ASSERTIONS
4156 if (unlikely(!Py_OptimizeFlag)) {
4157 __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 195, __pyx_L1_error)
4158 if (unlikely(!((__pyx_t_1 == __pyx_v_self->__pyx_base.key_size) != 0))) {
4159 PyErr_SetNone(PyExc_AssertionError);
4160 __PYX_ERR(0, 195, __pyx_L1_error)
4161 }
4162 }
4163 #endif
4164
4165 /* "borg/hashindex.pyx":196
4166 * def __contains__(self, key):
4167 * assert len(key) == self.key_size
4168 * return hashindex_get(self.index, <char *>key) != NULL # <<<<<<<<<<<<<<
4169 *
4170 *
4171 */
4172 __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 196, __pyx_L1_error)
4173 __pyx_r = (hashindex_get(__pyx_v_self->__pyx_base.index, ((char *)__pyx_t_2)) != NULL);
4174 goto __pyx_L0;
4175
4176 /* "borg/hashindex.pyx":194
4177 * raise Exception('hashindex_set failed')
4178 *
4179 * def __contains__(self, key): # <<<<<<<<<<<<<<
4180 * assert len(key) == self.key_size
4181 * return hashindex_get(self.index, <char *>key) != NULL
4182 */
4183
4184 /* function exit code */
4185 __pyx_L1_error:;
4186 __Pyx_AddTraceback("borg.hashindex.FuseVersionsIndex.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4187 __pyx_r = -1;
4188 __pyx_L0:;
4189 __Pyx_RefNannyFinishContext();
4190 return __pyx_r;
4191 }
4192
4193 /* "(tree fragment)":1
4194 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
4195 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4196 * def __setstate_cython__(self, __pyx_state):
4197 */
4198
4199 /* Python wrapper */
4200 static PyObject *__pyx_pw_4borg_9hashindex_17FuseVersionsIndex_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4borg_9hashindex_17FuseVersionsIndex_7__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)4201 static PyObject *__pyx_pw_4borg_9hashindex_17FuseVersionsIndex_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4202 PyObject *__pyx_r = 0;
4203 __Pyx_RefNannyDeclarations
4204 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
4205 __pyx_r = __pyx_pf_4borg_9hashindex_17FuseVersionsIndex_6__reduce_cython__(((struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *)__pyx_v_self));
4206
4207 /* function exit code */
4208 __Pyx_RefNannyFinishContext();
4209 return __pyx_r;
4210 }
4211
__pyx_pf_4borg_9hashindex_17FuseVersionsIndex_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex * __pyx_v_self)4212 static PyObject *__pyx_pf_4borg_9hashindex_17FuseVersionsIndex_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *__pyx_v_self) {
4213 PyObject *__pyx_r = NULL;
4214 __Pyx_RefNannyDeclarations
4215 PyObject *__pyx_t_1 = NULL;
4216 int __pyx_lineno = 0;
4217 const char *__pyx_filename = NULL;
4218 int __pyx_clineno = 0;
4219 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
4220
4221 /* "(tree fragment)":2
4222 * def __reduce_cython__(self):
4223 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
4224 * def __setstate_cython__(self, __pyx_state):
4225 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4226 */
4227 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
4228 __Pyx_GOTREF(__pyx_t_1);
4229 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4230 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4231 __PYX_ERR(1, 2, __pyx_L1_error)
4232
4233 /* "(tree fragment)":1
4234 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
4235 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4236 * def __setstate_cython__(self, __pyx_state):
4237 */
4238
4239 /* function exit code */
4240 __pyx_L1_error:;
4241 __Pyx_XDECREF(__pyx_t_1);
4242 __Pyx_AddTraceback("borg.hashindex.FuseVersionsIndex.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4243 __pyx_r = NULL;
4244 __Pyx_XGIVEREF(__pyx_r);
4245 __Pyx_RefNannyFinishContext();
4246 return __pyx_r;
4247 }
4248
4249 /* "(tree fragment)":3
4250 * def __reduce_cython__(self):
4251 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4252 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
4253 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4254 */
4255
4256 /* Python wrapper */
4257 static PyObject *__pyx_pw_4borg_9hashindex_17FuseVersionsIndex_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_4borg_9hashindex_17FuseVersionsIndex_9__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)4258 static PyObject *__pyx_pw_4borg_9hashindex_17FuseVersionsIndex_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4259 PyObject *__pyx_r = 0;
4260 __Pyx_RefNannyDeclarations
4261 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
4262 __pyx_r = __pyx_pf_4borg_9hashindex_17FuseVersionsIndex_8__setstate_cython__(((struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
4263
4264 /* function exit code */
4265 __Pyx_RefNannyFinishContext();
4266 return __pyx_r;
4267 }
4268
__pyx_pf_4borg_9hashindex_17FuseVersionsIndex_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)4269 static PyObject *__pyx_pf_4borg_9hashindex_17FuseVersionsIndex_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
4270 PyObject *__pyx_r = NULL;
4271 __Pyx_RefNannyDeclarations
4272 PyObject *__pyx_t_1 = NULL;
4273 int __pyx_lineno = 0;
4274 const char *__pyx_filename = NULL;
4275 int __pyx_clineno = 0;
4276 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
4277
4278 /* "(tree fragment)":4
4279 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4280 * def __setstate_cython__(self, __pyx_state):
4281 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
4282 */
4283 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
4284 __Pyx_GOTREF(__pyx_t_1);
4285 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4286 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4287 __PYX_ERR(1, 4, __pyx_L1_error)
4288
4289 /* "(tree fragment)":3
4290 * def __reduce_cython__(self):
4291 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4292 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
4293 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4294 */
4295
4296 /* function exit code */
4297 __pyx_L1_error:;
4298 __Pyx_XDECREF(__pyx_t_1);
4299 __Pyx_AddTraceback("borg.hashindex.FuseVersionsIndex.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4300 __pyx_r = NULL;
4301 __Pyx_XGIVEREF(__pyx_r);
4302 __Pyx_RefNannyFinishContext();
4303 return __pyx_r;
4304 }
4305
4306 /* "borg/hashindex.pyx":203
4307 * value_size = 8
4308 *
4309 * def __getitem__(self, key): # <<<<<<<<<<<<<<
4310 * assert len(key) == self.key_size
4311 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
4312 */
4313
4314 /* Python wrapper */
4315 static PyObject *__pyx_pw_4borg_9hashindex_7NSIndex_1__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
__pyx_pw_4borg_9hashindex_7NSIndex_1__getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_key)4316 static PyObject *__pyx_pw_4borg_9hashindex_7NSIndex_1__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
4317 PyObject *__pyx_r = 0;
4318 __Pyx_RefNannyDeclarations
4319 __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
4320 __pyx_r = __pyx_pf_4borg_9hashindex_7NSIndex___getitem__(((struct __pyx_obj_4borg_9hashindex_NSIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key));
4321
4322 /* function exit code */
4323 __Pyx_RefNannyFinishContext();
4324 return __pyx_r;
4325 }
4326
__pyx_pf_4borg_9hashindex_7NSIndex___getitem__(struct __pyx_obj_4borg_9hashindex_NSIndex * __pyx_v_self,PyObject * __pyx_v_key)4327 static PyObject *__pyx_pf_4borg_9hashindex_7NSIndex___getitem__(struct __pyx_obj_4borg_9hashindex_NSIndex *__pyx_v_self, PyObject *__pyx_v_key) {
4328 uint32_t *__pyx_v_data;
4329 uint32_t __pyx_v_segment;
4330 PyObject *__pyx_r = NULL;
4331 __Pyx_RefNannyDeclarations
4332 Py_ssize_t __pyx_t_1;
4333 char *__pyx_t_2;
4334 int __pyx_t_3;
4335 PyObject *__pyx_t_4 = NULL;
4336 PyObject *__pyx_t_5 = NULL;
4337 PyObject *__pyx_t_6 = NULL;
4338 int __pyx_lineno = 0;
4339 const char *__pyx_filename = NULL;
4340 int __pyx_clineno = 0;
4341 __Pyx_RefNannySetupContext("__getitem__", 0);
4342
4343 /* "borg/hashindex.pyx":204
4344 *
4345 * def __getitem__(self, key):
4346 * assert len(key) == self.key_size # <<<<<<<<<<<<<<
4347 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
4348 * if not data:
4349 */
4350 #ifndef CYTHON_WITHOUT_ASSERTIONS
4351 if (unlikely(!Py_OptimizeFlag)) {
4352 __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 204, __pyx_L1_error)
4353 if (unlikely(!((__pyx_t_1 == __pyx_v_self->__pyx_base.key_size) != 0))) {
4354 PyErr_SetNone(PyExc_AssertionError);
4355 __PYX_ERR(0, 204, __pyx_L1_error)
4356 }
4357 }
4358 #endif
4359
4360 /* "borg/hashindex.pyx":205
4361 * def __getitem__(self, key):
4362 * assert len(key) == self.key_size
4363 * data = <uint32_t *>hashindex_get(self.index, <char *>key) # <<<<<<<<<<<<<<
4364 * if not data:
4365 * raise KeyError(key)
4366 */
4367 __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L1_error)
4368 __pyx_v_data = ((uint32_t *)hashindex_get(__pyx_v_self->__pyx_base.index, ((char *)__pyx_t_2)));
4369
4370 /* "borg/hashindex.pyx":206
4371 * assert len(key) == self.key_size
4372 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
4373 * if not data: # <<<<<<<<<<<<<<
4374 * raise KeyError(key)
4375 * cdef uint32_t segment = _le32toh(data[0])
4376 */
4377 __pyx_t_3 = ((!(__pyx_v_data != 0)) != 0);
4378 if (unlikely(__pyx_t_3)) {
4379
4380 /* "borg/hashindex.pyx":207
4381 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
4382 * if not data:
4383 * raise KeyError(key) # <<<<<<<<<<<<<<
4384 * cdef uint32_t segment = _le32toh(data[0])
4385 * assert segment <= _MAX_VALUE, "maximum number of segments reached"
4386 */
4387 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L1_error)
4388 __Pyx_GOTREF(__pyx_t_4);
4389 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
4390 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4391 __PYX_ERR(0, 207, __pyx_L1_error)
4392
4393 /* "borg/hashindex.pyx":206
4394 * assert len(key) == self.key_size
4395 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
4396 * if not data: # <<<<<<<<<<<<<<
4397 * raise KeyError(key)
4398 * cdef uint32_t segment = _le32toh(data[0])
4399 */
4400 }
4401
4402 /* "borg/hashindex.pyx":208
4403 * if not data:
4404 * raise KeyError(key)
4405 * cdef uint32_t segment = _le32toh(data[0]) # <<<<<<<<<<<<<<
4406 * assert segment <= _MAX_VALUE, "maximum number of segments reached"
4407 * return segment, _le32toh(data[1])
4408 */
4409 __pyx_v_segment = _le32toh((__pyx_v_data[0]));
4410
4411 /* "borg/hashindex.pyx":209
4412 * raise KeyError(key)
4413 * cdef uint32_t segment = _le32toh(data[0])
4414 * assert segment <= _MAX_VALUE, "maximum number of segments reached" # <<<<<<<<<<<<<<
4415 * return segment, _le32toh(data[1])
4416 *
4417 */
4418 #ifndef CYTHON_WITHOUT_ASSERTIONS
4419 if (unlikely(!Py_OptimizeFlag)) {
4420 if (unlikely(!((__pyx_v_segment <= _MAX_VALUE) != 0))) {
4421 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_maximum_number_of_segments_reach);
4422 __PYX_ERR(0, 209, __pyx_L1_error)
4423 }
4424 }
4425 #endif
4426
4427 /* "borg/hashindex.pyx":210
4428 * cdef uint32_t segment = _le32toh(data[0])
4429 * assert segment <= _MAX_VALUE, "maximum number of segments reached"
4430 * return segment, _le32toh(data[1]) # <<<<<<<<<<<<<<
4431 *
4432 * def __setitem__(self, key, value):
4433 */
4434 __Pyx_XDECREF(__pyx_r);
4435 __pyx_t_4 = __Pyx_PyInt_From_uint32_t(__pyx_v_segment); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error)
4436 __Pyx_GOTREF(__pyx_t_4);
4437 __pyx_t_5 = __Pyx_PyInt_From_uint32_t(_le32toh((__pyx_v_data[1]))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error)
4438 __Pyx_GOTREF(__pyx_t_5);
4439 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error)
4440 __Pyx_GOTREF(__pyx_t_6);
4441 __Pyx_GIVEREF(__pyx_t_4);
4442 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
4443 __Pyx_GIVEREF(__pyx_t_5);
4444 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
4445 __pyx_t_4 = 0;
4446 __pyx_t_5 = 0;
4447 __pyx_r = __pyx_t_6;
4448 __pyx_t_6 = 0;
4449 goto __pyx_L0;
4450
4451 /* "borg/hashindex.pyx":203
4452 * value_size = 8
4453 *
4454 * def __getitem__(self, key): # <<<<<<<<<<<<<<
4455 * assert len(key) == self.key_size
4456 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
4457 */
4458
4459 /* function exit code */
4460 __pyx_L1_error:;
4461 __Pyx_XDECREF(__pyx_t_4);
4462 __Pyx_XDECREF(__pyx_t_5);
4463 __Pyx_XDECREF(__pyx_t_6);
4464 __Pyx_AddTraceback("borg.hashindex.NSIndex.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4465 __pyx_r = NULL;
4466 __pyx_L0:;
4467 __Pyx_XGIVEREF(__pyx_r);
4468 __Pyx_RefNannyFinishContext();
4469 return __pyx_r;
4470 }
4471
4472 /* "borg/hashindex.pyx":212
4473 * return segment, _le32toh(data[1])
4474 *
4475 * def __setitem__(self, key, value): # <<<<<<<<<<<<<<
4476 * assert len(key) == self.key_size
4477 * cdef uint32_t[2] data
4478 */
4479
4480 /* Python wrapper */
4481 static int __pyx_pw_4borg_9hashindex_7NSIndex_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_4borg_9hashindex_7NSIndex_3__setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_key,PyObject * __pyx_v_value)4482 static int __pyx_pw_4borg_9hashindex_7NSIndex_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
4483 int __pyx_r;
4484 __Pyx_RefNannyDeclarations
4485 __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
4486 __pyx_r = __pyx_pf_4borg_9hashindex_7NSIndex_2__setitem__(((struct __pyx_obj_4borg_9hashindex_NSIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));
4487
4488 /* function exit code */
4489 __Pyx_RefNannyFinishContext();
4490 return __pyx_r;
4491 }
4492
__pyx_pf_4borg_9hashindex_7NSIndex_2__setitem__(struct __pyx_obj_4borg_9hashindex_NSIndex * __pyx_v_self,PyObject * __pyx_v_key,PyObject * __pyx_v_value)4493 static int __pyx_pf_4borg_9hashindex_7NSIndex_2__setitem__(struct __pyx_obj_4borg_9hashindex_NSIndex *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
4494 uint32_t __pyx_v_data[2];
4495 uint32_t __pyx_v_segment;
4496 int __pyx_r;
4497 __Pyx_RefNannyDeclarations
4498 Py_ssize_t __pyx_t_1;
4499 PyObject *__pyx_t_2 = NULL;
4500 uint32_t __pyx_t_3;
4501 char *__pyx_t_4;
4502 int __pyx_t_5;
4503 int __pyx_lineno = 0;
4504 const char *__pyx_filename = NULL;
4505 int __pyx_clineno = 0;
4506 __Pyx_RefNannySetupContext("__setitem__", 0);
4507
4508 /* "borg/hashindex.pyx":213
4509 *
4510 * def __setitem__(self, key, value):
4511 * assert len(key) == self.key_size # <<<<<<<<<<<<<<
4512 * cdef uint32_t[2] data
4513 * cdef uint32_t segment = value[0]
4514 */
4515 #ifndef CYTHON_WITHOUT_ASSERTIONS
4516 if (unlikely(!Py_OptimizeFlag)) {
4517 __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 213, __pyx_L1_error)
4518 if (unlikely(!((__pyx_t_1 == __pyx_v_self->__pyx_base.key_size) != 0))) {
4519 PyErr_SetNone(PyExc_AssertionError);
4520 __PYX_ERR(0, 213, __pyx_L1_error)
4521 }
4522 }
4523 #endif
4524
4525 /* "borg/hashindex.pyx":215
4526 * assert len(key) == self.key_size
4527 * cdef uint32_t[2] data
4528 * cdef uint32_t segment = value[0] # <<<<<<<<<<<<<<
4529 * assert segment <= _MAX_VALUE, "maximum number of segments reached"
4530 * data[0] = _htole32(segment)
4531 */
4532 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error)
4533 __Pyx_GOTREF(__pyx_t_2);
4534 __pyx_t_3 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_3 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L1_error)
4535 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4536 __pyx_v_segment = __pyx_t_3;
4537
4538 /* "borg/hashindex.pyx":216
4539 * cdef uint32_t[2] data
4540 * cdef uint32_t segment = value[0]
4541 * assert segment <= _MAX_VALUE, "maximum number of segments reached" # <<<<<<<<<<<<<<
4542 * data[0] = _htole32(segment)
4543 * data[1] = _htole32(value[1])
4544 */
4545 #ifndef CYTHON_WITHOUT_ASSERTIONS
4546 if (unlikely(!Py_OptimizeFlag)) {
4547 if (unlikely(!((__pyx_v_segment <= _MAX_VALUE) != 0))) {
4548 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_maximum_number_of_segments_reach);
4549 __PYX_ERR(0, 216, __pyx_L1_error)
4550 }
4551 }
4552 #endif
4553
4554 /* "borg/hashindex.pyx":217
4555 * cdef uint32_t segment = value[0]
4556 * assert segment <= _MAX_VALUE, "maximum number of segments reached"
4557 * data[0] = _htole32(segment) # <<<<<<<<<<<<<<
4558 * data[1] = _htole32(value[1])
4559 * if not hashindex_set(self.index, <char *>key, data):
4560 */
4561 (__pyx_v_data[0]) = _htole32(__pyx_v_segment);
4562
4563 /* "borg/hashindex.pyx":218
4564 * assert segment <= _MAX_VALUE, "maximum number of segments reached"
4565 * data[0] = _htole32(segment)
4566 * data[1] = _htole32(value[1]) # <<<<<<<<<<<<<<
4567 * if not hashindex_set(self.index, <char *>key, data):
4568 * raise Exception('hashindex_set failed')
4569 */
4570 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error)
4571 __Pyx_GOTREF(__pyx_t_2);
4572 __pyx_t_3 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_3 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error)
4573 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4574 (__pyx_v_data[1]) = _htole32(__pyx_t_3);
4575
4576 /* "borg/hashindex.pyx":219
4577 * data[0] = _htole32(segment)
4578 * data[1] = _htole32(value[1])
4579 * if not hashindex_set(self.index, <char *>key, data): # <<<<<<<<<<<<<<
4580 * raise Exception('hashindex_set failed')
4581 *
4582 */
4583 __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L1_error)
4584 __pyx_t_5 = ((!(hashindex_set(__pyx_v_self->__pyx_base.index, ((char *)__pyx_t_4), __pyx_v_data) != 0)) != 0);
4585 if (unlikely(__pyx_t_5)) {
4586
4587 /* "borg/hashindex.pyx":220
4588 * data[1] = _htole32(value[1])
4589 * if not hashindex_set(self.index, <char *>key, data):
4590 * raise Exception('hashindex_set failed') # <<<<<<<<<<<<<<
4591 *
4592 * def __contains__(self, key):
4593 */
4594 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
4595 __Pyx_GOTREF(__pyx_t_2);
4596 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
4597 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4598 __PYX_ERR(0, 220, __pyx_L1_error)
4599
4600 /* "borg/hashindex.pyx":219
4601 * data[0] = _htole32(segment)
4602 * data[1] = _htole32(value[1])
4603 * if not hashindex_set(self.index, <char *>key, data): # <<<<<<<<<<<<<<
4604 * raise Exception('hashindex_set failed')
4605 *
4606 */
4607 }
4608
4609 /* "borg/hashindex.pyx":212
4610 * return segment, _le32toh(data[1])
4611 *
4612 * def __setitem__(self, key, value): # <<<<<<<<<<<<<<
4613 * assert len(key) == self.key_size
4614 * cdef uint32_t[2] data
4615 */
4616
4617 /* function exit code */
4618 __pyx_r = 0;
4619 goto __pyx_L0;
4620 __pyx_L1_error:;
4621 __Pyx_XDECREF(__pyx_t_2);
4622 __Pyx_AddTraceback("borg.hashindex.NSIndex.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4623 __pyx_r = -1;
4624 __pyx_L0:;
4625 __Pyx_RefNannyFinishContext();
4626 return __pyx_r;
4627 }
4628
4629 /* "borg/hashindex.pyx":222
4630 * raise Exception('hashindex_set failed')
4631 *
4632 * def __contains__(self, key): # <<<<<<<<<<<<<<
4633 * cdef uint32_t segment
4634 * assert len(key) == self.key_size
4635 */
4636
4637 /* Python wrapper */
4638 static int __pyx_pw_4borg_9hashindex_7NSIndex_5__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
__pyx_pw_4borg_9hashindex_7NSIndex_5__contains__(PyObject * __pyx_v_self,PyObject * __pyx_v_key)4639 static int __pyx_pw_4borg_9hashindex_7NSIndex_5__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
4640 int __pyx_r;
4641 __Pyx_RefNannyDeclarations
4642 __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
4643 __pyx_r = __pyx_pf_4borg_9hashindex_7NSIndex_4__contains__(((struct __pyx_obj_4borg_9hashindex_NSIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key));
4644
4645 /* function exit code */
4646 __Pyx_RefNannyFinishContext();
4647 return __pyx_r;
4648 }
4649
__pyx_pf_4borg_9hashindex_7NSIndex_4__contains__(struct __pyx_obj_4borg_9hashindex_NSIndex * __pyx_v_self,PyObject * __pyx_v_key)4650 static int __pyx_pf_4borg_9hashindex_7NSIndex_4__contains__(struct __pyx_obj_4borg_9hashindex_NSIndex *__pyx_v_self, PyObject *__pyx_v_key) {
4651 uint32_t __pyx_v_segment;
4652 uint32_t *__pyx_v_data;
4653 int __pyx_r;
4654 __Pyx_RefNannyDeclarations
4655 Py_ssize_t __pyx_t_1;
4656 char *__pyx_t_2;
4657 int __pyx_t_3;
4658 int __pyx_lineno = 0;
4659 const char *__pyx_filename = NULL;
4660 int __pyx_clineno = 0;
4661 __Pyx_RefNannySetupContext("__contains__", 0);
4662
4663 /* "borg/hashindex.pyx":224
4664 * def __contains__(self, key):
4665 * cdef uint32_t segment
4666 * assert len(key) == self.key_size # <<<<<<<<<<<<<<
4667 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
4668 * if data != NULL:
4669 */
4670 #ifndef CYTHON_WITHOUT_ASSERTIONS
4671 if (unlikely(!Py_OptimizeFlag)) {
4672 __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 224, __pyx_L1_error)
4673 if (unlikely(!((__pyx_t_1 == __pyx_v_self->__pyx_base.key_size) != 0))) {
4674 PyErr_SetNone(PyExc_AssertionError);
4675 __PYX_ERR(0, 224, __pyx_L1_error)
4676 }
4677 }
4678 #endif
4679
4680 /* "borg/hashindex.pyx":225
4681 * cdef uint32_t segment
4682 * assert len(key) == self.key_size
4683 * data = <uint32_t *>hashindex_get(self.index, <char *>key) # <<<<<<<<<<<<<<
4684 * if data != NULL:
4685 * segment = _le32toh(data[0])
4686 */
4687 __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L1_error)
4688 __pyx_v_data = ((uint32_t *)hashindex_get(__pyx_v_self->__pyx_base.index, ((char *)__pyx_t_2)));
4689
4690 /* "borg/hashindex.pyx":226
4691 * assert len(key) == self.key_size
4692 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
4693 * if data != NULL: # <<<<<<<<<<<<<<
4694 * segment = _le32toh(data[0])
4695 * assert segment <= _MAX_VALUE, "maximum number of segments reached"
4696 */
4697 __pyx_t_3 = ((__pyx_v_data != NULL) != 0);
4698 if (__pyx_t_3) {
4699
4700 /* "borg/hashindex.pyx":227
4701 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
4702 * if data != NULL:
4703 * segment = _le32toh(data[0]) # <<<<<<<<<<<<<<
4704 * assert segment <= _MAX_VALUE, "maximum number of segments reached"
4705 * return data != NULL
4706 */
4707 __pyx_v_segment = _le32toh((__pyx_v_data[0]));
4708
4709 /* "borg/hashindex.pyx":228
4710 * if data != NULL:
4711 * segment = _le32toh(data[0])
4712 * assert segment <= _MAX_VALUE, "maximum number of segments reached" # <<<<<<<<<<<<<<
4713 * return data != NULL
4714 *
4715 */
4716 #ifndef CYTHON_WITHOUT_ASSERTIONS
4717 if (unlikely(!Py_OptimizeFlag)) {
4718 if (unlikely(!((__pyx_v_segment <= _MAX_VALUE) != 0))) {
4719 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_maximum_number_of_segments_reach);
4720 __PYX_ERR(0, 228, __pyx_L1_error)
4721 }
4722 }
4723 #endif
4724
4725 /* "borg/hashindex.pyx":226
4726 * assert len(key) == self.key_size
4727 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
4728 * if data != NULL: # <<<<<<<<<<<<<<
4729 * segment = _le32toh(data[0])
4730 * assert segment <= _MAX_VALUE, "maximum number of segments reached"
4731 */
4732 }
4733
4734 /* "borg/hashindex.pyx":229
4735 * segment = _le32toh(data[0])
4736 * assert segment <= _MAX_VALUE, "maximum number of segments reached"
4737 * return data != NULL # <<<<<<<<<<<<<<
4738 *
4739 * def iteritems(self, marker=None):
4740 */
4741 __pyx_r = (__pyx_v_data != NULL);
4742 goto __pyx_L0;
4743
4744 /* "borg/hashindex.pyx":222
4745 * raise Exception('hashindex_set failed')
4746 *
4747 * def __contains__(self, key): # <<<<<<<<<<<<<<
4748 * cdef uint32_t segment
4749 * assert len(key) == self.key_size
4750 */
4751
4752 /* function exit code */
4753 __pyx_L1_error:;
4754 __Pyx_AddTraceback("borg.hashindex.NSIndex.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4755 __pyx_r = -1;
4756 __pyx_L0:;
4757 __Pyx_RefNannyFinishContext();
4758 return __pyx_r;
4759 }
4760
4761 /* "borg/hashindex.pyx":231
4762 * return data != NULL
4763 *
4764 * def iteritems(self, marker=None): # <<<<<<<<<<<<<<
4765 * cdef const void *key
4766 * iter = NSKeyIterator(self.key_size)
4767 */
4768
4769 /* Python wrapper */
4770 static PyObject *__pyx_pw_4borg_9hashindex_7NSIndex_7iteritems(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4borg_9hashindex_7NSIndex_7iteritems(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4771 static PyObject *__pyx_pw_4borg_9hashindex_7NSIndex_7iteritems(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4772 PyObject *__pyx_v_marker = 0;
4773 int __pyx_lineno = 0;
4774 const char *__pyx_filename = NULL;
4775 int __pyx_clineno = 0;
4776 PyObject *__pyx_r = 0;
4777 __Pyx_RefNannyDeclarations
4778 __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
4779 {
4780 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_marker,0};
4781 PyObject* values[1] = {0};
4782 values[0] = ((PyObject *)Py_None);
4783 if (unlikely(__pyx_kwds)) {
4784 Py_ssize_t kw_args;
4785 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4786 switch (pos_args) {
4787 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4788 CYTHON_FALLTHROUGH;
4789 case 0: break;
4790 default: goto __pyx_L5_argtuple_error;
4791 }
4792 kw_args = PyDict_Size(__pyx_kwds);
4793 switch (pos_args) {
4794 case 0:
4795 if (kw_args > 0) {
4796 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_marker);
4797 if (value) { values[0] = value; kw_args--; }
4798 }
4799 }
4800 if (unlikely(kw_args > 0)) {
4801 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iteritems") < 0)) __PYX_ERR(0, 231, __pyx_L3_error)
4802 }
4803 } else {
4804 switch (PyTuple_GET_SIZE(__pyx_args)) {
4805 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4806 CYTHON_FALLTHROUGH;
4807 case 0: break;
4808 default: goto __pyx_L5_argtuple_error;
4809 }
4810 }
4811 __pyx_v_marker = values[0];
4812 }
4813 goto __pyx_L4_argument_unpacking_done;
4814 __pyx_L5_argtuple_error:;
4815 __Pyx_RaiseArgtupleInvalid("iteritems", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 231, __pyx_L3_error)
4816 __pyx_L3_error:;
4817 __Pyx_AddTraceback("borg.hashindex.NSIndex.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
4818 __Pyx_RefNannyFinishContext();
4819 return NULL;
4820 __pyx_L4_argument_unpacking_done:;
4821 __pyx_r = __pyx_pf_4borg_9hashindex_7NSIndex_6iteritems(((struct __pyx_obj_4borg_9hashindex_NSIndex *)__pyx_v_self), __pyx_v_marker);
4822
4823 /* function exit code */
4824 __Pyx_RefNannyFinishContext();
4825 return __pyx_r;
4826 }
4827
__pyx_pf_4borg_9hashindex_7NSIndex_6iteritems(struct __pyx_obj_4borg_9hashindex_NSIndex * __pyx_v_self,PyObject * __pyx_v_marker)4828 static PyObject *__pyx_pf_4borg_9hashindex_7NSIndex_6iteritems(struct __pyx_obj_4borg_9hashindex_NSIndex *__pyx_v_self, PyObject *__pyx_v_marker) {
4829 void const *__pyx_v_key;
4830 struct __pyx_obj_4borg_9hashindex_NSKeyIterator *__pyx_v_iter = NULL;
4831 PyObject *__pyx_r = NULL;
4832 __Pyx_RefNannyDeclarations
4833 PyObject *__pyx_t_1 = NULL;
4834 PyObject *__pyx_t_2 = NULL;
4835 HashIndex *__pyx_t_3;
4836 int __pyx_t_4;
4837 char *__pyx_t_5;
4838 int __pyx_t_6;
4839 int __pyx_lineno = 0;
4840 const char *__pyx_filename = NULL;
4841 int __pyx_clineno = 0;
4842 __Pyx_RefNannySetupContext("iteritems", 0);
4843
4844 /* "borg/hashindex.pyx":233
4845 * def iteritems(self, marker=None):
4846 * cdef const void *key
4847 * iter = NSKeyIterator(self.key_size) # <<<<<<<<<<<<<<
4848 * iter.idx = self
4849 * iter.index = self.index
4850 */
4851 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->__pyx_base.key_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error)
4852 __Pyx_GOTREF(__pyx_t_1);
4853 __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4borg_9hashindex_NSKeyIterator), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error)
4854 __Pyx_GOTREF(__pyx_t_2);
4855 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4856 __pyx_v_iter = ((struct __pyx_obj_4borg_9hashindex_NSKeyIterator *)__pyx_t_2);
4857 __pyx_t_2 = 0;
4858
4859 /* "borg/hashindex.pyx":234
4860 * cdef const void *key
4861 * iter = NSKeyIterator(self.key_size)
4862 * iter.idx = self # <<<<<<<<<<<<<<
4863 * iter.index = self.index
4864 * if marker:
4865 */
4866 __Pyx_INCREF(((PyObject *)__pyx_v_self));
4867 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
4868 __Pyx_GOTREF(__pyx_v_iter->idx);
4869 __Pyx_DECREF(((PyObject *)__pyx_v_iter->idx));
4870 __pyx_v_iter->idx = __pyx_v_self;
4871
4872 /* "borg/hashindex.pyx":235
4873 * iter = NSKeyIterator(self.key_size)
4874 * iter.idx = self
4875 * iter.index = self.index # <<<<<<<<<<<<<<
4876 * if marker:
4877 * key = hashindex_get(self.index, <char *>marker)
4878 */
4879 __pyx_t_3 = __pyx_v_self->__pyx_base.index;
4880 __pyx_v_iter->index = __pyx_t_3;
4881
4882 /* "borg/hashindex.pyx":236
4883 * iter.idx = self
4884 * iter.index = self.index
4885 * if marker: # <<<<<<<<<<<<<<
4886 * key = hashindex_get(self.index, <char *>marker)
4887 * if marker is None:
4888 */
4889 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_marker); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 236, __pyx_L1_error)
4890 if (__pyx_t_4) {
4891
4892 /* "borg/hashindex.pyx":237
4893 * iter.index = self.index
4894 * if marker:
4895 * key = hashindex_get(self.index, <char *>marker) # <<<<<<<<<<<<<<
4896 * if marker is None:
4897 * raise IndexError
4898 */
4899 __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_v_marker); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L1_error)
4900 __pyx_v_key = hashindex_get(__pyx_v_self->__pyx_base.index, ((char *)__pyx_t_5));
4901
4902 /* "borg/hashindex.pyx":238
4903 * if marker:
4904 * key = hashindex_get(self.index, <char *>marker)
4905 * if marker is None: # <<<<<<<<<<<<<<
4906 * raise IndexError
4907 * iter.key = key - self.key_size
4908 */
4909 __pyx_t_4 = (__pyx_v_marker == Py_None);
4910 __pyx_t_6 = (__pyx_t_4 != 0);
4911 if (unlikely(__pyx_t_6)) {
4912
4913 /* "borg/hashindex.pyx":239
4914 * key = hashindex_get(self.index, <char *>marker)
4915 * if marker is None:
4916 * raise IndexError # <<<<<<<<<<<<<<
4917 * iter.key = key - self.key_size
4918 * return iter
4919 */
4920 __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0);
4921 __PYX_ERR(0, 239, __pyx_L1_error)
4922
4923 /* "borg/hashindex.pyx":238
4924 * if marker:
4925 * key = hashindex_get(self.index, <char *>marker)
4926 * if marker is None: # <<<<<<<<<<<<<<
4927 * raise IndexError
4928 * iter.key = key - self.key_size
4929 */
4930 }
4931
4932 /* "borg/hashindex.pyx":240
4933 * if marker is None:
4934 * raise IndexError
4935 * iter.key = key - self.key_size # <<<<<<<<<<<<<<
4936 * return iter
4937 *
4938 */
4939 __pyx_v_iter->key = (__pyx_v_key - __pyx_v_self->__pyx_base.key_size);
4940
4941 /* "borg/hashindex.pyx":236
4942 * iter.idx = self
4943 * iter.index = self.index
4944 * if marker: # <<<<<<<<<<<<<<
4945 * key = hashindex_get(self.index, <char *>marker)
4946 * if marker is None:
4947 */
4948 }
4949
4950 /* "borg/hashindex.pyx":241
4951 * raise IndexError
4952 * iter.key = key - self.key_size
4953 * return iter # <<<<<<<<<<<<<<
4954 *
4955 *
4956 */
4957 __Pyx_XDECREF(__pyx_r);
4958 __Pyx_INCREF(((PyObject *)__pyx_v_iter));
4959 __pyx_r = ((PyObject *)__pyx_v_iter);
4960 goto __pyx_L0;
4961
4962 /* "borg/hashindex.pyx":231
4963 * return data != NULL
4964 *
4965 * def iteritems(self, marker=None): # <<<<<<<<<<<<<<
4966 * cdef const void *key
4967 * iter = NSKeyIterator(self.key_size)
4968 */
4969
4970 /* function exit code */
4971 __pyx_L1_error:;
4972 __Pyx_XDECREF(__pyx_t_1);
4973 __Pyx_XDECREF(__pyx_t_2);
4974 __Pyx_AddTraceback("borg.hashindex.NSIndex.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
4975 __pyx_r = NULL;
4976 __pyx_L0:;
4977 __Pyx_XDECREF((PyObject *)__pyx_v_iter);
4978 __Pyx_XGIVEREF(__pyx_r);
4979 __Pyx_RefNannyFinishContext();
4980 return __pyx_r;
4981 }
4982
4983 /* "(tree fragment)":1
4984 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
4985 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4986 * def __setstate_cython__(self, __pyx_state):
4987 */
4988
4989 /* Python wrapper */
4990 static PyObject *__pyx_pw_4borg_9hashindex_7NSIndex_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4borg_9hashindex_7NSIndex_9__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)4991 static PyObject *__pyx_pw_4borg_9hashindex_7NSIndex_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4992 PyObject *__pyx_r = 0;
4993 __Pyx_RefNannyDeclarations
4994 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
4995 __pyx_r = __pyx_pf_4borg_9hashindex_7NSIndex_8__reduce_cython__(((struct __pyx_obj_4borg_9hashindex_NSIndex *)__pyx_v_self));
4996
4997 /* function exit code */
4998 __Pyx_RefNannyFinishContext();
4999 return __pyx_r;
5000 }
5001
__pyx_pf_4borg_9hashindex_7NSIndex_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_NSIndex * __pyx_v_self)5002 static PyObject *__pyx_pf_4borg_9hashindex_7NSIndex_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_NSIndex *__pyx_v_self) {
5003 PyObject *__pyx_r = NULL;
5004 __Pyx_RefNannyDeclarations
5005 PyObject *__pyx_t_1 = NULL;
5006 int __pyx_lineno = 0;
5007 const char *__pyx_filename = NULL;
5008 int __pyx_clineno = 0;
5009 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
5010
5011 /* "(tree fragment)":2
5012 * def __reduce_cython__(self):
5013 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
5014 * def __setstate_cython__(self, __pyx_state):
5015 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5016 */
5017 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
5018 __Pyx_GOTREF(__pyx_t_1);
5019 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5020 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5021 __PYX_ERR(1, 2, __pyx_L1_error)
5022
5023 /* "(tree fragment)":1
5024 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
5025 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5026 * def __setstate_cython__(self, __pyx_state):
5027 */
5028
5029 /* function exit code */
5030 __pyx_L1_error:;
5031 __Pyx_XDECREF(__pyx_t_1);
5032 __Pyx_AddTraceback("borg.hashindex.NSIndex.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5033 __pyx_r = NULL;
5034 __Pyx_XGIVEREF(__pyx_r);
5035 __Pyx_RefNannyFinishContext();
5036 return __pyx_r;
5037 }
5038
5039 /* "(tree fragment)":3
5040 * def __reduce_cython__(self):
5041 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5042 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
5043 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5044 */
5045
5046 /* Python wrapper */
5047 static PyObject *__pyx_pw_4borg_9hashindex_7NSIndex_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_4borg_9hashindex_7NSIndex_11__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)5048 static PyObject *__pyx_pw_4borg_9hashindex_7NSIndex_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
5049 PyObject *__pyx_r = 0;
5050 __Pyx_RefNannyDeclarations
5051 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
5052 __pyx_r = __pyx_pf_4borg_9hashindex_7NSIndex_10__setstate_cython__(((struct __pyx_obj_4borg_9hashindex_NSIndex *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
5053
5054 /* function exit code */
5055 __Pyx_RefNannyFinishContext();
5056 return __pyx_r;
5057 }
5058
__pyx_pf_4borg_9hashindex_7NSIndex_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_NSIndex * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)5059 static PyObject *__pyx_pf_4borg_9hashindex_7NSIndex_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_NSIndex *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
5060 PyObject *__pyx_r = NULL;
5061 __Pyx_RefNannyDeclarations
5062 PyObject *__pyx_t_1 = NULL;
5063 int __pyx_lineno = 0;
5064 const char *__pyx_filename = NULL;
5065 int __pyx_clineno = 0;
5066 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
5067
5068 /* "(tree fragment)":4
5069 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5070 * def __setstate_cython__(self, __pyx_state):
5071 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
5072 */
5073 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
5074 __Pyx_GOTREF(__pyx_t_1);
5075 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5076 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5077 __PYX_ERR(1, 4, __pyx_L1_error)
5078
5079 /* "(tree fragment)":3
5080 * def __reduce_cython__(self):
5081 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5082 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
5083 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5084 */
5085
5086 /* function exit code */
5087 __pyx_L1_error:;
5088 __Pyx_XDECREF(__pyx_t_1);
5089 __Pyx_AddTraceback("borg.hashindex.NSIndex.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5090 __pyx_r = NULL;
5091 __Pyx_XGIVEREF(__pyx_r);
5092 __Pyx_RefNannyFinishContext();
5093 return __pyx_r;
5094 }
5095
5096 /* "borg/hashindex.pyx":251
5097 * cdef int exhausted
5098 *
5099 * def __cinit__(self, key_size): # <<<<<<<<<<<<<<
5100 * self.key = NULL
5101 * self.key_size = key_size
5102 */
5103
5104 /* Python wrapper */
5105 static int __pyx_pw_4borg_9hashindex_13NSKeyIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4borg_9hashindex_13NSKeyIterator_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5106 static int __pyx_pw_4borg_9hashindex_13NSKeyIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5107 PyObject *__pyx_v_key_size = 0;
5108 int __pyx_lineno = 0;
5109 const char *__pyx_filename = NULL;
5110 int __pyx_clineno = 0;
5111 int __pyx_r;
5112 __Pyx_RefNannyDeclarations
5113 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
5114 {
5115 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key_size_2,0};
5116 PyObject* values[1] = {0};
5117 if (unlikely(__pyx_kwds)) {
5118 Py_ssize_t kw_args;
5119 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5120 switch (pos_args) {
5121 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5122 CYTHON_FALLTHROUGH;
5123 case 0: break;
5124 default: goto __pyx_L5_argtuple_error;
5125 }
5126 kw_args = PyDict_Size(__pyx_kwds);
5127 switch (pos_args) {
5128 case 0:
5129 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key_size_2)) != 0)) kw_args--;
5130 else goto __pyx_L5_argtuple_error;
5131 }
5132 if (unlikely(kw_args > 0)) {
5133 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 251, __pyx_L3_error)
5134 }
5135 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
5136 goto __pyx_L5_argtuple_error;
5137 } else {
5138 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5139 }
5140 __pyx_v_key_size = values[0];
5141 }
5142 goto __pyx_L4_argument_unpacking_done;
5143 __pyx_L5_argtuple_error:;
5144 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 251, __pyx_L3_error)
5145 __pyx_L3_error:;
5146 __Pyx_AddTraceback("borg.hashindex.NSKeyIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5147 __Pyx_RefNannyFinishContext();
5148 return -1;
5149 __pyx_L4_argument_unpacking_done:;
5150 __pyx_r = __pyx_pf_4borg_9hashindex_13NSKeyIterator___cinit__(((struct __pyx_obj_4borg_9hashindex_NSKeyIterator *)__pyx_v_self), __pyx_v_key_size);
5151
5152 /* function exit code */
5153 __Pyx_RefNannyFinishContext();
5154 return __pyx_r;
5155 }
5156
__pyx_pf_4borg_9hashindex_13NSKeyIterator___cinit__(struct __pyx_obj_4borg_9hashindex_NSKeyIterator * __pyx_v_self,PyObject * __pyx_v_key_size)5157 static int __pyx_pf_4borg_9hashindex_13NSKeyIterator___cinit__(struct __pyx_obj_4borg_9hashindex_NSKeyIterator *__pyx_v_self, PyObject *__pyx_v_key_size) {
5158 int __pyx_r;
5159 __Pyx_RefNannyDeclarations
5160 int __pyx_t_1;
5161 int __pyx_lineno = 0;
5162 const char *__pyx_filename = NULL;
5163 int __pyx_clineno = 0;
5164 __Pyx_RefNannySetupContext("__cinit__", 0);
5165
5166 /* "borg/hashindex.pyx":252
5167 *
5168 * def __cinit__(self, key_size):
5169 * self.key = NULL # <<<<<<<<<<<<<<
5170 * self.key_size = key_size
5171 * self.exhausted = 0
5172 */
5173 __pyx_v_self->key = NULL;
5174
5175 /* "borg/hashindex.pyx":253
5176 * def __cinit__(self, key_size):
5177 * self.key = NULL
5178 * self.key_size = key_size # <<<<<<<<<<<<<<
5179 * self.exhausted = 0
5180 *
5181 */
5182 __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_key_size); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 253, __pyx_L1_error)
5183 __pyx_v_self->key_size = __pyx_t_1;
5184
5185 /* "borg/hashindex.pyx":254
5186 * self.key = NULL
5187 * self.key_size = key_size
5188 * self.exhausted = 0 # <<<<<<<<<<<<<<
5189 *
5190 * def __iter__(self):
5191 */
5192 __pyx_v_self->exhausted = 0;
5193
5194 /* "borg/hashindex.pyx":251
5195 * cdef int exhausted
5196 *
5197 * def __cinit__(self, key_size): # <<<<<<<<<<<<<<
5198 * self.key = NULL
5199 * self.key_size = key_size
5200 */
5201
5202 /* function exit code */
5203 __pyx_r = 0;
5204 goto __pyx_L0;
5205 __pyx_L1_error:;
5206 __Pyx_AddTraceback("borg.hashindex.NSKeyIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5207 __pyx_r = -1;
5208 __pyx_L0:;
5209 __Pyx_RefNannyFinishContext();
5210 return __pyx_r;
5211 }
5212
5213 /* "borg/hashindex.pyx":256
5214 * self.exhausted = 0
5215 *
5216 * def __iter__(self): # <<<<<<<<<<<<<<
5217 * return self
5218 *
5219 */
5220
5221 /* Python wrapper */
5222 static PyObject *__pyx_pw_4borg_9hashindex_13NSKeyIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4borg_9hashindex_13NSKeyIterator_3__iter__(PyObject * __pyx_v_self)5223 static PyObject *__pyx_pw_4borg_9hashindex_13NSKeyIterator_3__iter__(PyObject *__pyx_v_self) {
5224 PyObject *__pyx_r = 0;
5225 __Pyx_RefNannyDeclarations
5226 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
5227 __pyx_r = __pyx_pf_4borg_9hashindex_13NSKeyIterator_2__iter__(((struct __pyx_obj_4borg_9hashindex_NSKeyIterator *)__pyx_v_self));
5228
5229 /* function exit code */
5230 __Pyx_RefNannyFinishContext();
5231 return __pyx_r;
5232 }
5233
__pyx_pf_4borg_9hashindex_13NSKeyIterator_2__iter__(struct __pyx_obj_4borg_9hashindex_NSKeyIterator * __pyx_v_self)5234 static PyObject *__pyx_pf_4borg_9hashindex_13NSKeyIterator_2__iter__(struct __pyx_obj_4borg_9hashindex_NSKeyIterator *__pyx_v_self) {
5235 PyObject *__pyx_r = NULL;
5236 __Pyx_RefNannyDeclarations
5237 __Pyx_RefNannySetupContext("__iter__", 0);
5238
5239 /* "borg/hashindex.pyx":257
5240 *
5241 * def __iter__(self):
5242 * return self # <<<<<<<<<<<<<<
5243 *
5244 * def __next__(self):
5245 */
5246 __Pyx_XDECREF(__pyx_r);
5247 __Pyx_INCREF(((PyObject *)__pyx_v_self));
5248 __pyx_r = ((PyObject *)__pyx_v_self);
5249 goto __pyx_L0;
5250
5251 /* "borg/hashindex.pyx":256
5252 * self.exhausted = 0
5253 *
5254 * def __iter__(self): # <<<<<<<<<<<<<<
5255 * return self
5256 *
5257 */
5258
5259 /* function exit code */
5260 __pyx_L0:;
5261 __Pyx_XGIVEREF(__pyx_r);
5262 __Pyx_RefNannyFinishContext();
5263 return __pyx_r;
5264 }
5265
5266 /* "borg/hashindex.pyx":259
5267 * return self
5268 *
5269 * def __next__(self): # <<<<<<<<<<<<<<
5270 * if self.exhausted:
5271 * raise StopIteration
5272 */
5273
5274 /* Python wrapper */
5275 static PyObject *__pyx_pw_4borg_9hashindex_13NSKeyIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4borg_9hashindex_13NSKeyIterator_5__next__(PyObject * __pyx_v_self)5276 static PyObject *__pyx_pw_4borg_9hashindex_13NSKeyIterator_5__next__(PyObject *__pyx_v_self) {
5277 PyObject *__pyx_r = 0;
5278 __Pyx_RefNannyDeclarations
5279 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
5280 __pyx_r = __pyx_pf_4borg_9hashindex_13NSKeyIterator_4__next__(((struct __pyx_obj_4borg_9hashindex_NSKeyIterator *)__pyx_v_self));
5281
5282 /* function exit code */
5283 __Pyx_RefNannyFinishContext();
5284 return __pyx_r;
5285 }
5286
__pyx_pf_4borg_9hashindex_13NSKeyIterator_4__next__(struct __pyx_obj_4borg_9hashindex_NSKeyIterator * __pyx_v_self)5287 static PyObject *__pyx_pf_4borg_9hashindex_13NSKeyIterator_4__next__(struct __pyx_obj_4borg_9hashindex_NSKeyIterator *__pyx_v_self) {
5288 uint32_t *__pyx_v_value;
5289 uint32_t __pyx_v_segment;
5290 PyObject *__pyx_r = NULL;
5291 __Pyx_RefNannyDeclarations
5292 int __pyx_t_1;
5293 PyObject *__pyx_t_2 = NULL;
5294 PyObject *__pyx_t_3 = NULL;
5295 PyObject *__pyx_t_4 = NULL;
5296 PyObject *__pyx_t_5 = NULL;
5297 int __pyx_lineno = 0;
5298 const char *__pyx_filename = NULL;
5299 int __pyx_clineno = 0;
5300 __Pyx_RefNannySetupContext("__next__", 0);
5301
5302 /* "borg/hashindex.pyx":260
5303 *
5304 * def __next__(self):
5305 * if self.exhausted: # <<<<<<<<<<<<<<
5306 * raise StopIteration
5307 * self.key = hashindex_next_key(self.index, <char *>self.key)
5308 */
5309 __pyx_t_1 = (__pyx_v_self->exhausted != 0);
5310 if (unlikely(__pyx_t_1)) {
5311
5312 /* "borg/hashindex.pyx":261
5313 * def __next__(self):
5314 * if self.exhausted:
5315 * raise StopIteration # <<<<<<<<<<<<<<
5316 * self.key = hashindex_next_key(self.index, <char *>self.key)
5317 * if not self.key:
5318 */
5319 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
5320 __PYX_ERR(0, 261, __pyx_L1_error)
5321
5322 /* "borg/hashindex.pyx":260
5323 *
5324 * def __next__(self):
5325 * if self.exhausted: # <<<<<<<<<<<<<<
5326 * raise StopIteration
5327 * self.key = hashindex_next_key(self.index, <char *>self.key)
5328 */
5329 }
5330
5331 /* "borg/hashindex.pyx":262
5332 * if self.exhausted:
5333 * raise StopIteration
5334 * self.key = hashindex_next_key(self.index, <char *>self.key) # <<<<<<<<<<<<<<
5335 * if not self.key:
5336 * self.exhausted = 1
5337 */
5338 __pyx_v_self->key = hashindex_next_key(__pyx_v_self->index, ((char *)__pyx_v_self->key));
5339
5340 /* "borg/hashindex.pyx":263
5341 * raise StopIteration
5342 * self.key = hashindex_next_key(self.index, <char *>self.key)
5343 * if not self.key: # <<<<<<<<<<<<<<
5344 * self.exhausted = 1
5345 * raise StopIteration
5346 */
5347 __pyx_t_1 = ((!(__pyx_v_self->key != 0)) != 0);
5348 if (unlikely(__pyx_t_1)) {
5349
5350 /* "borg/hashindex.pyx":264
5351 * self.key = hashindex_next_key(self.index, <char *>self.key)
5352 * if not self.key:
5353 * self.exhausted = 1 # <<<<<<<<<<<<<<
5354 * raise StopIteration
5355 * cdef uint32_t *value = <uint32_t *>(self.key + self.key_size)
5356 */
5357 __pyx_v_self->exhausted = 1;
5358
5359 /* "borg/hashindex.pyx":265
5360 * if not self.key:
5361 * self.exhausted = 1
5362 * raise StopIteration # <<<<<<<<<<<<<<
5363 * cdef uint32_t *value = <uint32_t *>(self.key + self.key_size)
5364 * cdef uint32_t segment = _le32toh(value[0])
5365 */
5366 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
5367 __PYX_ERR(0, 265, __pyx_L1_error)
5368
5369 /* "borg/hashindex.pyx":263
5370 * raise StopIteration
5371 * self.key = hashindex_next_key(self.index, <char *>self.key)
5372 * if not self.key: # <<<<<<<<<<<<<<
5373 * self.exhausted = 1
5374 * raise StopIteration
5375 */
5376 }
5377
5378 /* "borg/hashindex.pyx":266
5379 * self.exhausted = 1
5380 * raise StopIteration
5381 * cdef uint32_t *value = <uint32_t *>(self.key + self.key_size) # <<<<<<<<<<<<<<
5382 * cdef uint32_t segment = _le32toh(value[0])
5383 * assert segment <= _MAX_VALUE, "maximum number of segments reached"
5384 */
5385 __pyx_v_value = ((uint32_t *)(__pyx_v_self->key + __pyx_v_self->key_size));
5386
5387 /* "borg/hashindex.pyx":267
5388 * raise StopIteration
5389 * cdef uint32_t *value = <uint32_t *>(self.key + self.key_size)
5390 * cdef uint32_t segment = _le32toh(value[0]) # <<<<<<<<<<<<<<
5391 * assert segment <= _MAX_VALUE, "maximum number of segments reached"
5392 * return (<char *>self.key)[:self.key_size], (segment, _le32toh(value[1]))
5393 */
5394 __pyx_v_segment = _le32toh((__pyx_v_value[0]));
5395
5396 /* "borg/hashindex.pyx":268
5397 * cdef uint32_t *value = <uint32_t *>(self.key + self.key_size)
5398 * cdef uint32_t segment = _le32toh(value[0])
5399 * assert segment <= _MAX_VALUE, "maximum number of segments reached" # <<<<<<<<<<<<<<
5400 * return (<char *>self.key)[:self.key_size], (segment, _le32toh(value[1]))
5401 *
5402 */
5403 #ifndef CYTHON_WITHOUT_ASSERTIONS
5404 if (unlikely(!Py_OptimizeFlag)) {
5405 if (unlikely(!((__pyx_v_segment <= _MAX_VALUE) != 0))) {
5406 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_maximum_number_of_segments_reach);
5407 __PYX_ERR(0, 268, __pyx_L1_error)
5408 }
5409 }
5410 #endif
5411
5412 /* "borg/hashindex.pyx":269
5413 * cdef uint32_t segment = _le32toh(value[0])
5414 * assert segment <= _MAX_VALUE, "maximum number of segments reached"
5415 * return (<char *>self.key)[:self.key_size], (segment, _le32toh(value[1])) # <<<<<<<<<<<<<<
5416 *
5417 *
5418 */
5419 __Pyx_XDECREF(__pyx_r);
5420 __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((char *)__pyx_v_self->key) + 0, __pyx_v_self->key_size - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
5421 __Pyx_GOTREF(__pyx_t_2);
5422 __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_segment); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error)
5423 __Pyx_GOTREF(__pyx_t_3);
5424 __pyx_t_4 = __Pyx_PyInt_From_uint32_t(_le32toh((__pyx_v_value[1]))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 269, __pyx_L1_error)
5425 __Pyx_GOTREF(__pyx_t_4);
5426 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 269, __pyx_L1_error)
5427 __Pyx_GOTREF(__pyx_t_5);
5428 __Pyx_GIVEREF(__pyx_t_3);
5429 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
5430 __Pyx_GIVEREF(__pyx_t_4);
5431 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
5432 __pyx_t_3 = 0;
5433 __pyx_t_4 = 0;
5434 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 269, __pyx_L1_error)
5435 __Pyx_GOTREF(__pyx_t_4);
5436 __Pyx_GIVEREF(__pyx_t_2);
5437 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
5438 __Pyx_GIVEREF(__pyx_t_5);
5439 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
5440 __pyx_t_2 = 0;
5441 __pyx_t_5 = 0;
5442 __pyx_r = __pyx_t_4;
5443 __pyx_t_4 = 0;
5444 goto __pyx_L0;
5445
5446 /* "borg/hashindex.pyx":259
5447 * return self
5448 *
5449 * def __next__(self): # <<<<<<<<<<<<<<
5450 * if self.exhausted:
5451 * raise StopIteration
5452 */
5453
5454 /* function exit code */
5455 __pyx_L1_error:;
5456 __Pyx_XDECREF(__pyx_t_2);
5457 __Pyx_XDECREF(__pyx_t_3);
5458 __Pyx_XDECREF(__pyx_t_4);
5459 __Pyx_XDECREF(__pyx_t_5);
5460 __Pyx_AddTraceback("borg.hashindex.NSKeyIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5461 __pyx_r = NULL;
5462 __pyx_L0:;
5463 __Pyx_XGIVEREF(__pyx_r);
5464 __Pyx_RefNannyFinishContext();
5465 return __pyx_r;
5466 }
5467
5468 /* "(tree fragment)":1
5469 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
5470 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5471 * def __setstate_cython__(self, __pyx_state):
5472 */
5473
5474 /* Python wrapper */
5475 static PyObject *__pyx_pw_4borg_9hashindex_13NSKeyIterator_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4borg_9hashindex_13NSKeyIterator_7__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)5476 static PyObject *__pyx_pw_4borg_9hashindex_13NSKeyIterator_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5477 PyObject *__pyx_r = 0;
5478 __Pyx_RefNannyDeclarations
5479 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
5480 __pyx_r = __pyx_pf_4borg_9hashindex_13NSKeyIterator_6__reduce_cython__(((struct __pyx_obj_4borg_9hashindex_NSKeyIterator *)__pyx_v_self));
5481
5482 /* function exit code */
5483 __Pyx_RefNannyFinishContext();
5484 return __pyx_r;
5485 }
5486
__pyx_pf_4borg_9hashindex_13NSKeyIterator_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_NSKeyIterator * __pyx_v_self)5487 static PyObject *__pyx_pf_4borg_9hashindex_13NSKeyIterator_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_NSKeyIterator *__pyx_v_self) {
5488 PyObject *__pyx_r = NULL;
5489 __Pyx_RefNannyDeclarations
5490 PyObject *__pyx_t_1 = NULL;
5491 int __pyx_lineno = 0;
5492 const char *__pyx_filename = NULL;
5493 int __pyx_clineno = 0;
5494 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
5495
5496 /* "(tree fragment)":2
5497 * def __reduce_cython__(self):
5498 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
5499 * def __setstate_cython__(self, __pyx_state):
5500 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5501 */
5502 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
5503 __Pyx_GOTREF(__pyx_t_1);
5504 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5505 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5506 __PYX_ERR(1, 2, __pyx_L1_error)
5507
5508 /* "(tree fragment)":1
5509 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
5510 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5511 * def __setstate_cython__(self, __pyx_state):
5512 */
5513
5514 /* function exit code */
5515 __pyx_L1_error:;
5516 __Pyx_XDECREF(__pyx_t_1);
5517 __Pyx_AddTraceback("borg.hashindex.NSKeyIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5518 __pyx_r = NULL;
5519 __Pyx_XGIVEREF(__pyx_r);
5520 __Pyx_RefNannyFinishContext();
5521 return __pyx_r;
5522 }
5523
5524 /* "(tree fragment)":3
5525 * def __reduce_cython__(self):
5526 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5527 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
5528 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5529 */
5530
5531 /* Python wrapper */
5532 static PyObject *__pyx_pw_4borg_9hashindex_13NSKeyIterator_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_4borg_9hashindex_13NSKeyIterator_9__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)5533 static PyObject *__pyx_pw_4borg_9hashindex_13NSKeyIterator_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
5534 PyObject *__pyx_r = 0;
5535 __Pyx_RefNannyDeclarations
5536 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
5537 __pyx_r = __pyx_pf_4borg_9hashindex_13NSKeyIterator_8__setstate_cython__(((struct __pyx_obj_4borg_9hashindex_NSKeyIterator *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
5538
5539 /* function exit code */
5540 __Pyx_RefNannyFinishContext();
5541 return __pyx_r;
5542 }
5543
__pyx_pf_4borg_9hashindex_13NSKeyIterator_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_NSKeyIterator * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)5544 static PyObject *__pyx_pf_4borg_9hashindex_13NSKeyIterator_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_NSKeyIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
5545 PyObject *__pyx_r = NULL;
5546 __Pyx_RefNannyDeclarations
5547 PyObject *__pyx_t_1 = NULL;
5548 int __pyx_lineno = 0;
5549 const char *__pyx_filename = NULL;
5550 int __pyx_clineno = 0;
5551 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
5552
5553 /* "(tree fragment)":4
5554 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5555 * def __setstate_cython__(self, __pyx_state):
5556 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
5557 */
5558 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
5559 __Pyx_GOTREF(__pyx_t_1);
5560 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5561 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5562 __PYX_ERR(1, 4, __pyx_L1_error)
5563
5564 /* "(tree fragment)":3
5565 * def __reduce_cython__(self):
5566 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5567 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
5568 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5569 */
5570
5571 /* function exit code */
5572 __pyx_L1_error:;
5573 __Pyx_XDECREF(__pyx_t_1);
5574 __Pyx_AddTraceback("borg.hashindex.NSKeyIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5575 __pyx_r = NULL;
5576 __Pyx_XGIVEREF(__pyx_r);
5577 __Pyx_RefNannyFinishContext();
5578 return __pyx_r;
5579 }
5580
5581 /* "borg/hashindex.pyx":294
5582 * value_size = 12
5583 *
5584 * def __getitem__(self, key): # <<<<<<<<<<<<<<
5585 * assert len(key) == self.key_size
5586 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
5587 */
5588
5589 /* Python wrapper */
5590 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_1__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
__pyx_pw_4borg_9hashindex_10ChunkIndex_1__getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_key)5591 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_1__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
5592 PyObject *__pyx_r = 0;
5593 __Pyx_RefNannyDeclarations
5594 __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
5595 __pyx_r = __pyx_pf_4borg_9hashindex_10ChunkIndex___getitem__(((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key));
5596
5597 /* function exit code */
5598 __Pyx_RefNannyFinishContext();
5599 return __pyx_r;
5600 }
5601
__pyx_pf_4borg_9hashindex_10ChunkIndex___getitem__(struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_self,PyObject * __pyx_v_key)5602 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex___getitem__(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, PyObject *__pyx_v_key) {
5603 uint32_t *__pyx_v_data;
5604 uint32_t __pyx_v_refcount;
5605 PyObject *__pyx_r = NULL;
5606 __Pyx_RefNannyDeclarations
5607 Py_ssize_t __pyx_t_1;
5608 char *__pyx_t_2;
5609 int __pyx_t_3;
5610 PyObject *__pyx_t_4 = NULL;
5611 PyObject *__pyx_t_5 = NULL;
5612 PyObject *__pyx_t_6 = NULL;
5613 PyObject *__pyx_t_7 = NULL;
5614 PyObject *__pyx_t_8 = NULL;
5615 PyObject *__pyx_t_9 = NULL;
5616 int __pyx_t_10;
5617 PyObject *__pyx_t_11 = NULL;
5618 int __pyx_lineno = 0;
5619 const char *__pyx_filename = NULL;
5620 int __pyx_clineno = 0;
5621 __Pyx_RefNannySetupContext("__getitem__", 0);
5622
5623 /* "borg/hashindex.pyx":295
5624 *
5625 * def __getitem__(self, key):
5626 * assert len(key) == self.key_size # <<<<<<<<<<<<<<
5627 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
5628 * if not data:
5629 */
5630 #ifndef CYTHON_WITHOUT_ASSERTIONS
5631 if (unlikely(!Py_OptimizeFlag)) {
5632 __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 295, __pyx_L1_error)
5633 if (unlikely(!((__pyx_t_1 == __pyx_v_self->__pyx_base.key_size) != 0))) {
5634 PyErr_SetNone(PyExc_AssertionError);
5635 __PYX_ERR(0, 295, __pyx_L1_error)
5636 }
5637 }
5638 #endif
5639
5640 /* "borg/hashindex.pyx":296
5641 * def __getitem__(self, key):
5642 * assert len(key) == self.key_size
5643 * data = <uint32_t *>hashindex_get(self.index, <char *>key) # <<<<<<<<<<<<<<
5644 * if not data:
5645 * raise KeyError(key)
5646 */
5647 __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L1_error)
5648 __pyx_v_data = ((uint32_t *)hashindex_get(__pyx_v_self->__pyx_base.index, ((char *)__pyx_t_2)));
5649
5650 /* "borg/hashindex.pyx":297
5651 * assert len(key) == self.key_size
5652 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
5653 * if not data: # <<<<<<<<<<<<<<
5654 * raise KeyError(key)
5655 * cdef uint32_t refcount = _le32toh(data[0])
5656 */
5657 __pyx_t_3 = ((!(__pyx_v_data != 0)) != 0);
5658 if (unlikely(__pyx_t_3)) {
5659
5660 /* "borg/hashindex.pyx":298
5661 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
5662 * if not data:
5663 * raise KeyError(key) # <<<<<<<<<<<<<<
5664 * cdef uint32_t refcount = _le32toh(data[0])
5665 * assert refcount <= _MAX_VALUE, "invalid reference count"
5666 */
5667 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error)
5668 __Pyx_GOTREF(__pyx_t_4);
5669 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
5670 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5671 __PYX_ERR(0, 298, __pyx_L1_error)
5672
5673 /* "borg/hashindex.pyx":297
5674 * assert len(key) == self.key_size
5675 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
5676 * if not data: # <<<<<<<<<<<<<<
5677 * raise KeyError(key)
5678 * cdef uint32_t refcount = _le32toh(data[0])
5679 */
5680 }
5681
5682 /* "borg/hashindex.pyx":299
5683 * if not data:
5684 * raise KeyError(key)
5685 * cdef uint32_t refcount = _le32toh(data[0]) # <<<<<<<<<<<<<<
5686 * assert refcount <= _MAX_VALUE, "invalid reference count"
5687 * return ChunkIndexEntry(refcount, _le32toh(data[1]), _le32toh(data[2]))
5688 */
5689 __pyx_v_refcount = _le32toh((__pyx_v_data[0]));
5690
5691 /* "borg/hashindex.pyx":300
5692 * raise KeyError(key)
5693 * cdef uint32_t refcount = _le32toh(data[0])
5694 * assert refcount <= _MAX_VALUE, "invalid reference count" # <<<<<<<<<<<<<<
5695 * return ChunkIndexEntry(refcount, _le32toh(data[1]), _le32toh(data[2]))
5696 *
5697 */
5698 #ifndef CYTHON_WITHOUT_ASSERTIONS
5699 if (unlikely(!Py_OptimizeFlag)) {
5700 if (unlikely(!((__pyx_v_refcount <= _MAX_VALUE) != 0))) {
5701 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_invalid_reference_count);
5702 __PYX_ERR(0, 300, __pyx_L1_error)
5703 }
5704 }
5705 #endif
5706
5707 /* "borg/hashindex.pyx":301
5708 * cdef uint32_t refcount = _le32toh(data[0])
5709 * assert refcount <= _MAX_VALUE, "invalid reference count"
5710 * return ChunkIndexEntry(refcount, _le32toh(data[1]), _le32toh(data[2])) # <<<<<<<<<<<<<<
5711 *
5712 * def __setitem__(self, key, value):
5713 */
5714 __Pyx_XDECREF(__pyx_r);
5715 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ChunkIndexEntry); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 301, __pyx_L1_error)
5716 __Pyx_GOTREF(__pyx_t_5);
5717 __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_refcount); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 301, __pyx_L1_error)
5718 __Pyx_GOTREF(__pyx_t_6);
5719 __pyx_t_7 = __Pyx_PyInt_From_uint32_t(_le32toh((__pyx_v_data[1]))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 301, __pyx_L1_error)
5720 __Pyx_GOTREF(__pyx_t_7);
5721 __pyx_t_8 = __Pyx_PyInt_From_uint32_t(_le32toh((__pyx_v_data[2]))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 301, __pyx_L1_error)
5722 __Pyx_GOTREF(__pyx_t_8);
5723 __pyx_t_9 = NULL;
5724 __pyx_t_10 = 0;
5725 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
5726 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
5727 if (likely(__pyx_t_9)) {
5728 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5729 __Pyx_INCREF(__pyx_t_9);
5730 __Pyx_INCREF(function);
5731 __Pyx_DECREF_SET(__pyx_t_5, function);
5732 __pyx_t_10 = 1;
5733 }
5734 }
5735 #if CYTHON_FAST_PYCALL
5736 if (PyFunction_Check(__pyx_t_5)) {
5737 PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_6, __pyx_t_7, __pyx_t_8};
5738 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error)
5739 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5740 __Pyx_GOTREF(__pyx_t_4);
5741 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5742 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5743 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5744 } else
5745 #endif
5746 #if CYTHON_FAST_PYCCALL
5747 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
5748 PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_6, __pyx_t_7, __pyx_t_8};
5749 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error)
5750 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5751 __Pyx_GOTREF(__pyx_t_4);
5752 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5753 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5754 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5755 } else
5756 #endif
5757 {
5758 __pyx_t_11 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 301, __pyx_L1_error)
5759 __Pyx_GOTREF(__pyx_t_11);
5760 if (__pyx_t_9) {
5761 __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
5762 }
5763 __Pyx_GIVEREF(__pyx_t_6);
5764 PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_6);
5765 __Pyx_GIVEREF(__pyx_t_7);
5766 PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_7);
5767 __Pyx_GIVEREF(__pyx_t_8);
5768 PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_8);
5769 __pyx_t_6 = 0;
5770 __pyx_t_7 = 0;
5771 __pyx_t_8 = 0;
5772 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error)
5773 __Pyx_GOTREF(__pyx_t_4);
5774 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5775 }
5776 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5777 __pyx_r = __pyx_t_4;
5778 __pyx_t_4 = 0;
5779 goto __pyx_L0;
5780
5781 /* "borg/hashindex.pyx":294
5782 * value_size = 12
5783 *
5784 * def __getitem__(self, key): # <<<<<<<<<<<<<<
5785 * assert len(key) == self.key_size
5786 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
5787 */
5788
5789 /* function exit code */
5790 __pyx_L1_error:;
5791 __Pyx_XDECREF(__pyx_t_4);
5792 __Pyx_XDECREF(__pyx_t_5);
5793 __Pyx_XDECREF(__pyx_t_6);
5794 __Pyx_XDECREF(__pyx_t_7);
5795 __Pyx_XDECREF(__pyx_t_8);
5796 __Pyx_XDECREF(__pyx_t_9);
5797 __Pyx_XDECREF(__pyx_t_11);
5798 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5799 __pyx_r = NULL;
5800 __pyx_L0:;
5801 __Pyx_XGIVEREF(__pyx_r);
5802 __Pyx_RefNannyFinishContext();
5803 return __pyx_r;
5804 }
5805
5806 /* "borg/hashindex.pyx":303
5807 * return ChunkIndexEntry(refcount, _le32toh(data[1]), _le32toh(data[2]))
5808 *
5809 * def __setitem__(self, key, value): # <<<<<<<<<<<<<<
5810 * assert len(key) == self.key_size
5811 * cdef uint32_t[3] data
5812 */
5813
5814 /* Python wrapper */
5815 static int __pyx_pw_4borg_9hashindex_10ChunkIndex_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_4borg_9hashindex_10ChunkIndex_3__setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_key,PyObject * __pyx_v_value)5816 static int __pyx_pw_4borg_9hashindex_10ChunkIndex_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
5817 int __pyx_r;
5818 __Pyx_RefNannyDeclarations
5819 __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
5820 __pyx_r = __pyx_pf_4borg_9hashindex_10ChunkIndex_2__setitem__(((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));
5821
5822 /* function exit code */
5823 __Pyx_RefNannyFinishContext();
5824 return __pyx_r;
5825 }
5826
__pyx_pf_4borg_9hashindex_10ChunkIndex_2__setitem__(struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_self,PyObject * __pyx_v_key,PyObject * __pyx_v_value)5827 static int __pyx_pf_4borg_9hashindex_10ChunkIndex_2__setitem__(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
5828 uint32_t __pyx_v_data[3];
5829 uint32_t __pyx_v_refcount;
5830 int __pyx_r;
5831 __Pyx_RefNannyDeclarations
5832 Py_ssize_t __pyx_t_1;
5833 PyObject *__pyx_t_2 = NULL;
5834 uint32_t __pyx_t_3;
5835 char *__pyx_t_4;
5836 int __pyx_t_5;
5837 int __pyx_lineno = 0;
5838 const char *__pyx_filename = NULL;
5839 int __pyx_clineno = 0;
5840 __Pyx_RefNannySetupContext("__setitem__", 0);
5841
5842 /* "borg/hashindex.pyx":304
5843 *
5844 * def __setitem__(self, key, value):
5845 * assert len(key) == self.key_size # <<<<<<<<<<<<<<
5846 * cdef uint32_t[3] data
5847 * cdef uint32_t refcount = value[0]
5848 */
5849 #ifndef CYTHON_WITHOUT_ASSERTIONS
5850 if (unlikely(!Py_OptimizeFlag)) {
5851 __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 304, __pyx_L1_error)
5852 if (unlikely(!((__pyx_t_1 == __pyx_v_self->__pyx_base.key_size) != 0))) {
5853 PyErr_SetNone(PyExc_AssertionError);
5854 __PYX_ERR(0, 304, __pyx_L1_error)
5855 }
5856 }
5857 #endif
5858
5859 /* "borg/hashindex.pyx":306
5860 * assert len(key) == self.key_size
5861 * cdef uint32_t[3] data
5862 * cdef uint32_t refcount = value[0] # <<<<<<<<<<<<<<
5863 * assert refcount <= _MAX_VALUE, "invalid reference count"
5864 * data[0] = _htole32(refcount)
5865 */
5866 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error)
5867 __Pyx_GOTREF(__pyx_t_2);
5868 __pyx_t_3 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_3 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 306, __pyx_L1_error)
5869 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5870 __pyx_v_refcount = __pyx_t_3;
5871
5872 /* "borg/hashindex.pyx":307
5873 * cdef uint32_t[3] data
5874 * cdef uint32_t refcount = value[0]
5875 * assert refcount <= _MAX_VALUE, "invalid reference count" # <<<<<<<<<<<<<<
5876 * data[0] = _htole32(refcount)
5877 * data[1] = _htole32(value[1])
5878 */
5879 #ifndef CYTHON_WITHOUT_ASSERTIONS
5880 if (unlikely(!Py_OptimizeFlag)) {
5881 if (unlikely(!((__pyx_v_refcount <= _MAX_VALUE) != 0))) {
5882 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_invalid_reference_count);
5883 __PYX_ERR(0, 307, __pyx_L1_error)
5884 }
5885 }
5886 #endif
5887
5888 /* "borg/hashindex.pyx":308
5889 * cdef uint32_t refcount = value[0]
5890 * assert refcount <= _MAX_VALUE, "invalid reference count"
5891 * data[0] = _htole32(refcount) # <<<<<<<<<<<<<<
5892 * data[1] = _htole32(value[1])
5893 * data[2] = _htole32(value[2])
5894 */
5895 (__pyx_v_data[0]) = _htole32(__pyx_v_refcount);
5896
5897 /* "borg/hashindex.pyx":309
5898 * assert refcount <= _MAX_VALUE, "invalid reference count"
5899 * data[0] = _htole32(refcount)
5900 * data[1] = _htole32(value[1]) # <<<<<<<<<<<<<<
5901 * data[2] = _htole32(value[2])
5902 * if not hashindex_set(self.index, <char *>key, data):
5903 */
5904 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error)
5905 __Pyx_GOTREF(__pyx_t_2);
5906 __pyx_t_3 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_3 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L1_error)
5907 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5908 (__pyx_v_data[1]) = _htole32(__pyx_t_3);
5909
5910 /* "borg/hashindex.pyx":310
5911 * data[0] = _htole32(refcount)
5912 * data[1] = _htole32(value[1])
5913 * data[2] = _htole32(value[2]) # <<<<<<<<<<<<<<
5914 * if not hashindex_set(self.index, <char *>key, data):
5915 * raise Exception('hashindex_set failed')
5916 */
5917 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error)
5918 __Pyx_GOTREF(__pyx_t_2);
5919 __pyx_t_3 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_3 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 310, __pyx_L1_error)
5920 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5921 (__pyx_v_data[2]) = _htole32(__pyx_t_3);
5922
5923 /* "borg/hashindex.pyx":311
5924 * data[1] = _htole32(value[1])
5925 * data[2] = _htole32(value[2])
5926 * if not hashindex_set(self.index, <char *>key, data): # <<<<<<<<<<<<<<
5927 * raise Exception('hashindex_set failed')
5928 *
5929 */
5930 __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 311, __pyx_L1_error)
5931 __pyx_t_5 = ((!(hashindex_set(__pyx_v_self->__pyx_base.index, ((char *)__pyx_t_4), __pyx_v_data) != 0)) != 0);
5932 if (unlikely(__pyx_t_5)) {
5933
5934 /* "borg/hashindex.pyx":312
5935 * data[2] = _htole32(value[2])
5936 * if not hashindex_set(self.index, <char *>key, data):
5937 * raise Exception('hashindex_set failed') # <<<<<<<<<<<<<<
5938 *
5939 * def __contains__(self, key):
5940 */
5941 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L1_error)
5942 __Pyx_GOTREF(__pyx_t_2);
5943 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5944 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5945 __PYX_ERR(0, 312, __pyx_L1_error)
5946
5947 /* "borg/hashindex.pyx":311
5948 * data[1] = _htole32(value[1])
5949 * data[2] = _htole32(value[2])
5950 * if not hashindex_set(self.index, <char *>key, data): # <<<<<<<<<<<<<<
5951 * raise Exception('hashindex_set failed')
5952 *
5953 */
5954 }
5955
5956 /* "borg/hashindex.pyx":303
5957 * return ChunkIndexEntry(refcount, _le32toh(data[1]), _le32toh(data[2]))
5958 *
5959 * def __setitem__(self, key, value): # <<<<<<<<<<<<<<
5960 * assert len(key) == self.key_size
5961 * cdef uint32_t[3] data
5962 */
5963
5964 /* function exit code */
5965 __pyx_r = 0;
5966 goto __pyx_L0;
5967 __pyx_L1_error:;
5968 __Pyx_XDECREF(__pyx_t_2);
5969 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5970 __pyx_r = -1;
5971 __pyx_L0:;
5972 __Pyx_RefNannyFinishContext();
5973 return __pyx_r;
5974 }
5975
5976 /* "borg/hashindex.pyx":314
5977 * raise Exception('hashindex_set failed')
5978 *
5979 * def __contains__(self, key): # <<<<<<<<<<<<<<
5980 * assert len(key) == self.key_size
5981 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
5982 */
5983
5984 /* Python wrapper */
5985 static int __pyx_pw_4borg_9hashindex_10ChunkIndex_5__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
__pyx_pw_4borg_9hashindex_10ChunkIndex_5__contains__(PyObject * __pyx_v_self,PyObject * __pyx_v_key)5986 static int __pyx_pw_4borg_9hashindex_10ChunkIndex_5__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
5987 int __pyx_r;
5988 __Pyx_RefNannyDeclarations
5989 __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
5990 __pyx_r = __pyx_pf_4borg_9hashindex_10ChunkIndex_4__contains__(((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key));
5991
5992 /* function exit code */
5993 __Pyx_RefNannyFinishContext();
5994 return __pyx_r;
5995 }
5996
__pyx_pf_4borg_9hashindex_10ChunkIndex_4__contains__(struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_self,PyObject * __pyx_v_key)5997 static int __pyx_pf_4borg_9hashindex_10ChunkIndex_4__contains__(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, PyObject *__pyx_v_key) {
5998 uint32_t *__pyx_v_data;
5999 int __pyx_r;
6000 __Pyx_RefNannyDeclarations
6001 Py_ssize_t __pyx_t_1;
6002 char *__pyx_t_2;
6003 int __pyx_t_3;
6004 int __pyx_lineno = 0;
6005 const char *__pyx_filename = NULL;
6006 int __pyx_clineno = 0;
6007 __Pyx_RefNannySetupContext("__contains__", 0);
6008
6009 /* "borg/hashindex.pyx":315
6010 *
6011 * def __contains__(self, key):
6012 * assert len(key) == self.key_size # <<<<<<<<<<<<<<
6013 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
6014 * if data != NULL:
6015 */
6016 #ifndef CYTHON_WITHOUT_ASSERTIONS
6017 if (unlikely(!Py_OptimizeFlag)) {
6018 __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 315, __pyx_L1_error)
6019 if (unlikely(!((__pyx_t_1 == __pyx_v_self->__pyx_base.key_size) != 0))) {
6020 PyErr_SetNone(PyExc_AssertionError);
6021 __PYX_ERR(0, 315, __pyx_L1_error)
6022 }
6023 }
6024 #endif
6025
6026 /* "borg/hashindex.pyx":316
6027 * def __contains__(self, key):
6028 * assert len(key) == self.key_size
6029 * data = <uint32_t *>hashindex_get(self.index, <char *>key) # <<<<<<<<<<<<<<
6030 * if data != NULL:
6031 * assert _le32toh(data[0]) <= _MAX_VALUE, "invalid reference count"
6032 */
6033 __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 316, __pyx_L1_error)
6034 __pyx_v_data = ((uint32_t *)hashindex_get(__pyx_v_self->__pyx_base.index, ((char *)__pyx_t_2)));
6035
6036 /* "borg/hashindex.pyx":317
6037 * assert len(key) == self.key_size
6038 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
6039 * if data != NULL: # <<<<<<<<<<<<<<
6040 * assert _le32toh(data[0]) <= _MAX_VALUE, "invalid reference count"
6041 * return data != NULL
6042 */
6043 __pyx_t_3 = ((__pyx_v_data != NULL) != 0);
6044 if (__pyx_t_3) {
6045
6046 /* "borg/hashindex.pyx":318
6047 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
6048 * if data != NULL:
6049 * assert _le32toh(data[0]) <= _MAX_VALUE, "invalid reference count" # <<<<<<<<<<<<<<
6050 * return data != NULL
6051 *
6052 */
6053 #ifndef CYTHON_WITHOUT_ASSERTIONS
6054 if (unlikely(!Py_OptimizeFlag)) {
6055 if (unlikely(!((_le32toh((__pyx_v_data[0])) <= _MAX_VALUE) != 0))) {
6056 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_invalid_reference_count);
6057 __PYX_ERR(0, 318, __pyx_L1_error)
6058 }
6059 }
6060 #endif
6061
6062 /* "borg/hashindex.pyx":317
6063 * assert len(key) == self.key_size
6064 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
6065 * if data != NULL: # <<<<<<<<<<<<<<
6066 * assert _le32toh(data[0]) <= _MAX_VALUE, "invalid reference count"
6067 * return data != NULL
6068 */
6069 }
6070
6071 /* "borg/hashindex.pyx":319
6072 * if data != NULL:
6073 * assert _le32toh(data[0]) <= _MAX_VALUE, "invalid reference count"
6074 * return data != NULL # <<<<<<<<<<<<<<
6075 *
6076 * def incref(self, key):
6077 */
6078 __pyx_r = (__pyx_v_data != NULL);
6079 goto __pyx_L0;
6080
6081 /* "borg/hashindex.pyx":314
6082 * raise Exception('hashindex_set failed')
6083 *
6084 * def __contains__(self, key): # <<<<<<<<<<<<<<
6085 * assert len(key) == self.key_size
6086 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
6087 */
6088
6089 /* function exit code */
6090 __pyx_L1_error:;
6091 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6092 __pyx_r = -1;
6093 __pyx_L0:;
6094 __Pyx_RefNannyFinishContext();
6095 return __pyx_r;
6096 }
6097
6098 /* "borg/hashindex.pyx":321
6099 * return data != NULL
6100 *
6101 * def incref(self, key): # <<<<<<<<<<<<<<
6102 * """Increase refcount for 'key', return (refcount, size, csize)"""
6103 * assert len(key) == self.key_size
6104 */
6105
6106 /* Python wrapper */
6107 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_7incref(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
6108 static char __pyx_doc_4borg_9hashindex_10ChunkIndex_6incref[] = "Increase refcount for 'key', return (refcount, size, csize)";
__pyx_pw_4borg_9hashindex_10ChunkIndex_7incref(PyObject * __pyx_v_self,PyObject * __pyx_v_key)6109 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_7incref(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
6110 PyObject *__pyx_r = 0;
6111 __Pyx_RefNannyDeclarations
6112 __Pyx_RefNannySetupContext("incref (wrapper)", 0);
6113 __pyx_r = __pyx_pf_4borg_9hashindex_10ChunkIndex_6incref(((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key));
6114
6115 /* function exit code */
6116 __Pyx_RefNannyFinishContext();
6117 return __pyx_r;
6118 }
6119
__pyx_pf_4borg_9hashindex_10ChunkIndex_6incref(struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_self,PyObject * __pyx_v_key)6120 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_6incref(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, PyObject *__pyx_v_key) {
6121 uint32_t *__pyx_v_data;
6122 uint32_t __pyx_v_refcount;
6123 PyObject *__pyx_r = NULL;
6124 __Pyx_RefNannyDeclarations
6125 Py_ssize_t __pyx_t_1;
6126 char *__pyx_t_2;
6127 int __pyx_t_3;
6128 PyObject *__pyx_t_4 = NULL;
6129 PyObject *__pyx_t_5 = NULL;
6130 PyObject *__pyx_t_6 = NULL;
6131 PyObject *__pyx_t_7 = NULL;
6132 int __pyx_lineno = 0;
6133 const char *__pyx_filename = NULL;
6134 int __pyx_clineno = 0;
6135 __Pyx_RefNannySetupContext("incref", 0);
6136
6137 /* "borg/hashindex.pyx":323
6138 * def incref(self, key):
6139 * """Increase refcount for 'key', return (refcount, size, csize)"""
6140 * assert len(key) == self.key_size # <<<<<<<<<<<<<<
6141 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
6142 * if not data:
6143 */
6144 #ifndef CYTHON_WITHOUT_ASSERTIONS
6145 if (unlikely(!Py_OptimizeFlag)) {
6146 __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 323, __pyx_L1_error)
6147 if (unlikely(!((__pyx_t_1 == __pyx_v_self->__pyx_base.key_size) != 0))) {
6148 PyErr_SetNone(PyExc_AssertionError);
6149 __PYX_ERR(0, 323, __pyx_L1_error)
6150 }
6151 }
6152 #endif
6153
6154 /* "borg/hashindex.pyx":324
6155 * """Increase refcount for 'key', return (refcount, size, csize)"""
6156 * assert len(key) == self.key_size
6157 * data = <uint32_t *>hashindex_get(self.index, <char *>key) # <<<<<<<<<<<<<<
6158 * if not data:
6159 * raise KeyError(key)
6160 */
6161 __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 324, __pyx_L1_error)
6162 __pyx_v_data = ((uint32_t *)hashindex_get(__pyx_v_self->__pyx_base.index, ((char *)__pyx_t_2)));
6163
6164 /* "borg/hashindex.pyx":325
6165 * assert len(key) == self.key_size
6166 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
6167 * if not data: # <<<<<<<<<<<<<<
6168 * raise KeyError(key)
6169 * cdef uint32_t refcount = _le32toh(data[0])
6170 */
6171 __pyx_t_3 = ((!(__pyx_v_data != 0)) != 0);
6172 if (unlikely(__pyx_t_3)) {
6173
6174 /* "borg/hashindex.pyx":326
6175 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
6176 * if not data:
6177 * raise KeyError(key) # <<<<<<<<<<<<<<
6178 * cdef uint32_t refcount = _le32toh(data[0])
6179 * assert refcount <= _MAX_VALUE, "invalid reference count"
6180 */
6181 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L1_error)
6182 __Pyx_GOTREF(__pyx_t_4);
6183 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6184 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6185 __PYX_ERR(0, 326, __pyx_L1_error)
6186
6187 /* "borg/hashindex.pyx":325
6188 * assert len(key) == self.key_size
6189 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
6190 * if not data: # <<<<<<<<<<<<<<
6191 * raise KeyError(key)
6192 * cdef uint32_t refcount = _le32toh(data[0])
6193 */
6194 }
6195
6196 /* "borg/hashindex.pyx":327
6197 * if not data:
6198 * raise KeyError(key)
6199 * cdef uint32_t refcount = _le32toh(data[0]) # <<<<<<<<<<<<<<
6200 * assert refcount <= _MAX_VALUE, "invalid reference count"
6201 * if refcount != _MAX_VALUE:
6202 */
6203 __pyx_v_refcount = _le32toh((__pyx_v_data[0]));
6204
6205 /* "borg/hashindex.pyx":328
6206 * raise KeyError(key)
6207 * cdef uint32_t refcount = _le32toh(data[0])
6208 * assert refcount <= _MAX_VALUE, "invalid reference count" # <<<<<<<<<<<<<<
6209 * if refcount != _MAX_VALUE:
6210 * refcount += 1
6211 */
6212 #ifndef CYTHON_WITHOUT_ASSERTIONS
6213 if (unlikely(!Py_OptimizeFlag)) {
6214 if (unlikely(!((__pyx_v_refcount <= _MAX_VALUE) != 0))) {
6215 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_invalid_reference_count);
6216 __PYX_ERR(0, 328, __pyx_L1_error)
6217 }
6218 }
6219 #endif
6220
6221 /* "borg/hashindex.pyx":329
6222 * cdef uint32_t refcount = _le32toh(data[0])
6223 * assert refcount <= _MAX_VALUE, "invalid reference count"
6224 * if refcount != _MAX_VALUE: # <<<<<<<<<<<<<<
6225 * refcount += 1
6226 * data[0] = _htole32(refcount)
6227 */
6228 __pyx_t_3 = ((__pyx_v_refcount != _MAX_VALUE) != 0);
6229 if (__pyx_t_3) {
6230
6231 /* "borg/hashindex.pyx":330
6232 * assert refcount <= _MAX_VALUE, "invalid reference count"
6233 * if refcount != _MAX_VALUE:
6234 * refcount += 1 # <<<<<<<<<<<<<<
6235 * data[0] = _htole32(refcount)
6236 * return refcount, _le32toh(data[1]), _le32toh(data[2])
6237 */
6238 __pyx_v_refcount = (__pyx_v_refcount + 1);
6239
6240 /* "borg/hashindex.pyx":329
6241 * cdef uint32_t refcount = _le32toh(data[0])
6242 * assert refcount <= _MAX_VALUE, "invalid reference count"
6243 * if refcount != _MAX_VALUE: # <<<<<<<<<<<<<<
6244 * refcount += 1
6245 * data[0] = _htole32(refcount)
6246 */
6247 }
6248
6249 /* "borg/hashindex.pyx":331
6250 * if refcount != _MAX_VALUE:
6251 * refcount += 1
6252 * data[0] = _htole32(refcount) # <<<<<<<<<<<<<<
6253 * return refcount, _le32toh(data[1]), _le32toh(data[2])
6254 *
6255 */
6256 (__pyx_v_data[0]) = _htole32(__pyx_v_refcount);
6257
6258 /* "borg/hashindex.pyx":332
6259 * refcount += 1
6260 * data[0] = _htole32(refcount)
6261 * return refcount, _le32toh(data[1]), _le32toh(data[2]) # <<<<<<<<<<<<<<
6262 *
6263 * def decref(self, key):
6264 */
6265 __Pyx_XDECREF(__pyx_r);
6266 __pyx_t_4 = __Pyx_PyInt_From_uint32_t(__pyx_v_refcount); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error)
6267 __Pyx_GOTREF(__pyx_t_4);
6268 __pyx_t_5 = __Pyx_PyInt_From_uint32_t(_le32toh((__pyx_v_data[1]))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
6269 __Pyx_GOTREF(__pyx_t_5);
6270 __pyx_t_6 = __Pyx_PyInt_From_uint32_t(_le32toh((__pyx_v_data[2]))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 332, __pyx_L1_error)
6271 __Pyx_GOTREF(__pyx_t_6);
6272 __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 332, __pyx_L1_error)
6273 __Pyx_GOTREF(__pyx_t_7);
6274 __Pyx_GIVEREF(__pyx_t_4);
6275 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
6276 __Pyx_GIVEREF(__pyx_t_5);
6277 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
6278 __Pyx_GIVEREF(__pyx_t_6);
6279 PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
6280 __pyx_t_4 = 0;
6281 __pyx_t_5 = 0;
6282 __pyx_t_6 = 0;
6283 __pyx_r = __pyx_t_7;
6284 __pyx_t_7 = 0;
6285 goto __pyx_L0;
6286
6287 /* "borg/hashindex.pyx":321
6288 * return data != NULL
6289 *
6290 * def incref(self, key): # <<<<<<<<<<<<<<
6291 * """Increase refcount for 'key', return (refcount, size, csize)"""
6292 * assert len(key) == self.key_size
6293 */
6294
6295 /* function exit code */
6296 __pyx_L1_error:;
6297 __Pyx_XDECREF(__pyx_t_4);
6298 __Pyx_XDECREF(__pyx_t_5);
6299 __Pyx_XDECREF(__pyx_t_6);
6300 __Pyx_XDECREF(__pyx_t_7);
6301 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.incref", __pyx_clineno, __pyx_lineno, __pyx_filename);
6302 __pyx_r = NULL;
6303 __pyx_L0:;
6304 __Pyx_XGIVEREF(__pyx_r);
6305 __Pyx_RefNannyFinishContext();
6306 return __pyx_r;
6307 }
6308
6309 /* "borg/hashindex.pyx":334
6310 * return refcount, _le32toh(data[1]), _le32toh(data[2])
6311 *
6312 * def decref(self, key): # <<<<<<<<<<<<<<
6313 * """Decrease refcount for 'key', return (refcount, size, csize)"""
6314 * assert len(key) == self.key_size
6315 */
6316
6317 /* Python wrapper */
6318 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_9decref(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
6319 static char __pyx_doc_4borg_9hashindex_10ChunkIndex_8decref[] = "Decrease refcount for 'key', return (refcount, size, csize)";
__pyx_pw_4borg_9hashindex_10ChunkIndex_9decref(PyObject * __pyx_v_self,PyObject * __pyx_v_key)6320 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_9decref(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
6321 PyObject *__pyx_r = 0;
6322 __Pyx_RefNannyDeclarations
6323 __Pyx_RefNannySetupContext("decref (wrapper)", 0);
6324 __pyx_r = __pyx_pf_4borg_9hashindex_10ChunkIndex_8decref(((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key));
6325
6326 /* function exit code */
6327 __Pyx_RefNannyFinishContext();
6328 return __pyx_r;
6329 }
6330
__pyx_pf_4borg_9hashindex_10ChunkIndex_8decref(struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_self,PyObject * __pyx_v_key)6331 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_8decref(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, PyObject *__pyx_v_key) {
6332 uint32_t *__pyx_v_data;
6333 uint32_t __pyx_v_refcount;
6334 PyObject *__pyx_r = NULL;
6335 __Pyx_RefNannyDeclarations
6336 Py_ssize_t __pyx_t_1;
6337 char *__pyx_t_2;
6338 int __pyx_t_3;
6339 PyObject *__pyx_t_4 = NULL;
6340 PyObject *__pyx_t_5 = NULL;
6341 PyObject *__pyx_t_6 = NULL;
6342 PyObject *__pyx_t_7 = NULL;
6343 int __pyx_lineno = 0;
6344 const char *__pyx_filename = NULL;
6345 int __pyx_clineno = 0;
6346 __Pyx_RefNannySetupContext("decref", 0);
6347
6348 /* "borg/hashindex.pyx":336
6349 * def decref(self, key):
6350 * """Decrease refcount for 'key', return (refcount, size, csize)"""
6351 * assert len(key) == self.key_size # <<<<<<<<<<<<<<
6352 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
6353 * if not data:
6354 */
6355 #ifndef CYTHON_WITHOUT_ASSERTIONS
6356 if (unlikely(!Py_OptimizeFlag)) {
6357 __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 336, __pyx_L1_error)
6358 if (unlikely(!((__pyx_t_1 == __pyx_v_self->__pyx_base.key_size) != 0))) {
6359 PyErr_SetNone(PyExc_AssertionError);
6360 __PYX_ERR(0, 336, __pyx_L1_error)
6361 }
6362 }
6363 #endif
6364
6365 /* "borg/hashindex.pyx":337
6366 * """Decrease refcount for 'key', return (refcount, size, csize)"""
6367 * assert len(key) == self.key_size
6368 * data = <uint32_t *>hashindex_get(self.index, <char *>key) # <<<<<<<<<<<<<<
6369 * if not data:
6370 * raise KeyError(key)
6371 */
6372 __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 337, __pyx_L1_error)
6373 __pyx_v_data = ((uint32_t *)hashindex_get(__pyx_v_self->__pyx_base.index, ((char *)__pyx_t_2)));
6374
6375 /* "borg/hashindex.pyx":338
6376 * assert len(key) == self.key_size
6377 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
6378 * if not data: # <<<<<<<<<<<<<<
6379 * raise KeyError(key)
6380 * cdef uint32_t refcount = _le32toh(data[0])
6381 */
6382 __pyx_t_3 = ((!(__pyx_v_data != 0)) != 0);
6383 if (unlikely(__pyx_t_3)) {
6384
6385 /* "borg/hashindex.pyx":339
6386 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
6387 * if not data:
6388 * raise KeyError(key) # <<<<<<<<<<<<<<
6389 * cdef uint32_t refcount = _le32toh(data[0])
6390 * # Never decrease a reference count of zero
6391 */
6392 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 339, __pyx_L1_error)
6393 __Pyx_GOTREF(__pyx_t_4);
6394 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6395 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6396 __PYX_ERR(0, 339, __pyx_L1_error)
6397
6398 /* "borg/hashindex.pyx":338
6399 * assert len(key) == self.key_size
6400 * data = <uint32_t *>hashindex_get(self.index, <char *>key)
6401 * if not data: # <<<<<<<<<<<<<<
6402 * raise KeyError(key)
6403 * cdef uint32_t refcount = _le32toh(data[0])
6404 */
6405 }
6406
6407 /* "borg/hashindex.pyx":340
6408 * if not data:
6409 * raise KeyError(key)
6410 * cdef uint32_t refcount = _le32toh(data[0]) # <<<<<<<<<<<<<<
6411 * # Never decrease a reference count of zero
6412 * assert 0 < refcount <= _MAX_VALUE, "invalid reference count"
6413 */
6414 __pyx_v_refcount = _le32toh((__pyx_v_data[0]));
6415
6416 /* "borg/hashindex.pyx":342
6417 * cdef uint32_t refcount = _le32toh(data[0])
6418 * # Never decrease a reference count of zero
6419 * assert 0 < refcount <= _MAX_VALUE, "invalid reference count" # <<<<<<<<<<<<<<
6420 * if refcount != _MAX_VALUE:
6421 * refcount -= 1
6422 */
6423 #ifndef CYTHON_WITHOUT_ASSERTIONS
6424 if (unlikely(!Py_OptimizeFlag)) {
6425 __pyx_t_3 = (0 < __pyx_v_refcount);
6426 if (__pyx_t_3) {
6427 __pyx_t_3 = (__pyx_v_refcount <= _MAX_VALUE);
6428 }
6429 if (unlikely(!(__pyx_t_3 != 0))) {
6430 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_invalid_reference_count);
6431 __PYX_ERR(0, 342, __pyx_L1_error)
6432 }
6433 }
6434 #endif
6435
6436 /* "borg/hashindex.pyx":343
6437 * # Never decrease a reference count of zero
6438 * assert 0 < refcount <= _MAX_VALUE, "invalid reference count"
6439 * if refcount != _MAX_VALUE: # <<<<<<<<<<<<<<
6440 * refcount -= 1
6441 * data[0] = _htole32(refcount)
6442 */
6443 __pyx_t_3 = ((__pyx_v_refcount != _MAX_VALUE) != 0);
6444 if (__pyx_t_3) {
6445
6446 /* "borg/hashindex.pyx":344
6447 * assert 0 < refcount <= _MAX_VALUE, "invalid reference count"
6448 * if refcount != _MAX_VALUE:
6449 * refcount -= 1 # <<<<<<<<<<<<<<
6450 * data[0] = _htole32(refcount)
6451 * return refcount, _le32toh(data[1]), _le32toh(data[2])
6452 */
6453 __pyx_v_refcount = (__pyx_v_refcount - 1);
6454
6455 /* "borg/hashindex.pyx":343
6456 * # Never decrease a reference count of zero
6457 * assert 0 < refcount <= _MAX_VALUE, "invalid reference count"
6458 * if refcount != _MAX_VALUE: # <<<<<<<<<<<<<<
6459 * refcount -= 1
6460 * data[0] = _htole32(refcount)
6461 */
6462 }
6463
6464 /* "borg/hashindex.pyx":345
6465 * if refcount != _MAX_VALUE:
6466 * refcount -= 1
6467 * data[0] = _htole32(refcount) # <<<<<<<<<<<<<<
6468 * return refcount, _le32toh(data[1]), _le32toh(data[2])
6469 *
6470 */
6471 (__pyx_v_data[0]) = _htole32(__pyx_v_refcount);
6472
6473 /* "borg/hashindex.pyx":346
6474 * refcount -= 1
6475 * data[0] = _htole32(refcount)
6476 * return refcount, _le32toh(data[1]), _le32toh(data[2]) # <<<<<<<<<<<<<<
6477 *
6478 * def iteritems(self, marker=None):
6479 */
6480 __Pyx_XDECREF(__pyx_r);
6481 __pyx_t_4 = __Pyx_PyInt_From_uint32_t(__pyx_v_refcount); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 346, __pyx_L1_error)
6482 __Pyx_GOTREF(__pyx_t_4);
6483 __pyx_t_5 = __Pyx_PyInt_From_uint32_t(_le32toh((__pyx_v_data[1]))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L1_error)
6484 __Pyx_GOTREF(__pyx_t_5);
6485 __pyx_t_6 = __Pyx_PyInt_From_uint32_t(_le32toh((__pyx_v_data[2]))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error)
6486 __Pyx_GOTREF(__pyx_t_6);
6487 __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 346, __pyx_L1_error)
6488 __Pyx_GOTREF(__pyx_t_7);
6489 __Pyx_GIVEREF(__pyx_t_4);
6490 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
6491 __Pyx_GIVEREF(__pyx_t_5);
6492 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
6493 __Pyx_GIVEREF(__pyx_t_6);
6494 PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
6495 __pyx_t_4 = 0;
6496 __pyx_t_5 = 0;
6497 __pyx_t_6 = 0;
6498 __pyx_r = __pyx_t_7;
6499 __pyx_t_7 = 0;
6500 goto __pyx_L0;
6501
6502 /* "borg/hashindex.pyx":334
6503 * return refcount, _le32toh(data[1]), _le32toh(data[2])
6504 *
6505 * def decref(self, key): # <<<<<<<<<<<<<<
6506 * """Decrease refcount for 'key', return (refcount, size, csize)"""
6507 * assert len(key) == self.key_size
6508 */
6509
6510 /* function exit code */
6511 __pyx_L1_error:;
6512 __Pyx_XDECREF(__pyx_t_4);
6513 __Pyx_XDECREF(__pyx_t_5);
6514 __Pyx_XDECREF(__pyx_t_6);
6515 __Pyx_XDECREF(__pyx_t_7);
6516 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.decref", __pyx_clineno, __pyx_lineno, __pyx_filename);
6517 __pyx_r = NULL;
6518 __pyx_L0:;
6519 __Pyx_XGIVEREF(__pyx_r);
6520 __Pyx_RefNannyFinishContext();
6521 return __pyx_r;
6522 }
6523
6524 /* "borg/hashindex.pyx":348
6525 * return refcount, _le32toh(data[1]), _le32toh(data[2])
6526 *
6527 * def iteritems(self, marker=None): # <<<<<<<<<<<<<<
6528 * cdef const void *key
6529 * iter = ChunkKeyIterator(self.key_size)
6530 */
6531
6532 /* Python wrapper */
6533 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_11iteritems(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4borg_9hashindex_10ChunkIndex_11iteritems(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6534 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_11iteritems(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6535 PyObject *__pyx_v_marker = 0;
6536 int __pyx_lineno = 0;
6537 const char *__pyx_filename = NULL;
6538 int __pyx_clineno = 0;
6539 PyObject *__pyx_r = 0;
6540 __Pyx_RefNannyDeclarations
6541 __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
6542 {
6543 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_marker,0};
6544 PyObject* values[1] = {0};
6545 values[0] = ((PyObject *)Py_None);
6546 if (unlikely(__pyx_kwds)) {
6547 Py_ssize_t kw_args;
6548 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6549 switch (pos_args) {
6550 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6551 CYTHON_FALLTHROUGH;
6552 case 0: break;
6553 default: goto __pyx_L5_argtuple_error;
6554 }
6555 kw_args = PyDict_Size(__pyx_kwds);
6556 switch (pos_args) {
6557 case 0:
6558 if (kw_args > 0) {
6559 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_marker);
6560 if (value) { values[0] = value; kw_args--; }
6561 }
6562 }
6563 if (unlikely(kw_args > 0)) {
6564 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iteritems") < 0)) __PYX_ERR(0, 348, __pyx_L3_error)
6565 }
6566 } else {
6567 switch (PyTuple_GET_SIZE(__pyx_args)) {
6568 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6569 CYTHON_FALLTHROUGH;
6570 case 0: break;
6571 default: goto __pyx_L5_argtuple_error;
6572 }
6573 }
6574 __pyx_v_marker = values[0];
6575 }
6576 goto __pyx_L4_argument_unpacking_done;
6577 __pyx_L5_argtuple_error:;
6578 __Pyx_RaiseArgtupleInvalid("iteritems", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 348, __pyx_L3_error)
6579 __pyx_L3_error:;
6580 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
6581 __Pyx_RefNannyFinishContext();
6582 return NULL;
6583 __pyx_L4_argument_unpacking_done:;
6584 __pyx_r = __pyx_pf_4borg_9hashindex_10ChunkIndex_10iteritems(((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_self), __pyx_v_marker);
6585
6586 /* function exit code */
6587 __Pyx_RefNannyFinishContext();
6588 return __pyx_r;
6589 }
6590
__pyx_pf_4borg_9hashindex_10ChunkIndex_10iteritems(struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_self,PyObject * __pyx_v_marker)6591 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_10iteritems(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, PyObject *__pyx_v_marker) {
6592 void const *__pyx_v_key;
6593 struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *__pyx_v_iter = NULL;
6594 PyObject *__pyx_r = NULL;
6595 __Pyx_RefNannyDeclarations
6596 PyObject *__pyx_t_1 = NULL;
6597 PyObject *__pyx_t_2 = NULL;
6598 HashIndex *__pyx_t_3;
6599 int __pyx_t_4;
6600 char *__pyx_t_5;
6601 int __pyx_t_6;
6602 int __pyx_lineno = 0;
6603 const char *__pyx_filename = NULL;
6604 int __pyx_clineno = 0;
6605 __Pyx_RefNannySetupContext("iteritems", 0);
6606
6607 /* "borg/hashindex.pyx":350
6608 * def iteritems(self, marker=None):
6609 * cdef const void *key
6610 * iter = ChunkKeyIterator(self.key_size) # <<<<<<<<<<<<<<
6611 * iter.idx = self
6612 * iter.index = self.index
6613 */
6614 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->__pyx_base.key_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error)
6615 __Pyx_GOTREF(__pyx_t_1);
6616 __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4borg_9hashindex_ChunkKeyIterator), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error)
6617 __Pyx_GOTREF(__pyx_t_2);
6618 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6619 __pyx_v_iter = ((struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *)__pyx_t_2);
6620 __pyx_t_2 = 0;
6621
6622 /* "borg/hashindex.pyx":351
6623 * cdef const void *key
6624 * iter = ChunkKeyIterator(self.key_size)
6625 * iter.idx = self # <<<<<<<<<<<<<<
6626 * iter.index = self.index
6627 * if marker:
6628 */
6629 __Pyx_INCREF(((PyObject *)__pyx_v_self));
6630 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
6631 __Pyx_GOTREF(__pyx_v_iter->idx);
6632 __Pyx_DECREF(((PyObject *)__pyx_v_iter->idx));
6633 __pyx_v_iter->idx = __pyx_v_self;
6634
6635 /* "borg/hashindex.pyx":352
6636 * iter = ChunkKeyIterator(self.key_size)
6637 * iter.idx = self
6638 * iter.index = self.index # <<<<<<<<<<<<<<
6639 * if marker:
6640 * key = hashindex_get(self.index, <char *>marker)
6641 */
6642 __pyx_t_3 = __pyx_v_self->__pyx_base.index;
6643 __pyx_v_iter->index = __pyx_t_3;
6644
6645 /* "borg/hashindex.pyx":353
6646 * iter.idx = self
6647 * iter.index = self.index
6648 * if marker: # <<<<<<<<<<<<<<
6649 * key = hashindex_get(self.index, <char *>marker)
6650 * if marker is None:
6651 */
6652 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_marker); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 353, __pyx_L1_error)
6653 if (__pyx_t_4) {
6654
6655 /* "borg/hashindex.pyx":354
6656 * iter.index = self.index
6657 * if marker:
6658 * key = hashindex_get(self.index, <char *>marker) # <<<<<<<<<<<<<<
6659 * if marker is None:
6660 * raise IndexError
6661 */
6662 __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_v_marker); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 354, __pyx_L1_error)
6663 __pyx_v_key = hashindex_get(__pyx_v_self->__pyx_base.index, ((char *)__pyx_t_5));
6664
6665 /* "borg/hashindex.pyx":355
6666 * if marker:
6667 * key = hashindex_get(self.index, <char *>marker)
6668 * if marker is None: # <<<<<<<<<<<<<<
6669 * raise IndexError
6670 * iter.key = key - self.key_size
6671 */
6672 __pyx_t_4 = (__pyx_v_marker == Py_None);
6673 __pyx_t_6 = (__pyx_t_4 != 0);
6674 if (unlikely(__pyx_t_6)) {
6675
6676 /* "borg/hashindex.pyx":356
6677 * key = hashindex_get(self.index, <char *>marker)
6678 * if marker is None:
6679 * raise IndexError # <<<<<<<<<<<<<<
6680 * iter.key = key - self.key_size
6681 * return iter
6682 */
6683 __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0);
6684 __PYX_ERR(0, 356, __pyx_L1_error)
6685
6686 /* "borg/hashindex.pyx":355
6687 * if marker:
6688 * key = hashindex_get(self.index, <char *>marker)
6689 * if marker is None: # <<<<<<<<<<<<<<
6690 * raise IndexError
6691 * iter.key = key - self.key_size
6692 */
6693 }
6694
6695 /* "borg/hashindex.pyx":357
6696 * if marker is None:
6697 * raise IndexError
6698 * iter.key = key - self.key_size # <<<<<<<<<<<<<<
6699 * return iter
6700 *
6701 */
6702 __pyx_v_iter->key = (__pyx_v_key - __pyx_v_self->__pyx_base.key_size);
6703
6704 /* "borg/hashindex.pyx":353
6705 * iter.idx = self
6706 * iter.index = self.index
6707 * if marker: # <<<<<<<<<<<<<<
6708 * key = hashindex_get(self.index, <char *>marker)
6709 * if marker is None:
6710 */
6711 }
6712
6713 /* "borg/hashindex.pyx":358
6714 * raise IndexError
6715 * iter.key = key - self.key_size
6716 * return iter # <<<<<<<<<<<<<<
6717 *
6718 * def summarize(self):
6719 */
6720 __Pyx_XDECREF(__pyx_r);
6721 __Pyx_INCREF(((PyObject *)__pyx_v_iter));
6722 __pyx_r = ((PyObject *)__pyx_v_iter);
6723 goto __pyx_L0;
6724
6725 /* "borg/hashindex.pyx":348
6726 * return refcount, _le32toh(data[1]), _le32toh(data[2])
6727 *
6728 * def iteritems(self, marker=None): # <<<<<<<<<<<<<<
6729 * cdef const void *key
6730 * iter = ChunkKeyIterator(self.key_size)
6731 */
6732
6733 /* function exit code */
6734 __pyx_L1_error:;
6735 __Pyx_XDECREF(__pyx_t_1);
6736 __Pyx_XDECREF(__pyx_t_2);
6737 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
6738 __pyx_r = NULL;
6739 __pyx_L0:;
6740 __Pyx_XDECREF((PyObject *)__pyx_v_iter);
6741 __Pyx_XGIVEREF(__pyx_r);
6742 __Pyx_RefNannyFinishContext();
6743 return __pyx_r;
6744 }
6745
6746 /* "borg/hashindex.pyx":360
6747 * return iter
6748 *
6749 * def summarize(self): # <<<<<<<<<<<<<<
6750 * cdef uint64_t size = 0, csize = 0, unique_size = 0, unique_csize = 0, chunks = 0, unique_chunks = 0
6751 * cdef uint32_t *values
6752 */
6753
6754 /* Python wrapper */
6755 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_13summarize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4borg_9hashindex_10ChunkIndex_13summarize(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)6756 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_13summarize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6757 PyObject *__pyx_r = 0;
6758 __Pyx_RefNannyDeclarations
6759 __Pyx_RefNannySetupContext("summarize (wrapper)", 0);
6760 __pyx_r = __pyx_pf_4borg_9hashindex_10ChunkIndex_12summarize(((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_self));
6761
6762 /* function exit code */
6763 __Pyx_RefNannyFinishContext();
6764 return __pyx_r;
6765 }
6766
__pyx_pf_4borg_9hashindex_10ChunkIndex_12summarize(struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_self)6767 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_12summarize(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self) {
6768 uint64_t __pyx_v_size;
6769 uint64_t __pyx_v_csize;
6770 uint64_t __pyx_v_unique_size;
6771 uint64_t __pyx_v_unique_csize;
6772 uint64_t __pyx_v_chunks;
6773 uint64_t __pyx_v_unique_chunks;
6774 uint32_t *__pyx_v_values;
6775 uint32_t __pyx_v_refcount;
6776 void *__pyx_v_key;
6777 PyObject *__pyx_r = NULL;
6778 __Pyx_RefNannyDeclarations
6779 int __pyx_t_1;
6780 PyObject *__pyx_t_2 = NULL;
6781 PyObject *__pyx_t_3 = NULL;
6782 PyObject *__pyx_t_4 = NULL;
6783 PyObject *__pyx_t_5 = NULL;
6784 PyObject *__pyx_t_6 = NULL;
6785 PyObject *__pyx_t_7 = NULL;
6786 PyObject *__pyx_t_8 = NULL;
6787 int __pyx_lineno = 0;
6788 const char *__pyx_filename = NULL;
6789 int __pyx_clineno = 0;
6790 __Pyx_RefNannySetupContext("summarize", 0);
6791
6792 /* "borg/hashindex.pyx":361
6793 *
6794 * def summarize(self):
6795 * cdef uint64_t size = 0, csize = 0, unique_size = 0, unique_csize = 0, chunks = 0, unique_chunks = 0 # <<<<<<<<<<<<<<
6796 * cdef uint32_t *values
6797 * cdef uint32_t refcount
6798 */
6799 __pyx_v_size = 0;
6800 __pyx_v_csize = 0;
6801 __pyx_v_unique_size = 0;
6802 __pyx_v_unique_csize = 0;
6803 __pyx_v_chunks = 0;
6804 __pyx_v_unique_chunks = 0;
6805
6806 /* "borg/hashindex.pyx":364
6807 * cdef uint32_t *values
6808 * cdef uint32_t refcount
6809 * cdef void *key = NULL # <<<<<<<<<<<<<<
6810 *
6811 * while True:
6812 */
6813 __pyx_v_key = NULL;
6814
6815 /* "borg/hashindex.pyx":366
6816 * cdef void *key = NULL
6817 *
6818 * while True: # <<<<<<<<<<<<<<
6819 * key = hashindex_next_key(self.index, key)
6820 * if not key:
6821 */
6822 while (1) {
6823
6824 /* "borg/hashindex.pyx":367
6825 *
6826 * while True:
6827 * key = hashindex_next_key(self.index, key) # <<<<<<<<<<<<<<
6828 * if not key:
6829 * break
6830 */
6831 __pyx_v_key = hashindex_next_key(__pyx_v_self->__pyx_base.index, __pyx_v_key);
6832
6833 /* "borg/hashindex.pyx":368
6834 * while True:
6835 * key = hashindex_next_key(self.index, key)
6836 * if not key: # <<<<<<<<<<<<<<
6837 * break
6838 * unique_chunks += 1
6839 */
6840 __pyx_t_1 = ((!(__pyx_v_key != 0)) != 0);
6841 if (__pyx_t_1) {
6842
6843 /* "borg/hashindex.pyx":369
6844 * key = hashindex_next_key(self.index, key)
6845 * if not key:
6846 * break # <<<<<<<<<<<<<<
6847 * unique_chunks += 1
6848 * values = <uint32_t*> (key + self.key_size)
6849 */
6850 goto __pyx_L4_break;
6851
6852 /* "borg/hashindex.pyx":368
6853 * while True:
6854 * key = hashindex_next_key(self.index, key)
6855 * if not key: # <<<<<<<<<<<<<<
6856 * break
6857 * unique_chunks += 1
6858 */
6859 }
6860
6861 /* "borg/hashindex.pyx":370
6862 * if not key:
6863 * break
6864 * unique_chunks += 1 # <<<<<<<<<<<<<<
6865 * values = <uint32_t*> (key + self.key_size)
6866 * refcount = _le32toh(values[0])
6867 */
6868 __pyx_v_unique_chunks = (__pyx_v_unique_chunks + 1);
6869
6870 /* "borg/hashindex.pyx":371
6871 * break
6872 * unique_chunks += 1
6873 * values = <uint32_t*> (key + self.key_size) # <<<<<<<<<<<<<<
6874 * refcount = _le32toh(values[0])
6875 * assert refcount <= _MAX_VALUE, "invalid reference count"
6876 */
6877 __pyx_v_values = ((uint32_t *)(__pyx_v_key + __pyx_v_self->__pyx_base.key_size));
6878
6879 /* "borg/hashindex.pyx":372
6880 * unique_chunks += 1
6881 * values = <uint32_t*> (key + self.key_size)
6882 * refcount = _le32toh(values[0]) # <<<<<<<<<<<<<<
6883 * assert refcount <= _MAX_VALUE, "invalid reference count"
6884 * chunks += refcount
6885 */
6886 __pyx_v_refcount = _le32toh((__pyx_v_values[0]));
6887
6888 /* "borg/hashindex.pyx":373
6889 * values = <uint32_t*> (key + self.key_size)
6890 * refcount = _le32toh(values[0])
6891 * assert refcount <= _MAX_VALUE, "invalid reference count" # <<<<<<<<<<<<<<
6892 * chunks += refcount
6893 * unique_size += _le32toh(values[1])
6894 */
6895 #ifndef CYTHON_WITHOUT_ASSERTIONS
6896 if (unlikely(!Py_OptimizeFlag)) {
6897 if (unlikely(!((__pyx_v_refcount <= _MAX_VALUE) != 0))) {
6898 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_invalid_reference_count);
6899 __PYX_ERR(0, 373, __pyx_L1_error)
6900 }
6901 }
6902 #endif
6903
6904 /* "borg/hashindex.pyx":374
6905 * refcount = _le32toh(values[0])
6906 * assert refcount <= _MAX_VALUE, "invalid reference count"
6907 * chunks += refcount # <<<<<<<<<<<<<<
6908 * unique_size += _le32toh(values[1])
6909 * unique_csize += _le32toh(values[2])
6910 */
6911 __pyx_v_chunks = (__pyx_v_chunks + __pyx_v_refcount);
6912
6913 /* "borg/hashindex.pyx":375
6914 * assert refcount <= _MAX_VALUE, "invalid reference count"
6915 * chunks += refcount
6916 * unique_size += _le32toh(values[1]) # <<<<<<<<<<<<<<
6917 * unique_csize += _le32toh(values[2])
6918 * size += <uint64_t> _le32toh(values[1]) * _le32toh(values[0])
6919 */
6920 __pyx_v_unique_size = (__pyx_v_unique_size + _le32toh((__pyx_v_values[1])));
6921
6922 /* "borg/hashindex.pyx":376
6923 * chunks += refcount
6924 * unique_size += _le32toh(values[1])
6925 * unique_csize += _le32toh(values[2]) # <<<<<<<<<<<<<<
6926 * size += <uint64_t> _le32toh(values[1]) * _le32toh(values[0])
6927 * csize += <uint64_t> _le32toh(values[2]) * _le32toh(values[0])
6928 */
6929 __pyx_v_unique_csize = (__pyx_v_unique_csize + _le32toh((__pyx_v_values[2])));
6930
6931 /* "borg/hashindex.pyx":377
6932 * unique_size += _le32toh(values[1])
6933 * unique_csize += _le32toh(values[2])
6934 * size += <uint64_t> _le32toh(values[1]) * _le32toh(values[0]) # <<<<<<<<<<<<<<
6935 * csize += <uint64_t> _le32toh(values[2]) * _le32toh(values[0])
6936 *
6937 */
6938 __pyx_v_size = (__pyx_v_size + (((uint64_t)_le32toh((__pyx_v_values[1]))) * _le32toh((__pyx_v_values[0]))));
6939
6940 /* "borg/hashindex.pyx":378
6941 * unique_csize += _le32toh(values[2])
6942 * size += <uint64_t> _le32toh(values[1]) * _le32toh(values[0])
6943 * csize += <uint64_t> _le32toh(values[2]) * _le32toh(values[0]) # <<<<<<<<<<<<<<
6944 *
6945 * return size, csize, unique_size, unique_csize, unique_chunks, chunks
6946 */
6947 __pyx_v_csize = (__pyx_v_csize + (((uint64_t)_le32toh((__pyx_v_values[2]))) * _le32toh((__pyx_v_values[0]))));
6948 }
6949 __pyx_L4_break:;
6950
6951 /* "borg/hashindex.pyx":380
6952 * csize += <uint64_t> _le32toh(values[2]) * _le32toh(values[0])
6953 *
6954 * return size, csize, unique_size, unique_csize, unique_chunks, chunks # <<<<<<<<<<<<<<
6955 *
6956 * def stats_against(self, ChunkIndex master_index):
6957 */
6958 __Pyx_XDECREF(__pyx_r);
6959 __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error)
6960 __Pyx_GOTREF(__pyx_t_2);
6961 __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_csize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error)
6962 __Pyx_GOTREF(__pyx_t_3);
6963 __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_unique_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 380, __pyx_L1_error)
6964 __Pyx_GOTREF(__pyx_t_4);
6965 __pyx_t_5 = __Pyx_PyInt_From_uint64_t(__pyx_v_unique_csize); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 380, __pyx_L1_error)
6966 __Pyx_GOTREF(__pyx_t_5);
6967 __pyx_t_6 = __Pyx_PyInt_From_uint64_t(__pyx_v_unique_chunks); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 380, __pyx_L1_error)
6968 __Pyx_GOTREF(__pyx_t_6);
6969 __pyx_t_7 = __Pyx_PyInt_From_uint64_t(__pyx_v_chunks); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 380, __pyx_L1_error)
6970 __Pyx_GOTREF(__pyx_t_7);
6971 __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 380, __pyx_L1_error)
6972 __Pyx_GOTREF(__pyx_t_8);
6973 __Pyx_GIVEREF(__pyx_t_2);
6974 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
6975 __Pyx_GIVEREF(__pyx_t_3);
6976 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3);
6977 __Pyx_GIVEREF(__pyx_t_4);
6978 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_4);
6979 __Pyx_GIVEREF(__pyx_t_5);
6980 PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_5);
6981 __Pyx_GIVEREF(__pyx_t_6);
6982 PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_6);
6983 __Pyx_GIVEREF(__pyx_t_7);
6984 PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_7);
6985 __pyx_t_2 = 0;
6986 __pyx_t_3 = 0;
6987 __pyx_t_4 = 0;
6988 __pyx_t_5 = 0;
6989 __pyx_t_6 = 0;
6990 __pyx_t_7 = 0;
6991 __pyx_r = __pyx_t_8;
6992 __pyx_t_8 = 0;
6993 goto __pyx_L0;
6994
6995 /* "borg/hashindex.pyx":360
6996 * return iter
6997 *
6998 * def summarize(self): # <<<<<<<<<<<<<<
6999 * cdef uint64_t size = 0, csize = 0, unique_size = 0, unique_csize = 0, chunks = 0, unique_chunks = 0
7000 * cdef uint32_t *values
7001 */
7002
7003 /* function exit code */
7004 __pyx_L1_error:;
7005 __Pyx_XDECREF(__pyx_t_2);
7006 __Pyx_XDECREF(__pyx_t_3);
7007 __Pyx_XDECREF(__pyx_t_4);
7008 __Pyx_XDECREF(__pyx_t_5);
7009 __Pyx_XDECREF(__pyx_t_6);
7010 __Pyx_XDECREF(__pyx_t_7);
7011 __Pyx_XDECREF(__pyx_t_8);
7012 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.summarize", __pyx_clineno, __pyx_lineno, __pyx_filename);
7013 __pyx_r = NULL;
7014 __pyx_L0:;
7015 __Pyx_XGIVEREF(__pyx_r);
7016 __Pyx_RefNannyFinishContext();
7017 return __pyx_r;
7018 }
7019
7020 /* "borg/hashindex.pyx":382
7021 * return size, csize, unique_size, unique_csize, unique_chunks, chunks
7022 *
7023 * def stats_against(self, ChunkIndex master_index): # <<<<<<<<<<<<<<
7024 * """
7025 * Calculate chunk statistics of this index against *master_index*.
7026 */
7027
7028 /* Python wrapper */
7029 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_15stats_against(PyObject *__pyx_v_self, PyObject *__pyx_v_master_index); /*proto*/
7030 static char __pyx_doc_4borg_9hashindex_10ChunkIndex_14stats_against[] = "\n Calculate chunk statistics of this index against *master_index*.\n\n A chunk is counted as unique if the number of references\n in this index matches the number of references in *master_index*.\n\n This index must be a subset of *master_index*.\n\n Return the same statistics tuple as summarize:\n size, csize, unique_size, unique_csize, unique_chunks, chunks.\n ";
__pyx_pw_4borg_9hashindex_10ChunkIndex_15stats_against(PyObject * __pyx_v_self,PyObject * __pyx_v_master_index)7031 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_15stats_against(PyObject *__pyx_v_self, PyObject *__pyx_v_master_index) {
7032 int __pyx_lineno = 0;
7033 const char *__pyx_filename = NULL;
7034 int __pyx_clineno = 0;
7035 PyObject *__pyx_r = 0;
7036 __Pyx_RefNannyDeclarations
7037 __Pyx_RefNannySetupContext("stats_against (wrapper)", 0);
7038 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_master_index), __pyx_ptype_4borg_9hashindex_ChunkIndex, 1, "master_index", 0))) __PYX_ERR(0, 382, __pyx_L1_error)
7039 __pyx_r = __pyx_pf_4borg_9hashindex_10ChunkIndex_14stats_against(((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_self), ((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_master_index));
7040
7041 /* function exit code */
7042 goto __pyx_L0;
7043 __pyx_L1_error:;
7044 __pyx_r = NULL;
7045 __pyx_L0:;
7046 __Pyx_RefNannyFinishContext();
7047 return __pyx_r;
7048 }
7049
__pyx_pf_4borg_9hashindex_10ChunkIndex_14stats_against(struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_self,struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_master_index)7050 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_14stats_against(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_master_index) {
7051 uint64_t __pyx_v_size;
7052 uint64_t __pyx_v_csize;
7053 uint64_t __pyx_v_unique_size;
7054 uint64_t __pyx_v_unique_csize;
7055 uint64_t __pyx_v_chunks;
7056 uint64_t __pyx_v_unique_chunks;
7057 uint32_t __pyx_v_our_refcount;
7058 uint32_t __pyx_v_chunk_size;
7059 uint32_t __pyx_v_chunk_csize;
7060 uint32_t const *__pyx_v_our_values;
7061 uint32_t const *__pyx_v_master_values;
7062 void const *__pyx_v_key;
7063 HashIndex *__pyx_v_master;
7064 PyObject *__pyx_r = NULL;
7065 __Pyx_RefNannyDeclarations
7066 HashIndex *__pyx_t_1;
7067 int __pyx_t_2;
7068 PyObject *__pyx_t_3 = NULL;
7069 PyObject *__pyx_t_4 = NULL;
7070 PyObject *__pyx_t_5 = NULL;
7071 PyObject *__pyx_t_6 = NULL;
7072 PyObject *__pyx_t_7 = NULL;
7073 PyObject *__pyx_t_8 = NULL;
7074 PyObject *__pyx_t_9 = NULL;
7075 int __pyx_lineno = 0;
7076 const char *__pyx_filename = NULL;
7077 int __pyx_clineno = 0;
7078 __Pyx_RefNannySetupContext("stats_against", 0);
7079
7080 /* "borg/hashindex.pyx":394
7081 * size, csize, unique_size, unique_csize, unique_chunks, chunks.
7082 * """
7083 * cdef uint64_t size = 0, csize = 0, unique_size = 0, unique_csize = 0, chunks = 0, unique_chunks = 0 # <<<<<<<<<<<<<<
7084 * cdef uint32_t our_refcount, chunk_size, chunk_csize
7085 * cdef const uint32_t *our_values
7086 */
7087 __pyx_v_size = 0;
7088 __pyx_v_csize = 0;
7089 __pyx_v_unique_size = 0;
7090 __pyx_v_unique_csize = 0;
7091 __pyx_v_chunks = 0;
7092 __pyx_v_unique_chunks = 0;
7093
7094 /* "borg/hashindex.pyx":398
7095 * cdef const uint32_t *our_values
7096 * cdef const uint32_t *master_values
7097 * cdef const void *key = NULL # <<<<<<<<<<<<<<
7098 * cdef HashIndex *master = master_index.index
7099 *
7100 */
7101 __pyx_v_key = NULL;
7102
7103 /* "borg/hashindex.pyx":399
7104 * cdef const uint32_t *master_values
7105 * cdef const void *key = NULL
7106 * cdef HashIndex *master = master_index.index # <<<<<<<<<<<<<<
7107 *
7108 * while True:
7109 */
7110 __pyx_t_1 = __pyx_v_master_index->__pyx_base.index;
7111 __pyx_v_master = __pyx_t_1;
7112
7113 /* "borg/hashindex.pyx":401
7114 * cdef HashIndex *master = master_index.index
7115 *
7116 * while True: # <<<<<<<<<<<<<<
7117 * key = hashindex_next_key(self.index, key)
7118 * if not key:
7119 */
7120 while (1) {
7121
7122 /* "borg/hashindex.pyx":402
7123 *
7124 * while True:
7125 * key = hashindex_next_key(self.index, key) # <<<<<<<<<<<<<<
7126 * if not key:
7127 * break
7128 */
7129 __pyx_v_key = hashindex_next_key(__pyx_v_self->__pyx_base.index, __pyx_v_key);
7130
7131 /* "borg/hashindex.pyx":403
7132 * while True:
7133 * key = hashindex_next_key(self.index, key)
7134 * if not key: # <<<<<<<<<<<<<<
7135 * break
7136 * our_values = <const uint32_t*> (key + self.key_size)
7137 */
7138 __pyx_t_2 = ((!(__pyx_v_key != 0)) != 0);
7139 if (__pyx_t_2) {
7140
7141 /* "borg/hashindex.pyx":404
7142 * key = hashindex_next_key(self.index, key)
7143 * if not key:
7144 * break # <<<<<<<<<<<<<<
7145 * our_values = <const uint32_t*> (key + self.key_size)
7146 * master_values = <const uint32_t*> hashindex_get(master, key)
7147 */
7148 goto __pyx_L4_break;
7149
7150 /* "borg/hashindex.pyx":403
7151 * while True:
7152 * key = hashindex_next_key(self.index, key)
7153 * if not key: # <<<<<<<<<<<<<<
7154 * break
7155 * our_values = <const uint32_t*> (key + self.key_size)
7156 */
7157 }
7158
7159 /* "borg/hashindex.pyx":405
7160 * if not key:
7161 * break
7162 * our_values = <const uint32_t*> (key + self.key_size) # <<<<<<<<<<<<<<
7163 * master_values = <const uint32_t*> hashindex_get(master, key)
7164 * if not master_values:
7165 */
7166 __pyx_v_our_values = ((uint32_t const *)(__pyx_v_key + __pyx_v_self->__pyx_base.key_size));
7167
7168 /* "borg/hashindex.pyx":406
7169 * break
7170 * our_values = <const uint32_t*> (key + self.key_size)
7171 * master_values = <const uint32_t*> hashindex_get(master, key) # <<<<<<<<<<<<<<
7172 * if not master_values:
7173 * raise ValueError('stats_against: key contained in self but not in master_index.')
7174 */
7175 __pyx_v_master_values = ((uint32_t const *)hashindex_get(__pyx_v_master, __pyx_v_key));
7176
7177 /* "borg/hashindex.pyx":407
7178 * our_values = <const uint32_t*> (key + self.key_size)
7179 * master_values = <const uint32_t*> hashindex_get(master, key)
7180 * if not master_values: # <<<<<<<<<<<<<<
7181 * raise ValueError('stats_against: key contained in self but not in master_index.')
7182 * our_refcount = _le32toh(our_values[0])
7183 */
7184 __pyx_t_2 = ((!(__pyx_v_master_values != 0)) != 0);
7185 if (unlikely(__pyx_t_2)) {
7186
7187 /* "borg/hashindex.pyx":408
7188 * master_values = <const uint32_t*> hashindex_get(master, key)
7189 * if not master_values:
7190 * raise ValueError('stats_against: key contained in self but not in master_index.') # <<<<<<<<<<<<<<
7191 * our_refcount = _le32toh(our_values[0])
7192 * chunk_size = _le32toh(master_values[1])
7193 */
7194 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 408, __pyx_L1_error)
7195 __Pyx_GOTREF(__pyx_t_3);
7196 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7197 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7198 __PYX_ERR(0, 408, __pyx_L1_error)
7199
7200 /* "borg/hashindex.pyx":407
7201 * our_values = <const uint32_t*> (key + self.key_size)
7202 * master_values = <const uint32_t*> hashindex_get(master, key)
7203 * if not master_values: # <<<<<<<<<<<<<<
7204 * raise ValueError('stats_against: key contained in self but not in master_index.')
7205 * our_refcount = _le32toh(our_values[0])
7206 */
7207 }
7208
7209 /* "borg/hashindex.pyx":409
7210 * if not master_values:
7211 * raise ValueError('stats_against: key contained in self but not in master_index.')
7212 * our_refcount = _le32toh(our_values[0]) # <<<<<<<<<<<<<<
7213 * chunk_size = _le32toh(master_values[1])
7214 * chunk_csize = _le32toh(master_values[2])
7215 */
7216 __pyx_v_our_refcount = _le32toh((__pyx_v_our_values[0]));
7217
7218 /* "borg/hashindex.pyx":410
7219 * raise ValueError('stats_against: key contained in self but not in master_index.')
7220 * our_refcount = _le32toh(our_values[0])
7221 * chunk_size = _le32toh(master_values[1]) # <<<<<<<<<<<<<<
7222 * chunk_csize = _le32toh(master_values[2])
7223 *
7224 */
7225 __pyx_v_chunk_size = _le32toh((__pyx_v_master_values[1]));
7226
7227 /* "borg/hashindex.pyx":411
7228 * our_refcount = _le32toh(our_values[0])
7229 * chunk_size = _le32toh(master_values[1])
7230 * chunk_csize = _le32toh(master_values[2]) # <<<<<<<<<<<<<<
7231 *
7232 * chunks += our_refcount
7233 */
7234 __pyx_v_chunk_csize = _le32toh((__pyx_v_master_values[2]));
7235
7236 /* "borg/hashindex.pyx":413
7237 * chunk_csize = _le32toh(master_values[2])
7238 *
7239 * chunks += our_refcount # <<<<<<<<<<<<<<
7240 * size += <uint64_t> chunk_size * our_refcount
7241 * csize += <uint64_t> chunk_csize * our_refcount
7242 */
7243 __pyx_v_chunks = (__pyx_v_chunks + __pyx_v_our_refcount);
7244
7245 /* "borg/hashindex.pyx":414
7246 *
7247 * chunks += our_refcount
7248 * size += <uint64_t> chunk_size * our_refcount # <<<<<<<<<<<<<<
7249 * csize += <uint64_t> chunk_csize * our_refcount
7250 * if our_values[0] == master_values[0]:
7251 */
7252 __pyx_v_size = (__pyx_v_size + (((uint64_t)__pyx_v_chunk_size) * __pyx_v_our_refcount));
7253
7254 /* "borg/hashindex.pyx":415
7255 * chunks += our_refcount
7256 * size += <uint64_t> chunk_size * our_refcount
7257 * csize += <uint64_t> chunk_csize * our_refcount # <<<<<<<<<<<<<<
7258 * if our_values[0] == master_values[0]:
7259 * # our refcount equals the master's refcount, so this chunk is unique to us
7260 */
7261 __pyx_v_csize = (__pyx_v_csize + (((uint64_t)__pyx_v_chunk_csize) * __pyx_v_our_refcount));
7262
7263 /* "borg/hashindex.pyx":416
7264 * size += <uint64_t> chunk_size * our_refcount
7265 * csize += <uint64_t> chunk_csize * our_refcount
7266 * if our_values[0] == master_values[0]: # <<<<<<<<<<<<<<
7267 * # our refcount equals the master's refcount, so this chunk is unique to us
7268 * unique_chunks += 1
7269 */
7270 __pyx_t_2 = (((__pyx_v_our_values[0]) == (__pyx_v_master_values[0])) != 0);
7271 if (__pyx_t_2) {
7272
7273 /* "borg/hashindex.pyx":418
7274 * if our_values[0] == master_values[0]:
7275 * # our refcount equals the master's refcount, so this chunk is unique to us
7276 * unique_chunks += 1 # <<<<<<<<<<<<<<
7277 * unique_size += chunk_size
7278 * unique_csize += chunk_csize
7279 */
7280 __pyx_v_unique_chunks = (__pyx_v_unique_chunks + 1);
7281
7282 /* "borg/hashindex.pyx":419
7283 * # our refcount equals the master's refcount, so this chunk is unique to us
7284 * unique_chunks += 1
7285 * unique_size += chunk_size # <<<<<<<<<<<<<<
7286 * unique_csize += chunk_csize
7287 *
7288 */
7289 __pyx_v_unique_size = (__pyx_v_unique_size + __pyx_v_chunk_size);
7290
7291 /* "borg/hashindex.pyx":420
7292 * unique_chunks += 1
7293 * unique_size += chunk_size
7294 * unique_csize += chunk_csize # <<<<<<<<<<<<<<
7295 *
7296 * return size, csize, unique_size, unique_csize, unique_chunks, chunks
7297 */
7298 __pyx_v_unique_csize = (__pyx_v_unique_csize + __pyx_v_chunk_csize);
7299
7300 /* "borg/hashindex.pyx":416
7301 * size += <uint64_t> chunk_size * our_refcount
7302 * csize += <uint64_t> chunk_csize * our_refcount
7303 * if our_values[0] == master_values[0]: # <<<<<<<<<<<<<<
7304 * # our refcount equals the master's refcount, so this chunk is unique to us
7305 * unique_chunks += 1
7306 */
7307 }
7308 }
7309 __pyx_L4_break:;
7310
7311 /* "borg/hashindex.pyx":422
7312 * unique_csize += chunk_csize
7313 *
7314 * return size, csize, unique_size, unique_csize, unique_chunks, chunks # <<<<<<<<<<<<<<
7315 *
7316 * def add(self, key, refs, size, csize):
7317 */
7318 __Pyx_XDECREF(__pyx_r);
7319 __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error)
7320 __Pyx_GOTREF(__pyx_t_3);
7321 __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_csize); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 422, __pyx_L1_error)
7322 __Pyx_GOTREF(__pyx_t_4);
7323 __pyx_t_5 = __Pyx_PyInt_From_uint64_t(__pyx_v_unique_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 422, __pyx_L1_error)
7324 __Pyx_GOTREF(__pyx_t_5);
7325 __pyx_t_6 = __Pyx_PyInt_From_uint64_t(__pyx_v_unique_csize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 422, __pyx_L1_error)
7326 __Pyx_GOTREF(__pyx_t_6);
7327 __pyx_t_7 = __Pyx_PyInt_From_uint64_t(__pyx_v_unique_chunks); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 422, __pyx_L1_error)
7328 __Pyx_GOTREF(__pyx_t_7);
7329 __pyx_t_8 = __Pyx_PyInt_From_uint64_t(__pyx_v_chunks); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 422, __pyx_L1_error)
7330 __Pyx_GOTREF(__pyx_t_8);
7331 __pyx_t_9 = PyTuple_New(6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 422, __pyx_L1_error)
7332 __Pyx_GOTREF(__pyx_t_9);
7333 __Pyx_GIVEREF(__pyx_t_3);
7334 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3);
7335 __Pyx_GIVEREF(__pyx_t_4);
7336 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
7337 __Pyx_GIVEREF(__pyx_t_5);
7338 PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_5);
7339 __Pyx_GIVEREF(__pyx_t_6);
7340 PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_6);
7341 __Pyx_GIVEREF(__pyx_t_7);
7342 PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_7);
7343 __Pyx_GIVEREF(__pyx_t_8);
7344 PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_t_8);
7345 __pyx_t_3 = 0;
7346 __pyx_t_4 = 0;
7347 __pyx_t_5 = 0;
7348 __pyx_t_6 = 0;
7349 __pyx_t_7 = 0;
7350 __pyx_t_8 = 0;
7351 __pyx_r = __pyx_t_9;
7352 __pyx_t_9 = 0;
7353 goto __pyx_L0;
7354
7355 /* "borg/hashindex.pyx":382
7356 * return size, csize, unique_size, unique_csize, unique_chunks, chunks
7357 *
7358 * def stats_against(self, ChunkIndex master_index): # <<<<<<<<<<<<<<
7359 * """
7360 * Calculate chunk statistics of this index against *master_index*.
7361 */
7362
7363 /* function exit code */
7364 __pyx_L1_error:;
7365 __Pyx_XDECREF(__pyx_t_3);
7366 __Pyx_XDECREF(__pyx_t_4);
7367 __Pyx_XDECREF(__pyx_t_5);
7368 __Pyx_XDECREF(__pyx_t_6);
7369 __Pyx_XDECREF(__pyx_t_7);
7370 __Pyx_XDECREF(__pyx_t_8);
7371 __Pyx_XDECREF(__pyx_t_9);
7372 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.stats_against", __pyx_clineno, __pyx_lineno, __pyx_filename);
7373 __pyx_r = NULL;
7374 __pyx_L0:;
7375 __Pyx_XGIVEREF(__pyx_r);
7376 __Pyx_RefNannyFinishContext();
7377 return __pyx_r;
7378 }
7379
7380 /* "borg/hashindex.pyx":424
7381 * return size, csize, unique_size, unique_csize, unique_chunks, chunks
7382 *
7383 * def add(self, key, refs, size, csize): # <<<<<<<<<<<<<<
7384 * assert len(key) == self.key_size
7385 * cdef uint32_t[3] data
7386 */
7387
7388 /* Python wrapper */
7389 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_17add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4borg_9hashindex_10ChunkIndex_17add(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7390 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_17add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7391 PyObject *__pyx_v_key = 0;
7392 PyObject *__pyx_v_refs = 0;
7393 PyObject *__pyx_v_size = 0;
7394 PyObject *__pyx_v_csize = 0;
7395 int __pyx_lineno = 0;
7396 const char *__pyx_filename = NULL;
7397 int __pyx_clineno = 0;
7398 PyObject *__pyx_r = 0;
7399 __Pyx_RefNannyDeclarations
7400 __Pyx_RefNannySetupContext("add (wrapper)", 0);
7401 {
7402 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_refs,&__pyx_n_s_size,&__pyx_n_s_csize,0};
7403 PyObject* values[4] = {0,0,0,0};
7404 if (unlikely(__pyx_kwds)) {
7405 Py_ssize_t kw_args;
7406 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7407 switch (pos_args) {
7408 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7409 CYTHON_FALLTHROUGH;
7410 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7411 CYTHON_FALLTHROUGH;
7412 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7413 CYTHON_FALLTHROUGH;
7414 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7415 CYTHON_FALLTHROUGH;
7416 case 0: break;
7417 default: goto __pyx_L5_argtuple_error;
7418 }
7419 kw_args = PyDict_Size(__pyx_kwds);
7420 switch (pos_args) {
7421 case 0:
7422 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
7423 else goto __pyx_L5_argtuple_error;
7424 CYTHON_FALLTHROUGH;
7425 case 1:
7426 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_refs)) != 0)) kw_args--;
7427 else {
7428 __Pyx_RaiseArgtupleInvalid("add", 1, 4, 4, 1); __PYX_ERR(0, 424, __pyx_L3_error)
7429 }
7430 CYTHON_FALLTHROUGH;
7431 case 2:
7432 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--;
7433 else {
7434 __Pyx_RaiseArgtupleInvalid("add", 1, 4, 4, 2); __PYX_ERR(0, 424, __pyx_L3_error)
7435 }
7436 CYTHON_FALLTHROUGH;
7437 case 3:
7438 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_csize)) != 0)) kw_args--;
7439 else {
7440 __Pyx_RaiseArgtupleInvalid("add", 1, 4, 4, 3); __PYX_ERR(0, 424, __pyx_L3_error)
7441 }
7442 }
7443 if (unlikely(kw_args > 0)) {
7444 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add") < 0)) __PYX_ERR(0, 424, __pyx_L3_error)
7445 }
7446 } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
7447 goto __pyx_L5_argtuple_error;
7448 } else {
7449 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7450 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7451 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7452 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7453 }
7454 __pyx_v_key = values[0];
7455 __pyx_v_refs = values[1];
7456 __pyx_v_size = values[2];
7457 __pyx_v_csize = values[3];
7458 }
7459 goto __pyx_L4_argument_unpacking_done;
7460 __pyx_L5_argtuple_error:;
7461 __Pyx_RaiseArgtupleInvalid("add", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 424, __pyx_L3_error)
7462 __pyx_L3_error:;
7463 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
7464 __Pyx_RefNannyFinishContext();
7465 return NULL;
7466 __pyx_L4_argument_unpacking_done:;
7467 __pyx_r = __pyx_pf_4borg_9hashindex_10ChunkIndex_16add(((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_self), __pyx_v_key, __pyx_v_refs, __pyx_v_size, __pyx_v_csize);
7468
7469 /* function exit code */
7470 __Pyx_RefNannyFinishContext();
7471 return __pyx_r;
7472 }
7473
__pyx_pf_4borg_9hashindex_10ChunkIndex_16add(struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_self,PyObject * __pyx_v_key,PyObject * __pyx_v_refs,PyObject * __pyx_v_size,PyObject * __pyx_v_csize)7474 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_16add(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_refs, PyObject *__pyx_v_size, PyObject *__pyx_v_csize) {
7475 uint32_t __pyx_v_data[3];
7476 PyObject *__pyx_r = NULL;
7477 __Pyx_RefNannyDeclarations
7478 Py_ssize_t __pyx_t_1;
7479 uint32_t __pyx_t_2;
7480 char *__pyx_t_3;
7481 PyObject *__pyx_t_4 = NULL;
7482 int __pyx_lineno = 0;
7483 const char *__pyx_filename = NULL;
7484 int __pyx_clineno = 0;
7485 __Pyx_RefNannySetupContext("add", 0);
7486
7487 /* "borg/hashindex.pyx":425
7488 *
7489 * def add(self, key, refs, size, csize):
7490 * assert len(key) == self.key_size # <<<<<<<<<<<<<<
7491 * cdef uint32_t[3] data
7492 * data[0] = _htole32(refs)
7493 */
7494 #ifndef CYTHON_WITHOUT_ASSERTIONS
7495 if (unlikely(!Py_OptimizeFlag)) {
7496 __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 425, __pyx_L1_error)
7497 if (unlikely(!((__pyx_t_1 == __pyx_v_self->__pyx_base.key_size) != 0))) {
7498 PyErr_SetNone(PyExc_AssertionError);
7499 __PYX_ERR(0, 425, __pyx_L1_error)
7500 }
7501 }
7502 #endif
7503
7504 /* "borg/hashindex.pyx":427
7505 * assert len(key) == self.key_size
7506 * cdef uint32_t[3] data
7507 * data[0] = _htole32(refs) # <<<<<<<<<<<<<<
7508 * data[1] = _htole32(size)
7509 * data[2] = _htole32(csize)
7510 */
7511 __pyx_t_2 = __Pyx_PyInt_As_uint32_t(__pyx_v_refs); if (unlikely((__pyx_t_2 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 427, __pyx_L1_error)
7512 (__pyx_v_data[0]) = _htole32(__pyx_t_2);
7513
7514 /* "borg/hashindex.pyx":428
7515 * cdef uint32_t[3] data
7516 * data[0] = _htole32(refs)
7517 * data[1] = _htole32(size) # <<<<<<<<<<<<<<
7518 * data[2] = _htole32(csize)
7519 * self._add(<char*> key, data)
7520 */
7521 __pyx_t_2 = __Pyx_PyInt_As_uint32_t(__pyx_v_size); if (unlikely((__pyx_t_2 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error)
7522 (__pyx_v_data[1]) = _htole32(__pyx_t_2);
7523
7524 /* "borg/hashindex.pyx":429
7525 * data[0] = _htole32(refs)
7526 * data[1] = _htole32(size)
7527 * data[2] = _htole32(csize) # <<<<<<<<<<<<<<
7528 * self._add(<char*> key, data)
7529 *
7530 */
7531 __pyx_t_2 = __Pyx_PyInt_As_uint32_t(__pyx_v_csize); if (unlikely((__pyx_t_2 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 429, __pyx_L1_error)
7532 (__pyx_v_data[2]) = _htole32(__pyx_t_2);
7533
7534 /* "borg/hashindex.pyx":430
7535 * data[1] = _htole32(size)
7536 * data[2] = _htole32(csize)
7537 * self._add(<char*> key, data) # <<<<<<<<<<<<<<
7538 *
7539 * cdef _add(self, void *key, uint32_t *data):
7540 */
7541 __pyx_t_3 = __Pyx_PyObject_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 430, __pyx_L1_error)
7542 __pyx_t_4 = ((struct __pyx_vtabstruct_4borg_9hashindex_ChunkIndex *)__pyx_v_self->__pyx_vtab)->_add(__pyx_v_self, ((char *)__pyx_t_3), __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 430, __pyx_L1_error)
7543 __Pyx_GOTREF(__pyx_t_4);
7544 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7545
7546 /* "borg/hashindex.pyx":424
7547 * return size, csize, unique_size, unique_csize, unique_chunks, chunks
7548 *
7549 * def add(self, key, refs, size, csize): # <<<<<<<<<<<<<<
7550 * assert len(key) == self.key_size
7551 * cdef uint32_t[3] data
7552 */
7553
7554 /* function exit code */
7555 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7556 goto __pyx_L0;
7557 __pyx_L1_error:;
7558 __Pyx_XDECREF(__pyx_t_4);
7559 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
7560 __pyx_r = NULL;
7561 __pyx_L0:;
7562 __Pyx_XGIVEREF(__pyx_r);
7563 __Pyx_RefNannyFinishContext();
7564 return __pyx_r;
7565 }
7566
7567 /* "borg/hashindex.pyx":432
7568 * self._add(<char*> key, data)
7569 *
7570 * cdef _add(self, void *key, uint32_t *data): # <<<<<<<<<<<<<<
7571 * cdef uint64_t refcount1, refcount2, result64
7572 * values = <uint32_t*> hashindex_get(self.index, key)
7573 */
7574
__pyx_f_4borg_9hashindex_10ChunkIndex__add(struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_self,void * __pyx_v_key,uint32_t * __pyx_v_data)7575 static PyObject *__pyx_f_4borg_9hashindex_10ChunkIndex__add(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, void *__pyx_v_key, uint32_t *__pyx_v_data) {
7576 uint64_t __pyx_v_refcount1;
7577 uint64_t __pyx_v_refcount2;
7578 uint64_t __pyx_v_result64;
7579 uint32_t *__pyx_v_values;
7580 PyObject *__pyx_r = NULL;
7581 __Pyx_RefNannyDeclarations
7582 int __pyx_t_1;
7583 uint32_t __pyx_t_2;
7584 uint64_t __pyx_t_3;
7585 uint64_t __pyx_t_4;
7586 PyObject *__pyx_t_5 = NULL;
7587 int __pyx_lineno = 0;
7588 const char *__pyx_filename = NULL;
7589 int __pyx_clineno = 0;
7590 __Pyx_RefNannySetupContext("_add", 0);
7591
7592 /* "borg/hashindex.pyx":434
7593 * cdef _add(self, void *key, uint32_t *data):
7594 * cdef uint64_t refcount1, refcount2, result64
7595 * values = <uint32_t*> hashindex_get(self.index, key) # <<<<<<<<<<<<<<
7596 * if values:
7597 * refcount1 = _le32toh(values[0])
7598 */
7599 __pyx_v_values = ((uint32_t *)hashindex_get(__pyx_v_self->__pyx_base.index, __pyx_v_key));
7600
7601 /* "borg/hashindex.pyx":435
7602 * cdef uint64_t refcount1, refcount2, result64
7603 * values = <uint32_t*> hashindex_get(self.index, key)
7604 * if values: # <<<<<<<<<<<<<<
7605 * refcount1 = _le32toh(values[0])
7606 * refcount2 = _le32toh(data[0])
7607 */
7608 __pyx_t_1 = (__pyx_v_values != 0);
7609 if (__pyx_t_1) {
7610
7611 /* "borg/hashindex.pyx":436
7612 * values = <uint32_t*> hashindex_get(self.index, key)
7613 * if values:
7614 * refcount1 = _le32toh(values[0]) # <<<<<<<<<<<<<<
7615 * refcount2 = _le32toh(data[0])
7616 * assert refcount1 <= _MAX_VALUE, "invalid reference count"
7617 */
7618 __pyx_v_refcount1 = _le32toh((__pyx_v_values[0]));
7619
7620 /* "borg/hashindex.pyx":437
7621 * if values:
7622 * refcount1 = _le32toh(values[0])
7623 * refcount2 = _le32toh(data[0]) # <<<<<<<<<<<<<<
7624 * assert refcount1 <= _MAX_VALUE, "invalid reference count"
7625 * assert refcount2 <= _MAX_VALUE, "invalid reference count"
7626 */
7627 __pyx_v_refcount2 = _le32toh((__pyx_v_data[0]));
7628
7629 /* "borg/hashindex.pyx":438
7630 * refcount1 = _le32toh(values[0])
7631 * refcount2 = _le32toh(data[0])
7632 * assert refcount1 <= _MAX_VALUE, "invalid reference count" # <<<<<<<<<<<<<<
7633 * assert refcount2 <= _MAX_VALUE, "invalid reference count"
7634 * result64 = refcount1 + refcount2
7635 */
7636 #ifndef CYTHON_WITHOUT_ASSERTIONS
7637 if (unlikely(!Py_OptimizeFlag)) {
7638 if (unlikely(!((__pyx_v_refcount1 <= _MAX_VALUE) != 0))) {
7639 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_invalid_reference_count);
7640 __PYX_ERR(0, 438, __pyx_L1_error)
7641 }
7642 }
7643 #endif
7644
7645 /* "borg/hashindex.pyx":439
7646 * refcount2 = _le32toh(data[0])
7647 * assert refcount1 <= _MAX_VALUE, "invalid reference count"
7648 * assert refcount2 <= _MAX_VALUE, "invalid reference count" # <<<<<<<<<<<<<<
7649 * result64 = refcount1 + refcount2
7650 * values[0] = _htole32(min(result64, _MAX_VALUE))
7651 */
7652 #ifndef CYTHON_WITHOUT_ASSERTIONS
7653 if (unlikely(!Py_OptimizeFlag)) {
7654 if (unlikely(!((__pyx_v_refcount2 <= _MAX_VALUE) != 0))) {
7655 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_invalid_reference_count);
7656 __PYX_ERR(0, 439, __pyx_L1_error)
7657 }
7658 }
7659 #endif
7660
7661 /* "borg/hashindex.pyx":440
7662 * assert refcount1 <= _MAX_VALUE, "invalid reference count"
7663 * assert refcount2 <= _MAX_VALUE, "invalid reference count"
7664 * result64 = refcount1 + refcount2 # <<<<<<<<<<<<<<
7665 * values[0] = _htole32(min(result64, _MAX_VALUE))
7666 * values[1] = data[1]
7667 */
7668 __pyx_v_result64 = (__pyx_v_refcount1 + __pyx_v_refcount2);
7669
7670 /* "borg/hashindex.pyx":441
7671 * assert refcount2 <= _MAX_VALUE, "invalid reference count"
7672 * result64 = refcount1 + refcount2
7673 * values[0] = _htole32(min(result64, _MAX_VALUE)) # <<<<<<<<<<<<<<
7674 * values[1] = data[1]
7675 * values[2] = data[2]
7676 */
7677 __pyx_t_2 = _MAX_VALUE;
7678 __pyx_t_3 = __pyx_v_result64;
7679 if (((__pyx_t_2 < __pyx_t_3) != 0)) {
7680 __pyx_t_4 = __pyx_t_2;
7681 } else {
7682 __pyx_t_4 = __pyx_t_3;
7683 }
7684 (__pyx_v_values[0]) = _htole32(__pyx_t_4);
7685
7686 /* "borg/hashindex.pyx":442
7687 * result64 = refcount1 + refcount2
7688 * values[0] = _htole32(min(result64, _MAX_VALUE))
7689 * values[1] = data[1] # <<<<<<<<<<<<<<
7690 * values[2] = data[2]
7691 * else:
7692 */
7693 (__pyx_v_values[1]) = (__pyx_v_data[1]);
7694
7695 /* "borg/hashindex.pyx":443
7696 * values[0] = _htole32(min(result64, _MAX_VALUE))
7697 * values[1] = data[1]
7698 * values[2] = data[2] # <<<<<<<<<<<<<<
7699 * else:
7700 * if not hashindex_set(self.index, key, data):
7701 */
7702 (__pyx_v_values[2]) = (__pyx_v_data[2]);
7703
7704 /* "borg/hashindex.pyx":435
7705 * cdef uint64_t refcount1, refcount2, result64
7706 * values = <uint32_t*> hashindex_get(self.index, key)
7707 * if values: # <<<<<<<<<<<<<<
7708 * refcount1 = _le32toh(values[0])
7709 * refcount2 = _le32toh(data[0])
7710 */
7711 goto __pyx_L3;
7712 }
7713
7714 /* "borg/hashindex.pyx":445
7715 * values[2] = data[2]
7716 * else:
7717 * if not hashindex_set(self.index, key, data): # <<<<<<<<<<<<<<
7718 * raise Exception('hashindex_set failed')
7719 *
7720 */
7721 /*else*/ {
7722 __pyx_t_1 = ((!(hashindex_set(__pyx_v_self->__pyx_base.index, __pyx_v_key, __pyx_v_data) != 0)) != 0);
7723 if (unlikely(__pyx_t_1)) {
7724
7725 /* "borg/hashindex.pyx":446
7726 * else:
7727 * if not hashindex_set(self.index, key, data):
7728 * raise Exception('hashindex_set failed') # <<<<<<<<<<<<<<
7729 *
7730 * def merge(self, ChunkIndex other):
7731 */
7732 __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error)
7733 __Pyx_GOTREF(__pyx_t_5);
7734 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
7735 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7736 __PYX_ERR(0, 446, __pyx_L1_error)
7737
7738 /* "borg/hashindex.pyx":445
7739 * values[2] = data[2]
7740 * else:
7741 * if not hashindex_set(self.index, key, data): # <<<<<<<<<<<<<<
7742 * raise Exception('hashindex_set failed')
7743 *
7744 */
7745 }
7746 }
7747 __pyx_L3:;
7748
7749 /* "borg/hashindex.pyx":432
7750 * self._add(<char*> key, data)
7751 *
7752 * cdef _add(self, void *key, uint32_t *data): # <<<<<<<<<<<<<<
7753 * cdef uint64_t refcount1, refcount2, result64
7754 * values = <uint32_t*> hashindex_get(self.index, key)
7755 */
7756
7757 /* function exit code */
7758 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7759 goto __pyx_L0;
7760 __pyx_L1_error:;
7761 __Pyx_XDECREF(__pyx_t_5);
7762 __Pyx_AddTraceback("borg.hashindex.ChunkIndex._add", __pyx_clineno, __pyx_lineno, __pyx_filename);
7763 __pyx_r = 0;
7764 __pyx_L0:;
7765 __Pyx_XGIVEREF(__pyx_r);
7766 __Pyx_RefNannyFinishContext();
7767 return __pyx_r;
7768 }
7769
7770 /* "borg/hashindex.pyx":448
7771 * raise Exception('hashindex_set failed')
7772 *
7773 * def merge(self, ChunkIndex other): # <<<<<<<<<<<<<<
7774 * cdef void *key = NULL
7775 *
7776 */
7777
7778 /* Python wrapper */
7779 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_19merge(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
__pyx_pw_4borg_9hashindex_10ChunkIndex_19merge(PyObject * __pyx_v_self,PyObject * __pyx_v_other)7780 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_19merge(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
7781 int __pyx_lineno = 0;
7782 const char *__pyx_filename = NULL;
7783 int __pyx_clineno = 0;
7784 PyObject *__pyx_r = 0;
7785 __Pyx_RefNannyDeclarations
7786 __Pyx_RefNannySetupContext("merge (wrapper)", 0);
7787 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_4borg_9hashindex_ChunkIndex, 1, "other", 0))) __PYX_ERR(0, 448, __pyx_L1_error)
7788 __pyx_r = __pyx_pf_4borg_9hashindex_10ChunkIndex_18merge(((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_self), ((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_other));
7789
7790 /* function exit code */
7791 goto __pyx_L0;
7792 __pyx_L1_error:;
7793 __pyx_r = NULL;
7794 __pyx_L0:;
7795 __Pyx_RefNannyFinishContext();
7796 return __pyx_r;
7797 }
7798
__pyx_pf_4borg_9hashindex_10ChunkIndex_18merge(struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_self,struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_other)7799 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_18merge(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_other) {
7800 void *__pyx_v_key;
7801 PyObject *__pyx_r = NULL;
7802 __Pyx_RefNannyDeclarations
7803 int __pyx_t_1;
7804 PyObject *__pyx_t_2 = NULL;
7805 int __pyx_lineno = 0;
7806 const char *__pyx_filename = NULL;
7807 int __pyx_clineno = 0;
7808 __Pyx_RefNannySetupContext("merge", 0);
7809
7810 /* "borg/hashindex.pyx":449
7811 *
7812 * def merge(self, ChunkIndex other):
7813 * cdef void *key = NULL # <<<<<<<<<<<<<<
7814 *
7815 * while True:
7816 */
7817 __pyx_v_key = NULL;
7818
7819 /* "borg/hashindex.pyx":451
7820 * cdef void *key = NULL
7821 *
7822 * while True: # <<<<<<<<<<<<<<
7823 * key = hashindex_next_key(other.index, key)
7824 * if not key:
7825 */
7826 while (1) {
7827
7828 /* "borg/hashindex.pyx":452
7829 *
7830 * while True:
7831 * key = hashindex_next_key(other.index, key) # <<<<<<<<<<<<<<
7832 * if not key:
7833 * break
7834 */
7835 __pyx_v_key = hashindex_next_key(__pyx_v_other->__pyx_base.index, __pyx_v_key);
7836
7837 /* "borg/hashindex.pyx":453
7838 * while True:
7839 * key = hashindex_next_key(other.index, key)
7840 * if not key: # <<<<<<<<<<<<<<
7841 * break
7842 * self._add(key, <uint32_t*> (key + self.key_size))
7843 */
7844 __pyx_t_1 = ((!(__pyx_v_key != 0)) != 0);
7845 if (__pyx_t_1) {
7846
7847 /* "borg/hashindex.pyx":454
7848 * key = hashindex_next_key(other.index, key)
7849 * if not key:
7850 * break # <<<<<<<<<<<<<<
7851 * self._add(key, <uint32_t*> (key + self.key_size))
7852 *
7853 */
7854 goto __pyx_L4_break;
7855
7856 /* "borg/hashindex.pyx":453
7857 * while True:
7858 * key = hashindex_next_key(other.index, key)
7859 * if not key: # <<<<<<<<<<<<<<
7860 * break
7861 * self._add(key, <uint32_t*> (key + self.key_size))
7862 */
7863 }
7864
7865 /* "borg/hashindex.pyx":455
7866 * if not key:
7867 * break
7868 * self._add(key, <uint32_t*> (key + self.key_size)) # <<<<<<<<<<<<<<
7869 *
7870 * def zero_csize_ids(self):
7871 */
7872 __pyx_t_2 = ((struct __pyx_vtabstruct_4borg_9hashindex_ChunkIndex *)__pyx_v_self->__pyx_vtab)->_add(__pyx_v_self, __pyx_v_key, ((uint32_t *)(__pyx_v_key + __pyx_v_self->__pyx_base.key_size))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 455, __pyx_L1_error)
7873 __Pyx_GOTREF(__pyx_t_2);
7874 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7875 }
7876 __pyx_L4_break:;
7877
7878 /* "borg/hashindex.pyx":448
7879 * raise Exception('hashindex_set failed')
7880 *
7881 * def merge(self, ChunkIndex other): # <<<<<<<<<<<<<<
7882 * cdef void *key = NULL
7883 *
7884 */
7885
7886 /* function exit code */
7887 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7888 goto __pyx_L0;
7889 __pyx_L1_error:;
7890 __Pyx_XDECREF(__pyx_t_2);
7891 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.merge", __pyx_clineno, __pyx_lineno, __pyx_filename);
7892 __pyx_r = NULL;
7893 __pyx_L0:;
7894 __Pyx_XGIVEREF(__pyx_r);
7895 __Pyx_RefNannyFinishContext();
7896 return __pyx_r;
7897 }
7898
7899 /* "borg/hashindex.pyx":457
7900 * self._add(key, <uint32_t*> (key + self.key_size))
7901 *
7902 * def zero_csize_ids(self): # <<<<<<<<<<<<<<
7903 * cdef void *key = NULL
7904 * cdef uint32_t *values
7905 */
7906
7907 /* Python wrapper */
7908 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_21zero_csize_ids(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4borg_9hashindex_10ChunkIndex_21zero_csize_ids(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)7909 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_21zero_csize_ids(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7910 PyObject *__pyx_r = 0;
7911 __Pyx_RefNannyDeclarations
7912 __Pyx_RefNannySetupContext("zero_csize_ids (wrapper)", 0);
7913 __pyx_r = __pyx_pf_4borg_9hashindex_10ChunkIndex_20zero_csize_ids(((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_self));
7914
7915 /* function exit code */
7916 __Pyx_RefNannyFinishContext();
7917 return __pyx_r;
7918 }
7919
__pyx_pf_4borg_9hashindex_10ChunkIndex_20zero_csize_ids(struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_self)7920 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_20zero_csize_ids(struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self) {
7921 void *__pyx_v_key;
7922 uint32_t *__pyx_v_values;
7923 PyObject *__pyx_v_entries = NULL;
7924 uint32_t __pyx_v_refcount;
7925 PyObject *__pyx_r = NULL;
7926 __Pyx_RefNannyDeclarations
7927 PyObject *__pyx_t_1 = NULL;
7928 int __pyx_t_2;
7929 int __pyx_t_3;
7930 int __pyx_lineno = 0;
7931 const char *__pyx_filename = NULL;
7932 int __pyx_clineno = 0;
7933 __Pyx_RefNannySetupContext("zero_csize_ids", 0);
7934
7935 /* "borg/hashindex.pyx":458
7936 *
7937 * def zero_csize_ids(self):
7938 * cdef void *key = NULL # <<<<<<<<<<<<<<
7939 * cdef uint32_t *values
7940 * entries = []
7941 */
7942 __pyx_v_key = NULL;
7943
7944 /* "borg/hashindex.pyx":460
7945 * cdef void *key = NULL
7946 * cdef uint32_t *values
7947 * entries = [] # <<<<<<<<<<<<<<
7948 * while True:
7949 * key = hashindex_next_key(self.index, key)
7950 */
7951 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 460, __pyx_L1_error)
7952 __Pyx_GOTREF(__pyx_t_1);
7953 __pyx_v_entries = ((PyObject*)__pyx_t_1);
7954 __pyx_t_1 = 0;
7955
7956 /* "borg/hashindex.pyx":461
7957 * cdef uint32_t *values
7958 * entries = []
7959 * while True: # <<<<<<<<<<<<<<
7960 * key = hashindex_next_key(self.index, key)
7961 * if not key:
7962 */
7963 while (1) {
7964
7965 /* "borg/hashindex.pyx":462
7966 * entries = []
7967 * while True:
7968 * key = hashindex_next_key(self.index, key) # <<<<<<<<<<<<<<
7969 * if not key:
7970 * break
7971 */
7972 __pyx_v_key = hashindex_next_key(__pyx_v_self->__pyx_base.index, __pyx_v_key);
7973
7974 /* "borg/hashindex.pyx":463
7975 * while True:
7976 * key = hashindex_next_key(self.index, key)
7977 * if not key: # <<<<<<<<<<<<<<
7978 * break
7979 * values = <uint32_t*> (key + self.key_size)
7980 */
7981 __pyx_t_2 = ((!(__pyx_v_key != 0)) != 0);
7982 if (__pyx_t_2) {
7983
7984 /* "borg/hashindex.pyx":464
7985 * key = hashindex_next_key(self.index, key)
7986 * if not key:
7987 * break # <<<<<<<<<<<<<<
7988 * values = <uint32_t*> (key + self.key_size)
7989 * refcount = _le32toh(values[0])
7990 */
7991 goto __pyx_L4_break;
7992
7993 /* "borg/hashindex.pyx":463
7994 * while True:
7995 * key = hashindex_next_key(self.index, key)
7996 * if not key: # <<<<<<<<<<<<<<
7997 * break
7998 * values = <uint32_t*> (key + self.key_size)
7999 */
8000 }
8001
8002 /* "borg/hashindex.pyx":465
8003 * if not key:
8004 * break
8005 * values = <uint32_t*> (key + self.key_size) # <<<<<<<<<<<<<<
8006 * refcount = _le32toh(values[0])
8007 * assert refcount <= _MAX_VALUE, "invalid reference count"
8008 */
8009 __pyx_v_values = ((uint32_t *)(__pyx_v_key + __pyx_v_self->__pyx_base.key_size));
8010
8011 /* "borg/hashindex.pyx":466
8012 * break
8013 * values = <uint32_t*> (key + self.key_size)
8014 * refcount = _le32toh(values[0]) # <<<<<<<<<<<<<<
8015 * assert refcount <= _MAX_VALUE, "invalid reference count"
8016 * if _le32toh(values[2]) == 0:
8017 */
8018 __pyx_v_refcount = _le32toh((__pyx_v_values[0]));
8019
8020 /* "borg/hashindex.pyx":467
8021 * values = <uint32_t*> (key + self.key_size)
8022 * refcount = _le32toh(values[0])
8023 * assert refcount <= _MAX_VALUE, "invalid reference count" # <<<<<<<<<<<<<<
8024 * if _le32toh(values[2]) == 0:
8025 * # csize == 0
8026 */
8027 #ifndef CYTHON_WITHOUT_ASSERTIONS
8028 if (unlikely(!Py_OptimizeFlag)) {
8029 if (unlikely(!((__pyx_v_refcount <= _MAX_VALUE) != 0))) {
8030 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_invalid_reference_count);
8031 __PYX_ERR(0, 467, __pyx_L1_error)
8032 }
8033 }
8034 #endif
8035
8036 /* "borg/hashindex.pyx":468
8037 * refcount = _le32toh(values[0])
8038 * assert refcount <= _MAX_VALUE, "invalid reference count"
8039 * if _le32toh(values[2]) == 0: # <<<<<<<<<<<<<<
8040 * # csize == 0
8041 * entries.append(PyBytes_FromStringAndSize(<char*> key, self.key_size))
8042 */
8043 __pyx_t_2 = ((_le32toh((__pyx_v_values[2])) == 0) != 0);
8044 if (__pyx_t_2) {
8045
8046 /* "borg/hashindex.pyx":470
8047 * if _le32toh(values[2]) == 0:
8048 * # csize == 0
8049 * entries.append(PyBytes_FromStringAndSize(<char*> key, self.key_size)) # <<<<<<<<<<<<<<
8050 * return entries
8051 *
8052 */
8053 __pyx_t_1 = PyBytes_FromStringAndSize(((char *)__pyx_v_key), __pyx_v_self->__pyx_base.key_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
8054 __Pyx_GOTREF(__pyx_t_1);
8055 __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_entries, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 470, __pyx_L1_error)
8056 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8057
8058 /* "borg/hashindex.pyx":468
8059 * refcount = _le32toh(values[0])
8060 * assert refcount <= _MAX_VALUE, "invalid reference count"
8061 * if _le32toh(values[2]) == 0: # <<<<<<<<<<<<<<
8062 * # csize == 0
8063 * entries.append(PyBytes_FromStringAndSize(<char*> key, self.key_size))
8064 */
8065 }
8066 }
8067 __pyx_L4_break:;
8068
8069 /* "borg/hashindex.pyx":471
8070 * # csize == 0
8071 * entries.append(PyBytes_FromStringAndSize(<char*> key, self.key_size))
8072 * return entries # <<<<<<<<<<<<<<
8073 *
8074 *
8075 */
8076 __Pyx_XDECREF(__pyx_r);
8077 __Pyx_INCREF(__pyx_v_entries);
8078 __pyx_r = __pyx_v_entries;
8079 goto __pyx_L0;
8080
8081 /* "borg/hashindex.pyx":457
8082 * self._add(key, <uint32_t*> (key + self.key_size))
8083 *
8084 * def zero_csize_ids(self): # <<<<<<<<<<<<<<
8085 * cdef void *key = NULL
8086 * cdef uint32_t *values
8087 */
8088
8089 /* function exit code */
8090 __pyx_L1_error:;
8091 __Pyx_XDECREF(__pyx_t_1);
8092 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.zero_csize_ids", __pyx_clineno, __pyx_lineno, __pyx_filename);
8093 __pyx_r = NULL;
8094 __pyx_L0:;
8095 __Pyx_XDECREF(__pyx_v_entries);
8096 __Pyx_XGIVEREF(__pyx_r);
8097 __Pyx_RefNannyFinishContext();
8098 return __pyx_r;
8099 }
8100
8101 /* "(tree fragment)":1
8102 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
8103 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8104 * def __setstate_cython__(self, __pyx_state):
8105 */
8106
8107 /* Python wrapper */
8108 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4borg_9hashindex_10ChunkIndex_23__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)8109 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8110 PyObject *__pyx_r = 0;
8111 __Pyx_RefNannyDeclarations
8112 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8113 __pyx_r = __pyx_pf_4borg_9hashindex_10ChunkIndex_22__reduce_cython__(((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_self));
8114
8115 /* function exit code */
8116 __Pyx_RefNannyFinishContext();
8117 return __pyx_r;
8118 }
8119
__pyx_pf_4borg_9hashindex_10ChunkIndex_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_self)8120 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self) {
8121 PyObject *__pyx_r = NULL;
8122 __Pyx_RefNannyDeclarations
8123 PyObject *__pyx_t_1 = NULL;
8124 int __pyx_lineno = 0;
8125 const char *__pyx_filename = NULL;
8126 int __pyx_clineno = 0;
8127 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8128
8129 /* "(tree fragment)":2
8130 * def __reduce_cython__(self):
8131 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
8132 * def __setstate_cython__(self, __pyx_state):
8133 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8134 */
8135 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
8136 __Pyx_GOTREF(__pyx_t_1);
8137 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8138 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8139 __PYX_ERR(1, 2, __pyx_L1_error)
8140
8141 /* "(tree fragment)":1
8142 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
8143 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8144 * def __setstate_cython__(self, __pyx_state):
8145 */
8146
8147 /* function exit code */
8148 __pyx_L1_error:;
8149 __Pyx_XDECREF(__pyx_t_1);
8150 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8151 __pyx_r = NULL;
8152 __Pyx_XGIVEREF(__pyx_r);
8153 __Pyx_RefNannyFinishContext();
8154 return __pyx_r;
8155 }
8156
8157 /* "(tree fragment)":3
8158 * def __reduce_cython__(self):
8159 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8160 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
8161 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8162 */
8163
8164 /* Python wrapper */
8165 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_4borg_9hashindex_10ChunkIndex_25__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)8166 static PyObject *__pyx_pw_4borg_9hashindex_10ChunkIndex_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8167 PyObject *__pyx_r = 0;
8168 __Pyx_RefNannyDeclarations
8169 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8170 __pyx_r = __pyx_pf_4borg_9hashindex_10ChunkIndex_24__setstate_cython__(((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8171
8172 /* function exit code */
8173 __Pyx_RefNannyFinishContext();
8174 return __pyx_r;
8175 }
8176
__pyx_pf_4borg_9hashindex_10ChunkIndex_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_ChunkIndex * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)8177 static PyObject *__pyx_pf_4borg_9hashindex_10ChunkIndex_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_ChunkIndex *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
8178 PyObject *__pyx_r = NULL;
8179 __Pyx_RefNannyDeclarations
8180 PyObject *__pyx_t_1 = NULL;
8181 int __pyx_lineno = 0;
8182 const char *__pyx_filename = NULL;
8183 int __pyx_clineno = 0;
8184 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8185
8186 /* "(tree fragment)":4
8187 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8188 * def __setstate_cython__(self, __pyx_state):
8189 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
8190 */
8191 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
8192 __Pyx_GOTREF(__pyx_t_1);
8193 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8194 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8195 __PYX_ERR(1, 4, __pyx_L1_error)
8196
8197 /* "(tree fragment)":3
8198 * def __reduce_cython__(self):
8199 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8200 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
8201 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8202 */
8203
8204 /* function exit code */
8205 __pyx_L1_error:;
8206 __Pyx_XDECREF(__pyx_t_1);
8207 __Pyx_AddTraceback("borg.hashindex.ChunkIndex.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8208 __pyx_r = NULL;
8209 __Pyx_XGIVEREF(__pyx_r);
8210 __Pyx_RefNannyFinishContext();
8211 return __pyx_r;
8212 }
8213
8214 /* "borg/hashindex.pyx":481
8215 * cdef int exhausted
8216 *
8217 * def __cinit__(self, key_size): # <<<<<<<<<<<<<<
8218 * self.key = NULL
8219 * self.key_size = key_size
8220 */
8221
8222 /* Python wrapper */
8223 static int __pyx_pw_4borg_9hashindex_16ChunkKeyIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8224 static int __pyx_pw_4borg_9hashindex_16ChunkKeyIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8225 PyObject *__pyx_v_key_size = 0;
8226 int __pyx_lineno = 0;
8227 const char *__pyx_filename = NULL;
8228 int __pyx_clineno = 0;
8229 int __pyx_r;
8230 __Pyx_RefNannyDeclarations
8231 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
8232 {
8233 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key_size_2,0};
8234 PyObject* values[1] = {0};
8235 if (unlikely(__pyx_kwds)) {
8236 Py_ssize_t kw_args;
8237 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8238 switch (pos_args) {
8239 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8240 CYTHON_FALLTHROUGH;
8241 case 0: break;
8242 default: goto __pyx_L5_argtuple_error;
8243 }
8244 kw_args = PyDict_Size(__pyx_kwds);
8245 switch (pos_args) {
8246 case 0:
8247 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key_size_2)) != 0)) kw_args--;
8248 else goto __pyx_L5_argtuple_error;
8249 }
8250 if (unlikely(kw_args > 0)) {
8251 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 481, __pyx_L3_error)
8252 }
8253 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
8254 goto __pyx_L5_argtuple_error;
8255 } else {
8256 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8257 }
8258 __pyx_v_key_size = values[0];
8259 }
8260 goto __pyx_L4_argument_unpacking_done;
8261 __pyx_L5_argtuple_error:;
8262 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 481, __pyx_L3_error)
8263 __pyx_L3_error:;
8264 __Pyx_AddTraceback("borg.hashindex.ChunkKeyIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8265 __Pyx_RefNannyFinishContext();
8266 return -1;
8267 __pyx_L4_argument_unpacking_done:;
8268 __pyx_r = __pyx_pf_4borg_9hashindex_16ChunkKeyIterator___cinit__(((struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *)__pyx_v_self), __pyx_v_key_size);
8269
8270 /* function exit code */
8271 __Pyx_RefNannyFinishContext();
8272 return __pyx_r;
8273 }
8274
__pyx_pf_4borg_9hashindex_16ChunkKeyIterator___cinit__(struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator * __pyx_v_self,PyObject * __pyx_v_key_size)8275 static int __pyx_pf_4borg_9hashindex_16ChunkKeyIterator___cinit__(struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *__pyx_v_self, PyObject *__pyx_v_key_size) {
8276 int __pyx_r;
8277 __Pyx_RefNannyDeclarations
8278 int __pyx_t_1;
8279 int __pyx_lineno = 0;
8280 const char *__pyx_filename = NULL;
8281 int __pyx_clineno = 0;
8282 __Pyx_RefNannySetupContext("__cinit__", 0);
8283
8284 /* "borg/hashindex.pyx":482
8285 *
8286 * def __cinit__(self, key_size):
8287 * self.key = NULL # <<<<<<<<<<<<<<
8288 * self.key_size = key_size
8289 * self.exhausted = 0
8290 */
8291 __pyx_v_self->key = NULL;
8292
8293 /* "borg/hashindex.pyx":483
8294 * def __cinit__(self, key_size):
8295 * self.key = NULL
8296 * self.key_size = key_size # <<<<<<<<<<<<<<
8297 * self.exhausted = 0
8298 *
8299 */
8300 __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_key_size); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L1_error)
8301 __pyx_v_self->key_size = __pyx_t_1;
8302
8303 /* "borg/hashindex.pyx":484
8304 * self.key = NULL
8305 * self.key_size = key_size
8306 * self.exhausted = 0 # <<<<<<<<<<<<<<
8307 *
8308 * def __iter__(self):
8309 */
8310 __pyx_v_self->exhausted = 0;
8311
8312 /* "borg/hashindex.pyx":481
8313 * cdef int exhausted
8314 *
8315 * def __cinit__(self, key_size): # <<<<<<<<<<<<<<
8316 * self.key = NULL
8317 * self.key_size = key_size
8318 */
8319
8320 /* function exit code */
8321 __pyx_r = 0;
8322 goto __pyx_L0;
8323 __pyx_L1_error:;
8324 __Pyx_AddTraceback("borg.hashindex.ChunkKeyIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8325 __pyx_r = -1;
8326 __pyx_L0:;
8327 __Pyx_RefNannyFinishContext();
8328 return __pyx_r;
8329 }
8330
8331 /* "borg/hashindex.pyx":486
8332 * self.exhausted = 0
8333 *
8334 * def __iter__(self): # <<<<<<<<<<<<<<
8335 * return self
8336 *
8337 */
8338
8339 /* Python wrapper */
8340 static PyObject *__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_3__iter__(PyObject * __pyx_v_self)8341 static PyObject *__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_3__iter__(PyObject *__pyx_v_self) {
8342 PyObject *__pyx_r = 0;
8343 __Pyx_RefNannyDeclarations
8344 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
8345 __pyx_r = __pyx_pf_4borg_9hashindex_16ChunkKeyIterator_2__iter__(((struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *)__pyx_v_self));
8346
8347 /* function exit code */
8348 __Pyx_RefNannyFinishContext();
8349 return __pyx_r;
8350 }
8351
__pyx_pf_4borg_9hashindex_16ChunkKeyIterator_2__iter__(struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator * __pyx_v_self)8352 static PyObject *__pyx_pf_4borg_9hashindex_16ChunkKeyIterator_2__iter__(struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *__pyx_v_self) {
8353 PyObject *__pyx_r = NULL;
8354 __Pyx_RefNannyDeclarations
8355 __Pyx_RefNannySetupContext("__iter__", 0);
8356
8357 /* "borg/hashindex.pyx":487
8358 *
8359 * def __iter__(self):
8360 * return self # <<<<<<<<<<<<<<
8361 *
8362 * def __next__(self):
8363 */
8364 __Pyx_XDECREF(__pyx_r);
8365 __Pyx_INCREF(((PyObject *)__pyx_v_self));
8366 __pyx_r = ((PyObject *)__pyx_v_self);
8367 goto __pyx_L0;
8368
8369 /* "borg/hashindex.pyx":486
8370 * self.exhausted = 0
8371 *
8372 * def __iter__(self): # <<<<<<<<<<<<<<
8373 * return self
8374 *
8375 */
8376
8377 /* function exit code */
8378 __pyx_L0:;
8379 __Pyx_XGIVEREF(__pyx_r);
8380 __Pyx_RefNannyFinishContext();
8381 return __pyx_r;
8382 }
8383
8384 /* "borg/hashindex.pyx":489
8385 * return self
8386 *
8387 * def __next__(self): # <<<<<<<<<<<<<<
8388 * if self.exhausted:
8389 * raise StopIteration
8390 */
8391
8392 /* Python wrapper */
8393 static PyObject *__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_5__next__(PyObject * __pyx_v_self)8394 static PyObject *__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_5__next__(PyObject *__pyx_v_self) {
8395 PyObject *__pyx_r = 0;
8396 __Pyx_RefNannyDeclarations
8397 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
8398 __pyx_r = __pyx_pf_4borg_9hashindex_16ChunkKeyIterator_4__next__(((struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *)__pyx_v_self));
8399
8400 /* function exit code */
8401 __Pyx_RefNannyFinishContext();
8402 return __pyx_r;
8403 }
8404
__pyx_pf_4borg_9hashindex_16ChunkKeyIterator_4__next__(struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator * __pyx_v_self)8405 static PyObject *__pyx_pf_4borg_9hashindex_16ChunkKeyIterator_4__next__(struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *__pyx_v_self) {
8406 uint32_t *__pyx_v_value;
8407 uint32_t __pyx_v_refcount;
8408 PyObject *__pyx_r = NULL;
8409 __Pyx_RefNannyDeclarations
8410 int __pyx_t_1;
8411 PyObject *__pyx_t_2 = NULL;
8412 PyObject *__pyx_t_3 = NULL;
8413 PyObject *__pyx_t_4 = NULL;
8414 PyObject *__pyx_t_5 = NULL;
8415 PyObject *__pyx_t_6 = NULL;
8416 PyObject *__pyx_t_7 = NULL;
8417 PyObject *__pyx_t_8 = NULL;
8418 int __pyx_t_9;
8419 PyObject *__pyx_t_10 = NULL;
8420 int __pyx_lineno = 0;
8421 const char *__pyx_filename = NULL;
8422 int __pyx_clineno = 0;
8423 __Pyx_RefNannySetupContext("__next__", 0);
8424
8425 /* "borg/hashindex.pyx":490
8426 *
8427 * def __next__(self):
8428 * if self.exhausted: # <<<<<<<<<<<<<<
8429 * raise StopIteration
8430 * self.key = hashindex_next_key(self.index, <char *>self.key)
8431 */
8432 __pyx_t_1 = (__pyx_v_self->exhausted != 0);
8433 if (unlikely(__pyx_t_1)) {
8434
8435 /* "borg/hashindex.pyx":491
8436 * def __next__(self):
8437 * if self.exhausted:
8438 * raise StopIteration # <<<<<<<<<<<<<<
8439 * self.key = hashindex_next_key(self.index, <char *>self.key)
8440 * if not self.key:
8441 */
8442 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
8443 __PYX_ERR(0, 491, __pyx_L1_error)
8444
8445 /* "borg/hashindex.pyx":490
8446 *
8447 * def __next__(self):
8448 * if self.exhausted: # <<<<<<<<<<<<<<
8449 * raise StopIteration
8450 * self.key = hashindex_next_key(self.index, <char *>self.key)
8451 */
8452 }
8453
8454 /* "borg/hashindex.pyx":492
8455 * if self.exhausted:
8456 * raise StopIteration
8457 * self.key = hashindex_next_key(self.index, <char *>self.key) # <<<<<<<<<<<<<<
8458 * if not self.key:
8459 * self.exhausted = 1
8460 */
8461 __pyx_v_self->key = hashindex_next_key(__pyx_v_self->index, ((char *)__pyx_v_self->key));
8462
8463 /* "borg/hashindex.pyx":493
8464 * raise StopIteration
8465 * self.key = hashindex_next_key(self.index, <char *>self.key)
8466 * if not self.key: # <<<<<<<<<<<<<<
8467 * self.exhausted = 1
8468 * raise StopIteration
8469 */
8470 __pyx_t_1 = ((!(__pyx_v_self->key != 0)) != 0);
8471 if (unlikely(__pyx_t_1)) {
8472
8473 /* "borg/hashindex.pyx":494
8474 * self.key = hashindex_next_key(self.index, <char *>self.key)
8475 * if not self.key:
8476 * self.exhausted = 1 # <<<<<<<<<<<<<<
8477 * raise StopIteration
8478 * cdef uint32_t *value = <uint32_t *>(self.key + self.key_size)
8479 */
8480 __pyx_v_self->exhausted = 1;
8481
8482 /* "borg/hashindex.pyx":495
8483 * if not self.key:
8484 * self.exhausted = 1
8485 * raise StopIteration # <<<<<<<<<<<<<<
8486 * cdef uint32_t *value = <uint32_t *>(self.key + self.key_size)
8487 * cdef uint32_t refcount = _le32toh(value[0])
8488 */
8489 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
8490 __PYX_ERR(0, 495, __pyx_L1_error)
8491
8492 /* "borg/hashindex.pyx":493
8493 * raise StopIteration
8494 * self.key = hashindex_next_key(self.index, <char *>self.key)
8495 * if not self.key: # <<<<<<<<<<<<<<
8496 * self.exhausted = 1
8497 * raise StopIteration
8498 */
8499 }
8500
8501 /* "borg/hashindex.pyx":496
8502 * self.exhausted = 1
8503 * raise StopIteration
8504 * cdef uint32_t *value = <uint32_t *>(self.key + self.key_size) # <<<<<<<<<<<<<<
8505 * cdef uint32_t refcount = _le32toh(value[0])
8506 * assert refcount <= _MAX_VALUE, "invalid reference count"
8507 */
8508 __pyx_v_value = ((uint32_t *)(__pyx_v_self->key + __pyx_v_self->key_size));
8509
8510 /* "borg/hashindex.pyx":497
8511 * raise StopIteration
8512 * cdef uint32_t *value = <uint32_t *>(self.key + self.key_size)
8513 * cdef uint32_t refcount = _le32toh(value[0]) # <<<<<<<<<<<<<<
8514 * assert refcount <= _MAX_VALUE, "invalid reference count"
8515 * return (<char *>self.key)[:self.key_size], ChunkIndexEntry(refcount, _le32toh(value[1]), _le32toh(value[2]))
8516 */
8517 __pyx_v_refcount = _le32toh((__pyx_v_value[0]));
8518
8519 /* "borg/hashindex.pyx":498
8520 * cdef uint32_t *value = <uint32_t *>(self.key + self.key_size)
8521 * cdef uint32_t refcount = _le32toh(value[0])
8522 * assert refcount <= _MAX_VALUE, "invalid reference count" # <<<<<<<<<<<<<<
8523 * return (<char *>self.key)[:self.key_size], ChunkIndexEntry(refcount, _le32toh(value[1]), _le32toh(value[2]))
8524 *
8525 */
8526 #ifndef CYTHON_WITHOUT_ASSERTIONS
8527 if (unlikely(!Py_OptimizeFlag)) {
8528 if (unlikely(!((__pyx_v_refcount <= _MAX_VALUE) != 0))) {
8529 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_invalid_reference_count);
8530 __PYX_ERR(0, 498, __pyx_L1_error)
8531 }
8532 }
8533 #endif
8534
8535 /* "borg/hashindex.pyx":499
8536 * cdef uint32_t refcount = _le32toh(value[0])
8537 * assert refcount <= _MAX_VALUE, "invalid reference count"
8538 * return (<char *>self.key)[:self.key_size], ChunkIndexEntry(refcount, _le32toh(value[1]), _le32toh(value[2])) # <<<<<<<<<<<<<<
8539 *
8540 *
8541 */
8542 __Pyx_XDECREF(__pyx_r);
8543 __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((char *)__pyx_v_self->key) + 0, __pyx_v_self->key_size - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error)
8544 __Pyx_GOTREF(__pyx_t_2);
8545 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_ChunkIndexEntry); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 499, __pyx_L1_error)
8546 __Pyx_GOTREF(__pyx_t_4);
8547 __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_refcount); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 499, __pyx_L1_error)
8548 __Pyx_GOTREF(__pyx_t_5);
8549 __pyx_t_6 = __Pyx_PyInt_From_uint32_t(_le32toh((__pyx_v_value[1]))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 499, __pyx_L1_error)
8550 __Pyx_GOTREF(__pyx_t_6);
8551 __pyx_t_7 = __Pyx_PyInt_From_uint32_t(_le32toh((__pyx_v_value[2]))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 499, __pyx_L1_error)
8552 __Pyx_GOTREF(__pyx_t_7);
8553 __pyx_t_8 = NULL;
8554 __pyx_t_9 = 0;
8555 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
8556 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
8557 if (likely(__pyx_t_8)) {
8558 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
8559 __Pyx_INCREF(__pyx_t_8);
8560 __Pyx_INCREF(function);
8561 __Pyx_DECREF_SET(__pyx_t_4, function);
8562 __pyx_t_9 = 1;
8563 }
8564 }
8565 #if CYTHON_FAST_PYCALL
8566 if (PyFunction_Check(__pyx_t_4)) {
8567 PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_6, __pyx_t_7};
8568 __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 499, __pyx_L1_error)
8569 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
8570 __Pyx_GOTREF(__pyx_t_3);
8571 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8572 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8573 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8574 } else
8575 #endif
8576 #if CYTHON_FAST_PYCCALL
8577 if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
8578 PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_6, __pyx_t_7};
8579 __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 499, __pyx_L1_error)
8580 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
8581 __Pyx_GOTREF(__pyx_t_3);
8582 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8583 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8584 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8585 } else
8586 #endif
8587 {
8588 __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 499, __pyx_L1_error)
8589 __Pyx_GOTREF(__pyx_t_10);
8590 if (__pyx_t_8) {
8591 __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
8592 }
8593 __Pyx_GIVEREF(__pyx_t_5);
8594 PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_5);
8595 __Pyx_GIVEREF(__pyx_t_6);
8596 PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_6);
8597 __Pyx_GIVEREF(__pyx_t_7);
8598 PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_7);
8599 __pyx_t_5 = 0;
8600 __pyx_t_6 = 0;
8601 __pyx_t_7 = 0;
8602 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 499, __pyx_L1_error)
8603 __Pyx_GOTREF(__pyx_t_3);
8604 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8605 }
8606 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8607 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 499, __pyx_L1_error)
8608 __Pyx_GOTREF(__pyx_t_4);
8609 __Pyx_GIVEREF(__pyx_t_2);
8610 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
8611 __Pyx_GIVEREF(__pyx_t_3);
8612 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
8613 __pyx_t_2 = 0;
8614 __pyx_t_3 = 0;
8615 __pyx_r = __pyx_t_4;
8616 __pyx_t_4 = 0;
8617 goto __pyx_L0;
8618
8619 /* "borg/hashindex.pyx":489
8620 * return self
8621 *
8622 * def __next__(self): # <<<<<<<<<<<<<<
8623 * if self.exhausted:
8624 * raise StopIteration
8625 */
8626
8627 /* function exit code */
8628 __pyx_L1_error:;
8629 __Pyx_XDECREF(__pyx_t_2);
8630 __Pyx_XDECREF(__pyx_t_3);
8631 __Pyx_XDECREF(__pyx_t_4);
8632 __Pyx_XDECREF(__pyx_t_5);
8633 __Pyx_XDECREF(__pyx_t_6);
8634 __Pyx_XDECREF(__pyx_t_7);
8635 __Pyx_XDECREF(__pyx_t_8);
8636 __Pyx_XDECREF(__pyx_t_10);
8637 __Pyx_AddTraceback("borg.hashindex.ChunkKeyIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8638 __pyx_r = NULL;
8639 __pyx_L0:;
8640 __Pyx_XGIVEREF(__pyx_r);
8641 __Pyx_RefNannyFinishContext();
8642 return __pyx_r;
8643 }
8644
8645 /* "(tree fragment)":1
8646 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
8647 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8648 * def __setstate_cython__(self, __pyx_state):
8649 */
8650
8651 /* Python wrapper */
8652 static PyObject *__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_7__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)8653 static PyObject *__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8654 PyObject *__pyx_r = 0;
8655 __Pyx_RefNannyDeclarations
8656 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8657 __pyx_r = __pyx_pf_4borg_9hashindex_16ChunkKeyIterator_6__reduce_cython__(((struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *)__pyx_v_self));
8658
8659 /* function exit code */
8660 __Pyx_RefNannyFinishContext();
8661 return __pyx_r;
8662 }
8663
__pyx_pf_4borg_9hashindex_16ChunkKeyIterator_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator * __pyx_v_self)8664 static PyObject *__pyx_pf_4borg_9hashindex_16ChunkKeyIterator_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *__pyx_v_self) {
8665 PyObject *__pyx_r = NULL;
8666 __Pyx_RefNannyDeclarations
8667 PyObject *__pyx_t_1 = NULL;
8668 int __pyx_lineno = 0;
8669 const char *__pyx_filename = NULL;
8670 int __pyx_clineno = 0;
8671 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8672
8673 /* "(tree fragment)":2
8674 * def __reduce_cython__(self):
8675 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
8676 * def __setstate_cython__(self, __pyx_state):
8677 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8678 */
8679 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
8680 __Pyx_GOTREF(__pyx_t_1);
8681 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8682 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8683 __PYX_ERR(1, 2, __pyx_L1_error)
8684
8685 /* "(tree fragment)":1
8686 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
8687 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8688 * def __setstate_cython__(self, __pyx_state):
8689 */
8690
8691 /* function exit code */
8692 __pyx_L1_error:;
8693 __Pyx_XDECREF(__pyx_t_1);
8694 __Pyx_AddTraceback("borg.hashindex.ChunkKeyIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8695 __pyx_r = NULL;
8696 __Pyx_XGIVEREF(__pyx_r);
8697 __Pyx_RefNannyFinishContext();
8698 return __pyx_r;
8699 }
8700
8701 /* "(tree fragment)":3
8702 * def __reduce_cython__(self):
8703 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8704 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
8705 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8706 */
8707
8708 /* Python wrapper */
8709 static PyObject *__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_9__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)8710 static PyObject *__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8711 PyObject *__pyx_r = 0;
8712 __Pyx_RefNannyDeclarations
8713 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8714 __pyx_r = __pyx_pf_4borg_9hashindex_16ChunkKeyIterator_8__setstate_cython__(((struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8715
8716 /* function exit code */
8717 __Pyx_RefNannyFinishContext();
8718 return __pyx_r;
8719 }
8720
__pyx_pf_4borg_9hashindex_16ChunkKeyIterator_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)8721 static PyObject *__pyx_pf_4borg_9hashindex_16ChunkKeyIterator_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
8722 PyObject *__pyx_r = NULL;
8723 __Pyx_RefNannyDeclarations
8724 PyObject *__pyx_t_1 = NULL;
8725 int __pyx_lineno = 0;
8726 const char *__pyx_filename = NULL;
8727 int __pyx_clineno = 0;
8728 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8729
8730 /* "(tree fragment)":4
8731 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8732 * def __setstate_cython__(self, __pyx_state):
8733 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
8734 */
8735 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
8736 __Pyx_GOTREF(__pyx_t_1);
8737 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8738 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8739 __PYX_ERR(1, 4, __pyx_L1_error)
8740
8741 /* "(tree fragment)":3
8742 * def __reduce_cython__(self):
8743 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8744 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
8745 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8746 */
8747
8748 /* function exit code */
8749 __pyx_L1_error:;
8750 __Pyx_XDECREF(__pyx_t_1);
8751 __Pyx_AddTraceback("borg.hashindex.ChunkKeyIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8752 __pyx_r = NULL;
8753 __Pyx_XGIVEREF(__pyx_r);
8754 __Pyx_RefNannyFinishContext();
8755 return __pyx_r;
8756 }
8757
8758 /* "borg/hashindex.pyx":502
8759 *
8760 *
8761 * cdef Py_buffer ro_buffer(object data) except *: # <<<<<<<<<<<<<<
8762 * cdef Py_buffer view
8763 * PyObject_GetBuffer(data, &view, PyBUF_SIMPLE)
8764 */
8765
__pyx_f_4borg_9hashindex_ro_buffer(PyObject * __pyx_v_data)8766 static Py_buffer __pyx_f_4borg_9hashindex_ro_buffer(PyObject *__pyx_v_data) {
8767 Py_buffer __pyx_v_view;
8768 Py_buffer __pyx_r;
8769 __Pyx_RefNannyDeclarations
8770 int __pyx_t_1;
8771 int __pyx_lineno = 0;
8772 const char *__pyx_filename = NULL;
8773 int __pyx_clineno = 0;
8774 __Pyx_RefNannySetupContext("ro_buffer", 0);
8775
8776 /* "borg/hashindex.pyx":504
8777 * cdef Py_buffer ro_buffer(object data) except *:
8778 * cdef Py_buffer view
8779 * PyObject_GetBuffer(data, &view, PyBUF_SIMPLE) # <<<<<<<<<<<<<<
8780 * return view
8781 *
8782 */
8783 __pyx_t_1 = PyObject_GetBuffer(__pyx_v_data, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 504, __pyx_L1_error)
8784
8785 /* "borg/hashindex.pyx":505
8786 * cdef Py_buffer view
8787 * PyObject_GetBuffer(data, &view, PyBUF_SIMPLE)
8788 * return view # <<<<<<<<<<<<<<
8789 *
8790 *
8791 */
8792 __pyx_r = __pyx_v_view;
8793 goto __pyx_L0;
8794
8795 /* "borg/hashindex.pyx":502
8796 *
8797 *
8798 * cdef Py_buffer ro_buffer(object data) except *: # <<<<<<<<<<<<<<
8799 * cdef Py_buffer view
8800 * PyObject_GetBuffer(data, &view, PyBUF_SIMPLE)
8801 */
8802
8803 /* function exit code */
8804 __pyx_L1_error:;
8805 __Pyx_AddTraceback("borg.hashindex.ro_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
8806 __Pyx_pretend_to_initialize(&__pyx_r);
8807 __pyx_L0:;
8808 __Pyx_RefNannyFinishContext();
8809 return __pyx_r;
8810 }
8811
8812 /* "borg/hashindex.pyx":512
8813 * cdef CacheSyncCtx *sync
8814 *
8815 * def __cinit__(self, chunks): # <<<<<<<<<<<<<<
8816 * self.chunks = chunks
8817 * self.sync = cache_sync_init(self.chunks.index)
8818 */
8819
8820 /* Python wrapper */
8821 static int __pyx_pw_4borg_9hashindex_17CacheSynchronizer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4borg_9hashindex_17CacheSynchronizer_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8822 static int __pyx_pw_4borg_9hashindex_17CacheSynchronizer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8823 PyObject *__pyx_v_chunks = 0;
8824 int __pyx_lineno = 0;
8825 const char *__pyx_filename = NULL;
8826 int __pyx_clineno = 0;
8827 int __pyx_r;
8828 __Pyx_RefNannyDeclarations
8829 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
8830 {
8831 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_chunks,0};
8832 PyObject* values[1] = {0};
8833 if (unlikely(__pyx_kwds)) {
8834 Py_ssize_t kw_args;
8835 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8836 switch (pos_args) {
8837 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8838 CYTHON_FALLTHROUGH;
8839 case 0: break;
8840 default: goto __pyx_L5_argtuple_error;
8841 }
8842 kw_args = PyDict_Size(__pyx_kwds);
8843 switch (pos_args) {
8844 case 0:
8845 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chunks)) != 0)) kw_args--;
8846 else goto __pyx_L5_argtuple_error;
8847 }
8848 if (unlikely(kw_args > 0)) {
8849 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 512, __pyx_L3_error)
8850 }
8851 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
8852 goto __pyx_L5_argtuple_error;
8853 } else {
8854 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8855 }
8856 __pyx_v_chunks = values[0];
8857 }
8858 goto __pyx_L4_argument_unpacking_done;
8859 __pyx_L5_argtuple_error:;
8860 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 512, __pyx_L3_error)
8861 __pyx_L3_error:;
8862 __Pyx_AddTraceback("borg.hashindex.CacheSynchronizer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8863 __Pyx_RefNannyFinishContext();
8864 return -1;
8865 __pyx_L4_argument_unpacking_done:;
8866 __pyx_r = __pyx_pf_4borg_9hashindex_17CacheSynchronizer___cinit__(((struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)__pyx_v_self), __pyx_v_chunks);
8867
8868 /* function exit code */
8869 __Pyx_RefNannyFinishContext();
8870 return __pyx_r;
8871 }
8872
__pyx_pf_4borg_9hashindex_17CacheSynchronizer___cinit__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer * __pyx_v_self,PyObject * __pyx_v_chunks)8873 static int __pyx_pf_4borg_9hashindex_17CacheSynchronizer___cinit__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self, PyObject *__pyx_v_chunks) {
8874 int __pyx_r;
8875 __Pyx_RefNannyDeclarations
8876 PyObject *__pyx_t_1 = NULL;
8877 int __pyx_t_2;
8878 int __pyx_lineno = 0;
8879 const char *__pyx_filename = NULL;
8880 int __pyx_clineno = 0;
8881 __Pyx_RefNannySetupContext("__cinit__", 0);
8882
8883 /* "borg/hashindex.pyx":513
8884 *
8885 * def __cinit__(self, chunks):
8886 * self.chunks = chunks # <<<<<<<<<<<<<<
8887 * self.sync = cache_sync_init(self.chunks.index)
8888 * if not self.sync:
8889 */
8890 if (!(likely(((__pyx_v_chunks) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_chunks, __pyx_ptype_4borg_9hashindex_ChunkIndex))))) __PYX_ERR(0, 513, __pyx_L1_error)
8891 __pyx_t_1 = __pyx_v_chunks;
8892 __Pyx_INCREF(__pyx_t_1);
8893 __Pyx_GIVEREF(__pyx_t_1);
8894 __Pyx_GOTREF(__pyx_v_self->chunks);
8895 __Pyx_DECREF(((PyObject *)__pyx_v_self->chunks));
8896 __pyx_v_self->chunks = ((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)__pyx_t_1);
8897 __pyx_t_1 = 0;
8898
8899 /* "borg/hashindex.pyx":514
8900 * def __cinit__(self, chunks):
8901 * self.chunks = chunks
8902 * self.sync = cache_sync_init(self.chunks.index) # <<<<<<<<<<<<<<
8903 * if not self.sync:
8904 * raise Exception('cache_sync_init failed')
8905 */
8906 __pyx_v_self->sync = cache_sync_init(__pyx_v_self->chunks->__pyx_base.index);
8907
8908 /* "borg/hashindex.pyx":515
8909 * self.chunks = chunks
8910 * self.sync = cache_sync_init(self.chunks.index)
8911 * if not self.sync: # <<<<<<<<<<<<<<
8912 * raise Exception('cache_sync_init failed')
8913 *
8914 */
8915 __pyx_t_2 = ((!(__pyx_v_self->sync != 0)) != 0);
8916 if (unlikely(__pyx_t_2)) {
8917
8918 /* "borg/hashindex.pyx":516
8919 * self.sync = cache_sync_init(self.chunks.index)
8920 * if not self.sync:
8921 * raise Exception('cache_sync_init failed') # <<<<<<<<<<<<<<
8922 *
8923 * def __dealloc__(self):
8924 */
8925 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error)
8926 __Pyx_GOTREF(__pyx_t_1);
8927 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8928 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8929 __PYX_ERR(0, 516, __pyx_L1_error)
8930
8931 /* "borg/hashindex.pyx":515
8932 * self.chunks = chunks
8933 * self.sync = cache_sync_init(self.chunks.index)
8934 * if not self.sync: # <<<<<<<<<<<<<<
8935 * raise Exception('cache_sync_init failed')
8936 *
8937 */
8938 }
8939
8940 /* "borg/hashindex.pyx":512
8941 * cdef CacheSyncCtx *sync
8942 *
8943 * def __cinit__(self, chunks): # <<<<<<<<<<<<<<
8944 * self.chunks = chunks
8945 * self.sync = cache_sync_init(self.chunks.index)
8946 */
8947
8948 /* function exit code */
8949 __pyx_r = 0;
8950 goto __pyx_L0;
8951 __pyx_L1_error:;
8952 __Pyx_XDECREF(__pyx_t_1);
8953 __Pyx_AddTraceback("borg.hashindex.CacheSynchronizer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8954 __pyx_r = -1;
8955 __pyx_L0:;
8956 __Pyx_RefNannyFinishContext();
8957 return __pyx_r;
8958 }
8959
8960 /* "borg/hashindex.pyx":518
8961 * raise Exception('cache_sync_init failed')
8962 *
8963 * def __dealloc__(self): # <<<<<<<<<<<<<<
8964 * if self.sync:
8965 * cache_sync_free(self.sync)
8966 */
8967
8968 /* Python wrapper */
8969 static void __pyx_pw_4borg_9hashindex_17CacheSynchronizer_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4borg_9hashindex_17CacheSynchronizer_3__dealloc__(PyObject * __pyx_v_self)8970 static void __pyx_pw_4borg_9hashindex_17CacheSynchronizer_3__dealloc__(PyObject *__pyx_v_self) {
8971 __Pyx_RefNannyDeclarations
8972 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
8973 __pyx_pf_4borg_9hashindex_17CacheSynchronizer_2__dealloc__(((struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)__pyx_v_self));
8974
8975 /* function exit code */
8976 __Pyx_RefNannyFinishContext();
8977 }
8978
__pyx_pf_4borg_9hashindex_17CacheSynchronizer_2__dealloc__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer * __pyx_v_self)8979 static void __pyx_pf_4borg_9hashindex_17CacheSynchronizer_2__dealloc__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self) {
8980 __Pyx_RefNannyDeclarations
8981 int __pyx_t_1;
8982 __Pyx_RefNannySetupContext("__dealloc__", 0);
8983
8984 /* "borg/hashindex.pyx":519
8985 *
8986 * def __dealloc__(self):
8987 * if self.sync: # <<<<<<<<<<<<<<
8988 * cache_sync_free(self.sync)
8989 *
8990 */
8991 __pyx_t_1 = (__pyx_v_self->sync != 0);
8992 if (__pyx_t_1) {
8993
8994 /* "borg/hashindex.pyx":520
8995 * def __dealloc__(self):
8996 * if self.sync:
8997 * cache_sync_free(self.sync) # <<<<<<<<<<<<<<
8998 *
8999 * def feed(self, chunk):
9000 */
9001 cache_sync_free(__pyx_v_self->sync);
9002
9003 /* "borg/hashindex.pyx":519
9004 *
9005 * def __dealloc__(self):
9006 * if self.sync: # <<<<<<<<<<<<<<
9007 * cache_sync_free(self.sync)
9008 *
9009 */
9010 }
9011
9012 /* "borg/hashindex.pyx":518
9013 * raise Exception('cache_sync_init failed')
9014 *
9015 * def __dealloc__(self): # <<<<<<<<<<<<<<
9016 * if self.sync:
9017 * cache_sync_free(self.sync)
9018 */
9019
9020 /* function exit code */
9021 __Pyx_RefNannyFinishContext();
9022 }
9023
9024 /* "borg/hashindex.pyx":522
9025 * cache_sync_free(self.sync)
9026 *
9027 * def feed(self, chunk): # <<<<<<<<<<<<<<
9028 * cdef Py_buffer chunk_buf = ro_buffer(chunk)
9029 * cdef int rc
9030 */
9031
9032 /* Python wrapper */
9033 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_5feed(PyObject *__pyx_v_self, PyObject *__pyx_v_chunk); /*proto*/
__pyx_pw_4borg_9hashindex_17CacheSynchronizer_5feed(PyObject * __pyx_v_self,PyObject * __pyx_v_chunk)9034 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_5feed(PyObject *__pyx_v_self, PyObject *__pyx_v_chunk) {
9035 PyObject *__pyx_r = 0;
9036 __Pyx_RefNannyDeclarations
9037 __Pyx_RefNannySetupContext("feed (wrapper)", 0);
9038 __pyx_r = __pyx_pf_4borg_9hashindex_17CacheSynchronizer_4feed(((struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)__pyx_v_self), ((PyObject *)__pyx_v_chunk));
9039
9040 /* function exit code */
9041 __Pyx_RefNannyFinishContext();
9042 return __pyx_r;
9043 }
9044
__pyx_pf_4borg_9hashindex_17CacheSynchronizer_4feed(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer * __pyx_v_self,PyObject * __pyx_v_chunk)9045 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_4feed(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self, PyObject *__pyx_v_chunk) {
9046 Py_buffer __pyx_v_chunk_buf;
9047 int __pyx_v_rc;
9048 char const *__pyx_v_error;
9049 PyObject *__pyx_r = NULL;
9050 __Pyx_RefNannyDeclarations
9051 Py_buffer __pyx_t_1;
9052 int __pyx_t_2;
9053 PyObject *__pyx_t_3 = NULL;
9054 PyObject *__pyx_t_4 = NULL;
9055 int __pyx_lineno = 0;
9056 const char *__pyx_filename = NULL;
9057 int __pyx_clineno = 0;
9058 __Pyx_RefNannySetupContext("feed", 0);
9059
9060 /* "borg/hashindex.pyx":523
9061 *
9062 * def feed(self, chunk):
9063 * cdef Py_buffer chunk_buf = ro_buffer(chunk) # <<<<<<<<<<<<<<
9064 * cdef int rc
9065 * rc = cache_sync_feed(self.sync, chunk_buf.buf, chunk_buf.len)
9066 */
9067 __pyx_t_1 = __pyx_f_4borg_9hashindex_ro_buffer(__pyx_v_chunk); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 523, __pyx_L1_error)
9068 __pyx_v_chunk_buf = __pyx_t_1;
9069
9070 /* "borg/hashindex.pyx":525
9071 * cdef Py_buffer chunk_buf = ro_buffer(chunk)
9072 * cdef int rc
9073 * rc = cache_sync_feed(self.sync, chunk_buf.buf, chunk_buf.len) # <<<<<<<<<<<<<<
9074 * PyBuffer_Release(&chunk_buf)
9075 * if not rc:
9076 */
9077 __pyx_v_rc = cache_sync_feed(__pyx_v_self->sync, __pyx_v_chunk_buf.buf, __pyx_v_chunk_buf.len);
9078
9079 /* "borg/hashindex.pyx":526
9080 * cdef int rc
9081 * rc = cache_sync_feed(self.sync, chunk_buf.buf, chunk_buf.len)
9082 * PyBuffer_Release(&chunk_buf) # <<<<<<<<<<<<<<
9083 * if not rc:
9084 * error = cache_sync_error(self.sync)
9085 */
9086 PyBuffer_Release((&__pyx_v_chunk_buf));
9087
9088 /* "borg/hashindex.pyx":527
9089 * rc = cache_sync_feed(self.sync, chunk_buf.buf, chunk_buf.len)
9090 * PyBuffer_Release(&chunk_buf)
9091 * if not rc: # <<<<<<<<<<<<<<
9092 * error = cache_sync_error(self.sync)
9093 * if error != NULL:
9094 */
9095 __pyx_t_2 = ((!(__pyx_v_rc != 0)) != 0);
9096 if (__pyx_t_2) {
9097
9098 /* "borg/hashindex.pyx":528
9099 * PyBuffer_Release(&chunk_buf)
9100 * if not rc:
9101 * error = cache_sync_error(self.sync) # <<<<<<<<<<<<<<
9102 * if error != NULL:
9103 * raise ValueError('cache_sync_feed failed: ' + error.decode('ascii'))
9104 */
9105 __pyx_v_error = cache_sync_error(__pyx_v_self->sync);
9106
9107 /* "borg/hashindex.pyx":529
9108 * if not rc:
9109 * error = cache_sync_error(self.sync)
9110 * if error != NULL: # <<<<<<<<<<<<<<
9111 * raise ValueError('cache_sync_feed failed: ' + error.decode('ascii'))
9112 *
9113 */
9114 __pyx_t_2 = ((__pyx_v_error != NULL) != 0);
9115 if (unlikely(__pyx_t_2)) {
9116
9117 /* "borg/hashindex.pyx":530
9118 * error = cache_sync_error(self.sync)
9119 * if error != NULL:
9120 * raise ValueError('cache_sync_feed failed: ' + error.decode('ascii')) # <<<<<<<<<<<<<<
9121 *
9122 * @property
9123 */
9124 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_error, 0, strlen(__pyx_v_error), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 530, __pyx_L1_error)
9125 __Pyx_GOTREF(__pyx_t_3);
9126 __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_cache_sync_feed_failed, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error)
9127 __Pyx_GOTREF(__pyx_t_4);
9128 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9129 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 530, __pyx_L1_error)
9130 __Pyx_GOTREF(__pyx_t_3);
9131 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9132 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9133 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9134 __PYX_ERR(0, 530, __pyx_L1_error)
9135
9136 /* "borg/hashindex.pyx":529
9137 * if not rc:
9138 * error = cache_sync_error(self.sync)
9139 * if error != NULL: # <<<<<<<<<<<<<<
9140 * raise ValueError('cache_sync_feed failed: ' + error.decode('ascii'))
9141 *
9142 */
9143 }
9144
9145 /* "borg/hashindex.pyx":527
9146 * rc = cache_sync_feed(self.sync, chunk_buf.buf, chunk_buf.len)
9147 * PyBuffer_Release(&chunk_buf)
9148 * if not rc: # <<<<<<<<<<<<<<
9149 * error = cache_sync_error(self.sync)
9150 * if error != NULL:
9151 */
9152 }
9153
9154 /* "borg/hashindex.pyx":522
9155 * cache_sync_free(self.sync)
9156 *
9157 * def feed(self, chunk): # <<<<<<<<<<<<<<
9158 * cdef Py_buffer chunk_buf = ro_buffer(chunk)
9159 * cdef int rc
9160 */
9161
9162 /* function exit code */
9163 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9164 goto __pyx_L0;
9165 __pyx_L1_error:;
9166 __Pyx_XDECREF(__pyx_t_3);
9167 __Pyx_XDECREF(__pyx_t_4);
9168 __Pyx_AddTraceback("borg.hashindex.CacheSynchronizer.feed", __pyx_clineno, __pyx_lineno, __pyx_filename);
9169 __pyx_r = NULL;
9170 __pyx_L0:;
9171 __Pyx_XGIVEREF(__pyx_r);
9172 __Pyx_RefNannyFinishContext();
9173 return __pyx_r;
9174 }
9175
9176 /* "borg/hashindex.pyx":533
9177 *
9178 * @property
9179 * def num_files_totals(self): # <<<<<<<<<<<<<<
9180 * return cache_sync_num_files_totals(self.sync)
9181 *
9182 */
9183
9184 /* Python wrapper */
9185 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_16num_files_totals_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4borg_9hashindex_17CacheSynchronizer_16num_files_totals_1__get__(PyObject * __pyx_v_self)9186 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_16num_files_totals_1__get__(PyObject *__pyx_v_self) {
9187 PyObject *__pyx_r = 0;
9188 __Pyx_RefNannyDeclarations
9189 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
9190 __pyx_r = __pyx_pf_4borg_9hashindex_17CacheSynchronizer_16num_files_totals___get__(((struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)__pyx_v_self));
9191
9192 /* function exit code */
9193 __Pyx_RefNannyFinishContext();
9194 return __pyx_r;
9195 }
9196
__pyx_pf_4borg_9hashindex_17CacheSynchronizer_16num_files_totals___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer * __pyx_v_self)9197 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_16num_files_totals___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self) {
9198 PyObject *__pyx_r = NULL;
9199 __Pyx_RefNannyDeclarations
9200 PyObject *__pyx_t_1 = NULL;
9201 int __pyx_lineno = 0;
9202 const char *__pyx_filename = NULL;
9203 int __pyx_clineno = 0;
9204 __Pyx_RefNannySetupContext("__get__", 0);
9205
9206 /* "borg/hashindex.pyx":534
9207 * @property
9208 * def num_files_totals(self):
9209 * return cache_sync_num_files_totals(self.sync) # <<<<<<<<<<<<<<
9210 *
9211 * @property
9212 */
9213 __Pyx_XDECREF(__pyx_r);
9214 __pyx_t_1 = __Pyx_PyInt_From_uint64_t(cache_sync_num_files_totals(__pyx_v_self->sync)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error)
9215 __Pyx_GOTREF(__pyx_t_1);
9216 __pyx_r = __pyx_t_1;
9217 __pyx_t_1 = 0;
9218 goto __pyx_L0;
9219
9220 /* "borg/hashindex.pyx":533
9221 *
9222 * @property
9223 * def num_files_totals(self): # <<<<<<<<<<<<<<
9224 * return cache_sync_num_files_totals(self.sync)
9225 *
9226 */
9227
9228 /* function exit code */
9229 __pyx_L1_error:;
9230 __Pyx_XDECREF(__pyx_t_1);
9231 __Pyx_AddTraceback("borg.hashindex.CacheSynchronizer.num_files_totals.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9232 __pyx_r = NULL;
9233 __pyx_L0:;
9234 __Pyx_XGIVEREF(__pyx_r);
9235 __Pyx_RefNannyFinishContext();
9236 return __pyx_r;
9237 }
9238
9239 /* "borg/hashindex.pyx":537
9240 *
9241 * @property
9242 * def num_files_parts(self): # <<<<<<<<<<<<<<
9243 * return cache_sync_num_files_parts(self.sync)
9244 *
9245 */
9246
9247 /* Python wrapper */
9248 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_15num_files_parts_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4borg_9hashindex_17CacheSynchronizer_15num_files_parts_1__get__(PyObject * __pyx_v_self)9249 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_15num_files_parts_1__get__(PyObject *__pyx_v_self) {
9250 PyObject *__pyx_r = 0;
9251 __Pyx_RefNannyDeclarations
9252 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
9253 __pyx_r = __pyx_pf_4borg_9hashindex_17CacheSynchronizer_15num_files_parts___get__(((struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)__pyx_v_self));
9254
9255 /* function exit code */
9256 __Pyx_RefNannyFinishContext();
9257 return __pyx_r;
9258 }
9259
__pyx_pf_4borg_9hashindex_17CacheSynchronizer_15num_files_parts___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer * __pyx_v_self)9260 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_15num_files_parts___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self) {
9261 PyObject *__pyx_r = NULL;
9262 __Pyx_RefNannyDeclarations
9263 PyObject *__pyx_t_1 = NULL;
9264 int __pyx_lineno = 0;
9265 const char *__pyx_filename = NULL;
9266 int __pyx_clineno = 0;
9267 __Pyx_RefNannySetupContext("__get__", 0);
9268
9269 /* "borg/hashindex.pyx":538
9270 * @property
9271 * def num_files_parts(self):
9272 * return cache_sync_num_files_parts(self.sync) # <<<<<<<<<<<<<<
9273 *
9274 * @property
9275 */
9276 __Pyx_XDECREF(__pyx_r);
9277 __pyx_t_1 = __Pyx_PyInt_From_uint64_t(cache_sync_num_files_parts(__pyx_v_self->sync)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error)
9278 __Pyx_GOTREF(__pyx_t_1);
9279 __pyx_r = __pyx_t_1;
9280 __pyx_t_1 = 0;
9281 goto __pyx_L0;
9282
9283 /* "borg/hashindex.pyx":537
9284 *
9285 * @property
9286 * def num_files_parts(self): # <<<<<<<<<<<<<<
9287 * return cache_sync_num_files_parts(self.sync)
9288 *
9289 */
9290
9291 /* function exit code */
9292 __pyx_L1_error:;
9293 __Pyx_XDECREF(__pyx_t_1);
9294 __Pyx_AddTraceback("borg.hashindex.CacheSynchronizer.num_files_parts.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9295 __pyx_r = NULL;
9296 __pyx_L0:;
9297 __Pyx_XGIVEREF(__pyx_r);
9298 __Pyx_RefNannyFinishContext();
9299 return __pyx_r;
9300 }
9301
9302 /* "borg/hashindex.pyx":541
9303 *
9304 * @property
9305 * def size_totals(self): # <<<<<<<<<<<<<<
9306 * return cache_sync_size_totals(self.sync)
9307 *
9308 */
9309
9310 /* Python wrapper */
9311 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_11size_totals_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4borg_9hashindex_17CacheSynchronizer_11size_totals_1__get__(PyObject * __pyx_v_self)9312 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_11size_totals_1__get__(PyObject *__pyx_v_self) {
9313 PyObject *__pyx_r = 0;
9314 __Pyx_RefNannyDeclarations
9315 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
9316 __pyx_r = __pyx_pf_4borg_9hashindex_17CacheSynchronizer_11size_totals___get__(((struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)__pyx_v_self));
9317
9318 /* function exit code */
9319 __Pyx_RefNannyFinishContext();
9320 return __pyx_r;
9321 }
9322
__pyx_pf_4borg_9hashindex_17CacheSynchronizer_11size_totals___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer * __pyx_v_self)9323 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_11size_totals___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self) {
9324 PyObject *__pyx_r = NULL;
9325 __Pyx_RefNannyDeclarations
9326 PyObject *__pyx_t_1 = NULL;
9327 int __pyx_lineno = 0;
9328 const char *__pyx_filename = NULL;
9329 int __pyx_clineno = 0;
9330 __Pyx_RefNannySetupContext("__get__", 0);
9331
9332 /* "borg/hashindex.pyx":542
9333 * @property
9334 * def size_totals(self):
9335 * return cache_sync_size_totals(self.sync) # <<<<<<<<<<<<<<
9336 *
9337 * @property
9338 */
9339 __Pyx_XDECREF(__pyx_r);
9340 __pyx_t_1 = __Pyx_PyInt_From_uint64_t(cache_sync_size_totals(__pyx_v_self->sync)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error)
9341 __Pyx_GOTREF(__pyx_t_1);
9342 __pyx_r = __pyx_t_1;
9343 __pyx_t_1 = 0;
9344 goto __pyx_L0;
9345
9346 /* "borg/hashindex.pyx":541
9347 *
9348 * @property
9349 * def size_totals(self): # <<<<<<<<<<<<<<
9350 * return cache_sync_size_totals(self.sync)
9351 *
9352 */
9353
9354 /* function exit code */
9355 __pyx_L1_error:;
9356 __Pyx_XDECREF(__pyx_t_1);
9357 __Pyx_AddTraceback("borg.hashindex.CacheSynchronizer.size_totals.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9358 __pyx_r = NULL;
9359 __pyx_L0:;
9360 __Pyx_XGIVEREF(__pyx_r);
9361 __Pyx_RefNannyFinishContext();
9362 return __pyx_r;
9363 }
9364
9365 /* "borg/hashindex.pyx":545
9366 *
9367 * @property
9368 * def size_parts(self): # <<<<<<<<<<<<<<
9369 * return cache_sync_size_parts(self.sync)
9370 *
9371 */
9372
9373 /* Python wrapper */
9374 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_10size_parts_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4borg_9hashindex_17CacheSynchronizer_10size_parts_1__get__(PyObject * __pyx_v_self)9375 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_10size_parts_1__get__(PyObject *__pyx_v_self) {
9376 PyObject *__pyx_r = 0;
9377 __Pyx_RefNannyDeclarations
9378 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
9379 __pyx_r = __pyx_pf_4borg_9hashindex_17CacheSynchronizer_10size_parts___get__(((struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)__pyx_v_self));
9380
9381 /* function exit code */
9382 __Pyx_RefNannyFinishContext();
9383 return __pyx_r;
9384 }
9385
__pyx_pf_4borg_9hashindex_17CacheSynchronizer_10size_parts___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer * __pyx_v_self)9386 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_10size_parts___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self) {
9387 PyObject *__pyx_r = NULL;
9388 __Pyx_RefNannyDeclarations
9389 PyObject *__pyx_t_1 = NULL;
9390 int __pyx_lineno = 0;
9391 const char *__pyx_filename = NULL;
9392 int __pyx_clineno = 0;
9393 __Pyx_RefNannySetupContext("__get__", 0);
9394
9395 /* "borg/hashindex.pyx":546
9396 * @property
9397 * def size_parts(self):
9398 * return cache_sync_size_parts(self.sync) # <<<<<<<<<<<<<<
9399 *
9400 * @property
9401 */
9402 __Pyx_XDECREF(__pyx_r);
9403 __pyx_t_1 = __Pyx_PyInt_From_uint64_t(cache_sync_size_parts(__pyx_v_self->sync)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error)
9404 __Pyx_GOTREF(__pyx_t_1);
9405 __pyx_r = __pyx_t_1;
9406 __pyx_t_1 = 0;
9407 goto __pyx_L0;
9408
9409 /* "borg/hashindex.pyx":545
9410 *
9411 * @property
9412 * def size_parts(self): # <<<<<<<<<<<<<<
9413 * return cache_sync_size_parts(self.sync)
9414 *
9415 */
9416
9417 /* function exit code */
9418 __pyx_L1_error:;
9419 __Pyx_XDECREF(__pyx_t_1);
9420 __Pyx_AddTraceback("borg.hashindex.CacheSynchronizer.size_parts.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9421 __pyx_r = NULL;
9422 __pyx_L0:;
9423 __Pyx_XGIVEREF(__pyx_r);
9424 __Pyx_RefNannyFinishContext();
9425 return __pyx_r;
9426 }
9427
9428 /* "borg/hashindex.pyx":549
9429 *
9430 * @property
9431 * def csize_totals(self): # <<<<<<<<<<<<<<
9432 * return cache_sync_csize_totals(self.sync)
9433 *
9434 */
9435
9436 /* Python wrapper */
9437 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_12csize_totals_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4borg_9hashindex_17CacheSynchronizer_12csize_totals_1__get__(PyObject * __pyx_v_self)9438 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_12csize_totals_1__get__(PyObject *__pyx_v_self) {
9439 PyObject *__pyx_r = 0;
9440 __Pyx_RefNannyDeclarations
9441 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
9442 __pyx_r = __pyx_pf_4borg_9hashindex_17CacheSynchronizer_12csize_totals___get__(((struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)__pyx_v_self));
9443
9444 /* function exit code */
9445 __Pyx_RefNannyFinishContext();
9446 return __pyx_r;
9447 }
9448
__pyx_pf_4borg_9hashindex_17CacheSynchronizer_12csize_totals___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer * __pyx_v_self)9449 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_12csize_totals___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self) {
9450 PyObject *__pyx_r = NULL;
9451 __Pyx_RefNannyDeclarations
9452 PyObject *__pyx_t_1 = NULL;
9453 int __pyx_lineno = 0;
9454 const char *__pyx_filename = NULL;
9455 int __pyx_clineno = 0;
9456 __Pyx_RefNannySetupContext("__get__", 0);
9457
9458 /* "borg/hashindex.pyx":550
9459 * @property
9460 * def csize_totals(self):
9461 * return cache_sync_csize_totals(self.sync) # <<<<<<<<<<<<<<
9462 *
9463 * @property
9464 */
9465 __Pyx_XDECREF(__pyx_r);
9466 __pyx_t_1 = __Pyx_PyInt_From_uint64_t(cache_sync_csize_totals(__pyx_v_self->sync)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error)
9467 __Pyx_GOTREF(__pyx_t_1);
9468 __pyx_r = __pyx_t_1;
9469 __pyx_t_1 = 0;
9470 goto __pyx_L0;
9471
9472 /* "borg/hashindex.pyx":549
9473 *
9474 * @property
9475 * def csize_totals(self): # <<<<<<<<<<<<<<
9476 * return cache_sync_csize_totals(self.sync)
9477 *
9478 */
9479
9480 /* function exit code */
9481 __pyx_L1_error:;
9482 __Pyx_XDECREF(__pyx_t_1);
9483 __Pyx_AddTraceback("borg.hashindex.CacheSynchronizer.csize_totals.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9484 __pyx_r = NULL;
9485 __pyx_L0:;
9486 __Pyx_XGIVEREF(__pyx_r);
9487 __Pyx_RefNannyFinishContext();
9488 return __pyx_r;
9489 }
9490
9491 /* "borg/hashindex.pyx":553
9492 *
9493 * @property
9494 * def csize_parts(self): # <<<<<<<<<<<<<<
9495 * return cache_sync_csize_parts(self.sync)
9496 */
9497
9498 /* Python wrapper */
9499 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_11csize_parts_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4borg_9hashindex_17CacheSynchronizer_11csize_parts_1__get__(PyObject * __pyx_v_self)9500 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_11csize_parts_1__get__(PyObject *__pyx_v_self) {
9501 PyObject *__pyx_r = 0;
9502 __Pyx_RefNannyDeclarations
9503 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
9504 __pyx_r = __pyx_pf_4borg_9hashindex_17CacheSynchronizer_11csize_parts___get__(((struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)__pyx_v_self));
9505
9506 /* function exit code */
9507 __Pyx_RefNannyFinishContext();
9508 return __pyx_r;
9509 }
9510
__pyx_pf_4borg_9hashindex_17CacheSynchronizer_11csize_parts___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer * __pyx_v_self)9511 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_11csize_parts___get__(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self) {
9512 PyObject *__pyx_r = NULL;
9513 __Pyx_RefNannyDeclarations
9514 PyObject *__pyx_t_1 = NULL;
9515 int __pyx_lineno = 0;
9516 const char *__pyx_filename = NULL;
9517 int __pyx_clineno = 0;
9518 __Pyx_RefNannySetupContext("__get__", 0);
9519
9520 /* "borg/hashindex.pyx":554
9521 * @property
9522 * def csize_parts(self):
9523 * return cache_sync_csize_parts(self.sync) # <<<<<<<<<<<<<<
9524 */
9525 __Pyx_XDECREF(__pyx_r);
9526 __pyx_t_1 = __Pyx_PyInt_From_uint64_t(cache_sync_csize_parts(__pyx_v_self->sync)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 554, __pyx_L1_error)
9527 __Pyx_GOTREF(__pyx_t_1);
9528 __pyx_r = __pyx_t_1;
9529 __pyx_t_1 = 0;
9530 goto __pyx_L0;
9531
9532 /* "borg/hashindex.pyx":553
9533 *
9534 * @property
9535 * def csize_parts(self): # <<<<<<<<<<<<<<
9536 * return cache_sync_csize_parts(self.sync)
9537 */
9538
9539 /* function exit code */
9540 __pyx_L1_error:;
9541 __Pyx_XDECREF(__pyx_t_1);
9542 __Pyx_AddTraceback("borg.hashindex.CacheSynchronizer.csize_parts.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9543 __pyx_r = NULL;
9544 __pyx_L0:;
9545 __Pyx_XGIVEREF(__pyx_r);
9546 __Pyx_RefNannyFinishContext();
9547 return __pyx_r;
9548 }
9549
9550 /* "(tree fragment)":1
9551 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
9552 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9553 * def __setstate_cython__(self, __pyx_state):
9554 */
9555
9556 /* Python wrapper */
9557 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4borg_9hashindex_17CacheSynchronizer_7__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)9558 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9559 PyObject *__pyx_r = 0;
9560 __Pyx_RefNannyDeclarations
9561 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
9562 __pyx_r = __pyx_pf_4borg_9hashindex_17CacheSynchronizer_6__reduce_cython__(((struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)__pyx_v_self));
9563
9564 /* function exit code */
9565 __Pyx_RefNannyFinishContext();
9566 return __pyx_r;
9567 }
9568
__pyx_pf_4borg_9hashindex_17CacheSynchronizer_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_CacheSynchronizer * __pyx_v_self)9569 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self) {
9570 PyObject *__pyx_r = NULL;
9571 __Pyx_RefNannyDeclarations
9572 PyObject *__pyx_t_1 = NULL;
9573 int __pyx_lineno = 0;
9574 const char *__pyx_filename = NULL;
9575 int __pyx_clineno = 0;
9576 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
9577
9578 /* "(tree fragment)":2
9579 * def __reduce_cython__(self):
9580 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
9581 * def __setstate_cython__(self, __pyx_state):
9582 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9583 */
9584 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
9585 __Pyx_GOTREF(__pyx_t_1);
9586 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
9587 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9588 __PYX_ERR(1, 2, __pyx_L1_error)
9589
9590 /* "(tree fragment)":1
9591 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
9592 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9593 * def __setstate_cython__(self, __pyx_state):
9594 */
9595
9596 /* function exit code */
9597 __pyx_L1_error:;
9598 __Pyx_XDECREF(__pyx_t_1);
9599 __Pyx_AddTraceback("borg.hashindex.CacheSynchronizer.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9600 __pyx_r = NULL;
9601 __Pyx_XGIVEREF(__pyx_r);
9602 __Pyx_RefNannyFinishContext();
9603 return __pyx_r;
9604 }
9605
9606 /* "(tree fragment)":3
9607 * def __reduce_cython__(self):
9608 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9609 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
9610 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9611 */
9612
9613 /* Python wrapper */
9614 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_4borg_9hashindex_17CacheSynchronizer_9__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)9615 static PyObject *__pyx_pw_4borg_9hashindex_17CacheSynchronizer_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9616 PyObject *__pyx_r = 0;
9617 __Pyx_RefNannyDeclarations
9618 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
9619 __pyx_r = __pyx_pf_4borg_9hashindex_17CacheSynchronizer_8__setstate_cython__(((struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
9620
9621 /* function exit code */
9622 __Pyx_RefNannyFinishContext();
9623 return __pyx_r;
9624 }
9625
__pyx_pf_4borg_9hashindex_17CacheSynchronizer_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_CacheSynchronizer * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)9626 static PyObject *__pyx_pf_4borg_9hashindex_17CacheSynchronizer_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
9627 PyObject *__pyx_r = NULL;
9628 __Pyx_RefNannyDeclarations
9629 PyObject *__pyx_t_1 = NULL;
9630 int __pyx_lineno = 0;
9631 const char *__pyx_filename = NULL;
9632 int __pyx_clineno = 0;
9633 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
9634
9635 /* "(tree fragment)":4
9636 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9637 * def __setstate_cython__(self, __pyx_state):
9638 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
9639 */
9640 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
9641 __Pyx_GOTREF(__pyx_t_1);
9642 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
9643 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9644 __PYX_ERR(1, 4, __pyx_L1_error)
9645
9646 /* "(tree fragment)":3
9647 * def __reduce_cython__(self):
9648 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9649 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
9650 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9651 */
9652
9653 /* function exit code */
9654 __pyx_L1_error:;
9655 __Pyx_XDECREF(__pyx_t_1);
9656 __Pyx_AddTraceback("borg.hashindex.CacheSynchronizer.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9657 __pyx_r = NULL;
9658 __Pyx_XGIVEREF(__pyx_r);
9659 __Pyx_RefNannyFinishContext();
9660 return __pyx_r;
9661 }
9662
__pyx_tp_new_4borg_9hashindex_IndexBase(PyTypeObject * t,PyObject * a,PyObject * k)9663 static PyObject *__pyx_tp_new_4borg_9hashindex_IndexBase(PyTypeObject *t, PyObject *a, PyObject *k) {
9664 PyObject *o;
9665 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
9666 o = (*t->tp_alloc)(t, 0);
9667 } else {
9668 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
9669 }
9670 if (unlikely(!o)) return 0;
9671 if (unlikely(__pyx_pw_4borg_9hashindex_9IndexBase_1__cinit__(o, a, k) < 0)) goto bad;
9672 return o;
9673 bad:
9674 Py_DECREF(o); o = 0;
9675 return NULL;
9676 }
9677
__pyx_tp_dealloc_4borg_9hashindex_IndexBase(PyObject * o)9678 static void __pyx_tp_dealloc_4borg_9hashindex_IndexBase(PyObject *o) {
9679 #if CYTHON_USE_TP_FINALIZE
9680 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
9681 if (PyObject_CallFinalizerFromDealloc(o)) return;
9682 }
9683 #endif
9684 {
9685 PyObject *etype, *eval, *etb;
9686 PyErr_Fetch(&etype, &eval, &etb);
9687 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
9688 __pyx_pw_4borg_9hashindex_9IndexBase_3__dealloc__(o);
9689 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
9690 PyErr_Restore(etype, eval, etb);
9691 }
9692 (*Py_TYPE(o)->tp_free)(o);
9693 }
9694
__pyx_mp_ass_subscript_4borg_9hashindex_IndexBase(PyObject * o,PyObject * i,PyObject * v)9695 static int __pyx_mp_ass_subscript_4borg_9hashindex_IndexBase(PyObject *o, PyObject *i, PyObject *v) {
9696 if (v) {
9697 PyErr_Format(PyExc_NotImplementedError,
9698 "Subscript assignment not supported by %.200s", Py_TYPE(o)->tp_name);
9699 return -1;
9700 }
9701 else {
9702 return __pyx_pw_4borg_9hashindex_9IndexBase_13__delitem__(o, i);
9703 }
9704 }
9705
9706 static PyMethodDef __pyx_methods_4borg_9hashindex_IndexBase[] = {
9707 {"read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4borg_9hashindex_9IndexBase_5read, METH_VARARGS|METH_KEYWORDS, 0},
9708 {"write", (PyCFunction)__pyx_pw_4borg_9hashindex_9IndexBase_7write, METH_O, 0},
9709 {"clear", (PyCFunction)__pyx_pw_4borg_9hashindex_9IndexBase_9clear, METH_NOARGS, 0},
9710 {"setdefault", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4borg_9hashindex_9IndexBase_11setdefault, METH_VARARGS|METH_KEYWORDS, 0},
9711 {"get", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4borg_9hashindex_9IndexBase_15get, METH_VARARGS|METH_KEYWORDS, 0},
9712 {"pop", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4borg_9hashindex_9IndexBase_17pop, METH_VARARGS|METH_KEYWORDS, 0},
9713 {"size", (PyCFunction)__pyx_pw_4borg_9hashindex_9IndexBase_21size, METH_NOARGS, __pyx_doc_4borg_9hashindex_9IndexBase_20size},
9714 {"compact", (PyCFunction)__pyx_pw_4borg_9hashindex_9IndexBase_23compact, METH_NOARGS, 0},
9715 {"__reduce_cython__", (PyCFunction)__pyx_pw_4borg_9hashindex_9IndexBase_25__reduce_cython__, METH_NOARGS, 0},
9716 {"__setstate_cython__", (PyCFunction)__pyx_pw_4borg_9hashindex_9IndexBase_27__setstate_cython__, METH_O, 0},
9717 {0, 0, 0, 0}
9718 };
9719
9720 static PySequenceMethods __pyx_tp_as_sequence_IndexBase = {
9721 __pyx_pw_4borg_9hashindex_9IndexBase_19__len__, /*sq_length*/
9722 0, /*sq_concat*/
9723 0, /*sq_repeat*/
9724 0, /*sq_item*/
9725 0, /*sq_slice*/
9726 0, /*sq_ass_item*/
9727 0, /*sq_ass_slice*/
9728 0, /*sq_contains*/
9729 0, /*sq_inplace_concat*/
9730 0, /*sq_inplace_repeat*/
9731 };
9732
9733 static PyMappingMethods __pyx_tp_as_mapping_IndexBase = {
9734 __pyx_pw_4borg_9hashindex_9IndexBase_19__len__, /*mp_length*/
9735 0, /*mp_subscript*/
9736 __pyx_mp_ass_subscript_4borg_9hashindex_IndexBase, /*mp_ass_subscript*/
9737 };
9738
9739 static PyTypeObject __pyx_type_4borg_9hashindex_IndexBase = {
9740 PyVarObject_HEAD_INIT(0, 0)
9741 "borg.hashindex.IndexBase", /*tp_name*/
9742 sizeof(struct __pyx_obj_4borg_9hashindex_IndexBase), /*tp_basicsize*/
9743 0, /*tp_itemsize*/
9744 __pyx_tp_dealloc_4borg_9hashindex_IndexBase, /*tp_dealloc*/
9745 #if PY_VERSION_HEX < 0x030800b4
9746 0, /*tp_print*/
9747 #endif
9748 #if PY_VERSION_HEX >= 0x030800b4
9749 0, /*tp_vectorcall_offset*/
9750 #endif
9751 0, /*tp_getattr*/
9752 0, /*tp_setattr*/
9753 #if PY_MAJOR_VERSION < 3
9754 0, /*tp_compare*/
9755 #endif
9756 #if PY_MAJOR_VERSION >= 3
9757 0, /*tp_as_async*/
9758 #endif
9759 0, /*tp_repr*/
9760 0, /*tp_as_number*/
9761 &__pyx_tp_as_sequence_IndexBase, /*tp_as_sequence*/
9762 &__pyx_tp_as_mapping_IndexBase, /*tp_as_mapping*/
9763 0, /*tp_hash*/
9764 0, /*tp_call*/
9765 0, /*tp_str*/
9766 0, /*tp_getattro*/
9767 0, /*tp_setattro*/
9768 0, /*tp_as_buffer*/
9769 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
9770 0, /*tp_doc*/
9771 0, /*tp_traverse*/
9772 0, /*tp_clear*/
9773 0, /*tp_richcompare*/
9774 0, /*tp_weaklistoffset*/
9775 0, /*tp_iter*/
9776 0, /*tp_iternext*/
9777 __pyx_methods_4borg_9hashindex_IndexBase, /*tp_methods*/
9778 0, /*tp_members*/
9779 0, /*tp_getset*/
9780 0, /*tp_base*/
9781 0, /*tp_dict*/
9782 0, /*tp_descr_get*/
9783 0, /*tp_descr_set*/
9784 0, /*tp_dictoffset*/
9785 0, /*tp_init*/
9786 0, /*tp_alloc*/
9787 __pyx_tp_new_4borg_9hashindex_IndexBase, /*tp_new*/
9788 0, /*tp_free*/
9789 0, /*tp_is_gc*/
9790 0, /*tp_bases*/
9791 0, /*tp_mro*/
9792 0, /*tp_cache*/
9793 0, /*tp_subclasses*/
9794 0, /*tp_weaklist*/
9795 0, /*tp_del*/
9796 0, /*tp_version_tag*/
9797 #if PY_VERSION_HEX >= 0x030400a1
9798 0, /*tp_finalize*/
9799 #endif
9800 #if PY_VERSION_HEX >= 0x030800b1
9801 0, /*tp_vectorcall*/
9802 #endif
9803 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
9804 0, /*tp_print*/
9805 #endif
9806 };
9807
__pyx_tp_new_4borg_9hashindex_FuseVersionsIndex(PyTypeObject * t,PyObject * a,PyObject * k)9808 static PyObject *__pyx_tp_new_4borg_9hashindex_FuseVersionsIndex(PyTypeObject *t, PyObject *a, PyObject *k) {
9809 PyObject *o = __pyx_tp_new_4borg_9hashindex_IndexBase(t, a, k);
9810 if (unlikely(!o)) return 0;
9811 return o;
9812 }
__pyx_sq_item_4borg_9hashindex_FuseVersionsIndex(PyObject * o,Py_ssize_t i)9813 static PyObject *__pyx_sq_item_4borg_9hashindex_FuseVersionsIndex(PyObject *o, Py_ssize_t i) {
9814 PyObject *r;
9815 PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
9816 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
9817 Py_DECREF(x);
9818 return r;
9819 }
9820
__pyx_mp_ass_subscript_4borg_9hashindex_FuseVersionsIndex(PyObject * o,PyObject * i,PyObject * v)9821 static int __pyx_mp_ass_subscript_4borg_9hashindex_FuseVersionsIndex(PyObject *o, PyObject *i, PyObject *v) {
9822 if (v) {
9823 return __pyx_pw_4borg_9hashindex_17FuseVersionsIndex_3__setitem__(o, i, v);
9824 }
9825 else {
9826 if (__pyx_ptype_4borg_9hashindex_IndexBase->tp_as_mapping && __pyx_ptype_4borg_9hashindex_IndexBase->tp_as_mapping->mp_ass_subscript)
9827 return __pyx_ptype_4borg_9hashindex_IndexBase->tp_as_mapping->mp_ass_subscript(o, i, v);
9828 PyErr_Format(PyExc_NotImplementedError,
9829 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
9830 return -1;
9831 }
9832 }
9833
9834 static PyMethodDef __pyx_methods_4borg_9hashindex_FuseVersionsIndex[] = {
9835 {"__reduce_cython__", (PyCFunction)__pyx_pw_4borg_9hashindex_17FuseVersionsIndex_7__reduce_cython__, METH_NOARGS, 0},
9836 {"__setstate_cython__", (PyCFunction)__pyx_pw_4borg_9hashindex_17FuseVersionsIndex_9__setstate_cython__, METH_O, 0},
9837 {0, 0, 0, 0}
9838 };
9839
9840 static PySequenceMethods __pyx_tp_as_sequence_FuseVersionsIndex = {
9841 #if CYTHON_COMPILING_IN_PYPY
9842 __pyx_pw_4borg_9hashindex_9IndexBase_19__len__, /*sq_length*/
9843 #else
9844 0, /*sq_length*/
9845 #endif
9846 0, /*sq_concat*/
9847 0, /*sq_repeat*/
9848 __pyx_sq_item_4borg_9hashindex_FuseVersionsIndex, /*sq_item*/
9849 0, /*sq_slice*/
9850 0, /*sq_ass_item*/
9851 0, /*sq_ass_slice*/
9852 __pyx_pw_4borg_9hashindex_17FuseVersionsIndex_5__contains__, /*sq_contains*/
9853 0, /*sq_inplace_concat*/
9854 0, /*sq_inplace_repeat*/
9855 };
9856
9857 static PyMappingMethods __pyx_tp_as_mapping_FuseVersionsIndex = {
9858 #if CYTHON_COMPILING_IN_PYPY
9859 __pyx_pw_4borg_9hashindex_9IndexBase_19__len__, /*mp_length*/
9860 #else
9861 0, /*mp_length*/
9862 #endif
9863 __pyx_pw_4borg_9hashindex_17FuseVersionsIndex_1__getitem__, /*mp_subscript*/
9864 __pyx_mp_ass_subscript_4borg_9hashindex_FuseVersionsIndex, /*mp_ass_subscript*/
9865 };
9866
9867 static PyTypeObject __pyx_type_4borg_9hashindex_FuseVersionsIndex = {
9868 PyVarObject_HEAD_INIT(0, 0)
9869 "borg.hashindex.FuseVersionsIndex", /*tp_name*/
9870 sizeof(struct __pyx_obj_4borg_9hashindex_FuseVersionsIndex), /*tp_basicsize*/
9871 0, /*tp_itemsize*/
9872 __pyx_tp_dealloc_4borg_9hashindex_IndexBase, /*tp_dealloc*/
9873 #if PY_VERSION_HEX < 0x030800b4
9874 0, /*tp_print*/
9875 #endif
9876 #if PY_VERSION_HEX >= 0x030800b4
9877 0, /*tp_vectorcall_offset*/
9878 #endif
9879 0, /*tp_getattr*/
9880 0, /*tp_setattr*/
9881 #if PY_MAJOR_VERSION < 3
9882 0, /*tp_compare*/
9883 #endif
9884 #if PY_MAJOR_VERSION >= 3
9885 0, /*tp_as_async*/
9886 #endif
9887 0, /*tp_repr*/
9888 0, /*tp_as_number*/
9889 &__pyx_tp_as_sequence_FuseVersionsIndex, /*tp_as_sequence*/
9890 &__pyx_tp_as_mapping_FuseVersionsIndex, /*tp_as_mapping*/
9891 0, /*tp_hash*/
9892 0, /*tp_call*/
9893 0, /*tp_str*/
9894 0, /*tp_getattro*/
9895 0, /*tp_setattro*/
9896 0, /*tp_as_buffer*/
9897 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
9898 0, /*tp_doc*/
9899 0, /*tp_traverse*/
9900 0, /*tp_clear*/
9901 0, /*tp_richcompare*/
9902 0, /*tp_weaklistoffset*/
9903 0, /*tp_iter*/
9904 0, /*tp_iternext*/
9905 __pyx_methods_4borg_9hashindex_FuseVersionsIndex, /*tp_methods*/
9906 0, /*tp_members*/
9907 0, /*tp_getset*/
9908 0, /*tp_base*/
9909 0, /*tp_dict*/
9910 0, /*tp_descr_get*/
9911 0, /*tp_descr_set*/
9912 0, /*tp_dictoffset*/
9913 0, /*tp_init*/
9914 0, /*tp_alloc*/
9915 __pyx_tp_new_4borg_9hashindex_FuseVersionsIndex, /*tp_new*/
9916 0, /*tp_free*/
9917 0, /*tp_is_gc*/
9918 0, /*tp_bases*/
9919 0, /*tp_mro*/
9920 0, /*tp_cache*/
9921 0, /*tp_subclasses*/
9922 0, /*tp_weaklist*/
9923 0, /*tp_del*/
9924 0, /*tp_version_tag*/
9925 #if PY_VERSION_HEX >= 0x030400a1
9926 0, /*tp_finalize*/
9927 #endif
9928 #if PY_VERSION_HEX >= 0x030800b1
9929 0, /*tp_vectorcall*/
9930 #endif
9931 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
9932 0, /*tp_print*/
9933 #endif
9934 };
9935
__pyx_tp_new_4borg_9hashindex_NSIndex(PyTypeObject * t,PyObject * a,PyObject * k)9936 static PyObject *__pyx_tp_new_4borg_9hashindex_NSIndex(PyTypeObject *t, PyObject *a, PyObject *k) {
9937 PyObject *o = __pyx_tp_new_4borg_9hashindex_IndexBase(t, a, k);
9938 if (unlikely(!o)) return 0;
9939 return o;
9940 }
__pyx_sq_item_4borg_9hashindex_NSIndex(PyObject * o,Py_ssize_t i)9941 static PyObject *__pyx_sq_item_4borg_9hashindex_NSIndex(PyObject *o, Py_ssize_t i) {
9942 PyObject *r;
9943 PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
9944 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
9945 Py_DECREF(x);
9946 return r;
9947 }
9948
__pyx_mp_ass_subscript_4borg_9hashindex_NSIndex(PyObject * o,PyObject * i,PyObject * v)9949 static int __pyx_mp_ass_subscript_4borg_9hashindex_NSIndex(PyObject *o, PyObject *i, PyObject *v) {
9950 if (v) {
9951 return __pyx_pw_4borg_9hashindex_7NSIndex_3__setitem__(o, i, v);
9952 }
9953 else {
9954 if (__pyx_ptype_4borg_9hashindex_IndexBase->tp_as_mapping && __pyx_ptype_4borg_9hashindex_IndexBase->tp_as_mapping->mp_ass_subscript)
9955 return __pyx_ptype_4borg_9hashindex_IndexBase->tp_as_mapping->mp_ass_subscript(o, i, v);
9956 PyErr_Format(PyExc_NotImplementedError,
9957 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
9958 return -1;
9959 }
9960 }
9961
9962 static PyMethodDef __pyx_methods_4borg_9hashindex_NSIndex[] = {
9963 {"iteritems", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4borg_9hashindex_7NSIndex_7iteritems, METH_VARARGS|METH_KEYWORDS, 0},
9964 {"__reduce_cython__", (PyCFunction)__pyx_pw_4borg_9hashindex_7NSIndex_9__reduce_cython__, METH_NOARGS, 0},
9965 {"__setstate_cython__", (PyCFunction)__pyx_pw_4borg_9hashindex_7NSIndex_11__setstate_cython__, METH_O, 0},
9966 {0, 0, 0, 0}
9967 };
9968
9969 static PySequenceMethods __pyx_tp_as_sequence_NSIndex = {
9970 #if CYTHON_COMPILING_IN_PYPY
9971 __pyx_pw_4borg_9hashindex_9IndexBase_19__len__, /*sq_length*/
9972 #else
9973 0, /*sq_length*/
9974 #endif
9975 0, /*sq_concat*/
9976 0, /*sq_repeat*/
9977 __pyx_sq_item_4borg_9hashindex_NSIndex, /*sq_item*/
9978 0, /*sq_slice*/
9979 0, /*sq_ass_item*/
9980 0, /*sq_ass_slice*/
9981 __pyx_pw_4borg_9hashindex_7NSIndex_5__contains__, /*sq_contains*/
9982 0, /*sq_inplace_concat*/
9983 0, /*sq_inplace_repeat*/
9984 };
9985
9986 static PyMappingMethods __pyx_tp_as_mapping_NSIndex = {
9987 #if CYTHON_COMPILING_IN_PYPY
9988 __pyx_pw_4borg_9hashindex_9IndexBase_19__len__, /*mp_length*/
9989 #else
9990 0, /*mp_length*/
9991 #endif
9992 __pyx_pw_4borg_9hashindex_7NSIndex_1__getitem__, /*mp_subscript*/
9993 __pyx_mp_ass_subscript_4borg_9hashindex_NSIndex, /*mp_ass_subscript*/
9994 };
9995
9996 static PyTypeObject __pyx_type_4borg_9hashindex_NSIndex = {
9997 PyVarObject_HEAD_INIT(0, 0)
9998 "borg.hashindex.NSIndex", /*tp_name*/
9999 sizeof(struct __pyx_obj_4borg_9hashindex_NSIndex), /*tp_basicsize*/
10000 0, /*tp_itemsize*/
10001 __pyx_tp_dealloc_4borg_9hashindex_IndexBase, /*tp_dealloc*/
10002 #if PY_VERSION_HEX < 0x030800b4
10003 0, /*tp_print*/
10004 #endif
10005 #if PY_VERSION_HEX >= 0x030800b4
10006 0, /*tp_vectorcall_offset*/
10007 #endif
10008 0, /*tp_getattr*/
10009 0, /*tp_setattr*/
10010 #if PY_MAJOR_VERSION < 3
10011 0, /*tp_compare*/
10012 #endif
10013 #if PY_MAJOR_VERSION >= 3
10014 0, /*tp_as_async*/
10015 #endif
10016 0, /*tp_repr*/
10017 0, /*tp_as_number*/
10018 &__pyx_tp_as_sequence_NSIndex, /*tp_as_sequence*/
10019 &__pyx_tp_as_mapping_NSIndex, /*tp_as_mapping*/
10020 0, /*tp_hash*/
10021 0, /*tp_call*/
10022 0, /*tp_str*/
10023 0, /*tp_getattro*/
10024 0, /*tp_setattro*/
10025 0, /*tp_as_buffer*/
10026 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
10027 0, /*tp_doc*/
10028 0, /*tp_traverse*/
10029 0, /*tp_clear*/
10030 0, /*tp_richcompare*/
10031 0, /*tp_weaklistoffset*/
10032 0, /*tp_iter*/
10033 0, /*tp_iternext*/
10034 __pyx_methods_4borg_9hashindex_NSIndex, /*tp_methods*/
10035 0, /*tp_members*/
10036 0, /*tp_getset*/
10037 0, /*tp_base*/
10038 0, /*tp_dict*/
10039 0, /*tp_descr_get*/
10040 0, /*tp_descr_set*/
10041 0, /*tp_dictoffset*/
10042 0, /*tp_init*/
10043 0, /*tp_alloc*/
10044 __pyx_tp_new_4borg_9hashindex_NSIndex, /*tp_new*/
10045 0, /*tp_free*/
10046 0, /*tp_is_gc*/
10047 0, /*tp_bases*/
10048 0, /*tp_mro*/
10049 0, /*tp_cache*/
10050 0, /*tp_subclasses*/
10051 0, /*tp_weaklist*/
10052 0, /*tp_del*/
10053 0, /*tp_version_tag*/
10054 #if PY_VERSION_HEX >= 0x030400a1
10055 0, /*tp_finalize*/
10056 #endif
10057 #if PY_VERSION_HEX >= 0x030800b1
10058 0, /*tp_vectorcall*/
10059 #endif
10060 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
10061 0, /*tp_print*/
10062 #endif
10063 };
10064
__pyx_tp_new_4borg_9hashindex_NSKeyIterator(PyTypeObject * t,PyObject * a,PyObject * k)10065 static PyObject *__pyx_tp_new_4borg_9hashindex_NSKeyIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
10066 struct __pyx_obj_4borg_9hashindex_NSKeyIterator *p;
10067 PyObject *o;
10068 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
10069 o = (*t->tp_alloc)(t, 0);
10070 } else {
10071 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
10072 }
10073 if (unlikely(!o)) return 0;
10074 p = ((struct __pyx_obj_4borg_9hashindex_NSKeyIterator *)o);
10075 p->idx = ((struct __pyx_obj_4borg_9hashindex_NSIndex *)Py_None); Py_INCREF(Py_None);
10076 if (unlikely(__pyx_pw_4borg_9hashindex_13NSKeyIterator_1__cinit__(o, a, k) < 0)) goto bad;
10077 return o;
10078 bad:
10079 Py_DECREF(o); o = 0;
10080 return NULL;
10081 }
10082
__pyx_tp_dealloc_4borg_9hashindex_NSKeyIterator(PyObject * o)10083 static void __pyx_tp_dealloc_4borg_9hashindex_NSKeyIterator(PyObject *o) {
10084 struct __pyx_obj_4borg_9hashindex_NSKeyIterator *p = (struct __pyx_obj_4borg_9hashindex_NSKeyIterator *)o;
10085 #if CYTHON_USE_TP_FINALIZE
10086 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
10087 if (PyObject_CallFinalizerFromDealloc(o)) return;
10088 }
10089 #endif
10090 PyObject_GC_UnTrack(o);
10091 Py_CLEAR(p->idx);
10092 (*Py_TYPE(o)->tp_free)(o);
10093 }
10094
__pyx_tp_traverse_4borg_9hashindex_NSKeyIterator(PyObject * o,visitproc v,void * a)10095 static int __pyx_tp_traverse_4borg_9hashindex_NSKeyIterator(PyObject *o, visitproc v, void *a) {
10096 int e;
10097 struct __pyx_obj_4borg_9hashindex_NSKeyIterator *p = (struct __pyx_obj_4borg_9hashindex_NSKeyIterator *)o;
10098 if (p->idx) {
10099 e = (*v)(((PyObject *)p->idx), a); if (e) return e;
10100 }
10101 return 0;
10102 }
10103
__pyx_tp_clear_4borg_9hashindex_NSKeyIterator(PyObject * o)10104 static int __pyx_tp_clear_4borg_9hashindex_NSKeyIterator(PyObject *o) {
10105 PyObject* tmp;
10106 struct __pyx_obj_4borg_9hashindex_NSKeyIterator *p = (struct __pyx_obj_4borg_9hashindex_NSKeyIterator *)o;
10107 tmp = ((PyObject*)p->idx);
10108 p->idx = ((struct __pyx_obj_4borg_9hashindex_NSIndex *)Py_None); Py_INCREF(Py_None);
10109 Py_XDECREF(tmp);
10110 return 0;
10111 }
10112
__pyx_specialmethod___pyx_pw_4borg_9hashindex_13NSKeyIterator_5__next__(PyObject * self,CYTHON_UNUSED PyObject * arg)10113 static PyObject *__pyx_specialmethod___pyx_pw_4borg_9hashindex_13NSKeyIterator_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {return __pyx_pw_4borg_9hashindex_13NSKeyIterator_5__next__(self);}
10114
10115 static PyMethodDef __pyx_methods_4borg_9hashindex_NSKeyIterator[] = {
10116 {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4borg_9hashindex_13NSKeyIterator_5__next__, METH_NOARGS|METH_COEXIST, 0},
10117 {"__reduce_cython__", (PyCFunction)__pyx_pw_4borg_9hashindex_13NSKeyIterator_7__reduce_cython__, METH_NOARGS, 0},
10118 {"__setstate_cython__", (PyCFunction)__pyx_pw_4borg_9hashindex_13NSKeyIterator_9__setstate_cython__, METH_O, 0},
10119 {0, 0, 0, 0}
10120 };
10121
10122 static PyTypeObject __pyx_type_4borg_9hashindex_NSKeyIterator = {
10123 PyVarObject_HEAD_INIT(0, 0)
10124 "borg.hashindex.NSKeyIterator", /*tp_name*/
10125 sizeof(struct __pyx_obj_4borg_9hashindex_NSKeyIterator), /*tp_basicsize*/
10126 0, /*tp_itemsize*/
10127 __pyx_tp_dealloc_4borg_9hashindex_NSKeyIterator, /*tp_dealloc*/
10128 #if PY_VERSION_HEX < 0x030800b4
10129 0, /*tp_print*/
10130 #endif
10131 #if PY_VERSION_HEX >= 0x030800b4
10132 0, /*tp_vectorcall_offset*/
10133 #endif
10134 0, /*tp_getattr*/
10135 0, /*tp_setattr*/
10136 #if PY_MAJOR_VERSION < 3
10137 0, /*tp_compare*/
10138 #endif
10139 #if PY_MAJOR_VERSION >= 3
10140 0, /*tp_as_async*/
10141 #endif
10142 0, /*tp_repr*/
10143 0, /*tp_as_number*/
10144 0, /*tp_as_sequence*/
10145 0, /*tp_as_mapping*/
10146 0, /*tp_hash*/
10147 0, /*tp_call*/
10148 0, /*tp_str*/
10149 0, /*tp_getattro*/
10150 0, /*tp_setattro*/
10151 0, /*tp_as_buffer*/
10152 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
10153 0, /*tp_doc*/
10154 __pyx_tp_traverse_4borg_9hashindex_NSKeyIterator, /*tp_traverse*/
10155 __pyx_tp_clear_4borg_9hashindex_NSKeyIterator, /*tp_clear*/
10156 0, /*tp_richcompare*/
10157 0, /*tp_weaklistoffset*/
10158 __pyx_pw_4borg_9hashindex_13NSKeyIterator_3__iter__, /*tp_iter*/
10159 __pyx_pw_4borg_9hashindex_13NSKeyIterator_5__next__, /*tp_iternext*/
10160 __pyx_methods_4borg_9hashindex_NSKeyIterator, /*tp_methods*/
10161 0, /*tp_members*/
10162 0, /*tp_getset*/
10163 0, /*tp_base*/
10164 0, /*tp_dict*/
10165 0, /*tp_descr_get*/
10166 0, /*tp_descr_set*/
10167 0, /*tp_dictoffset*/
10168 0, /*tp_init*/
10169 0, /*tp_alloc*/
10170 __pyx_tp_new_4borg_9hashindex_NSKeyIterator, /*tp_new*/
10171 0, /*tp_free*/
10172 0, /*tp_is_gc*/
10173 0, /*tp_bases*/
10174 0, /*tp_mro*/
10175 0, /*tp_cache*/
10176 0, /*tp_subclasses*/
10177 0, /*tp_weaklist*/
10178 0, /*tp_del*/
10179 0, /*tp_version_tag*/
10180 #if PY_VERSION_HEX >= 0x030400a1
10181 0, /*tp_finalize*/
10182 #endif
10183 #if PY_VERSION_HEX >= 0x030800b1
10184 0, /*tp_vectorcall*/
10185 #endif
10186 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
10187 0, /*tp_print*/
10188 #endif
10189 };
10190 static struct __pyx_vtabstruct_4borg_9hashindex_ChunkIndex __pyx_vtable_4borg_9hashindex_ChunkIndex;
10191
__pyx_tp_new_4borg_9hashindex_ChunkIndex(PyTypeObject * t,PyObject * a,PyObject * k)10192 static PyObject *__pyx_tp_new_4borg_9hashindex_ChunkIndex(PyTypeObject *t, PyObject *a, PyObject *k) {
10193 struct __pyx_obj_4borg_9hashindex_ChunkIndex *p;
10194 PyObject *o = __pyx_tp_new_4borg_9hashindex_IndexBase(t, a, k);
10195 if (unlikely(!o)) return 0;
10196 p = ((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)o);
10197 p->__pyx_vtab = __pyx_vtabptr_4borg_9hashindex_ChunkIndex;
10198 return o;
10199 }
__pyx_sq_item_4borg_9hashindex_ChunkIndex(PyObject * o,Py_ssize_t i)10200 static PyObject *__pyx_sq_item_4borg_9hashindex_ChunkIndex(PyObject *o, Py_ssize_t i) {
10201 PyObject *r;
10202 PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
10203 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
10204 Py_DECREF(x);
10205 return r;
10206 }
10207
__pyx_mp_ass_subscript_4borg_9hashindex_ChunkIndex(PyObject * o,PyObject * i,PyObject * v)10208 static int __pyx_mp_ass_subscript_4borg_9hashindex_ChunkIndex(PyObject *o, PyObject *i, PyObject *v) {
10209 if (v) {
10210 return __pyx_pw_4borg_9hashindex_10ChunkIndex_3__setitem__(o, i, v);
10211 }
10212 else {
10213 if (__pyx_ptype_4borg_9hashindex_IndexBase->tp_as_mapping && __pyx_ptype_4borg_9hashindex_IndexBase->tp_as_mapping->mp_ass_subscript)
10214 return __pyx_ptype_4borg_9hashindex_IndexBase->tp_as_mapping->mp_ass_subscript(o, i, v);
10215 PyErr_Format(PyExc_NotImplementedError,
10216 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
10217 return -1;
10218 }
10219 }
10220
10221 static PyMethodDef __pyx_methods_4borg_9hashindex_ChunkIndex[] = {
10222 {"incref", (PyCFunction)__pyx_pw_4borg_9hashindex_10ChunkIndex_7incref, METH_O, __pyx_doc_4borg_9hashindex_10ChunkIndex_6incref},
10223 {"decref", (PyCFunction)__pyx_pw_4borg_9hashindex_10ChunkIndex_9decref, METH_O, __pyx_doc_4borg_9hashindex_10ChunkIndex_8decref},
10224 {"iteritems", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4borg_9hashindex_10ChunkIndex_11iteritems, METH_VARARGS|METH_KEYWORDS, 0},
10225 {"summarize", (PyCFunction)__pyx_pw_4borg_9hashindex_10ChunkIndex_13summarize, METH_NOARGS, 0},
10226 {"stats_against", (PyCFunction)__pyx_pw_4borg_9hashindex_10ChunkIndex_15stats_against, METH_O, __pyx_doc_4borg_9hashindex_10ChunkIndex_14stats_against},
10227 {"add", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4borg_9hashindex_10ChunkIndex_17add, METH_VARARGS|METH_KEYWORDS, 0},
10228 {"merge", (PyCFunction)__pyx_pw_4borg_9hashindex_10ChunkIndex_19merge, METH_O, 0},
10229 {"zero_csize_ids", (PyCFunction)__pyx_pw_4borg_9hashindex_10ChunkIndex_21zero_csize_ids, METH_NOARGS, 0},
10230 {"__reduce_cython__", (PyCFunction)__pyx_pw_4borg_9hashindex_10ChunkIndex_23__reduce_cython__, METH_NOARGS, 0},
10231 {"__setstate_cython__", (PyCFunction)__pyx_pw_4borg_9hashindex_10ChunkIndex_25__setstate_cython__, METH_O, 0},
10232 {0, 0, 0, 0}
10233 };
10234
10235 static PySequenceMethods __pyx_tp_as_sequence_ChunkIndex = {
10236 #if CYTHON_COMPILING_IN_PYPY
10237 __pyx_pw_4borg_9hashindex_9IndexBase_19__len__, /*sq_length*/
10238 #else
10239 0, /*sq_length*/
10240 #endif
10241 0, /*sq_concat*/
10242 0, /*sq_repeat*/
10243 __pyx_sq_item_4borg_9hashindex_ChunkIndex, /*sq_item*/
10244 0, /*sq_slice*/
10245 0, /*sq_ass_item*/
10246 0, /*sq_ass_slice*/
10247 __pyx_pw_4borg_9hashindex_10ChunkIndex_5__contains__, /*sq_contains*/
10248 0, /*sq_inplace_concat*/
10249 0, /*sq_inplace_repeat*/
10250 };
10251
10252 static PyMappingMethods __pyx_tp_as_mapping_ChunkIndex = {
10253 #if CYTHON_COMPILING_IN_PYPY
10254 __pyx_pw_4borg_9hashindex_9IndexBase_19__len__, /*mp_length*/
10255 #else
10256 0, /*mp_length*/
10257 #endif
10258 __pyx_pw_4borg_9hashindex_10ChunkIndex_1__getitem__, /*mp_subscript*/
10259 __pyx_mp_ass_subscript_4borg_9hashindex_ChunkIndex, /*mp_ass_subscript*/
10260 };
10261
10262 static PyTypeObject __pyx_type_4borg_9hashindex_ChunkIndex = {
10263 PyVarObject_HEAD_INIT(0, 0)
10264 "borg.hashindex.ChunkIndex", /*tp_name*/
10265 sizeof(struct __pyx_obj_4borg_9hashindex_ChunkIndex), /*tp_basicsize*/
10266 0, /*tp_itemsize*/
10267 __pyx_tp_dealloc_4borg_9hashindex_IndexBase, /*tp_dealloc*/
10268 #if PY_VERSION_HEX < 0x030800b4
10269 0, /*tp_print*/
10270 #endif
10271 #if PY_VERSION_HEX >= 0x030800b4
10272 0, /*tp_vectorcall_offset*/
10273 #endif
10274 0, /*tp_getattr*/
10275 0, /*tp_setattr*/
10276 #if PY_MAJOR_VERSION < 3
10277 0, /*tp_compare*/
10278 #endif
10279 #if PY_MAJOR_VERSION >= 3
10280 0, /*tp_as_async*/
10281 #endif
10282 0, /*tp_repr*/
10283 0, /*tp_as_number*/
10284 &__pyx_tp_as_sequence_ChunkIndex, /*tp_as_sequence*/
10285 &__pyx_tp_as_mapping_ChunkIndex, /*tp_as_mapping*/
10286 0, /*tp_hash*/
10287 0, /*tp_call*/
10288 0, /*tp_str*/
10289 0, /*tp_getattro*/
10290 0, /*tp_setattro*/
10291 0, /*tp_as_buffer*/
10292 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
10293 "\n Mapping of 32 byte keys to (refcount, size, csize), which are all 32-bit unsigned.\n\n The reference count cannot overflow. If an overflow would occur, the refcount\n is fixed to MAX_VALUE and will neither increase nor decrease by incref(), decref()\n or add().\n\n Prior signed 32-bit overflow is handled correctly for most cases: All values\n from UINT32_MAX (2**32-1, inclusive) to MAX_VALUE (exclusive) are reserved and either\n cause silent data loss (-1, -2) or will raise an AssertionError when accessed.\n Other values are handled correctly. Note that previously the refcount could also reach\n 0 by *increasing* it.\n\n Assigning refcounts in this reserved range is an invalid operation and raises AssertionError.\n ", /*tp_doc*/
10294 0, /*tp_traverse*/
10295 0, /*tp_clear*/
10296 0, /*tp_richcompare*/
10297 0, /*tp_weaklistoffset*/
10298 0, /*tp_iter*/
10299 0, /*tp_iternext*/
10300 __pyx_methods_4borg_9hashindex_ChunkIndex, /*tp_methods*/
10301 0, /*tp_members*/
10302 0, /*tp_getset*/
10303 0, /*tp_base*/
10304 0, /*tp_dict*/
10305 0, /*tp_descr_get*/
10306 0, /*tp_descr_set*/
10307 0, /*tp_dictoffset*/
10308 0, /*tp_init*/
10309 0, /*tp_alloc*/
10310 __pyx_tp_new_4borg_9hashindex_ChunkIndex, /*tp_new*/
10311 0, /*tp_free*/
10312 0, /*tp_is_gc*/
10313 0, /*tp_bases*/
10314 0, /*tp_mro*/
10315 0, /*tp_cache*/
10316 0, /*tp_subclasses*/
10317 0, /*tp_weaklist*/
10318 0, /*tp_del*/
10319 0, /*tp_version_tag*/
10320 #if PY_VERSION_HEX >= 0x030400a1
10321 0, /*tp_finalize*/
10322 #endif
10323 #if PY_VERSION_HEX >= 0x030800b1
10324 0, /*tp_vectorcall*/
10325 #endif
10326 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
10327 0, /*tp_print*/
10328 #endif
10329 };
10330
__pyx_tp_new_4borg_9hashindex_ChunkKeyIterator(PyTypeObject * t,PyObject * a,PyObject * k)10331 static PyObject *__pyx_tp_new_4borg_9hashindex_ChunkKeyIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
10332 struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *p;
10333 PyObject *o;
10334 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
10335 o = (*t->tp_alloc)(t, 0);
10336 } else {
10337 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
10338 }
10339 if (unlikely(!o)) return 0;
10340 p = ((struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *)o);
10341 p->idx = ((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)Py_None); Py_INCREF(Py_None);
10342 if (unlikely(__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_1__cinit__(o, a, k) < 0)) goto bad;
10343 return o;
10344 bad:
10345 Py_DECREF(o); o = 0;
10346 return NULL;
10347 }
10348
__pyx_tp_dealloc_4borg_9hashindex_ChunkKeyIterator(PyObject * o)10349 static void __pyx_tp_dealloc_4borg_9hashindex_ChunkKeyIterator(PyObject *o) {
10350 struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *p = (struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *)o;
10351 #if CYTHON_USE_TP_FINALIZE
10352 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
10353 if (PyObject_CallFinalizerFromDealloc(o)) return;
10354 }
10355 #endif
10356 PyObject_GC_UnTrack(o);
10357 Py_CLEAR(p->idx);
10358 (*Py_TYPE(o)->tp_free)(o);
10359 }
10360
__pyx_tp_traverse_4borg_9hashindex_ChunkKeyIterator(PyObject * o,visitproc v,void * a)10361 static int __pyx_tp_traverse_4borg_9hashindex_ChunkKeyIterator(PyObject *o, visitproc v, void *a) {
10362 int e;
10363 struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *p = (struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *)o;
10364 if (p->idx) {
10365 e = (*v)(((PyObject *)p->idx), a); if (e) return e;
10366 }
10367 return 0;
10368 }
10369
__pyx_tp_clear_4borg_9hashindex_ChunkKeyIterator(PyObject * o)10370 static int __pyx_tp_clear_4borg_9hashindex_ChunkKeyIterator(PyObject *o) {
10371 PyObject* tmp;
10372 struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *p = (struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator *)o;
10373 tmp = ((PyObject*)p->idx);
10374 p->idx = ((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)Py_None); Py_INCREF(Py_None);
10375 Py_XDECREF(tmp);
10376 return 0;
10377 }
10378
__pyx_specialmethod___pyx_pw_4borg_9hashindex_16ChunkKeyIterator_5__next__(PyObject * self,CYTHON_UNUSED PyObject * arg)10379 static PyObject *__pyx_specialmethod___pyx_pw_4borg_9hashindex_16ChunkKeyIterator_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {return __pyx_pw_4borg_9hashindex_16ChunkKeyIterator_5__next__(self);}
10380
10381 static PyMethodDef __pyx_methods_4borg_9hashindex_ChunkKeyIterator[] = {
10382 {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4borg_9hashindex_16ChunkKeyIterator_5__next__, METH_NOARGS|METH_COEXIST, 0},
10383 {"__reduce_cython__", (PyCFunction)__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_7__reduce_cython__, METH_NOARGS, 0},
10384 {"__setstate_cython__", (PyCFunction)__pyx_pw_4borg_9hashindex_16ChunkKeyIterator_9__setstate_cython__, METH_O, 0},
10385 {0, 0, 0, 0}
10386 };
10387
10388 static PyTypeObject __pyx_type_4borg_9hashindex_ChunkKeyIterator = {
10389 PyVarObject_HEAD_INIT(0, 0)
10390 "borg.hashindex.ChunkKeyIterator", /*tp_name*/
10391 sizeof(struct __pyx_obj_4borg_9hashindex_ChunkKeyIterator), /*tp_basicsize*/
10392 0, /*tp_itemsize*/
10393 __pyx_tp_dealloc_4borg_9hashindex_ChunkKeyIterator, /*tp_dealloc*/
10394 #if PY_VERSION_HEX < 0x030800b4
10395 0, /*tp_print*/
10396 #endif
10397 #if PY_VERSION_HEX >= 0x030800b4
10398 0, /*tp_vectorcall_offset*/
10399 #endif
10400 0, /*tp_getattr*/
10401 0, /*tp_setattr*/
10402 #if PY_MAJOR_VERSION < 3
10403 0, /*tp_compare*/
10404 #endif
10405 #if PY_MAJOR_VERSION >= 3
10406 0, /*tp_as_async*/
10407 #endif
10408 0, /*tp_repr*/
10409 0, /*tp_as_number*/
10410 0, /*tp_as_sequence*/
10411 0, /*tp_as_mapping*/
10412 0, /*tp_hash*/
10413 0, /*tp_call*/
10414 0, /*tp_str*/
10415 0, /*tp_getattro*/
10416 0, /*tp_setattro*/
10417 0, /*tp_as_buffer*/
10418 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
10419 0, /*tp_doc*/
10420 __pyx_tp_traverse_4borg_9hashindex_ChunkKeyIterator, /*tp_traverse*/
10421 __pyx_tp_clear_4borg_9hashindex_ChunkKeyIterator, /*tp_clear*/
10422 0, /*tp_richcompare*/
10423 0, /*tp_weaklistoffset*/
10424 __pyx_pw_4borg_9hashindex_16ChunkKeyIterator_3__iter__, /*tp_iter*/
10425 __pyx_pw_4borg_9hashindex_16ChunkKeyIterator_5__next__, /*tp_iternext*/
10426 __pyx_methods_4borg_9hashindex_ChunkKeyIterator, /*tp_methods*/
10427 0, /*tp_members*/
10428 0, /*tp_getset*/
10429 0, /*tp_base*/
10430 0, /*tp_dict*/
10431 0, /*tp_descr_get*/
10432 0, /*tp_descr_set*/
10433 0, /*tp_dictoffset*/
10434 0, /*tp_init*/
10435 0, /*tp_alloc*/
10436 __pyx_tp_new_4borg_9hashindex_ChunkKeyIterator, /*tp_new*/
10437 0, /*tp_free*/
10438 0, /*tp_is_gc*/
10439 0, /*tp_bases*/
10440 0, /*tp_mro*/
10441 0, /*tp_cache*/
10442 0, /*tp_subclasses*/
10443 0, /*tp_weaklist*/
10444 0, /*tp_del*/
10445 0, /*tp_version_tag*/
10446 #if PY_VERSION_HEX >= 0x030400a1
10447 0, /*tp_finalize*/
10448 #endif
10449 #if PY_VERSION_HEX >= 0x030800b1
10450 0, /*tp_vectorcall*/
10451 #endif
10452 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
10453 0, /*tp_print*/
10454 #endif
10455 };
10456
__pyx_tp_new_4borg_9hashindex_CacheSynchronizer(PyTypeObject * t,PyObject * a,PyObject * k)10457 static PyObject *__pyx_tp_new_4borg_9hashindex_CacheSynchronizer(PyTypeObject *t, PyObject *a, PyObject *k) {
10458 struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *p;
10459 PyObject *o;
10460 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
10461 o = (*t->tp_alloc)(t, 0);
10462 } else {
10463 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
10464 }
10465 if (unlikely(!o)) return 0;
10466 p = ((struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)o);
10467 p->chunks = ((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)Py_None); Py_INCREF(Py_None);
10468 if (unlikely(__pyx_pw_4borg_9hashindex_17CacheSynchronizer_1__cinit__(o, a, k) < 0)) goto bad;
10469 return o;
10470 bad:
10471 Py_DECREF(o); o = 0;
10472 return NULL;
10473 }
10474
__pyx_tp_dealloc_4borg_9hashindex_CacheSynchronizer(PyObject * o)10475 static void __pyx_tp_dealloc_4borg_9hashindex_CacheSynchronizer(PyObject *o) {
10476 struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *p = (struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)o;
10477 #if CYTHON_USE_TP_FINALIZE
10478 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
10479 if (PyObject_CallFinalizerFromDealloc(o)) return;
10480 }
10481 #endif
10482 PyObject_GC_UnTrack(o);
10483 {
10484 PyObject *etype, *eval, *etb;
10485 PyErr_Fetch(&etype, &eval, &etb);
10486 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
10487 __pyx_pw_4borg_9hashindex_17CacheSynchronizer_3__dealloc__(o);
10488 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
10489 PyErr_Restore(etype, eval, etb);
10490 }
10491 Py_CLEAR(p->chunks);
10492 (*Py_TYPE(o)->tp_free)(o);
10493 }
10494
__pyx_tp_traverse_4borg_9hashindex_CacheSynchronizer(PyObject * o,visitproc v,void * a)10495 static int __pyx_tp_traverse_4borg_9hashindex_CacheSynchronizer(PyObject *o, visitproc v, void *a) {
10496 int e;
10497 struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *p = (struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)o;
10498 if (p->chunks) {
10499 e = (*v)(((PyObject *)p->chunks), a); if (e) return e;
10500 }
10501 return 0;
10502 }
10503
__pyx_tp_clear_4borg_9hashindex_CacheSynchronizer(PyObject * o)10504 static int __pyx_tp_clear_4borg_9hashindex_CacheSynchronizer(PyObject *o) {
10505 PyObject* tmp;
10506 struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *p = (struct __pyx_obj_4borg_9hashindex_CacheSynchronizer *)o;
10507 tmp = ((PyObject*)p->chunks);
10508 p->chunks = ((struct __pyx_obj_4borg_9hashindex_ChunkIndex *)Py_None); Py_INCREF(Py_None);
10509 Py_XDECREF(tmp);
10510 return 0;
10511 }
10512
__pyx_getprop_4borg_9hashindex_17CacheSynchronizer_num_files_totals(PyObject * o,CYTHON_UNUSED void * x)10513 static PyObject *__pyx_getprop_4borg_9hashindex_17CacheSynchronizer_num_files_totals(PyObject *o, CYTHON_UNUSED void *x) {
10514 return __pyx_pw_4borg_9hashindex_17CacheSynchronizer_16num_files_totals_1__get__(o);
10515 }
10516
__pyx_getprop_4borg_9hashindex_17CacheSynchronizer_num_files_parts(PyObject * o,CYTHON_UNUSED void * x)10517 static PyObject *__pyx_getprop_4borg_9hashindex_17CacheSynchronizer_num_files_parts(PyObject *o, CYTHON_UNUSED void *x) {
10518 return __pyx_pw_4borg_9hashindex_17CacheSynchronizer_15num_files_parts_1__get__(o);
10519 }
10520
__pyx_getprop_4borg_9hashindex_17CacheSynchronizer_size_totals(PyObject * o,CYTHON_UNUSED void * x)10521 static PyObject *__pyx_getprop_4borg_9hashindex_17CacheSynchronizer_size_totals(PyObject *o, CYTHON_UNUSED void *x) {
10522 return __pyx_pw_4borg_9hashindex_17CacheSynchronizer_11size_totals_1__get__(o);
10523 }
10524
__pyx_getprop_4borg_9hashindex_17CacheSynchronizer_size_parts(PyObject * o,CYTHON_UNUSED void * x)10525 static PyObject *__pyx_getprop_4borg_9hashindex_17CacheSynchronizer_size_parts(PyObject *o, CYTHON_UNUSED void *x) {
10526 return __pyx_pw_4borg_9hashindex_17CacheSynchronizer_10size_parts_1__get__(o);
10527 }
10528
__pyx_getprop_4borg_9hashindex_17CacheSynchronizer_csize_totals(PyObject * o,CYTHON_UNUSED void * x)10529 static PyObject *__pyx_getprop_4borg_9hashindex_17CacheSynchronizer_csize_totals(PyObject *o, CYTHON_UNUSED void *x) {
10530 return __pyx_pw_4borg_9hashindex_17CacheSynchronizer_12csize_totals_1__get__(o);
10531 }
10532
__pyx_getprop_4borg_9hashindex_17CacheSynchronizer_csize_parts(PyObject * o,CYTHON_UNUSED void * x)10533 static PyObject *__pyx_getprop_4borg_9hashindex_17CacheSynchronizer_csize_parts(PyObject *o, CYTHON_UNUSED void *x) {
10534 return __pyx_pw_4borg_9hashindex_17CacheSynchronizer_11csize_parts_1__get__(o);
10535 }
10536
10537 static PyMethodDef __pyx_methods_4borg_9hashindex_CacheSynchronizer[] = {
10538 {"feed", (PyCFunction)__pyx_pw_4borg_9hashindex_17CacheSynchronizer_5feed, METH_O, 0},
10539 {"__reduce_cython__", (PyCFunction)__pyx_pw_4borg_9hashindex_17CacheSynchronizer_7__reduce_cython__, METH_NOARGS, 0},
10540 {"__setstate_cython__", (PyCFunction)__pyx_pw_4borg_9hashindex_17CacheSynchronizer_9__setstate_cython__, METH_O, 0},
10541 {0, 0, 0, 0}
10542 };
10543
10544 static struct PyGetSetDef __pyx_getsets_4borg_9hashindex_CacheSynchronizer[] = {
10545 {(char *)"num_files_totals", __pyx_getprop_4borg_9hashindex_17CacheSynchronizer_num_files_totals, 0, (char *)0, 0},
10546 {(char *)"num_files_parts", __pyx_getprop_4borg_9hashindex_17CacheSynchronizer_num_files_parts, 0, (char *)0, 0},
10547 {(char *)"size_totals", __pyx_getprop_4borg_9hashindex_17CacheSynchronizer_size_totals, 0, (char *)0, 0},
10548 {(char *)"size_parts", __pyx_getprop_4borg_9hashindex_17CacheSynchronizer_size_parts, 0, (char *)0, 0},
10549 {(char *)"csize_totals", __pyx_getprop_4borg_9hashindex_17CacheSynchronizer_csize_totals, 0, (char *)0, 0},
10550 {(char *)"csize_parts", __pyx_getprop_4borg_9hashindex_17CacheSynchronizer_csize_parts, 0, (char *)0, 0},
10551 {0, 0, 0, 0, 0}
10552 };
10553
10554 static PyTypeObject __pyx_type_4borg_9hashindex_CacheSynchronizer = {
10555 PyVarObject_HEAD_INIT(0, 0)
10556 "borg.hashindex.CacheSynchronizer", /*tp_name*/
10557 sizeof(struct __pyx_obj_4borg_9hashindex_CacheSynchronizer), /*tp_basicsize*/
10558 0, /*tp_itemsize*/
10559 __pyx_tp_dealloc_4borg_9hashindex_CacheSynchronizer, /*tp_dealloc*/
10560 #if PY_VERSION_HEX < 0x030800b4
10561 0, /*tp_print*/
10562 #endif
10563 #if PY_VERSION_HEX >= 0x030800b4
10564 0, /*tp_vectorcall_offset*/
10565 #endif
10566 0, /*tp_getattr*/
10567 0, /*tp_setattr*/
10568 #if PY_MAJOR_VERSION < 3
10569 0, /*tp_compare*/
10570 #endif
10571 #if PY_MAJOR_VERSION >= 3
10572 0, /*tp_as_async*/
10573 #endif
10574 0, /*tp_repr*/
10575 0, /*tp_as_number*/
10576 0, /*tp_as_sequence*/
10577 0, /*tp_as_mapping*/
10578 0, /*tp_hash*/
10579 0, /*tp_call*/
10580 0, /*tp_str*/
10581 0, /*tp_getattro*/
10582 0, /*tp_setattro*/
10583 0, /*tp_as_buffer*/
10584 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
10585 0, /*tp_doc*/
10586 __pyx_tp_traverse_4borg_9hashindex_CacheSynchronizer, /*tp_traverse*/
10587 __pyx_tp_clear_4borg_9hashindex_CacheSynchronizer, /*tp_clear*/
10588 0, /*tp_richcompare*/
10589 0, /*tp_weaklistoffset*/
10590 0, /*tp_iter*/
10591 0, /*tp_iternext*/
10592 __pyx_methods_4borg_9hashindex_CacheSynchronizer, /*tp_methods*/
10593 0, /*tp_members*/
10594 __pyx_getsets_4borg_9hashindex_CacheSynchronizer, /*tp_getset*/
10595 0, /*tp_base*/
10596 0, /*tp_dict*/
10597 0, /*tp_descr_get*/
10598 0, /*tp_descr_set*/
10599 0, /*tp_dictoffset*/
10600 0, /*tp_init*/
10601 0, /*tp_alloc*/
10602 __pyx_tp_new_4borg_9hashindex_CacheSynchronizer, /*tp_new*/
10603 0, /*tp_free*/
10604 0, /*tp_is_gc*/
10605 0, /*tp_bases*/
10606 0, /*tp_mro*/
10607 0, /*tp_cache*/
10608 0, /*tp_subclasses*/
10609 0, /*tp_weaklist*/
10610 0, /*tp_del*/
10611 0, /*tp_version_tag*/
10612 #if PY_VERSION_HEX >= 0x030400a1
10613 0, /*tp_finalize*/
10614 #endif
10615 #if PY_VERSION_HEX >= 0x030800b1
10616 0, /*tp_vectorcall*/
10617 #endif
10618 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
10619 0, /*tp_print*/
10620 #endif
10621 };
10622
10623 static PyMethodDef __pyx_methods[] = {
10624 {0, 0, 0, 0}
10625 };
10626
10627 #if PY_MAJOR_VERSION >= 3
10628 #if CYTHON_PEP489_MULTI_PHASE_INIT
10629 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
10630 static int __pyx_pymod_exec_hashindex(PyObject* module); /*proto*/
10631 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
10632 {Py_mod_create, (void*)__pyx_pymod_create},
10633 {Py_mod_exec, (void*)__pyx_pymod_exec_hashindex},
10634 {0, NULL}
10635 };
10636 #endif
10637
10638 static struct PyModuleDef __pyx_moduledef = {
10639 PyModuleDef_HEAD_INIT,
10640 "hashindex",
10641 0, /* m_doc */
10642 #if CYTHON_PEP489_MULTI_PHASE_INIT
10643 0, /* m_size */
10644 #else
10645 -1, /* m_size */
10646 #endif
10647 __pyx_methods /* m_methods */,
10648 #if CYTHON_PEP489_MULTI_PHASE_INIT
10649 __pyx_moduledef_slots, /* m_slots */
10650 #else
10651 NULL, /* m_reload */
10652 #endif
10653 NULL, /* m_traverse */
10654 NULL, /* m_clear */
10655 NULL /* m_free */
10656 };
10657 #endif
10658 #ifndef CYTHON_SMALL_CODE
10659 #if defined(__clang__)
10660 #define CYTHON_SMALL_CODE
10661 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
10662 #define CYTHON_SMALL_CODE __attribute__((cold))
10663 #else
10664 #define CYTHON_SMALL_CODE
10665 #endif
10666 #endif
10667
10668 static __Pyx_StringTabEntry __pyx_string_tab[] = {
10669 {&__pyx_kp_u_1_1_07, __pyx_k_1_1_07, sizeof(__pyx_k_1_1_07), 0, 1, 0, 0},
10670 {&__pyx_n_s_API_VERSION, __pyx_k_API_VERSION, sizeof(__pyx_k_API_VERSION), 0, 0, 1, 1},
10671 {&__pyx_n_s_CacheSynchronizer, __pyx_k_CacheSynchronizer, sizeof(__pyx_k_CacheSynchronizer), 0, 0, 1, 1},
10672 {&__pyx_n_s_ChunkIndex, __pyx_k_ChunkIndex, sizeof(__pyx_k_ChunkIndex), 0, 0, 1, 1},
10673 {&__pyx_n_s_ChunkIndexEntry, __pyx_k_ChunkIndexEntry, sizeof(__pyx_k_ChunkIndexEntry), 0, 0, 1, 1},
10674 {&__pyx_n_u_ChunkIndexEntry, __pyx_k_ChunkIndexEntry, sizeof(__pyx_k_ChunkIndexEntry), 0, 1, 0, 1},
10675 {&__pyx_n_s_ChunkKeyIterator, __pyx_k_ChunkKeyIterator, sizeof(__pyx_k_ChunkKeyIterator), 0, 0, 1, 1},
10676 {&__pyx_kp_u_Expected_bytes_of_length_16_for, __pyx_k_Expected_bytes_of_length_16_for, sizeof(__pyx_k_Expected_bytes_of_length_16_for), 0, 1, 0, 0},
10677 {&__pyx_n_s_FuseVersionsIndex, __pyx_k_FuseVersionsIndex, sizeof(__pyx_k_FuseVersionsIndex), 0, 0, 1, 1},
10678 {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
10679 {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
10680 {&__pyx_n_s_MAX_LOAD_FACTOR, __pyx_k_MAX_LOAD_FACTOR, sizeof(__pyx_k_MAX_LOAD_FACTOR), 0, 0, 1, 1},
10681 {&__pyx_n_s_MAX_VALUE, __pyx_k_MAX_VALUE, sizeof(__pyx_k_MAX_VALUE), 0, 0, 1, 1},
10682 {&__pyx_n_s_NSIndex, __pyx_k_NSIndex, sizeof(__pyx_k_NSIndex), 0, 0, 1, 1},
10683 {&__pyx_n_s_NSKeyIterator, __pyx_k_NSKeyIterator, sizeof(__pyx_k_NSKeyIterator), 0, 0, 1, 1},
10684 {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
10685 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
10686 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
10687 {&__pyx_kp_u_cache_sync_feed_failed, __pyx_k_cache_sync_feed_failed, sizeof(__pyx_k_cache_sync_feed_failed), 0, 1, 0, 0},
10688 {&__pyx_kp_u_cache_sync_init_failed, __pyx_k_cache_sync_init_failed, sizeof(__pyx_k_cache_sync_init_failed), 0, 1, 0, 0},
10689 {&__pyx_n_s_capacity, __pyx_k_capacity, sizeof(__pyx_k_capacity), 0, 0, 1, 1},
10690 {&__pyx_n_s_chunks, __pyx_k_chunks, sizeof(__pyx_k_chunks), 0, 0, 1, 1},
10691 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
10692 {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
10693 {&__pyx_n_s_csize, __pyx_k_csize, sizeof(__pyx_k_csize), 0, 0, 1, 1},
10694 {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
10695 {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
10696 {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
10697 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
10698 {&__pyx_kp_u_hashindex_delete_failed, __pyx_k_hashindex_delete_failed, sizeof(__pyx_k_hashindex_delete_failed), 0, 1, 0, 0},
10699 {&__pyx_kp_u_hashindex_init_failed, __pyx_k_hashindex_init_failed, sizeof(__pyx_k_hashindex_init_failed), 0, 1, 0, 0},
10700 {&__pyx_kp_u_hashindex_read_returned_NULL_wit, __pyx_k_hashindex_read_returned_NULL_wit, sizeof(__pyx_k_hashindex_read_returned_NULL_wit), 0, 1, 0, 0},
10701 {&__pyx_kp_u_hashindex_set_failed, __pyx_k_hashindex_set_failed, sizeof(__pyx_k_hashindex_set_failed), 0, 1, 0, 0},
10702 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
10703 {&__pyx_kp_u_invalid_reference_count, __pyx_k_invalid_reference_count, sizeof(__pyx_k_invalid_reference_count), 0, 1, 0, 0},
10704 {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
10705 {&__pyx_n_s_key_size, __pyx_k_key_size, sizeof(__pyx_k_key_size), 0, 0, 1, 1},
10706 {&__pyx_n_s_key_size_2, __pyx_k_key_size_2, sizeof(__pyx_k_key_size_2), 0, 0, 1, 1},
10707 {&__pyx_n_s_locale, __pyx_k_locale, sizeof(__pyx_k_locale), 0, 0, 1, 1},
10708 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
10709 {&__pyx_n_s_marker, __pyx_k_marker, sizeof(__pyx_k_marker), 0, 0, 1, 1},
10710 {&__pyx_kp_u_maximum_number_of_segments_reach, __pyx_k_maximum_number_of_segments_reach, sizeof(__pyx_k_maximum_number_of_segments_reach), 0, 1, 0, 0},
10711 {&__pyx_kp_u_maximum_number_of_versions_reach, __pyx_k_maximum_number_of_versions_reach, sizeof(__pyx_k_maximum_number_of_versions_reach), 0, 1, 0, 0},
10712 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
10713 {&__pyx_n_s_namedtuple, __pyx_k_namedtuple, sizeof(__pyx_k_namedtuple), 0, 0, 1, 1},
10714 {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
10715 {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
10716 {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
10717 {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
10718 {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
10719 {&__pyx_n_s_permit_compact, __pyx_k_permit_compact, sizeof(__pyx_k_permit_compact), 0, 0, 1, 1},
10720 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
10721 {&__pyx_n_u_rb, __pyx_k_rb, sizeof(__pyx_k_rb), 0, 1, 0, 1},
10722 {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1},
10723 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
10724 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
10725 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
10726 {&__pyx_kp_u_refcount_size_csize, __pyx_k_refcount_size_csize, sizeof(__pyx_k_refcount_size_csize), 0, 1, 0, 0},
10727 {&__pyx_n_s_refs, __pyx_k_refs, sizeof(__pyx_k_refs), 0, 0, 1, 1},
10728 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
10729 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
10730 {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
10731 {&__pyx_kp_u_stats_against_key_contained_in_s, __pyx_k_stats_against_key_contained_in_s, sizeof(__pyx_k_stats_against_key_contained_in_s), 0, 1, 0, 0},
10732 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
10733 {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
10734 {&__pyx_n_s_value_size, __pyx_k_value_size, sizeof(__pyx_k_value_size), 0, 0, 1, 1},
10735 {&__pyx_n_u_wb, __pyx_k_wb, sizeof(__pyx_k_wb), 0, 1, 0, 1},
10736 {0, 0, 0, 0, 0, 0, 0}
10737 };
__Pyx_InitCachedBuiltins(void)10738 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
10739 __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 61, __pyx_L1_error)
10740 __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 97, __pyx_L1_error)
10741 __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 138, __pyx_L1_error)
10742 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
10743 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 239, __pyx_L1_error)
10744 __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 261, __pyx_L1_error)
10745 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 408, __pyx_L1_error)
10746 return 0;
10747 __pyx_L1_error:;
10748 return -1;
10749 }
10750
__Pyx_InitCachedConstants(void)10751 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
10752 __Pyx_RefNannyDeclarations
10753 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
10754
10755 /* "borg/hashindex.pyx":97
10756 * if path:
10757 * if isinstance(path, (str, bytes)):
10758 * with open(path, 'rb') as fd: # <<<<<<<<<<<<<<
10759 * self.index = hashindex_read(fd, permit_compact)
10760 * else:
10761 */
10762 __pyx_tuple_ = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 97, __pyx_L1_error)
10763 __Pyx_GOTREF(__pyx_tuple_);
10764 __Pyx_GIVEREF(__pyx_tuple_);
10765
10766 /* "borg/hashindex.pyx":105
10767 * self.index = hashindex_init(capacity, self.key_size, self.value_size)
10768 * if not self.index:
10769 * raise Exception('hashindex_init failed') # <<<<<<<<<<<<<<
10770 *
10771 * def __dealloc__(self):
10772 */
10773 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_hashindex_init_failed); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 105, __pyx_L1_error)
10774 __Pyx_GOTREF(__pyx_tuple__2);
10775 __Pyx_GIVEREF(__pyx_tuple__2);
10776
10777 /* "borg/hashindex.pyx":140
10778 * raise KeyError(key)
10779 * if rc == 0:
10780 * raise Exception('hashindex_delete failed') # <<<<<<<<<<<<<<
10781 *
10782 * def get(self, key, default=None):
10783 */
10784 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_hashindex_delete_failed); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 140, __pyx_L1_error)
10785 __Pyx_GOTREF(__pyx_tuple__3);
10786 __Pyx_GIVEREF(__pyx_tuple__3);
10787
10788 /* "(tree fragment)":2
10789 * def __reduce_cython__(self):
10790 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10791 * def __setstate_cython__(self, __pyx_state):
10792 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10793 */
10794 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 2, __pyx_L1_error)
10795 __Pyx_GOTREF(__pyx_tuple__5);
10796 __Pyx_GIVEREF(__pyx_tuple__5);
10797
10798 /* "(tree fragment)":4
10799 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10800 * def __setstate_cython__(self, __pyx_state):
10801 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10802 */
10803 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 4, __pyx_L1_error)
10804 __Pyx_GOTREF(__pyx_tuple__6);
10805 __Pyx_GIVEREF(__pyx_tuple__6);
10806
10807 /* "borg/hashindex.pyx":188
10808 * assert data.version <= _MAX_VALUE, "maximum number of versions reached"
10809 * if not PyBytes_CheckExact(value[1]) or PyBytes_GET_SIZE(value[1]) != 16:
10810 * raise TypeError("Expected bytes of length 16 for second value") # <<<<<<<<<<<<<<
10811 * memcpy(data.hash, PyBytes_AS_STRING(value[1]), 16)
10812 * data.version = _htole32(data.version)
10813 */
10814 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Expected_bytes_of_length_16_for); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 188, __pyx_L1_error)
10815 __Pyx_GOTREF(__pyx_tuple__7);
10816 __Pyx_GIVEREF(__pyx_tuple__7);
10817
10818 /* "borg/hashindex.pyx":192
10819 * data.version = _htole32(data.version)
10820 * if not hashindex_set(self.index, <char *>key, <void *> &data):
10821 * raise Exception('hashindex_set failed') # <<<<<<<<<<<<<<
10822 *
10823 * def __contains__(self, key):
10824 */
10825 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_hashindex_set_failed); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 192, __pyx_L1_error)
10826 __Pyx_GOTREF(__pyx_tuple__8);
10827 __Pyx_GIVEREF(__pyx_tuple__8);
10828
10829 /* "(tree fragment)":2
10830 * def __reduce_cython__(self):
10831 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10832 * def __setstate_cython__(self, __pyx_state):
10833 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10834 */
10835 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 2, __pyx_L1_error)
10836 __Pyx_GOTREF(__pyx_tuple__9);
10837 __Pyx_GIVEREF(__pyx_tuple__9);
10838
10839 /* "(tree fragment)":4
10840 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10841 * def __setstate_cython__(self, __pyx_state):
10842 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10843 */
10844 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 4, __pyx_L1_error)
10845 __Pyx_GOTREF(__pyx_tuple__10);
10846 __Pyx_GIVEREF(__pyx_tuple__10);
10847
10848 /* "(tree fragment)":2
10849 * def __reduce_cython__(self):
10850 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10851 * def __setstate_cython__(self, __pyx_state):
10852 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10853 */
10854 __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 2, __pyx_L1_error)
10855 __Pyx_GOTREF(__pyx_tuple__11);
10856 __Pyx_GIVEREF(__pyx_tuple__11);
10857
10858 /* "(tree fragment)":4
10859 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10860 * def __setstate_cython__(self, __pyx_state):
10861 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10862 */
10863 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 4, __pyx_L1_error)
10864 __Pyx_GOTREF(__pyx_tuple__12);
10865 __Pyx_GIVEREF(__pyx_tuple__12);
10866
10867 /* "(tree fragment)":2
10868 * def __reduce_cython__(self):
10869 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10870 * def __setstate_cython__(self, __pyx_state):
10871 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10872 */
10873 __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 2, __pyx_L1_error)
10874 __Pyx_GOTREF(__pyx_tuple__13);
10875 __Pyx_GIVEREF(__pyx_tuple__13);
10876
10877 /* "(tree fragment)":4
10878 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10879 * def __setstate_cython__(self, __pyx_state):
10880 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10881 */
10882 __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 4, __pyx_L1_error)
10883 __Pyx_GOTREF(__pyx_tuple__14);
10884 __Pyx_GIVEREF(__pyx_tuple__14);
10885
10886 /* "borg/hashindex.pyx":408
10887 * master_values = <const uint32_t*> hashindex_get(master, key)
10888 * if not master_values:
10889 * raise ValueError('stats_against: key contained in self but not in master_index.') # <<<<<<<<<<<<<<
10890 * our_refcount = _le32toh(our_values[0])
10891 * chunk_size = _le32toh(master_values[1])
10892 */
10893 __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_u_stats_against_key_contained_in_s); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 408, __pyx_L1_error)
10894 __Pyx_GOTREF(__pyx_tuple__15);
10895 __Pyx_GIVEREF(__pyx_tuple__15);
10896
10897 /* "(tree fragment)":2
10898 * def __reduce_cython__(self):
10899 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10900 * def __setstate_cython__(self, __pyx_state):
10901 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10902 */
10903 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 2, __pyx_L1_error)
10904 __Pyx_GOTREF(__pyx_tuple__16);
10905 __Pyx_GIVEREF(__pyx_tuple__16);
10906
10907 /* "(tree fragment)":4
10908 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10909 * def __setstate_cython__(self, __pyx_state):
10910 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10911 */
10912 __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 4, __pyx_L1_error)
10913 __Pyx_GOTREF(__pyx_tuple__17);
10914 __Pyx_GIVEREF(__pyx_tuple__17);
10915
10916 /* "(tree fragment)":2
10917 * def __reduce_cython__(self):
10918 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10919 * def __setstate_cython__(self, __pyx_state):
10920 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10921 */
10922 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 2, __pyx_L1_error)
10923 __Pyx_GOTREF(__pyx_tuple__18);
10924 __Pyx_GIVEREF(__pyx_tuple__18);
10925
10926 /* "(tree fragment)":4
10927 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10928 * def __setstate_cython__(self, __pyx_state):
10929 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10930 */
10931 __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 4, __pyx_L1_error)
10932 __Pyx_GOTREF(__pyx_tuple__19);
10933 __Pyx_GIVEREF(__pyx_tuple__19);
10934
10935 /* "borg/hashindex.pyx":516
10936 * self.sync = cache_sync_init(self.chunks.index)
10937 * if not self.sync:
10938 * raise Exception('cache_sync_init failed') # <<<<<<<<<<<<<<
10939 *
10940 * def __dealloc__(self):
10941 */
10942 __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_u_cache_sync_init_failed); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 516, __pyx_L1_error)
10943 __Pyx_GOTREF(__pyx_tuple__20);
10944 __Pyx_GIVEREF(__pyx_tuple__20);
10945
10946 /* "(tree fragment)":2
10947 * def __reduce_cython__(self):
10948 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10949 * def __setstate_cython__(self, __pyx_state):
10950 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10951 */
10952 __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 2, __pyx_L1_error)
10953 __Pyx_GOTREF(__pyx_tuple__21);
10954 __Pyx_GIVEREF(__pyx_tuple__21);
10955
10956 /* "(tree fragment)":4
10957 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10958 * def __setstate_cython__(self, __pyx_state):
10959 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10960 */
10961 __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 4, __pyx_L1_error)
10962 __Pyx_GOTREF(__pyx_tuple__22);
10963 __Pyx_GIVEREF(__pyx_tuple__22);
10964
10965 /* "borg/hashindex.pyx":272
10966 *
10967 *
10968 * ChunkIndexEntry = namedtuple('ChunkIndexEntry', 'refcount size csize') # <<<<<<<<<<<<<<
10969 *
10970 *
10971 */
10972 __pyx_tuple__23 = PyTuple_Pack(2, __pyx_n_u_ChunkIndexEntry, __pyx_kp_u_refcount_size_csize); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 272, __pyx_L1_error)
10973 __Pyx_GOTREF(__pyx_tuple__23);
10974 __Pyx_GIVEREF(__pyx_tuple__23);
10975 __Pyx_RefNannyFinishContext();
10976 return 0;
10977 __pyx_L1_error:;
10978 __Pyx_RefNannyFinishContext();
10979 return -1;
10980 }
10981
__Pyx_InitGlobals(void)10982 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
10983 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
10984 __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
10985 __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
10986 __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) __PYX_ERR(0, 1, __pyx_L1_error)
10987 __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error)
10988 __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) __PYX_ERR(0, 1, __pyx_L1_error)
10989 __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) __PYX_ERR(0, 1, __pyx_L1_error)
10990 __pyx_int_4294967295 = PyInt_FromString((char *)"4294967295", 0, 0); if (unlikely(!__pyx_int_4294967295)) __PYX_ERR(0, 1, __pyx_L1_error)
10991 return 0;
10992 __pyx_L1_error:;
10993 return -1;
10994 }
10995
10996 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
10997 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
10998 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
10999 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
11000 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
11001 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
11002 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
11003
__Pyx_modinit_global_init_code(void)11004 static int __Pyx_modinit_global_init_code(void) {
11005 __Pyx_RefNannyDeclarations
11006 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
11007 /*--- Global init code ---*/
11008 __pyx_v_4borg_9hashindex__NoDefault = Py_None; Py_INCREF(Py_None);
11009 __Pyx_RefNannyFinishContext();
11010 return 0;
11011 }
11012
__Pyx_modinit_variable_export_code(void)11013 static int __Pyx_modinit_variable_export_code(void) {
11014 __Pyx_RefNannyDeclarations
11015 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
11016 /*--- Variable export code ---*/
11017 __Pyx_RefNannyFinishContext();
11018 return 0;
11019 }
11020
__Pyx_modinit_function_export_code(void)11021 static int __Pyx_modinit_function_export_code(void) {
11022 __Pyx_RefNannyDeclarations
11023 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
11024 /*--- Function export code ---*/
11025 __Pyx_RefNannyFinishContext();
11026 return 0;
11027 }
11028
__Pyx_modinit_type_init_code(void)11029 static int __Pyx_modinit_type_init_code(void) {
11030 __Pyx_RefNannyDeclarations
11031 int __pyx_lineno = 0;
11032 const char *__pyx_filename = NULL;
11033 int __pyx_clineno = 0;
11034 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
11035 /*--- Type init code ---*/
11036 if (PyType_Ready(&__pyx_type_4borg_9hashindex_IndexBase) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
11037 #if PY_VERSION_HEX < 0x030800B1
11038 __pyx_type_4borg_9hashindex_IndexBase.tp_print = 0;
11039 #endif
11040 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4borg_9hashindex_IndexBase.tp_dictoffset && __pyx_type_4borg_9hashindex_IndexBase.tp_getattro == PyObject_GenericGetAttr)) {
11041 __pyx_type_4borg_9hashindex_IndexBase.tp_getattro = __Pyx_PyObject_GenericGetAttr;
11042 }
11043 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4borg_9hashindex_IndexBase) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
11044 __pyx_ptype_4borg_9hashindex_IndexBase = &__pyx_type_4borg_9hashindex_IndexBase;
11045 __pyx_type_4borg_9hashindex_FuseVersionsIndex.tp_base = __pyx_ptype_4borg_9hashindex_IndexBase;
11046 if (PyType_Ready(&__pyx_type_4borg_9hashindex_FuseVersionsIndex) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
11047 #if PY_VERSION_HEX < 0x030800B1
11048 __pyx_type_4borg_9hashindex_FuseVersionsIndex.tp_print = 0;
11049 #endif
11050 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4borg_9hashindex_FuseVersionsIndex.tp_dictoffset && __pyx_type_4borg_9hashindex_FuseVersionsIndex.tp_getattro == PyObject_GenericGetAttr)) {
11051 __pyx_type_4borg_9hashindex_FuseVersionsIndex.tp_getattro = __Pyx_PyObject_GenericGetAttr;
11052 }
11053 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FuseVersionsIndex, (PyObject *)&__pyx_type_4borg_9hashindex_FuseVersionsIndex) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
11054 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4borg_9hashindex_FuseVersionsIndex) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
11055 __pyx_ptype_4borg_9hashindex_FuseVersionsIndex = &__pyx_type_4borg_9hashindex_FuseVersionsIndex;
11056 __pyx_type_4borg_9hashindex_NSIndex.tp_base = __pyx_ptype_4borg_9hashindex_IndexBase;
11057 if (PyType_Ready(&__pyx_type_4borg_9hashindex_NSIndex) < 0) __PYX_ERR(0, 199, __pyx_L1_error)
11058 #if PY_VERSION_HEX < 0x030800B1
11059 __pyx_type_4borg_9hashindex_NSIndex.tp_print = 0;
11060 #endif
11061 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4borg_9hashindex_NSIndex.tp_dictoffset && __pyx_type_4borg_9hashindex_NSIndex.tp_getattro == PyObject_GenericGetAttr)) {
11062 __pyx_type_4borg_9hashindex_NSIndex.tp_getattro = __Pyx_PyObject_GenericGetAttr;
11063 }
11064 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_NSIndex, (PyObject *)&__pyx_type_4borg_9hashindex_NSIndex) < 0) __PYX_ERR(0, 199, __pyx_L1_error)
11065 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4borg_9hashindex_NSIndex) < 0) __PYX_ERR(0, 199, __pyx_L1_error)
11066 __pyx_ptype_4borg_9hashindex_NSIndex = &__pyx_type_4borg_9hashindex_NSIndex;
11067 if (PyType_Ready(&__pyx_type_4borg_9hashindex_NSKeyIterator) < 0) __PYX_ERR(0, 244, __pyx_L1_error)
11068 #if PY_VERSION_HEX < 0x030800B1
11069 __pyx_type_4borg_9hashindex_NSKeyIterator.tp_print = 0;
11070 #endif
11071 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4borg_9hashindex_NSKeyIterator.tp_dictoffset && __pyx_type_4borg_9hashindex_NSKeyIterator.tp_getattro == PyObject_GenericGetAttr)) {
11072 __pyx_type_4borg_9hashindex_NSKeyIterator.tp_getattro = __Pyx_PyObject_GenericGetAttr;
11073 }
11074 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_NSKeyIterator, (PyObject *)&__pyx_type_4borg_9hashindex_NSKeyIterator) < 0) __PYX_ERR(0, 244, __pyx_L1_error)
11075 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4borg_9hashindex_NSKeyIterator) < 0) __PYX_ERR(0, 244, __pyx_L1_error)
11076 __pyx_ptype_4borg_9hashindex_NSKeyIterator = &__pyx_type_4borg_9hashindex_NSKeyIterator;
11077 __pyx_vtabptr_4borg_9hashindex_ChunkIndex = &__pyx_vtable_4borg_9hashindex_ChunkIndex;
11078 __pyx_vtable_4borg_9hashindex_ChunkIndex._add = (PyObject *(*)(struct __pyx_obj_4borg_9hashindex_ChunkIndex *, void *, uint32_t *))__pyx_f_4borg_9hashindex_10ChunkIndex__add;
11079 __pyx_type_4borg_9hashindex_ChunkIndex.tp_base = __pyx_ptype_4borg_9hashindex_IndexBase;
11080 if (PyType_Ready(&__pyx_type_4borg_9hashindex_ChunkIndex) < 0) __PYX_ERR(0, 275, __pyx_L1_error)
11081 #if PY_VERSION_HEX < 0x030800B1
11082 __pyx_type_4borg_9hashindex_ChunkIndex.tp_print = 0;
11083 #endif
11084 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4borg_9hashindex_ChunkIndex.tp_dictoffset && __pyx_type_4borg_9hashindex_ChunkIndex.tp_getattro == PyObject_GenericGetAttr)) {
11085 __pyx_type_4borg_9hashindex_ChunkIndex.tp_getattro = __Pyx_PyObject_GenericGetAttr;
11086 }
11087 if (__Pyx_SetVtable(__pyx_type_4borg_9hashindex_ChunkIndex.tp_dict, __pyx_vtabptr_4borg_9hashindex_ChunkIndex) < 0) __PYX_ERR(0, 275, __pyx_L1_error)
11088 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ChunkIndex, (PyObject *)&__pyx_type_4borg_9hashindex_ChunkIndex) < 0) __PYX_ERR(0, 275, __pyx_L1_error)
11089 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4borg_9hashindex_ChunkIndex) < 0) __PYX_ERR(0, 275, __pyx_L1_error)
11090 __pyx_ptype_4borg_9hashindex_ChunkIndex = &__pyx_type_4borg_9hashindex_ChunkIndex;
11091 if (PyType_Ready(&__pyx_type_4borg_9hashindex_ChunkKeyIterator) < 0) __PYX_ERR(0, 474, __pyx_L1_error)
11092 #if PY_VERSION_HEX < 0x030800B1
11093 __pyx_type_4borg_9hashindex_ChunkKeyIterator.tp_print = 0;
11094 #endif
11095 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4borg_9hashindex_ChunkKeyIterator.tp_dictoffset && __pyx_type_4borg_9hashindex_ChunkKeyIterator.tp_getattro == PyObject_GenericGetAttr)) {
11096 __pyx_type_4borg_9hashindex_ChunkKeyIterator.tp_getattro = __Pyx_PyObject_GenericGetAttr;
11097 }
11098 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ChunkKeyIterator, (PyObject *)&__pyx_type_4borg_9hashindex_ChunkKeyIterator) < 0) __PYX_ERR(0, 474, __pyx_L1_error)
11099 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4borg_9hashindex_ChunkKeyIterator) < 0) __PYX_ERR(0, 474, __pyx_L1_error)
11100 __pyx_ptype_4borg_9hashindex_ChunkKeyIterator = &__pyx_type_4borg_9hashindex_ChunkKeyIterator;
11101 if (PyType_Ready(&__pyx_type_4borg_9hashindex_CacheSynchronizer) < 0) __PYX_ERR(0, 508, __pyx_L1_error)
11102 #if PY_VERSION_HEX < 0x030800B1
11103 __pyx_type_4borg_9hashindex_CacheSynchronizer.tp_print = 0;
11104 #endif
11105 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4borg_9hashindex_CacheSynchronizer.tp_dictoffset && __pyx_type_4borg_9hashindex_CacheSynchronizer.tp_getattro == PyObject_GenericGetAttr)) {
11106 __pyx_type_4borg_9hashindex_CacheSynchronizer.tp_getattro = __Pyx_PyObject_GenericGetAttr;
11107 }
11108 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CacheSynchronizer, (PyObject *)&__pyx_type_4borg_9hashindex_CacheSynchronizer) < 0) __PYX_ERR(0, 508, __pyx_L1_error)
11109 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4borg_9hashindex_CacheSynchronizer) < 0) __PYX_ERR(0, 508, __pyx_L1_error)
11110 __pyx_ptype_4borg_9hashindex_CacheSynchronizer = &__pyx_type_4borg_9hashindex_CacheSynchronizer;
11111 __Pyx_RefNannyFinishContext();
11112 return 0;
11113 __pyx_L1_error:;
11114 __Pyx_RefNannyFinishContext();
11115 return -1;
11116 }
11117
__Pyx_modinit_type_import_code(void)11118 static int __Pyx_modinit_type_import_code(void) {
11119 __Pyx_RefNannyDeclarations
11120 PyObject *__pyx_t_1 = NULL;
11121 int __pyx_lineno = 0;
11122 const char *__pyx_filename = NULL;
11123 int __pyx_clineno = 0;
11124 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
11125 /*--- Type import code ---*/
11126 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
11127 __Pyx_GOTREF(__pyx_t_1);
11128 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
11129 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
11130 sizeof(PyTypeObject),
11131 #else
11132 sizeof(PyHeapTypeObject),
11133 #endif
11134 __Pyx_ImportType_CheckSize_Warn);
11135 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
11136 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11137 __Pyx_RefNannyFinishContext();
11138 return 0;
11139 __pyx_L1_error:;
11140 __Pyx_XDECREF(__pyx_t_1);
11141 __Pyx_RefNannyFinishContext();
11142 return -1;
11143 }
11144
__Pyx_modinit_variable_import_code(void)11145 static int __Pyx_modinit_variable_import_code(void) {
11146 __Pyx_RefNannyDeclarations
11147 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
11148 /*--- Variable import code ---*/
11149 __Pyx_RefNannyFinishContext();
11150 return 0;
11151 }
11152
__Pyx_modinit_function_import_code(void)11153 static int __Pyx_modinit_function_import_code(void) {
11154 __Pyx_RefNannyDeclarations
11155 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
11156 /*--- Function import code ---*/
11157 __Pyx_RefNannyFinishContext();
11158 return 0;
11159 }
11160
11161
11162 #ifndef CYTHON_NO_PYINIT_EXPORT
11163 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
11164 #elif PY_MAJOR_VERSION < 3
11165 #ifdef __cplusplus
11166 #define __Pyx_PyMODINIT_FUNC extern "C" void
11167 #else
11168 #define __Pyx_PyMODINIT_FUNC void
11169 #endif
11170 #else
11171 #ifdef __cplusplus
11172 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
11173 #else
11174 #define __Pyx_PyMODINIT_FUNC PyObject *
11175 #endif
11176 #endif
11177
11178
11179 #if PY_MAJOR_VERSION < 3
11180 __Pyx_PyMODINIT_FUNC inithashindex(void) CYTHON_SMALL_CODE; /*proto*/
inithashindex(void)11181 __Pyx_PyMODINIT_FUNC inithashindex(void)
11182 #else
11183 __Pyx_PyMODINIT_FUNC PyInit_hashindex(void) CYTHON_SMALL_CODE; /*proto*/
11184 __Pyx_PyMODINIT_FUNC PyInit_hashindex(void)
11185 #if CYTHON_PEP489_MULTI_PHASE_INIT
11186 {
11187 return PyModuleDef_Init(&__pyx_moduledef);
11188 }
11189 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
11190 #if PY_VERSION_HEX >= 0x030700A1
11191 static PY_INT64_T main_interpreter_id = -1;
11192 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
11193 if (main_interpreter_id == -1) {
11194 main_interpreter_id = current_id;
11195 return (unlikely(current_id == -1)) ? -1 : 0;
11196 } else if (unlikely(main_interpreter_id != current_id))
11197 #else
11198 static PyInterpreterState *main_interpreter = NULL;
11199 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
11200 if (!main_interpreter) {
11201 main_interpreter = current_interpreter;
11202 } else if (unlikely(main_interpreter != current_interpreter))
11203 #endif
11204 {
11205 PyErr_SetString(
11206 PyExc_ImportError,
11207 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
11208 return -1;
11209 }
11210 return 0;
11211 }
11212 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
11213 PyObject *value = PyObject_GetAttrString(spec, from_name);
11214 int result = 0;
11215 if (likely(value)) {
11216 if (allow_none || value != Py_None) {
11217 result = PyDict_SetItemString(moddict, to_name, value);
11218 }
11219 Py_DECREF(value);
11220 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
11221 PyErr_Clear();
11222 } else {
11223 result = -1;
11224 }
11225 return result;
11226 }
11227 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
11228 PyObject *module = NULL, *moddict, *modname;
11229 if (__Pyx_check_single_interpreter())
11230 return NULL;
11231 if (__pyx_m)
11232 return __Pyx_NewRef(__pyx_m);
11233 modname = PyObject_GetAttrString(spec, "name");
11234 if (unlikely(!modname)) goto bad;
11235 module = PyModule_NewObject(modname);
11236 Py_DECREF(modname);
11237 if (unlikely(!module)) goto bad;
11238 moddict = PyModule_GetDict(module);
11239 if (unlikely(!moddict)) goto bad;
11240 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
11241 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
11242 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
11243 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
11244 return module;
11245 bad:
11246 Py_XDECREF(module);
11247 return NULL;
11248 }
11249
11250
11251 static CYTHON_SMALL_CODE int __pyx_pymod_exec_hashindex(PyObject *__pyx_pyinit_module)
11252 #endif
11253 #endif
11254 {
11255 PyObject *__pyx_t_1 = NULL;
11256 PyObject *__pyx_t_2 = NULL;
11257 int __pyx_t_3;
11258 int __pyx_lineno = 0;
11259 const char *__pyx_filename = NULL;
11260 int __pyx_clineno = 0;
11261 __Pyx_RefNannyDeclarations
11262 #if CYTHON_PEP489_MULTI_PHASE_INIT
11263 if (__pyx_m) {
11264 if (__pyx_m == __pyx_pyinit_module) return 0;
11265 PyErr_SetString(PyExc_RuntimeError, "Module 'hashindex' has already been imported. Re-initialisation is not supported.");
11266 return -1;
11267 }
11268 #elif PY_MAJOR_VERSION >= 3
11269 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
11270 #endif
11271 #if CYTHON_REFNANNY
11272 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
11273 if (!__Pyx_RefNanny) {
11274 PyErr_Clear();
11275 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
11276 if (!__Pyx_RefNanny)
11277 Py_FatalError("failed to import 'refnanny' module");
11278 }
11279 #endif
11280 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_hashindex(void)", 0);
11281 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11282 #ifdef __Pxy_PyFrame_Initialize_Offsets
11283 __Pxy_PyFrame_Initialize_Offsets();
11284 #endif
11285 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
11286 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
11287 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
11288 #ifdef __Pyx_CyFunction_USED
11289 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11290 #endif
11291 #ifdef __Pyx_FusedFunction_USED
11292 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11293 #endif
11294 #ifdef __Pyx_Coroutine_USED
11295 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11296 #endif
11297 #ifdef __Pyx_Generator_USED
11298 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11299 #endif
11300 #ifdef __Pyx_AsyncGen_USED
11301 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11302 #endif
11303 #ifdef __Pyx_StopAsyncIteration_USED
11304 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11305 #endif
11306 /*--- Library function declarations ---*/
11307 /*--- Threads initialization code ---*/
11308 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
11309 #ifdef WITH_THREAD /* Python build with threading support? */
11310 PyEval_InitThreads();
11311 #endif
11312 #endif
11313 /*--- Module creation code ---*/
11314 #if CYTHON_PEP489_MULTI_PHASE_INIT
11315 __pyx_m = __pyx_pyinit_module;
11316 Py_INCREF(__pyx_m);
11317 #else
11318 #if PY_MAJOR_VERSION < 3
11319 __pyx_m = Py_InitModule4("hashindex", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
11320 #else
11321 __pyx_m = PyModule_Create(&__pyx_moduledef);
11322 #endif
11323 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
11324 #endif
11325 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
11326 Py_INCREF(__pyx_d);
11327 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
11328 Py_INCREF(__pyx_b);
11329 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
11330 Py_INCREF(__pyx_cython_runtime);
11331 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11332 /*--- Initialize various global constants etc. ---*/
11333 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11334 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
11335 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11336 #endif
11337 if (__pyx_module_is_main_borg__hashindex) {
11338 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11339 }
11340 #if PY_MAJOR_VERSION >= 3
11341 {
11342 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
11343 if (!PyDict_GetItemString(modules, "borg.hashindex")) {
11344 if (unlikely(PyDict_SetItemString(modules, "borg.hashindex", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
11345 }
11346 }
11347 #endif
11348 /*--- Builtin init code ---*/
11349 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11350 /*--- Constants init code ---*/
11351 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11352 /*--- Global type/function init code ---*/
11353 (void)__Pyx_modinit_global_init_code();
11354 (void)__Pyx_modinit_variable_export_code();
11355 (void)__Pyx_modinit_function_export_code();
11356 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
11357 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
11358 (void)__Pyx_modinit_variable_import_code();
11359 (void)__Pyx_modinit_function_import_code();
11360 /*--- Execution code ---*/
11361 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
11362 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11363 #endif
11364
11365 /* "borg/hashindex.pyx":3
11366 * # cython: language_level=3
11367 *
11368 * from collections import namedtuple # <<<<<<<<<<<<<<
11369 * import locale
11370 * import os
11371 */
11372 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
11373 __Pyx_GOTREF(__pyx_t_1);
11374 __Pyx_INCREF(__pyx_n_s_namedtuple);
11375 __Pyx_GIVEREF(__pyx_n_s_namedtuple);
11376 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_namedtuple);
11377 __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error)
11378 __Pyx_GOTREF(__pyx_t_2);
11379 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11380 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
11381 __Pyx_GOTREF(__pyx_t_1);
11382 if (PyDict_SetItem(__pyx_d, __pyx_n_s_namedtuple, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
11383 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11384 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11385
11386 /* "borg/hashindex.pyx":4
11387 *
11388 * from collections import namedtuple
11389 * import locale # <<<<<<<<<<<<<<
11390 * import os
11391 *
11392 */
11393 __pyx_t_2 = __Pyx_Import(__pyx_n_s_locale, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
11394 __Pyx_GOTREF(__pyx_t_2);
11395 if (PyDict_SetItem(__pyx_d, __pyx_n_s_locale, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
11396 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11397
11398 /* "borg/hashindex.pyx":5
11399 * from collections import namedtuple
11400 * import locale
11401 * import os # <<<<<<<<<<<<<<
11402 *
11403 * cimport cython
11404 */
11405 __pyx_t_2 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)
11406 __Pyx_GOTREF(__pyx_t_2);
11407 if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
11408 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11409
11410 /* "borg/hashindex.pyx":15
11411 * from cpython.bytes cimport PyBytes_FromStringAndSize, PyBytes_CheckExact, PyBytes_GET_SIZE, PyBytes_AS_STRING
11412 *
11413 * API_VERSION = '1.1_07' # <<<<<<<<<<<<<<
11414 *
11415 *
11416 */
11417 if (PyDict_SetItem(__pyx_d, __pyx_n_s_API_VERSION, __pyx_kp_u_1_1_07) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
11418
11419 /* "borg/hashindex.pyx":61
11420 *
11421 *
11422 * cdef _NoDefault = object() # <<<<<<<<<<<<<<
11423 *
11424 * """
11425 */
11426 __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error)
11427 __Pyx_GOTREF(__pyx_t_2);
11428 __Pyx_XGOTREF(__pyx_v_4borg_9hashindex__NoDefault);
11429 __Pyx_DECREF_SET(__pyx_v_4borg_9hashindex__NoDefault, __pyx_t_2);
11430 __Pyx_GIVEREF(__pyx_t_2);
11431 __pyx_t_2 = 0;
11432
11433 /* "borg/hashindex.pyx":78
11434 * """
11435 *
11436 * assert UINT32_MAX == 2**32-1 # <<<<<<<<<<<<<<
11437 *
11438 * assert _MAX_VALUE % 2 == 1
11439 */
11440 #ifndef CYTHON_WITHOUT_ASSERTIONS
11441 if (unlikely(!Py_OptimizeFlag)) {
11442 __pyx_t_2 = __Pyx_PyInt_From_uint32_t(UINT32_MAX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
11443 __Pyx_GOTREF(__pyx_t_2);
11444 __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_4294967295, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
11445 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11446 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 78, __pyx_L1_error)
11447 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11448 if (unlikely(!__pyx_t_3)) {
11449 PyErr_SetNone(PyExc_AssertionError);
11450 __PYX_ERR(0, 78, __pyx_L1_error)
11451 }
11452 }
11453 #endif
11454
11455 /* "borg/hashindex.pyx":80
11456 * assert UINT32_MAX == 2**32-1
11457 *
11458 * assert _MAX_VALUE % 2 == 1 # <<<<<<<<<<<<<<
11459 *
11460 *
11461 */
11462 #ifndef CYTHON_WITHOUT_ASSERTIONS
11463 if (unlikely(!Py_OptimizeFlag)) {
11464 if (unlikely(!((__Pyx_mod_long(_MAX_VALUE, 2) == 1) != 0))) {
11465 PyErr_SetNone(PyExc_AssertionError);
11466 __PYX_ERR(0, 80, __pyx_L1_error)
11467 }
11468 }
11469 #endif
11470
11471 /* "borg/hashindex.pyx":88
11472 * cdef int key_size
11473 *
11474 * _key_size = 32 # <<<<<<<<<<<<<<
11475 *
11476 * MAX_LOAD_FACTOR = HASH_MAX_LOAD
11477 */
11478 if (PyDict_SetItem((PyObject *)__pyx_ptype_4borg_9hashindex_IndexBase->tp_dict, __pyx_n_s_key_size, __pyx_int_32) < 0) __PYX_ERR(0, 88, __pyx_L1_error)
11479 PyType_Modified(__pyx_ptype_4borg_9hashindex_IndexBase);
11480
11481 /* "borg/hashindex.pyx":90
11482 * _key_size = 32
11483 *
11484 * MAX_LOAD_FACTOR = HASH_MAX_LOAD # <<<<<<<<<<<<<<
11485 * MAX_VALUE = _MAX_VALUE
11486 *
11487 */
11488 __pyx_t_1 = PyFloat_FromDouble(HASH_MAX_LOAD); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
11489 __Pyx_GOTREF(__pyx_t_1);
11490 if (PyDict_SetItem((PyObject *)__pyx_ptype_4borg_9hashindex_IndexBase->tp_dict, __pyx_n_s_MAX_LOAD_FACTOR, __pyx_t_1) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
11491 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11492 PyType_Modified(__pyx_ptype_4borg_9hashindex_IndexBase);
11493
11494 /* "borg/hashindex.pyx":91
11495 *
11496 * MAX_LOAD_FACTOR = HASH_MAX_LOAD
11497 * MAX_VALUE = _MAX_VALUE # <<<<<<<<<<<<<<
11498 *
11499 * def __cinit__(self, capacity=0, path=None, permit_compact=False):
11500 */
11501 __pyx_t_1 = __Pyx_PyInt_From_uint32_t(_MAX_VALUE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
11502 __Pyx_GOTREF(__pyx_t_1);
11503 if (PyDict_SetItem((PyObject *)__pyx_ptype_4borg_9hashindex_IndexBase->tp_dict, __pyx_n_s_MAX_VALUE, __pyx_t_1) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
11504 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11505 PyType_Modified(__pyx_ptype_4borg_9hashindex_IndexBase);
11506
11507 /* "borg/hashindex.pyx":112
11508 *
11509 * @classmethod
11510 * def read(cls, path, permit_compact=False): # <<<<<<<<<<<<<<
11511 * return cls(path=path, permit_compact=permit_compact)
11512 *
11513 */
11514 __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_4borg_9hashindex_IndexBase, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
11515 __Pyx_GOTREF(__pyx_t_1);
11516
11517 /* "borg/hashindex.pyx":111
11518 * hashindex_free(self.index)
11519 *
11520 * @classmethod # <<<<<<<<<<<<<<
11521 * def read(cls, path, permit_compact=False):
11522 * return cls(path=path, permit_compact=permit_compact)
11523 */
11524 __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
11525 __Pyx_GOTREF(__pyx_t_2);
11526 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11527 if (PyDict_SetItem((PyObject *)__pyx_ptype_4borg_9hashindex_IndexBase->tp_dict, __pyx_n_s_read, __pyx_t_2) < 0) __PYX_ERR(0, 112, __pyx_L1_error)
11528 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11529 PyType_Modified(__pyx_ptype_4borg_9hashindex_IndexBase);
11530
11531 /* "borg/hashindex.pyx":148
11532 * return default
11533 *
11534 * def pop(self, key, default=_NoDefault): # <<<<<<<<<<<<<<
11535 * try:
11536 * value = self[key]
11537 */
11538 __Pyx_INCREF(__pyx_v_4borg_9hashindex__NoDefault);
11539 __pyx_k__4 = __pyx_v_4borg_9hashindex__NoDefault;
11540 __Pyx_GIVEREF(__pyx_v_4borg_9hashindex__NoDefault);
11541
11542 /* "borg/hashindex.pyx":171
11543 * cdef class FuseVersionsIndex(IndexBase):
11544 * # 4 byte version + 16 byte file contents hash
11545 * value_size = 20 # <<<<<<<<<<<<<<
11546 * _key_size = 16
11547 *
11548 */
11549 if (PyDict_SetItem((PyObject *)__pyx_ptype_4borg_9hashindex_FuseVersionsIndex->tp_dict, __pyx_n_s_value_size, __pyx_int_20) < 0) __PYX_ERR(0, 171, __pyx_L1_error)
11550 PyType_Modified(__pyx_ptype_4borg_9hashindex_FuseVersionsIndex);
11551
11552 /* "borg/hashindex.pyx":172
11553 * # 4 byte version + 16 byte file contents hash
11554 * value_size = 20
11555 * _key_size = 16 # <<<<<<<<<<<<<<
11556 *
11557 * def __getitem__(self, key):
11558 */
11559 if (PyDict_SetItem((PyObject *)__pyx_ptype_4borg_9hashindex_FuseVersionsIndex->tp_dict, __pyx_n_s_key_size, __pyx_int_16) < 0) __PYX_ERR(0, 172, __pyx_L1_error)
11560 PyType_Modified(__pyx_ptype_4borg_9hashindex_FuseVersionsIndex);
11561
11562 /* "borg/hashindex.pyx":201
11563 * cdef class NSIndex(IndexBase):
11564 *
11565 * value_size = 8 # <<<<<<<<<<<<<<
11566 *
11567 * def __getitem__(self, key):
11568 */
11569 if (PyDict_SetItem((PyObject *)__pyx_ptype_4borg_9hashindex_NSIndex->tp_dict, __pyx_n_s_value_size, __pyx_int_8) < 0) __PYX_ERR(0, 201, __pyx_L1_error)
11570 PyType_Modified(__pyx_ptype_4borg_9hashindex_NSIndex);
11571
11572 /* "borg/hashindex.pyx":272
11573 *
11574 *
11575 * ChunkIndexEntry = namedtuple('ChunkIndexEntry', 'refcount size csize') # <<<<<<<<<<<<<<
11576 *
11577 *
11578 */
11579 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error)
11580 __Pyx_GOTREF(__pyx_t_2);
11581 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error)
11582 __Pyx_GOTREF(__pyx_t_1);
11583 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11584 if (PyDict_SetItem(__pyx_d, __pyx_n_s_ChunkIndexEntry, __pyx_t_1) < 0) __PYX_ERR(0, 272, __pyx_L1_error)
11585 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11586
11587 /* "borg/hashindex.pyx":292
11588 * """
11589 *
11590 * value_size = 12 # <<<<<<<<<<<<<<
11591 *
11592 * def __getitem__(self, key):
11593 */
11594 if (PyDict_SetItem((PyObject *)__pyx_ptype_4borg_9hashindex_ChunkIndex->tp_dict, __pyx_n_s_value_size, __pyx_int_12) < 0) __PYX_ERR(0, 292, __pyx_L1_error)
11595 PyType_Modified(__pyx_ptype_4borg_9hashindex_ChunkIndex);
11596
11597 /* "borg/hashindex.pyx":1
11598 * # cython: language_level=3 # <<<<<<<<<<<<<<
11599 *
11600 * from collections import namedtuple
11601 */
11602 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
11603 __Pyx_GOTREF(__pyx_t_1);
11604 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11605 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11606
11607 /*--- Wrapped vars code ---*/
11608
11609 goto __pyx_L0;
11610 __pyx_L1_error:;
11611 __Pyx_XDECREF(__pyx_t_1);
11612 __Pyx_XDECREF(__pyx_t_2);
11613 if (__pyx_m) {
11614 if (__pyx_d) {
11615 __Pyx_AddTraceback("init borg.hashindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
11616 }
11617 Py_CLEAR(__pyx_m);
11618 } else if (!PyErr_Occurred()) {
11619 PyErr_SetString(PyExc_ImportError, "init borg.hashindex");
11620 }
11621 __pyx_L0:;
11622 __Pyx_RefNannyFinishContext();
11623 #if CYTHON_PEP489_MULTI_PHASE_INIT
11624 return (__pyx_m != NULL) ? 0 : -1;
11625 #elif PY_MAJOR_VERSION >= 3
11626 return __pyx_m;
11627 #else
11628 return;
11629 #endif
11630 }
11631
11632 /* --- Runtime support code --- */
11633 /* Refnanny */
11634 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)11635 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
11636 PyObject *m = NULL, *p = NULL;
11637 void *r = NULL;
11638 m = PyImport_ImportModule(modname);
11639 if (!m) goto end;
11640 p = PyObject_GetAttrString(m, "RefNannyAPI");
11641 if (!p) goto end;
11642 r = PyLong_AsVoidPtr(p);
11643 end:
11644 Py_XDECREF(p);
11645 Py_XDECREF(m);
11646 return (__Pyx_RefNannyAPIStruct *)r;
11647 }
11648 #endif
11649
11650 /* PyObjectGetAttrStr */
11651 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)11652 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
11653 PyTypeObject* tp = Py_TYPE(obj);
11654 if (likely(tp->tp_getattro))
11655 return tp->tp_getattro(obj, attr_name);
11656 #if PY_MAJOR_VERSION < 3
11657 if (likely(tp->tp_getattr))
11658 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
11659 #endif
11660 return PyObject_GetAttr(obj, attr_name);
11661 }
11662 #endif
11663
11664 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)11665 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
11666 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
11667 if (unlikely(!result)) {
11668 PyErr_Format(PyExc_NameError,
11669 #if PY_MAJOR_VERSION >= 3
11670 "name '%U' is not defined", name);
11671 #else
11672 "name '%.200s' is not defined", PyString_AS_STRING(name));
11673 #endif
11674 }
11675 return result;
11676 }
11677
11678 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)11679 static void __Pyx_RaiseDoubleKeywordsError(
11680 const char* func_name,
11681 PyObject* kw_name)
11682 {
11683 PyErr_Format(PyExc_TypeError,
11684 #if PY_MAJOR_VERSION >= 3
11685 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
11686 #else
11687 "%s() got multiple values for keyword argument '%s'", func_name,
11688 PyString_AsString(kw_name));
11689 #endif
11690 }
11691
11692 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)11693 static int __Pyx_ParseOptionalKeywords(
11694 PyObject *kwds,
11695 PyObject **argnames[],
11696 PyObject *kwds2,
11697 PyObject *values[],
11698 Py_ssize_t num_pos_args,
11699 const char* function_name)
11700 {
11701 PyObject *key = 0, *value = 0;
11702 Py_ssize_t pos = 0;
11703 PyObject*** name;
11704 PyObject*** first_kw_arg = argnames + num_pos_args;
11705 while (PyDict_Next(kwds, &pos, &key, &value)) {
11706 name = first_kw_arg;
11707 while (*name && (**name != key)) name++;
11708 if (*name) {
11709 values[name-argnames] = value;
11710 continue;
11711 }
11712 name = first_kw_arg;
11713 #if PY_MAJOR_VERSION < 3
11714 if (likely(PyString_Check(key))) {
11715 while (*name) {
11716 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
11717 && _PyString_Eq(**name, key)) {
11718 values[name-argnames] = value;
11719 break;
11720 }
11721 name++;
11722 }
11723 if (*name) continue;
11724 else {
11725 PyObject*** argname = argnames;
11726 while (argname != first_kw_arg) {
11727 if ((**argname == key) || (
11728 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
11729 && _PyString_Eq(**argname, key))) {
11730 goto arg_passed_twice;
11731 }
11732 argname++;
11733 }
11734 }
11735 } else
11736 #endif
11737 if (likely(PyUnicode_Check(key))) {
11738 while (*name) {
11739 int cmp = (**name == key) ? 0 :
11740 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
11741 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
11742 #endif
11743 PyUnicode_Compare(**name, key);
11744 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
11745 if (cmp == 0) {
11746 values[name-argnames] = value;
11747 break;
11748 }
11749 name++;
11750 }
11751 if (*name) continue;
11752 else {
11753 PyObject*** argname = argnames;
11754 while (argname != first_kw_arg) {
11755 int cmp = (**argname == key) ? 0 :
11756 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
11757 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
11758 #endif
11759 PyUnicode_Compare(**argname, key);
11760 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
11761 if (cmp == 0) goto arg_passed_twice;
11762 argname++;
11763 }
11764 }
11765 } else
11766 goto invalid_keyword_type;
11767 if (kwds2) {
11768 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
11769 } else {
11770 goto invalid_keyword;
11771 }
11772 }
11773 return 0;
11774 arg_passed_twice:
11775 __Pyx_RaiseDoubleKeywordsError(function_name, key);
11776 goto bad;
11777 invalid_keyword_type:
11778 PyErr_Format(PyExc_TypeError,
11779 "%.200s() keywords must be strings", function_name);
11780 goto bad;
11781 invalid_keyword:
11782 PyErr_Format(PyExc_TypeError,
11783 #if PY_MAJOR_VERSION < 3
11784 "%.200s() got an unexpected keyword argument '%.200s'",
11785 function_name, PyString_AsString(key));
11786 #else
11787 "%s() got an unexpected keyword argument '%U'",
11788 function_name, key);
11789 #endif
11790 bad:
11791 return -1;
11792 }
11793
11794 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)11795 static void __Pyx_RaiseArgtupleInvalid(
11796 const char* func_name,
11797 int exact,
11798 Py_ssize_t num_min,
11799 Py_ssize_t num_max,
11800 Py_ssize_t num_found)
11801 {
11802 Py_ssize_t num_expected;
11803 const char *more_or_less;
11804 if (num_found < num_min) {
11805 num_expected = num_min;
11806 more_or_less = "at least";
11807 } else {
11808 num_expected = num_max;
11809 more_or_less = "at most";
11810 }
11811 if (exact) {
11812 more_or_less = "exactly";
11813 }
11814 PyErr_Format(PyExc_TypeError,
11815 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
11816 func_name, more_or_less, num_expected,
11817 (num_expected == 1) ? "" : "s", num_found);
11818 }
11819
11820 /* PyObjectCall */
11821 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)11822 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
11823 PyObject *result;
11824 ternaryfunc call = func->ob_type->tp_call;
11825 if (unlikely(!call))
11826 return PyObject_Call(func, arg, kw);
11827 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
11828 return NULL;
11829 result = (*call)(func, arg, kw);
11830 Py_LeaveRecursiveCall();
11831 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
11832 PyErr_SetString(
11833 PyExc_SystemError,
11834 "NULL result without error in PyObject_Call");
11835 }
11836 return result;
11837 }
11838 #endif
11839
11840 /* PyFunctionFastCall */
11841 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)11842 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
11843 PyObject *globals) {
11844 PyFrameObject *f;
11845 PyThreadState *tstate = __Pyx_PyThreadState_Current;
11846 PyObject **fastlocals;
11847 Py_ssize_t i;
11848 PyObject *result;
11849 assert(globals != NULL);
11850 /* XXX Perhaps we should create a specialized
11851 PyFrame_New() that doesn't take locals, but does
11852 take builtins without sanity checking them.
11853 */
11854 assert(tstate != NULL);
11855 f = PyFrame_New(tstate, co, globals, NULL);
11856 if (f == NULL) {
11857 return NULL;
11858 }
11859 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
11860 for (i = 0; i < na; i++) {
11861 Py_INCREF(*args);
11862 fastlocals[i] = *args++;
11863 }
11864 result = PyEval_EvalFrameEx(f,0);
11865 ++tstate->recursion_depth;
11866 Py_DECREF(f);
11867 --tstate->recursion_depth;
11868 return result;
11869 }
11870 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)11871 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
11872 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
11873 PyObject *globals = PyFunction_GET_GLOBALS(func);
11874 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
11875 PyObject *closure;
11876 #if PY_MAJOR_VERSION >= 3
11877 PyObject *kwdefs;
11878 #endif
11879 PyObject *kwtuple, **k;
11880 PyObject **d;
11881 Py_ssize_t nd;
11882 Py_ssize_t nk;
11883 PyObject *result;
11884 assert(kwargs == NULL || PyDict_Check(kwargs));
11885 nk = kwargs ? PyDict_Size(kwargs) : 0;
11886 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
11887 return NULL;
11888 }
11889 if (
11890 #if PY_MAJOR_VERSION >= 3
11891 co->co_kwonlyargcount == 0 &&
11892 #endif
11893 likely(kwargs == NULL || nk == 0) &&
11894 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
11895 if (argdefs == NULL && co->co_argcount == nargs) {
11896 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
11897 goto done;
11898 }
11899 else if (nargs == 0 && argdefs != NULL
11900 && co->co_argcount == Py_SIZE(argdefs)) {
11901 /* function called with no arguments, but all parameters have
11902 a default value: use default values as arguments .*/
11903 args = &PyTuple_GET_ITEM(argdefs, 0);
11904 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
11905 goto done;
11906 }
11907 }
11908 if (kwargs != NULL) {
11909 Py_ssize_t pos, i;
11910 kwtuple = PyTuple_New(2 * nk);
11911 if (kwtuple == NULL) {
11912 result = NULL;
11913 goto done;
11914 }
11915 k = &PyTuple_GET_ITEM(kwtuple, 0);
11916 pos = i = 0;
11917 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
11918 Py_INCREF(k[i]);
11919 Py_INCREF(k[i+1]);
11920 i += 2;
11921 }
11922 nk = i / 2;
11923 }
11924 else {
11925 kwtuple = NULL;
11926 k = NULL;
11927 }
11928 closure = PyFunction_GET_CLOSURE(func);
11929 #if PY_MAJOR_VERSION >= 3
11930 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
11931 #endif
11932 if (argdefs != NULL) {
11933 d = &PyTuple_GET_ITEM(argdefs, 0);
11934 nd = Py_SIZE(argdefs);
11935 }
11936 else {
11937 d = NULL;
11938 nd = 0;
11939 }
11940 #if PY_MAJOR_VERSION >= 3
11941 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
11942 args, (int)nargs,
11943 k, (int)nk,
11944 d, (int)nd, kwdefs, closure);
11945 #else
11946 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
11947 args, (int)nargs,
11948 k, (int)nk,
11949 d, (int)nd, closure);
11950 #endif
11951 Py_XDECREF(kwtuple);
11952 done:
11953 Py_LeaveRecursiveCall();
11954 return result;
11955 }
11956 #endif
11957 #endif
11958
11959 /* PyObjectCallMethO */
11960 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)11961 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
11962 PyObject *self, *result;
11963 PyCFunction cfunc;
11964 cfunc = PyCFunction_GET_FUNCTION(func);
11965 self = PyCFunction_GET_SELF(func);
11966 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
11967 return NULL;
11968 result = cfunc(self, arg);
11969 Py_LeaveRecursiveCall();
11970 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
11971 PyErr_SetString(
11972 PyExc_SystemError,
11973 "NULL result without error in PyObject_Call");
11974 }
11975 return result;
11976 }
11977 #endif
11978
11979 /* PyObjectCallNoArg */
11980 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)11981 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
11982 #if CYTHON_FAST_PYCALL
11983 if (PyFunction_Check(func)) {
11984 return __Pyx_PyFunction_FastCall(func, NULL, 0);
11985 }
11986 #endif
11987 #ifdef __Pyx_CyFunction_USED
11988 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
11989 #else
11990 if (likely(PyCFunction_Check(func)))
11991 #endif
11992 {
11993 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
11994 return __Pyx_PyObject_CallMethO(func, NULL);
11995 }
11996 }
11997 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
11998 }
11999 #endif
12000
12001 /* PyCFunctionFastCall */
12002 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)12003 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
12004 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
12005 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
12006 PyObject *self = PyCFunction_GET_SELF(func);
12007 int flags = PyCFunction_GET_FLAGS(func);
12008 assert(PyCFunction_Check(func));
12009 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
12010 assert(nargs >= 0);
12011 assert(nargs == 0 || args != NULL);
12012 /* _PyCFunction_FastCallDict() must not be called with an exception set,
12013 because it may clear it (directly or indirectly) and so the
12014 caller loses its exception */
12015 assert(!PyErr_Occurred());
12016 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
12017 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
12018 } else {
12019 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
12020 }
12021 }
12022 #endif
12023
12024 /* PyObjectCallOneArg */
12025 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)12026 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
12027 PyObject *result;
12028 PyObject *args = PyTuple_New(1);
12029 if (unlikely(!args)) return NULL;
12030 Py_INCREF(arg);
12031 PyTuple_SET_ITEM(args, 0, arg);
12032 result = __Pyx_PyObject_Call(func, args, NULL);
12033 Py_DECREF(args);
12034 return result;
12035 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)12036 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
12037 #if CYTHON_FAST_PYCALL
12038 if (PyFunction_Check(func)) {
12039 return __Pyx_PyFunction_FastCall(func, &arg, 1);
12040 }
12041 #endif
12042 if (likely(PyCFunction_Check(func))) {
12043 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
12044 return __Pyx_PyObject_CallMethO(func, arg);
12045 #if CYTHON_FAST_PYCCALL
12046 } else if (__Pyx_PyFastCFunction_Check(func)) {
12047 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
12048 #endif
12049 }
12050 }
12051 return __Pyx__PyObject_CallOneArg(func, arg);
12052 }
12053 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)12054 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
12055 PyObject *result;
12056 PyObject *args = PyTuple_Pack(1, arg);
12057 if (unlikely(!args)) return NULL;
12058 result = __Pyx_PyObject_Call(func, args, NULL);
12059 Py_DECREF(args);
12060 return result;
12061 }
12062 #endif
12063
12064 /* GetTopmostException */
12065 #if CYTHON_USE_EXC_INFO_STACK
12066 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)12067 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
12068 {
12069 _PyErr_StackItem *exc_info = tstate->exc_info;
12070 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
12071 exc_info->previous_item != NULL)
12072 {
12073 exc_info = exc_info->previous_item;
12074 }
12075 return exc_info;
12076 }
12077 #endif
12078
12079 /* SaveResetException */
12080 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)12081 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
12082 #if CYTHON_USE_EXC_INFO_STACK
12083 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
12084 *type = exc_info->exc_type;
12085 *value = exc_info->exc_value;
12086 *tb = exc_info->exc_traceback;
12087 #else
12088 *type = tstate->exc_type;
12089 *value = tstate->exc_value;
12090 *tb = tstate->exc_traceback;
12091 #endif
12092 Py_XINCREF(*type);
12093 Py_XINCREF(*value);
12094 Py_XINCREF(*tb);
12095 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)12096 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
12097 PyObject *tmp_type, *tmp_value, *tmp_tb;
12098 #if CYTHON_USE_EXC_INFO_STACK
12099 _PyErr_StackItem *exc_info = tstate->exc_info;
12100 tmp_type = exc_info->exc_type;
12101 tmp_value = exc_info->exc_value;
12102 tmp_tb = exc_info->exc_traceback;
12103 exc_info->exc_type = type;
12104 exc_info->exc_value = value;
12105 exc_info->exc_traceback = tb;
12106 #else
12107 tmp_type = tstate->exc_type;
12108 tmp_value = tstate->exc_value;
12109 tmp_tb = tstate->exc_traceback;
12110 tstate->exc_type = type;
12111 tstate->exc_value = value;
12112 tstate->exc_traceback = tb;
12113 #endif
12114 Py_XDECREF(tmp_type);
12115 Py_XDECREF(tmp_value);
12116 Py_XDECREF(tmp_tb);
12117 }
12118 #endif
12119
12120 /* GetException */
12121 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)12122 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
12123 #else
12124 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
12125 #endif
12126 {
12127 PyObject *local_type, *local_value, *local_tb;
12128 #if CYTHON_FAST_THREAD_STATE
12129 PyObject *tmp_type, *tmp_value, *tmp_tb;
12130 local_type = tstate->curexc_type;
12131 local_value = tstate->curexc_value;
12132 local_tb = tstate->curexc_traceback;
12133 tstate->curexc_type = 0;
12134 tstate->curexc_value = 0;
12135 tstate->curexc_traceback = 0;
12136 #else
12137 PyErr_Fetch(&local_type, &local_value, &local_tb);
12138 #endif
12139 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
12140 #if CYTHON_FAST_THREAD_STATE
12141 if (unlikely(tstate->curexc_type))
12142 #else
12143 if (unlikely(PyErr_Occurred()))
12144 #endif
12145 goto bad;
12146 #if PY_MAJOR_VERSION >= 3
12147 if (local_tb) {
12148 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
12149 goto bad;
12150 }
12151 #endif
12152 Py_XINCREF(local_tb);
12153 Py_XINCREF(local_type);
12154 Py_XINCREF(local_value);
12155 *type = local_type;
12156 *value = local_value;
12157 *tb = local_tb;
12158 #if CYTHON_FAST_THREAD_STATE
12159 #if CYTHON_USE_EXC_INFO_STACK
12160 {
12161 _PyErr_StackItem *exc_info = tstate->exc_info;
12162 tmp_type = exc_info->exc_type;
12163 tmp_value = exc_info->exc_value;
12164 tmp_tb = exc_info->exc_traceback;
12165 exc_info->exc_type = local_type;
12166 exc_info->exc_value = local_value;
12167 exc_info->exc_traceback = local_tb;
12168 }
12169 #else
12170 tmp_type = tstate->exc_type;
12171 tmp_value = tstate->exc_value;
12172 tmp_tb = tstate->exc_traceback;
12173 tstate->exc_type = local_type;
12174 tstate->exc_value = local_value;
12175 tstate->exc_traceback = local_tb;
12176 #endif
12177 Py_XDECREF(tmp_type);
12178 Py_XDECREF(tmp_value);
12179 Py_XDECREF(tmp_tb);
12180 #else
12181 PyErr_SetExcInfo(local_type, local_value, local_tb);
12182 #endif
12183 return 0;
12184 bad:
12185 *type = 0;
12186 *value = 0;
12187 *tb = 0;
12188 Py_XDECREF(local_type);
12189 Py_XDECREF(local_value);
12190 Py_XDECREF(local_tb);
12191 return -1;
12192 }
12193
12194 /* PyErrFetchRestore */
12195 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)12196 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
12197 PyObject *tmp_type, *tmp_value, *tmp_tb;
12198 tmp_type = tstate->curexc_type;
12199 tmp_value = tstate->curexc_value;
12200 tmp_tb = tstate->curexc_traceback;
12201 tstate->curexc_type = type;
12202 tstate->curexc_value = value;
12203 tstate->curexc_traceback = tb;
12204 Py_XDECREF(tmp_type);
12205 Py_XDECREF(tmp_value);
12206 Py_XDECREF(tmp_tb);
12207 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)12208 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
12209 *type = tstate->curexc_type;
12210 *value = tstate->curexc_value;
12211 *tb = tstate->curexc_traceback;
12212 tstate->curexc_type = 0;
12213 tstate->curexc_value = 0;
12214 tstate->curexc_traceback = 0;
12215 }
12216 #endif
12217
12218 /* RaiseException */
12219 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)12220 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
12221 CYTHON_UNUSED PyObject *cause) {
12222 __Pyx_PyThreadState_declare
12223 Py_XINCREF(type);
12224 if (!value || value == Py_None)
12225 value = NULL;
12226 else
12227 Py_INCREF(value);
12228 if (!tb || tb == Py_None)
12229 tb = NULL;
12230 else {
12231 Py_INCREF(tb);
12232 if (!PyTraceBack_Check(tb)) {
12233 PyErr_SetString(PyExc_TypeError,
12234 "raise: arg 3 must be a traceback or None");
12235 goto raise_error;
12236 }
12237 }
12238 if (PyType_Check(type)) {
12239 #if CYTHON_COMPILING_IN_PYPY
12240 if (!value) {
12241 Py_INCREF(Py_None);
12242 value = Py_None;
12243 }
12244 #endif
12245 PyErr_NormalizeException(&type, &value, &tb);
12246 } else {
12247 if (value) {
12248 PyErr_SetString(PyExc_TypeError,
12249 "instance exception may not have a separate value");
12250 goto raise_error;
12251 }
12252 value = type;
12253 type = (PyObject*) Py_TYPE(type);
12254 Py_INCREF(type);
12255 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
12256 PyErr_SetString(PyExc_TypeError,
12257 "raise: exception class must be a subclass of BaseException");
12258 goto raise_error;
12259 }
12260 }
12261 __Pyx_PyThreadState_assign
12262 __Pyx_ErrRestore(type, value, tb);
12263 return;
12264 raise_error:
12265 Py_XDECREF(value);
12266 Py_XDECREF(type);
12267 Py_XDECREF(tb);
12268 return;
12269 }
12270 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)12271 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
12272 PyObject* owned_instance = NULL;
12273 if (tb == Py_None) {
12274 tb = 0;
12275 } else if (tb && !PyTraceBack_Check(tb)) {
12276 PyErr_SetString(PyExc_TypeError,
12277 "raise: arg 3 must be a traceback or None");
12278 goto bad;
12279 }
12280 if (value == Py_None)
12281 value = 0;
12282 if (PyExceptionInstance_Check(type)) {
12283 if (value) {
12284 PyErr_SetString(PyExc_TypeError,
12285 "instance exception may not have a separate value");
12286 goto bad;
12287 }
12288 value = type;
12289 type = (PyObject*) Py_TYPE(value);
12290 } else if (PyExceptionClass_Check(type)) {
12291 PyObject *instance_class = NULL;
12292 if (value && PyExceptionInstance_Check(value)) {
12293 instance_class = (PyObject*) Py_TYPE(value);
12294 if (instance_class != type) {
12295 int is_subclass = PyObject_IsSubclass(instance_class, type);
12296 if (!is_subclass) {
12297 instance_class = NULL;
12298 } else if (unlikely(is_subclass == -1)) {
12299 goto bad;
12300 } else {
12301 type = instance_class;
12302 }
12303 }
12304 }
12305 if (!instance_class) {
12306 PyObject *args;
12307 if (!value)
12308 args = PyTuple_New(0);
12309 else if (PyTuple_Check(value)) {
12310 Py_INCREF(value);
12311 args = value;
12312 } else
12313 args = PyTuple_Pack(1, value);
12314 if (!args)
12315 goto bad;
12316 owned_instance = PyObject_Call(type, args, NULL);
12317 Py_DECREF(args);
12318 if (!owned_instance)
12319 goto bad;
12320 value = owned_instance;
12321 if (!PyExceptionInstance_Check(value)) {
12322 PyErr_Format(PyExc_TypeError,
12323 "calling %R should have returned an instance of "
12324 "BaseException, not %R",
12325 type, Py_TYPE(value));
12326 goto bad;
12327 }
12328 }
12329 } else {
12330 PyErr_SetString(PyExc_TypeError,
12331 "raise: exception class must be a subclass of BaseException");
12332 goto bad;
12333 }
12334 if (cause) {
12335 PyObject *fixed_cause;
12336 if (cause == Py_None) {
12337 fixed_cause = NULL;
12338 } else if (PyExceptionClass_Check(cause)) {
12339 fixed_cause = PyObject_CallObject(cause, NULL);
12340 if (fixed_cause == NULL)
12341 goto bad;
12342 } else if (PyExceptionInstance_Check(cause)) {
12343 fixed_cause = cause;
12344 Py_INCREF(fixed_cause);
12345 } else {
12346 PyErr_SetString(PyExc_TypeError,
12347 "exception causes must derive from "
12348 "BaseException");
12349 goto bad;
12350 }
12351 PyException_SetCause(value, fixed_cause);
12352 }
12353 PyErr_SetObject(type, value);
12354 if (tb) {
12355 #if CYTHON_COMPILING_IN_PYPY
12356 PyObject *tmp_type, *tmp_value, *tmp_tb;
12357 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
12358 Py_INCREF(tb);
12359 PyErr_Restore(tmp_type, tmp_value, tb);
12360 Py_XDECREF(tmp_tb);
12361 #else
12362 PyThreadState *tstate = __Pyx_PyThreadState_Current;
12363 PyObject* tmp_tb = tstate->curexc_traceback;
12364 if (tb != tmp_tb) {
12365 Py_INCREF(tb);
12366 tstate->curexc_traceback = tb;
12367 Py_XDECREF(tmp_tb);
12368 }
12369 #endif
12370 }
12371 bad:
12372 Py_XDECREF(owned_instance);
12373 return;
12374 }
12375 #endif
12376
12377 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)12378 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
12379 PyObject *r;
12380 if (!j) return NULL;
12381 r = PyObject_GetItem(o, j);
12382 Py_DECREF(j);
12383 return r;
12384 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)12385 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
12386 CYTHON_NCP_UNUSED int wraparound,
12387 CYTHON_NCP_UNUSED int boundscheck) {
12388 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12389 Py_ssize_t wrapped_i = i;
12390 if (wraparound & unlikely(i < 0)) {
12391 wrapped_i += PyList_GET_SIZE(o);
12392 }
12393 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
12394 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
12395 Py_INCREF(r);
12396 return r;
12397 }
12398 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
12399 #else
12400 return PySequence_GetItem(o, i);
12401 #endif
12402 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)12403 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
12404 CYTHON_NCP_UNUSED int wraparound,
12405 CYTHON_NCP_UNUSED int boundscheck) {
12406 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12407 Py_ssize_t wrapped_i = i;
12408 if (wraparound & unlikely(i < 0)) {
12409 wrapped_i += PyTuple_GET_SIZE(o);
12410 }
12411 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
12412 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
12413 Py_INCREF(r);
12414 return r;
12415 }
12416 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
12417 #else
12418 return PySequence_GetItem(o, i);
12419 #endif
12420 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)12421 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
12422 CYTHON_NCP_UNUSED int wraparound,
12423 CYTHON_NCP_UNUSED int boundscheck) {
12424 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
12425 if (is_list || PyList_CheckExact(o)) {
12426 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
12427 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
12428 PyObject *r = PyList_GET_ITEM(o, n);
12429 Py_INCREF(r);
12430 return r;
12431 }
12432 }
12433 else if (PyTuple_CheckExact(o)) {
12434 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
12435 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
12436 PyObject *r = PyTuple_GET_ITEM(o, n);
12437 Py_INCREF(r);
12438 return r;
12439 }
12440 } else {
12441 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
12442 if (likely(m && m->sq_item)) {
12443 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
12444 Py_ssize_t l = m->sq_length(o);
12445 if (likely(l >= 0)) {
12446 i += l;
12447 } else {
12448 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
12449 return NULL;
12450 PyErr_Clear();
12451 }
12452 }
12453 return m->sq_item(o, i);
12454 }
12455 }
12456 #else
12457 if (is_list || PySequence_Check(o)) {
12458 return PySequence_GetItem(o, i);
12459 }
12460 #endif
12461 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
12462 }
12463
12464 /* ObjectGetItem */
12465 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)12466 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
12467 PyObject *runerr;
12468 Py_ssize_t key_value;
12469 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
12470 if (unlikely(!(m && m->sq_item))) {
12471 PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
12472 return NULL;
12473 }
12474 key_value = __Pyx_PyIndex_AsSsize_t(index);
12475 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
12476 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
12477 }
12478 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
12479 PyErr_Clear();
12480 PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
12481 }
12482 return NULL;
12483 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)12484 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
12485 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
12486 if (likely(m && m->mp_subscript)) {
12487 return m->mp_subscript(obj, key);
12488 }
12489 return __Pyx_PyObject_GetIndex(obj, key);
12490 }
12491 #endif
12492
12493 /* PyErrExceptionMatches */
12494 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)12495 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
12496 Py_ssize_t i, n;
12497 n = PyTuple_GET_SIZE(tuple);
12498 #if PY_MAJOR_VERSION >= 3
12499 for (i=0; i<n; i++) {
12500 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
12501 }
12502 #endif
12503 for (i=0; i<n; i++) {
12504 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
12505 }
12506 return 0;
12507 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)12508 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
12509 PyObject *exc_type = tstate->curexc_type;
12510 if (exc_type == err) return 1;
12511 if (unlikely(!exc_type)) return 0;
12512 if (unlikely(PyTuple_Check(err)))
12513 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
12514 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
12515 }
12516 #endif
12517
12518 /* PyDictVersioning */
12519 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)12520 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
12521 PyObject *dict = Py_TYPE(obj)->tp_dict;
12522 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
12523 }
__Pyx_get_object_dict_version(PyObject * obj)12524 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
12525 PyObject **dictptr = NULL;
12526 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
12527 if (offset) {
12528 #if CYTHON_COMPILING_IN_CPYTHON
12529 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
12530 #else
12531 dictptr = _PyObject_GetDictPtr(obj);
12532 #endif
12533 }
12534 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
12535 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)12536 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
12537 PyObject *dict = Py_TYPE(obj)->tp_dict;
12538 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
12539 return 0;
12540 return obj_dict_version == __Pyx_get_object_dict_version(obj);
12541 }
12542 #endif
12543
12544 /* GetModuleGlobalName */
12545 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)12546 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
12547 #else
12548 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
12549 #endif
12550 {
12551 PyObject *result;
12552 #if !CYTHON_AVOID_BORROWED_REFS
12553 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
12554 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
12555 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
12556 if (likely(result)) {
12557 return __Pyx_NewRef(result);
12558 } else if (unlikely(PyErr_Occurred())) {
12559 return NULL;
12560 }
12561 #else
12562 result = PyDict_GetItem(__pyx_d, name);
12563 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
12564 if (likely(result)) {
12565 return __Pyx_NewRef(result);
12566 }
12567 #endif
12568 #else
12569 result = PyObject_GetItem(__pyx_d, name);
12570 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
12571 if (likely(result)) {
12572 return __Pyx_NewRef(result);
12573 }
12574 PyErr_Clear();
12575 #endif
12576 return __Pyx_GetBuiltinName(name);
12577 }
12578
12579 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)12580 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
12581 {
12582 if (unlikely(!type)) {
12583 PyErr_SetString(PyExc_SystemError, "Missing type object");
12584 return 0;
12585 }
12586 else if (exact) {
12587 #if PY_MAJOR_VERSION == 2
12588 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
12589 #endif
12590 }
12591 else {
12592 if (likely(__Pyx_TypeCheck(obj, type))) return 1;
12593 }
12594 PyErr_Format(PyExc_TypeError,
12595 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
12596 name, type->tp_name, Py_TYPE(obj)->tp_name);
12597 return 0;
12598 }
12599
12600 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)12601 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
12602 if (unlikely(!type)) {
12603 PyErr_SetString(PyExc_SystemError, "Missing type object");
12604 return 0;
12605 }
12606 if (likely(__Pyx_TypeCheck(obj, type)))
12607 return 1;
12608 PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
12609 Py_TYPE(obj)->tp_name, type->tp_name);
12610 return 0;
12611 }
12612
12613 /* decode_c_string */
__Pyx_decode_c_string(const char * cstring,Py_ssize_t start,Py_ssize_t stop,const char * encoding,const char * errors,PyObject * (* decode_func)(const char * s,Py_ssize_t size,const char * errors))12614 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
12615 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
12616 const char* encoding, const char* errors,
12617 PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
12618 Py_ssize_t length;
12619 if (unlikely((start < 0) | (stop < 0))) {
12620 size_t slen = strlen(cstring);
12621 if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
12622 PyErr_SetString(PyExc_OverflowError,
12623 "c-string too long to convert to Python");
12624 return NULL;
12625 }
12626 length = (Py_ssize_t) slen;
12627 if (start < 0) {
12628 start += length;
12629 if (start < 0)
12630 start = 0;
12631 }
12632 if (stop < 0)
12633 stop += length;
12634 }
12635 if (unlikely(stop <= start))
12636 return __Pyx_NewRef(__pyx_empty_unicode);
12637 length = stop - start;
12638 cstring += start;
12639 if (decode_func) {
12640 return decode_func(cstring, length, errors);
12641 } else {
12642 return PyUnicode_Decode(cstring, length, encoding, errors);
12643 }
12644 }
12645
12646 /* PyObject_GenericGetAttrNoDict */
12647 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)12648 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
12649 PyErr_Format(PyExc_AttributeError,
12650 #if PY_MAJOR_VERSION >= 3
12651 "'%.50s' object has no attribute '%U'",
12652 tp->tp_name, attr_name);
12653 #else
12654 "'%.50s' object has no attribute '%.400s'",
12655 tp->tp_name, PyString_AS_STRING(attr_name));
12656 #endif
12657 return NULL;
12658 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)12659 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
12660 PyObject *descr;
12661 PyTypeObject *tp = Py_TYPE(obj);
12662 if (unlikely(!PyString_Check(attr_name))) {
12663 return PyObject_GenericGetAttr(obj, attr_name);
12664 }
12665 assert(!tp->tp_dictoffset);
12666 descr = _PyType_Lookup(tp, attr_name);
12667 if (unlikely(!descr)) {
12668 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
12669 }
12670 Py_INCREF(descr);
12671 #if PY_MAJOR_VERSION < 3
12672 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
12673 #endif
12674 {
12675 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
12676 if (unlikely(f)) {
12677 PyObject *res = f(descr, obj, (PyObject *)tp);
12678 Py_DECREF(descr);
12679 return res;
12680 }
12681 }
12682 return descr;
12683 }
12684 #endif
12685
12686 /* PyObject_GenericGetAttr */
12687 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)12688 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
12689 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
12690 return PyObject_GenericGetAttr(obj, attr_name);
12691 }
12692 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
12693 }
12694 #endif
12695
12696 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)12697 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
12698 __Pyx_PyThreadState_declare
12699 __Pyx_PyThreadState_assign
12700 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
12701 __Pyx_PyErr_Clear();
12702 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)12703 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
12704 PyObject *result;
12705 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
12706 PyTypeObject* tp = Py_TYPE(obj);
12707 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
12708 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
12709 }
12710 #endif
12711 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
12712 if (unlikely(!result)) {
12713 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
12714 }
12715 return result;
12716 }
12717
12718 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)12719 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
12720 int ret;
12721 PyObject *name_attr;
12722 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
12723 if (likely(name_attr)) {
12724 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
12725 } else {
12726 ret = -1;
12727 }
12728 if (unlikely(ret < 0)) {
12729 PyErr_Clear();
12730 ret = 0;
12731 }
12732 Py_XDECREF(name_attr);
12733 return ret;
12734 }
__Pyx_setup_reduce(PyObject * type_obj)12735 static int __Pyx_setup_reduce(PyObject* type_obj) {
12736 int ret = 0;
12737 PyObject *object_reduce = NULL;
12738 PyObject *object_reduce_ex = NULL;
12739 PyObject *reduce = NULL;
12740 PyObject *reduce_ex = NULL;
12741 PyObject *reduce_cython = NULL;
12742 PyObject *setstate = NULL;
12743 PyObject *setstate_cython = NULL;
12744 #if CYTHON_USE_PYTYPE_LOOKUP
12745 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
12746 #else
12747 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
12748 #endif
12749 #if CYTHON_USE_PYTYPE_LOOKUP
12750 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
12751 #else
12752 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
12753 #endif
12754 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
12755 if (reduce_ex == object_reduce_ex) {
12756 #if CYTHON_USE_PYTYPE_LOOKUP
12757 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
12758 #else
12759 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
12760 #endif
12761 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
12762 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
12763 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
12764 if (likely(reduce_cython)) {
12765 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12766 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12767 } else if (reduce == object_reduce || PyErr_Occurred()) {
12768 goto __PYX_BAD;
12769 }
12770 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
12771 if (!setstate) PyErr_Clear();
12772 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
12773 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
12774 if (likely(setstate_cython)) {
12775 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12776 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12777 } else if (!setstate || PyErr_Occurred()) {
12778 goto __PYX_BAD;
12779 }
12780 }
12781 PyType_Modified((PyTypeObject*)type_obj);
12782 }
12783 }
12784 goto __PYX_GOOD;
12785 __PYX_BAD:
12786 if (!PyErr_Occurred())
12787 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
12788 ret = -1;
12789 __PYX_GOOD:
12790 #if !CYTHON_USE_PYTYPE_LOOKUP
12791 Py_XDECREF(object_reduce);
12792 Py_XDECREF(object_reduce_ex);
12793 #endif
12794 Py_XDECREF(reduce);
12795 Py_XDECREF(reduce_ex);
12796 Py_XDECREF(reduce_cython);
12797 Py_XDECREF(setstate);
12798 Py_XDECREF(setstate_cython);
12799 return ret;
12800 }
12801
12802 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)12803 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
12804 #if PY_VERSION_HEX >= 0x02070000
12805 PyObject *ob = PyCapsule_New(vtable, 0, 0);
12806 #else
12807 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
12808 #endif
12809 if (!ob)
12810 goto bad;
12811 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
12812 goto bad;
12813 Py_DECREF(ob);
12814 return 0;
12815 bad:
12816 Py_XDECREF(ob);
12817 return -1;
12818 }
12819
12820 /* TypeImport */
12821 #ifndef __PYX_HAVE_RT_ImportType
12822 #define __PYX_HAVE_RT_ImportType
__Pyx_ImportType(PyObject * module,const char * module_name,const char * class_name,size_t size,enum __Pyx_ImportType_CheckSize check_size)12823 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
12824 size_t size, enum __Pyx_ImportType_CheckSize check_size)
12825 {
12826 PyObject *result = 0;
12827 char warning[200];
12828 Py_ssize_t basicsize;
12829 #ifdef Py_LIMITED_API
12830 PyObject *py_basicsize;
12831 #endif
12832 result = PyObject_GetAttrString(module, class_name);
12833 if (!result)
12834 goto bad;
12835 if (!PyType_Check(result)) {
12836 PyErr_Format(PyExc_TypeError,
12837 "%.200s.%.200s is not a type object",
12838 module_name, class_name);
12839 goto bad;
12840 }
12841 #ifndef Py_LIMITED_API
12842 basicsize = ((PyTypeObject *)result)->tp_basicsize;
12843 #else
12844 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
12845 if (!py_basicsize)
12846 goto bad;
12847 basicsize = PyLong_AsSsize_t(py_basicsize);
12848 Py_DECREF(py_basicsize);
12849 py_basicsize = 0;
12850 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
12851 goto bad;
12852 #endif
12853 if ((size_t)basicsize < size) {
12854 PyErr_Format(PyExc_ValueError,
12855 "%.200s.%.200s size changed, may indicate binary incompatibility. "
12856 "Expected %zd from C header, got %zd from PyObject",
12857 module_name, class_name, size, basicsize);
12858 goto bad;
12859 }
12860 if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
12861 PyErr_Format(PyExc_ValueError,
12862 "%.200s.%.200s size changed, may indicate binary incompatibility. "
12863 "Expected %zd from C header, got %zd from PyObject",
12864 module_name, class_name, size, basicsize);
12865 goto bad;
12866 }
12867 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
12868 PyOS_snprintf(warning, sizeof(warning),
12869 "%s.%s size changed, may indicate binary incompatibility. "
12870 "Expected %zd from C header, got %zd from PyObject",
12871 module_name, class_name, size, basicsize);
12872 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
12873 }
12874 return (PyTypeObject *)result;
12875 bad:
12876 Py_XDECREF(result);
12877 return NULL;
12878 }
12879 #endif
12880
12881 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)12882 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
12883 PyObject *empty_list = 0;
12884 PyObject *module = 0;
12885 PyObject *global_dict = 0;
12886 PyObject *empty_dict = 0;
12887 PyObject *list;
12888 #if PY_MAJOR_VERSION < 3
12889 PyObject *py_import;
12890 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
12891 if (!py_import)
12892 goto bad;
12893 #endif
12894 if (from_list)
12895 list = from_list;
12896 else {
12897 empty_list = PyList_New(0);
12898 if (!empty_list)
12899 goto bad;
12900 list = empty_list;
12901 }
12902 global_dict = PyModule_GetDict(__pyx_m);
12903 if (!global_dict)
12904 goto bad;
12905 empty_dict = PyDict_New();
12906 if (!empty_dict)
12907 goto bad;
12908 {
12909 #if PY_MAJOR_VERSION >= 3
12910 if (level == -1) {
12911 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
12912 module = PyImport_ImportModuleLevelObject(
12913 name, global_dict, empty_dict, list, 1);
12914 if (!module) {
12915 if (!PyErr_ExceptionMatches(PyExc_ImportError))
12916 goto bad;
12917 PyErr_Clear();
12918 }
12919 }
12920 level = 0;
12921 }
12922 #endif
12923 if (!module) {
12924 #if PY_MAJOR_VERSION < 3
12925 PyObject *py_level = PyInt_FromLong(level);
12926 if (!py_level)
12927 goto bad;
12928 module = PyObject_CallFunctionObjArgs(py_import,
12929 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
12930 Py_DECREF(py_level);
12931 #else
12932 module = PyImport_ImportModuleLevelObject(
12933 name, global_dict, empty_dict, list, level);
12934 #endif
12935 }
12936 }
12937 bad:
12938 #if PY_MAJOR_VERSION < 3
12939 Py_XDECREF(py_import);
12940 #endif
12941 Py_XDECREF(empty_list);
12942 Py_XDECREF(empty_dict);
12943 return module;
12944 }
12945
12946 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)12947 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
12948 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
12949 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
12950 PyErr_Format(PyExc_ImportError,
12951 #if PY_MAJOR_VERSION < 3
12952 "cannot import name %.230s", PyString_AS_STRING(name));
12953 #else
12954 "cannot import name %S", name);
12955 #endif
12956 }
12957 return value;
12958 }
12959
12960 /* None */
__Pyx_mod_long(long a,long b)12961 static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
12962 long r = a % b;
12963 r += ((r != 0) & ((r ^ b) < 0)) * b;
12964 return r;
12965 }
12966
12967 /* ClassMethod */
__Pyx_Method_ClassMethod(PyObject * method)12968 static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
12969 #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000
12970 if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) {
12971 return PyClassMethod_New(method);
12972 }
12973 #else
12974 #if CYTHON_COMPILING_IN_PYSTON || CYTHON_COMPILING_IN_PYPY
12975 if (PyMethodDescr_Check(method))
12976 #else
12977 #if PY_MAJOR_VERSION == 2
12978 static PyTypeObject *methoddescr_type = NULL;
12979 if (methoddescr_type == NULL) {
12980 PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append");
12981 if (!meth) return NULL;
12982 methoddescr_type = Py_TYPE(meth);
12983 Py_DECREF(meth);
12984 }
12985 #else
12986 PyTypeObject *methoddescr_type = &PyMethodDescr_Type;
12987 #endif
12988 if (__Pyx_TypeCheck(method, methoddescr_type))
12989 #endif
12990 {
12991 PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
12992 #if PY_VERSION_HEX < 0x03020000
12993 PyTypeObject *d_type = descr->d_type;
12994 #else
12995 PyTypeObject *d_type = descr->d_common.d_type;
12996 #endif
12997 return PyDescr_NewClassMethod(d_type, descr->d_method);
12998 }
12999 #endif
13000 else if (PyMethod_Check(method)) {
13001 return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
13002 }
13003 else {
13004 return PyClassMethod_New(method);
13005 }
13006 }
13007
13008 /* GetNameInClass */
__Pyx_GetGlobalNameAfterAttributeLookup(PyObject * name)13009 static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) {
13010 PyObject *result;
13011 __Pyx_PyThreadState_declare
13012 __Pyx_PyThreadState_assign
13013 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
13014 return NULL;
13015 __Pyx_PyErr_Clear();
13016 __Pyx_GetModuleGlobalNameUncached(result, name);
13017 return result;
13018 }
__Pyx__GetNameInClass(PyObject * nmspace,PyObject * name)13019 static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) {
13020 PyObject *result;
13021 result = __Pyx_PyObject_GetAttrStr(nmspace, name);
13022 if (!result) {
13023 result = __Pyx_GetGlobalNameAfterAttributeLookup(name);
13024 }
13025 return result;
13026 }
13027
13028 /* CLineInTraceback */
13029 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)13030 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
13031 PyObject *use_cline;
13032 PyObject *ptype, *pvalue, *ptraceback;
13033 #if CYTHON_COMPILING_IN_CPYTHON
13034 PyObject **cython_runtime_dict;
13035 #endif
13036 if (unlikely(!__pyx_cython_runtime)) {
13037 return c_line;
13038 }
13039 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
13040 #if CYTHON_COMPILING_IN_CPYTHON
13041 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
13042 if (likely(cython_runtime_dict)) {
13043 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
13044 use_cline, *cython_runtime_dict,
13045 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
13046 } else
13047 #endif
13048 {
13049 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
13050 if (use_cline_obj) {
13051 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
13052 Py_DECREF(use_cline_obj);
13053 } else {
13054 PyErr_Clear();
13055 use_cline = NULL;
13056 }
13057 }
13058 if (!use_cline) {
13059 c_line = 0;
13060 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
13061 }
13062 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
13063 c_line = 0;
13064 }
13065 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
13066 return c_line;
13067 }
13068 #endif
13069
13070 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)13071 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
13072 int start = 0, mid = 0, end = count - 1;
13073 if (end >= 0 && code_line > entries[end].code_line) {
13074 return count;
13075 }
13076 while (start < end) {
13077 mid = start + (end - start) / 2;
13078 if (code_line < entries[mid].code_line) {
13079 end = mid;
13080 } else if (code_line > entries[mid].code_line) {
13081 start = mid + 1;
13082 } else {
13083 return mid;
13084 }
13085 }
13086 if (code_line <= entries[mid].code_line) {
13087 return mid;
13088 } else {
13089 return mid + 1;
13090 }
13091 }
__pyx_find_code_object(int code_line)13092 static PyCodeObject *__pyx_find_code_object(int code_line) {
13093 PyCodeObject* code_object;
13094 int pos;
13095 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
13096 return NULL;
13097 }
13098 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
13099 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
13100 return NULL;
13101 }
13102 code_object = __pyx_code_cache.entries[pos].code_object;
13103 Py_INCREF(code_object);
13104 return code_object;
13105 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)13106 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
13107 int pos, i;
13108 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
13109 if (unlikely(!code_line)) {
13110 return;
13111 }
13112 if (unlikely(!entries)) {
13113 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
13114 if (likely(entries)) {
13115 __pyx_code_cache.entries = entries;
13116 __pyx_code_cache.max_count = 64;
13117 __pyx_code_cache.count = 1;
13118 entries[0].code_line = code_line;
13119 entries[0].code_object = code_object;
13120 Py_INCREF(code_object);
13121 }
13122 return;
13123 }
13124 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
13125 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
13126 PyCodeObject* tmp = entries[pos].code_object;
13127 entries[pos].code_object = code_object;
13128 Py_DECREF(tmp);
13129 return;
13130 }
13131 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
13132 int new_max = __pyx_code_cache.max_count + 64;
13133 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
13134 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
13135 if (unlikely(!entries)) {
13136 return;
13137 }
13138 __pyx_code_cache.entries = entries;
13139 __pyx_code_cache.max_count = new_max;
13140 }
13141 for (i=__pyx_code_cache.count; i>pos; i--) {
13142 entries[i] = entries[i-1];
13143 }
13144 entries[pos].code_line = code_line;
13145 entries[pos].code_object = code_object;
13146 __pyx_code_cache.count++;
13147 Py_INCREF(code_object);
13148 }
13149
13150 /* AddTraceback */
13151 #include "compile.h"
13152 #include "frameobject.h"
13153 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)13154 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
13155 const char *funcname, int c_line,
13156 int py_line, const char *filename) {
13157 PyCodeObject *py_code = 0;
13158 PyObject *py_srcfile = 0;
13159 PyObject *py_funcname = 0;
13160 #if PY_MAJOR_VERSION < 3
13161 py_srcfile = PyString_FromString(filename);
13162 #else
13163 py_srcfile = PyUnicode_FromString(filename);
13164 #endif
13165 if (!py_srcfile) goto bad;
13166 if (c_line) {
13167 #if PY_MAJOR_VERSION < 3
13168 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13169 #else
13170 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13171 #endif
13172 }
13173 else {
13174 #if PY_MAJOR_VERSION < 3
13175 py_funcname = PyString_FromString(funcname);
13176 #else
13177 py_funcname = PyUnicode_FromString(funcname);
13178 #endif
13179 }
13180 if (!py_funcname) goto bad;
13181 py_code = __Pyx_PyCode_New(
13182 0,
13183 0,
13184 0,
13185 0,
13186 0,
13187 __pyx_empty_bytes, /*PyObject *code,*/
13188 __pyx_empty_tuple, /*PyObject *consts,*/
13189 __pyx_empty_tuple, /*PyObject *names,*/
13190 __pyx_empty_tuple, /*PyObject *varnames,*/
13191 __pyx_empty_tuple, /*PyObject *freevars,*/
13192 __pyx_empty_tuple, /*PyObject *cellvars,*/
13193 py_srcfile, /*PyObject *filename,*/
13194 py_funcname, /*PyObject *name,*/
13195 py_line,
13196 __pyx_empty_bytes /*PyObject *lnotab*/
13197 );
13198 Py_DECREF(py_srcfile);
13199 Py_DECREF(py_funcname);
13200 return py_code;
13201 bad:
13202 Py_XDECREF(py_srcfile);
13203 Py_XDECREF(py_funcname);
13204 return NULL;
13205 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)13206 static void __Pyx_AddTraceback(const char *funcname, int c_line,
13207 int py_line, const char *filename) {
13208 PyCodeObject *py_code = 0;
13209 PyFrameObject *py_frame = 0;
13210 PyThreadState *tstate = __Pyx_PyThreadState_Current;
13211 if (c_line) {
13212 c_line = __Pyx_CLineForTraceback(tstate, c_line);
13213 }
13214 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
13215 if (!py_code) {
13216 py_code = __Pyx_CreateCodeObjectForTraceback(
13217 funcname, c_line, py_line, filename);
13218 if (!py_code) goto bad;
13219 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
13220 }
13221 py_frame = PyFrame_New(
13222 tstate, /*PyThreadState *tstate,*/
13223 py_code, /*PyCodeObject *code,*/
13224 __pyx_d, /*PyObject *globals,*/
13225 0 /*PyObject *locals*/
13226 );
13227 if (!py_frame) goto bad;
13228 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
13229 PyTraceBack_Here(py_frame);
13230 bad:
13231 Py_XDECREF(py_code);
13232 Py_XDECREF(py_frame);
13233 }
13234
13235 /* CIntFromPyVerify */
13236 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
13237 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
13238 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
13239 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
13240 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
13241 {\
13242 func_type value = func_value;\
13243 if (sizeof(target_type) < sizeof(func_type)) {\
13244 if (unlikely(value != (func_type) (target_type) value)) {\
13245 func_type zero = 0;\
13246 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
13247 return (target_type) -1;\
13248 if (is_unsigned && unlikely(value < zero))\
13249 goto raise_neg_overflow;\
13250 else\
13251 goto raise_overflow;\
13252 }\
13253 }\
13254 return (target_type) value;\
13255 }
13256
13257 /* CIntToPy */
__Pyx_PyInt_From_uint32_t(uint32_t value)13258 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) {
13259 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13260 #pragma GCC diagnostic push
13261 #pragma GCC diagnostic ignored "-Wconversion"
13262 #endif
13263 const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0;
13264 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13265 #pragma GCC diagnostic pop
13266 #endif
13267 const int is_unsigned = neg_one > const_zero;
13268 if (is_unsigned) {
13269 if (sizeof(uint32_t) < sizeof(long)) {
13270 return PyInt_FromLong((long) value);
13271 } else if (sizeof(uint32_t) <= sizeof(unsigned long)) {
13272 return PyLong_FromUnsignedLong((unsigned long) value);
13273 #ifdef HAVE_LONG_LONG
13274 } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
13275 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
13276 #endif
13277 }
13278 } else {
13279 if (sizeof(uint32_t) <= sizeof(long)) {
13280 return PyInt_FromLong((long) value);
13281 #ifdef HAVE_LONG_LONG
13282 } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
13283 return PyLong_FromLongLong((PY_LONG_LONG) value);
13284 #endif
13285 }
13286 }
13287 {
13288 int one = 1; int little = (int)*(unsigned char *)&one;
13289 unsigned char *bytes = (unsigned char *)&value;
13290 return _PyLong_FromByteArray(bytes, sizeof(uint32_t),
13291 little, !is_unsigned);
13292 }
13293 }
13294
13295 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)13296 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
13297 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13298 #pragma GCC diagnostic push
13299 #pragma GCC diagnostic ignored "-Wconversion"
13300 #endif
13301 const int neg_one = (int) -1, const_zero = (int) 0;
13302 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13303 #pragma GCC diagnostic pop
13304 #endif
13305 const int is_unsigned = neg_one > const_zero;
13306 #if PY_MAJOR_VERSION < 3
13307 if (likely(PyInt_Check(x))) {
13308 if (sizeof(int) < sizeof(long)) {
13309 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
13310 } else {
13311 long val = PyInt_AS_LONG(x);
13312 if (is_unsigned && unlikely(val < 0)) {
13313 goto raise_neg_overflow;
13314 }
13315 return (int) val;
13316 }
13317 } else
13318 #endif
13319 if (likely(PyLong_Check(x))) {
13320 if (is_unsigned) {
13321 #if CYTHON_USE_PYLONG_INTERNALS
13322 const digit* digits = ((PyLongObject*)x)->ob_digit;
13323 switch (Py_SIZE(x)) {
13324 case 0: return (int) 0;
13325 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
13326 case 2:
13327 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
13328 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13329 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13330 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
13331 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13332 }
13333 }
13334 break;
13335 case 3:
13336 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
13337 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13338 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13339 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
13340 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13341 }
13342 }
13343 break;
13344 case 4:
13345 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
13346 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13347 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13348 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
13349 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13350 }
13351 }
13352 break;
13353 }
13354 #endif
13355 #if CYTHON_COMPILING_IN_CPYTHON
13356 if (unlikely(Py_SIZE(x) < 0)) {
13357 goto raise_neg_overflow;
13358 }
13359 #else
13360 {
13361 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13362 if (unlikely(result < 0))
13363 return (int) -1;
13364 if (unlikely(result == 1))
13365 goto raise_neg_overflow;
13366 }
13367 #endif
13368 if (sizeof(int) <= sizeof(unsigned long)) {
13369 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
13370 #ifdef HAVE_LONG_LONG
13371 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
13372 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
13373 #endif
13374 }
13375 } else {
13376 #if CYTHON_USE_PYLONG_INTERNALS
13377 const digit* digits = ((PyLongObject*)x)->ob_digit;
13378 switch (Py_SIZE(x)) {
13379 case 0: return (int) 0;
13380 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
13381 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
13382 case -2:
13383 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
13384 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13385 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13386 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13387 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13388 }
13389 }
13390 break;
13391 case 2:
13392 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
13393 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13394 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13395 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13396 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13397 }
13398 }
13399 break;
13400 case -3:
13401 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13402 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13403 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13404 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13405 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13406 }
13407 }
13408 break;
13409 case 3:
13410 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
13411 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13412 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13413 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13414 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13415 }
13416 }
13417 break;
13418 case -4:
13419 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13420 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13421 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13422 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
13423 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13424 }
13425 }
13426 break;
13427 case 4:
13428 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
13429 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13430 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13431 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
13432 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13433 }
13434 }
13435 break;
13436 }
13437 #endif
13438 if (sizeof(int) <= sizeof(long)) {
13439 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
13440 #ifdef HAVE_LONG_LONG
13441 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
13442 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
13443 #endif
13444 }
13445 }
13446 {
13447 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
13448 PyErr_SetString(PyExc_RuntimeError,
13449 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
13450 #else
13451 int val;
13452 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13453 #if PY_MAJOR_VERSION < 3
13454 if (likely(v) && !PyLong_Check(v)) {
13455 PyObject *tmp = v;
13456 v = PyNumber_Long(tmp);
13457 Py_DECREF(tmp);
13458 }
13459 #endif
13460 if (likely(v)) {
13461 int one = 1; int is_little = (int)*(unsigned char *)&one;
13462 unsigned char *bytes = (unsigned char *)&val;
13463 int ret = _PyLong_AsByteArray((PyLongObject *)v,
13464 bytes, sizeof(val),
13465 is_little, !is_unsigned);
13466 Py_DECREF(v);
13467 if (likely(!ret))
13468 return val;
13469 }
13470 #endif
13471 return (int) -1;
13472 }
13473 } else {
13474 int val;
13475 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13476 if (!tmp) return (int) -1;
13477 val = __Pyx_PyInt_As_int(tmp);
13478 Py_DECREF(tmp);
13479 return val;
13480 }
13481 raise_overflow:
13482 PyErr_SetString(PyExc_OverflowError,
13483 "value too large to convert to int");
13484 return (int) -1;
13485 raise_neg_overflow:
13486 PyErr_SetString(PyExc_OverflowError,
13487 "can't convert negative value to int");
13488 return (int) -1;
13489 }
13490
13491 /* CIntToPy */
__Pyx_PyInt_From_int(int value)13492 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
13493 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13494 #pragma GCC diagnostic push
13495 #pragma GCC diagnostic ignored "-Wconversion"
13496 #endif
13497 const int neg_one = (int) -1, const_zero = (int) 0;
13498 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13499 #pragma GCC diagnostic pop
13500 #endif
13501 const int is_unsigned = neg_one > const_zero;
13502 if (is_unsigned) {
13503 if (sizeof(int) < sizeof(long)) {
13504 return PyInt_FromLong((long) value);
13505 } else if (sizeof(int) <= sizeof(unsigned long)) {
13506 return PyLong_FromUnsignedLong((unsigned long) value);
13507 #ifdef HAVE_LONG_LONG
13508 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
13509 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
13510 #endif
13511 }
13512 } else {
13513 if (sizeof(int) <= sizeof(long)) {
13514 return PyInt_FromLong((long) value);
13515 #ifdef HAVE_LONG_LONG
13516 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
13517 return PyLong_FromLongLong((PY_LONG_LONG) value);
13518 #endif
13519 }
13520 }
13521 {
13522 int one = 1; int little = (int)*(unsigned char *)&one;
13523 unsigned char *bytes = (unsigned char *)&value;
13524 return _PyLong_FromByteArray(bytes, sizeof(int),
13525 little, !is_unsigned);
13526 }
13527 }
13528
13529 /* CIntToPy */
__Pyx_PyInt_From_uint64_t(uint64_t value)13530 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) {
13531 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13532 #pragma GCC diagnostic push
13533 #pragma GCC diagnostic ignored "-Wconversion"
13534 #endif
13535 const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0;
13536 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13537 #pragma GCC diagnostic pop
13538 #endif
13539 const int is_unsigned = neg_one > const_zero;
13540 if (is_unsigned) {
13541 if (sizeof(uint64_t) < sizeof(long)) {
13542 return PyInt_FromLong((long) value);
13543 } else if (sizeof(uint64_t) <= sizeof(unsigned long)) {
13544 return PyLong_FromUnsignedLong((unsigned long) value);
13545 #ifdef HAVE_LONG_LONG
13546 } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
13547 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
13548 #endif
13549 }
13550 } else {
13551 if (sizeof(uint64_t) <= sizeof(long)) {
13552 return PyInt_FromLong((long) value);
13553 #ifdef HAVE_LONG_LONG
13554 } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
13555 return PyLong_FromLongLong((PY_LONG_LONG) value);
13556 #endif
13557 }
13558 }
13559 {
13560 int one = 1; int little = (int)*(unsigned char *)&one;
13561 unsigned char *bytes = (unsigned char *)&value;
13562 return _PyLong_FromByteArray(bytes, sizeof(uint64_t),
13563 little, !is_unsigned);
13564 }
13565 }
13566
13567 /* CIntToPy */
__Pyx_PyInt_From_long(long value)13568 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
13569 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13570 #pragma GCC diagnostic push
13571 #pragma GCC diagnostic ignored "-Wconversion"
13572 #endif
13573 const long neg_one = (long) -1, const_zero = (long) 0;
13574 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13575 #pragma GCC diagnostic pop
13576 #endif
13577 const int is_unsigned = neg_one > const_zero;
13578 if (is_unsigned) {
13579 if (sizeof(long) < sizeof(long)) {
13580 return PyInt_FromLong((long) value);
13581 } else if (sizeof(long) <= sizeof(unsigned long)) {
13582 return PyLong_FromUnsignedLong((unsigned long) value);
13583 #ifdef HAVE_LONG_LONG
13584 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
13585 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
13586 #endif
13587 }
13588 } else {
13589 if (sizeof(long) <= sizeof(long)) {
13590 return PyInt_FromLong((long) value);
13591 #ifdef HAVE_LONG_LONG
13592 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
13593 return PyLong_FromLongLong((PY_LONG_LONG) value);
13594 #endif
13595 }
13596 }
13597 {
13598 int one = 1; int little = (int)*(unsigned char *)&one;
13599 unsigned char *bytes = (unsigned char *)&value;
13600 return _PyLong_FromByteArray(bytes, sizeof(long),
13601 little, !is_unsigned);
13602 }
13603 }
13604
13605 /* CIntFromPy */
__Pyx_PyInt_As_uint32_t(PyObject * x)13606 static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) {
13607 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13608 #pragma GCC diagnostic push
13609 #pragma GCC diagnostic ignored "-Wconversion"
13610 #endif
13611 const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0;
13612 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13613 #pragma GCC diagnostic pop
13614 #endif
13615 const int is_unsigned = neg_one > const_zero;
13616 #if PY_MAJOR_VERSION < 3
13617 if (likely(PyInt_Check(x))) {
13618 if (sizeof(uint32_t) < sizeof(long)) {
13619 __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x))
13620 } else {
13621 long val = PyInt_AS_LONG(x);
13622 if (is_unsigned && unlikely(val < 0)) {
13623 goto raise_neg_overflow;
13624 }
13625 return (uint32_t) val;
13626 }
13627 } else
13628 #endif
13629 if (likely(PyLong_Check(x))) {
13630 if (is_unsigned) {
13631 #if CYTHON_USE_PYLONG_INTERNALS
13632 const digit* digits = ((PyLongObject*)x)->ob_digit;
13633 switch (Py_SIZE(x)) {
13634 case 0: return (uint32_t) 0;
13635 case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0])
13636 case 2:
13637 if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) {
13638 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13639 __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13640 } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) {
13641 return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
13642 }
13643 }
13644 break;
13645 case 3:
13646 if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) {
13647 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13648 __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13649 } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) {
13650 return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
13651 }
13652 }
13653 break;
13654 case 4:
13655 if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) {
13656 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13657 __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13658 } else if (8 * sizeof(uint32_t) >= 4 * PyLong_SHIFT) {
13659 return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
13660 }
13661 }
13662 break;
13663 }
13664 #endif
13665 #if CYTHON_COMPILING_IN_CPYTHON
13666 if (unlikely(Py_SIZE(x) < 0)) {
13667 goto raise_neg_overflow;
13668 }
13669 #else
13670 {
13671 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13672 if (unlikely(result < 0))
13673 return (uint32_t) -1;
13674 if (unlikely(result == 1))
13675 goto raise_neg_overflow;
13676 }
13677 #endif
13678 if (sizeof(uint32_t) <= sizeof(unsigned long)) {
13679 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x))
13680 #ifdef HAVE_LONG_LONG
13681 } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
13682 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
13683 #endif
13684 }
13685 } else {
13686 #if CYTHON_USE_PYLONG_INTERNALS
13687 const digit* digits = ((PyLongObject*)x)->ob_digit;
13688 switch (Py_SIZE(x)) {
13689 case 0: return (uint32_t) 0;
13690 case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0]))
13691 case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0])
13692 case -2:
13693 if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) {
13694 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13695 __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13696 } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
13697 return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
13698 }
13699 }
13700 break;
13701 case 2:
13702 if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) {
13703 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13704 __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13705 } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
13706 return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
13707 }
13708 }
13709 break;
13710 case -3:
13711 if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
13712 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13713 __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13714 } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
13715 return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
13716 }
13717 }
13718 break;
13719 case 3:
13720 if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) {
13721 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13722 __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13723 } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
13724 return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
13725 }
13726 }
13727 break;
13728 case -4:
13729 if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
13730 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13731 __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13732 } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) {
13733 return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
13734 }
13735 }
13736 break;
13737 case 4:
13738 if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) {
13739 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13740 __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13741 } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) {
13742 return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
13743 }
13744 }
13745 break;
13746 }
13747 #endif
13748 if (sizeof(uint32_t) <= sizeof(long)) {
13749 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x))
13750 #ifdef HAVE_LONG_LONG
13751 } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
13752 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x))
13753 #endif
13754 }
13755 }
13756 {
13757 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
13758 PyErr_SetString(PyExc_RuntimeError,
13759 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
13760 #else
13761 uint32_t val;
13762 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13763 #if PY_MAJOR_VERSION < 3
13764 if (likely(v) && !PyLong_Check(v)) {
13765 PyObject *tmp = v;
13766 v = PyNumber_Long(tmp);
13767 Py_DECREF(tmp);
13768 }
13769 #endif
13770 if (likely(v)) {
13771 int one = 1; int is_little = (int)*(unsigned char *)&one;
13772 unsigned char *bytes = (unsigned char *)&val;
13773 int ret = _PyLong_AsByteArray((PyLongObject *)v,
13774 bytes, sizeof(val),
13775 is_little, !is_unsigned);
13776 Py_DECREF(v);
13777 if (likely(!ret))
13778 return val;
13779 }
13780 #endif
13781 return (uint32_t) -1;
13782 }
13783 } else {
13784 uint32_t val;
13785 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13786 if (!tmp) return (uint32_t) -1;
13787 val = __Pyx_PyInt_As_uint32_t(tmp);
13788 Py_DECREF(tmp);
13789 return val;
13790 }
13791 raise_overflow:
13792 PyErr_SetString(PyExc_OverflowError,
13793 "value too large to convert to uint32_t");
13794 return (uint32_t) -1;
13795 raise_neg_overflow:
13796 PyErr_SetString(PyExc_OverflowError,
13797 "can't convert negative value to uint32_t");
13798 return (uint32_t) -1;
13799 }
13800
13801 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)13802 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
13803 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13804 #pragma GCC diagnostic push
13805 #pragma GCC diagnostic ignored "-Wconversion"
13806 #endif
13807 const long neg_one = (long) -1, const_zero = (long) 0;
13808 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13809 #pragma GCC diagnostic pop
13810 #endif
13811 const int is_unsigned = neg_one > const_zero;
13812 #if PY_MAJOR_VERSION < 3
13813 if (likely(PyInt_Check(x))) {
13814 if (sizeof(long) < sizeof(long)) {
13815 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
13816 } else {
13817 long val = PyInt_AS_LONG(x);
13818 if (is_unsigned && unlikely(val < 0)) {
13819 goto raise_neg_overflow;
13820 }
13821 return (long) val;
13822 }
13823 } else
13824 #endif
13825 if (likely(PyLong_Check(x))) {
13826 if (is_unsigned) {
13827 #if CYTHON_USE_PYLONG_INTERNALS
13828 const digit* digits = ((PyLongObject*)x)->ob_digit;
13829 switch (Py_SIZE(x)) {
13830 case 0: return (long) 0;
13831 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
13832 case 2:
13833 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
13834 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13835 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13836 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
13837 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
13838 }
13839 }
13840 break;
13841 case 3:
13842 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
13843 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13844 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13845 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
13846 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
13847 }
13848 }
13849 break;
13850 case 4:
13851 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
13852 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13853 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13854 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
13855 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
13856 }
13857 }
13858 break;
13859 }
13860 #endif
13861 #if CYTHON_COMPILING_IN_CPYTHON
13862 if (unlikely(Py_SIZE(x) < 0)) {
13863 goto raise_neg_overflow;
13864 }
13865 #else
13866 {
13867 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13868 if (unlikely(result < 0))
13869 return (long) -1;
13870 if (unlikely(result == 1))
13871 goto raise_neg_overflow;
13872 }
13873 #endif
13874 if (sizeof(long) <= sizeof(unsigned long)) {
13875 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
13876 #ifdef HAVE_LONG_LONG
13877 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
13878 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
13879 #endif
13880 }
13881 } else {
13882 #if CYTHON_USE_PYLONG_INTERNALS
13883 const digit* digits = ((PyLongObject*)x)->ob_digit;
13884 switch (Py_SIZE(x)) {
13885 case 0: return (long) 0;
13886 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
13887 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
13888 case -2:
13889 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
13890 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13891 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13892 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
13893 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13894 }
13895 }
13896 break;
13897 case 2:
13898 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
13899 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13900 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13901 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
13902 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13903 }
13904 }
13905 break;
13906 case -3:
13907 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
13908 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13909 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13910 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
13911 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13912 }
13913 }
13914 break;
13915 case 3:
13916 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
13917 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13918 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13919 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
13920 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13921 }
13922 }
13923 break;
13924 case -4:
13925 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
13926 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13927 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13928 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
13929 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13930 }
13931 }
13932 break;
13933 case 4:
13934 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
13935 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13936 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13937 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
13938 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13939 }
13940 }
13941 break;
13942 }
13943 #endif
13944 if (sizeof(long) <= sizeof(long)) {
13945 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
13946 #ifdef HAVE_LONG_LONG
13947 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
13948 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
13949 #endif
13950 }
13951 }
13952 {
13953 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
13954 PyErr_SetString(PyExc_RuntimeError,
13955 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
13956 #else
13957 long val;
13958 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13959 #if PY_MAJOR_VERSION < 3
13960 if (likely(v) && !PyLong_Check(v)) {
13961 PyObject *tmp = v;
13962 v = PyNumber_Long(tmp);
13963 Py_DECREF(tmp);
13964 }
13965 #endif
13966 if (likely(v)) {
13967 int one = 1; int is_little = (int)*(unsigned char *)&one;
13968 unsigned char *bytes = (unsigned char *)&val;
13969 int ret = _PyLong_AsByteArray((PyLongObject *)v,
13970 bytes, sizeof(val),
13971 is_little, !is_unsigned);
13972 Py_DECREF(v);
13973 if (likely(!ret))
13974 return val;
13975 }
13976 #endif
13977 return (long) -1;
13978 }
13979 } else {
13980 long val;
13981 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13982 if (!tmp) return (long) -1;
13983 val = __Pyx_PyInt_As_long(tmp);
13984 Py_DECREF(tmp);
13985 return val;
13986 }
13987 raise_overflow:
13988 PyErr_SetString(PyExc_OverflowError,
13989 "value too large to convert to long");
13990 return (long) -1;
13991 raise_neg_overflow:
13992 PyErr_SetString(PyExc_OverflowError,
13993 "can't convert negative value to long");
13994 return (long) -1;
13995 }
13996
13997 /* FastTypeChecks */
13998 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)13999 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
14000 while (a) {
14001 a = a->tp_base;
14002 if (a == b)
14003 return 1;
14004 }
14005 return b == &PyBaseObject_Type;
14006 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)14007 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
14008 PyObject *mro;
14009 if (a == b) return 1;
14010 mro = a->tp_mro;
14011 if (likely(mro)) {
14012 Py_ssize_t i, n;
14013 n = PyTuple_GET_SIZE(mro);
14014 for (i = 0; i < n; i++) {
14015 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
14016 return 1;
14017 }
14018 return 0;
14019 }
14020 return __Pyx_InBases(a, b);
14021 }
14022 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)14023 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
14024 PyObject *exception, *value, *tb;
14025 int res;
14026 __Pyx_PyThreadState_declare
14027 __Pyx_PyThreadState_assign
14028 __Pyx_ErrFetch(&exception, &value, &tb);
14029 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
14030 if (unlikely(res == -1)) {
14031 PyErr_WriteUnraisable(err);
14032 res = 0;
14033 }
14034 if (!res) {
14035 res = PyObject_IsSubclass(err, exc_type2);
14036 if (unlikely(res == -1)) {
14037 PyErr_WriteUnraisable(err);
14038 res = 0;
14039 }
14040 }
14041 __Pyx_ErrRestore(exception, value, tb);
14042 return res;
14043 }
14044 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)14045 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
14046 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
14047 if (!res) {
14048 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
14049 }
14050 return res;
14051 }
14052 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)14053 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
14054 Py_ssize_t i, n;
14055 assert(PyExceptionClass_Check(exc_type));
14056 n = PyTuple_GET_SIZE(tuple);
14057 #if PY_MAJOR_VERSION >= 3
14058 for (i=0; i<n; i++) {
14059 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
14060 }
14061 #endif
14062 for (i=0; i<n; i++) {
14063 PyObject *t = PyTuple_GET_ITEM(tuple, i);
14064 #if PY_MAJOR_VERSION < 3
14065 if (likely(exc_type == t)) return 1;
14066 #endif
14067 if (likely(PyExceptionClass_Check(t))) {
14068 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
14069 } else {
14070 }
14071 }
14072 return 0;
14073 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)14074 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
14075 if (likely(err == exc_type)) return 1;
14076 if (likely(PyExceptionClass_Check(err))) {
14077 if (likely(PyExceptionClass_Check(exc_type))) {
14078 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
14079 } else if (likely(PyTuple_Check(exc_type))) {
14080 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
14081 } else {
14082 }
14083 }
14084 return PyErr_GivenExceptionMatches(err, exc_type);
14085 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)14086 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
14087 assert(PyExceptionClass_Check(exc_type1));
14088 assert(PyExceptionClass_Check(exc_type2));
14089 if (likely(err == exc_type1 || err == exc_type2)) return 1;
14090 if (likely(PyExceptionClass_Check(err))) {
14091 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
14092 }
14093 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
14094 }
14095 #endif
14096
14097 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)14098 static int __Pyx_check_binary_version(void) {
14099 char ctversion[4], rtversion[4];
14100 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
14101 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
14102 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
14103 char message[200];
14104 PyOS_snprintf(message, sizeof(message),
14105 "compiletime version %s of module '%.100s' "
14106 "does not match runtime version %s",
14107 ctversion, __Pyx_MODULE_NAME, rtversion);
14108 return PyErr_WarnEx(NULL, message, 1);
14109 }
14110 return 0;
14111 }
14112
14113 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)14114 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
14115 while (t->p) {
14116 #if PY_MAJOR_VERSION < 3
14117 if (t->is_unicode) {
14118 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
14119 } else if (t->intern) {
14120 *t->p = PyString_InternFromString(t->s);
14121 } else {
14122 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
14123 }
14124 #else
14125 if (t->is_unicode | t->is_str) {
14126 if (t->intern) {
14127 *t->p = PyUnicode_InternFromString(t->s);
14128 } else if (t->encoding) {
14129 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
14130 } else {
14131 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
14132 }
14133 } else {
14134 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
14135 }
14136 #endif
14137 if (!*t->p)
14138 return -1;
14139 if (PyObject_Hash(*t->p) == -1)
14140 return -1;
14141 ++t;
14142 }
14143 return 0;
14144 }
14145
__Pyx_PyUnicode_FromString(const char * c_str)14146 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
14147 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
14148 }
__Pyx_PyObject_AsString(PyObject * o)14149 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
14150 Py_ssize_t ignore;
14151 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
14152 }
14153 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
14154 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)14155 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
14156 char* defenc_c;
14157 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
14158 if (!defenc) return NULL;
14159 defenc_c = PyBytes_AS_STRING(defenc);
14160 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
14161 {
14162 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
14163 char* c;
14164 for (c = defenc_c; c < end; c++) {
14165 if ((unsigned char) (*c) >= 128) {
14166 PyUnicode_AsASCIIString(o);
14167 return NULL;
14168 }
14169 }
14170 }
14171 #endif
14172 *length = PyBytes_GET_SIZE(defenc);
14173 return defenc_c;
14174 }
14175 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)14176 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
14177 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
14178 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
14179 if (likely(PyUnicode_IS_ASCII(o))) {
14180 *length = PyUnicode_GET_LENGTH(o);
14181 return PyUnicode_AsUTF8(o);
14182 } else {
14183 PyUnicode_AsASCIIString(o);
14184 return NULL;
14185 }
14186 #else
14187 return PyUnicode_AsUTF8AndSize(o, length);
14188 #endif
14189 }
14190 #endif
14191 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)14192 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
14193 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
14194 if (
14195 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
14196 __Pyx_sys_getdefaultencoding_not_ascii &&
14197 #endif
14198 PyUnicode_Check(o)) {
14199 return __Pyx_PyUnicode_AsStringAndSize(o, length);
14200 } else
14201 #endif
14202 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
14203 if (PyByteArray_Check(o)) {
14204 *length = PyByteArray_GET_SIZE(o);
14205 return PyByteArray_AS_STRING(o);
14206 } else
14207 #endif
14208 {
14209 char* result;
14210 int r = PyBytes_AsStringAndSize(o, &result, length);
14211 if (unlikely(r < 0)) {
14212 return NULL;
14213 } else {
14214 return result;
14215 }
14216 }
14217 }
__Pyx_PyObject_IsTrue(PyObject * x)14218 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
14219 int is_true = x == Py_True;
14220 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
14221 else return PyObject_IsTrue(x);
14222 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)14223 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
14224 int retval;
14225 if (unlikely(!x)) return -1;
14226 retval = __Pyx_PyObject_IsTrue(x);
14227 Py_DECREF(x);
14228 return retval;
14229 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)14230 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
14231 #if PY_MAJOR_VERSION >= 3
14232 if (PyLong_Check(result)) {
14233 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
14234 "__int__ returned non-int (type %.200s). "
14235 "The ability to return an instance of a strict subclass of int "
14236 "is deprecated, and may be removed in a future version of Python.",
14237 Py_TYPE(result)->tp_name)) {
14238 Py_DECREF(result);
14239 return NULL;
14240 }
14241 return result;
14242 }
14243 #endif
14244 PyErr_Format(PyExc_TypeError,
14245 "__%.4s__ returned non-%.4s (type %.200s)",
14246 type_name, type_name, Py_TYPE(result)->tp_name);
14247 Py_DECREF(result);
14248 return NULL;
14249 }
__Pyx_PyNumber_IntOrLong(PyObject * x)14250 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
14251 #if CYTHON_USE_TYPE_SLOTS
14252 PyNumberMethods *m;
14253 #endif
14254 const char *name = NULL;
14255 PyObject *res = NULL;
14256 #if PY_MAJOR_VERSION < 3
14257 if (likely(PyInt_Check(x) || PyLong_Check(x)))
14258 #else
14259 if (likely(PyLong_Check(x)))
14260 #endif
14261 return __Pyx_NewRef(x);
14262 #if CYTHON_USE_TYPE_SLOTS
14263 m = Py_TYPE(x)->tp_as_number;
14264 #if PY_MAJOR_VERSION < 3
14265 if (m && m->nb_int) {
14266 name = "int";
14267 res = m->nb_int(x);
14268 }
14269 else if (m && m->nb_long) {
14270 name = "long";
14271 res = m->nb_long(x);
14272 }
14273 #else
14274 if (likely(m && m->nb_int)) {
14275 name = "int";
14276 res = m->nb_int(x);
14277 }
14278 #endif
14279 #else
14280 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
14281 res = PyNumber_Int(x);
14282 }
14283 #endif
14284 if (likely(res)) {
14285 #if PY_MAJOR_VERSION < 3
14286 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
14287 #else
14288 if (unlikely(!PyLong_CheckExact(res))) {
14289 #endif
14290 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
14291 }
14292 }
14293 else if (!PyErr_Occurred()) {
14294 PyErr_SetString(PyExc_TypeError,
14295 "an integer is required");
14296 }
14297 return res;
14298 }
14299 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
14300 Py_ssize_t ival;
14301 PyObject *x;
14302 #if PY_MAJOR_VERSION < 3
14303 if (likely(PyInt_CheckExact(b))) {
14304 if (sizeof(Py_ssize_t) >= sizeof(long))
14305 return PyInt_AS_LONG(b);
14306 else
14307 return PyInt_AsSsize_t(b);
14308 }
14309 #endif
14310 if (likely(PyLong_CheckExact(b))) {
14311 #if CYTHON_USE_PYLONG_INTERNALS
14312 const digit* digits = ((PyLongObject*)b)->ob_digit;
14313 const Py_ssize_t size = Py_SIZE(b);
14314 if (likely(__Pyx_sst_abs(size) <= 1)) {
14315 ival = likely(size) ? digits[0] : 0;
14316 if (size == -1) ival = -ival;
14317 return ival;
14318 } else {
14319 switch (size) {
14320 case 2:
14321 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
14322 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14323 }
14324 break;
14325 case -2:
14326 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
14327 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14328 }
14329 break;
14330 case 3:
14331 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
14332 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14333 }
14334 break;
14335 case -3:
14336 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
14337 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14338 }
14339 break;
14340 case 4:
14341 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
14342 return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14343 }
14344 break;
14345 case -4:
14346 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
14347 return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14348 }
14349 break;
14350 }
14351 }
14352 #endif
14353 return PyLong_AsSsize_t(b);
14354 }
14355 x = PyNumber_Index(b);
14356 if (!x) return -1;
14357 ival = PyInt_AsSsize_t(x);
14358 Py_DECREF(x);
14359 return ival;
14360 }
14361 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
14362 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
14363 }
14364 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
14365 return PyInt_FromSize_t(ival);
14366 }
14367
14368
14369 #endif /* Py_PYTHON_H */
14370