1 /* Generated by Cython 0.29.21 */
2 
3 /* BEGIN: Cython Metadata
4 {
5     "distutils": {
6         "depends": [
7             "/home/sean/local/include/cpl_conv.h",
8             "/home/sean/local/include/cpl_error.h",
9             "/home/sean/local/include/cpl_string.h",
10             "/home/sean/local/include/cpl_vsi.h",
11             "/home/sean/local/include/gdal.h",
12             "/home/sean/local/include/gdal_alg.h",
13             "/home/sean/local/include/gdalwarper.h",
14             "/home/sean/local/include/ogr_api.h",
15             "/home/sean/local/include/ogr_core.h",
16             "/home/sean/local/include/ogr_srs_api.h"
17         ],
18         "extra_compile_args": [
19             "-Wno-unused-parameter",
20             "-Wno-unused-function"
21         ],
22         "include_dirs": [
23             "/home/sean/.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/core/include",
24             "/home/sean/local/include"
25         ],
26         "libraries": [
27             "gdal"
28         ],
29         "library_dirs": [
30             "/home/sean/local/lib"
31         ],
32         "name": "rasterio._base",
33         "sources": [
34             "rasterio/_base.pyx"
35         ]
36     },
37     "module_name": "rasterio._base"
38 }
39 END: Cython Metadata */
40 
41 #define PY_SSIZE_T_CLEAN
42 #include "Python.h"
43 #ifndef Py_PYTHON_H
44     #error Python headers needed to compile C extensions, please install development version of Python.
45 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
46     #error Cython requires Python 2.6+ or Python 3.3+.
47 #else
48 #define CYTHON_ABI "0_29_21"
49 #define CYTHON_HEX_VERSION 0x001D15F0
50 #define CYTHON_FUTURE_DIVISION 1
51 #include <stddef.h>
52 #ifndef offsetof
53   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
54 #endif
55 #if !defined(WIN32) && !defined(MS_WINDOWS)
56   #ifndef __stdcall
57     #define __stdcall
58   #endif
59   #ifndef __cdecl
60     #define __cdecl
61   #endif
62   #ifndef __fastcall
63     #define __fastcall
64   #endif
65 #endif
66 #ifndef DL_IMPORT
67   #define DL_IMPORT(t) t
68 #endif
69 #ifndef DL_EXPORT
70   #define DL_EXPORT(t) t
71 #endif
72 #define __PYX_COMMA ,
73 #ifndef HAVE_LONG_LONG
74   #if PY_VERSION_HEX >= 0x02070000
75     #define HAVE_LONG_LONG
76   #endif
77 #endif
78 #ifndef PY_LONG_LONG
79   #define PY_LONG_LONG LONG_LONG
80 #endif
81 #ifndef Py_HUGE_VAL
82   #define Py_HUGE_VAL HUGE_VAL
83 #endif
84 #ifdef PYPY_VERSION
85   #define CYTHON_COMPILING_IN_PYPY 1
86   #define CYTHON_COMPILING_IN_PYSTON 0
87   #define CYTHON_COMPILING_IN_CPYTHON 0
88   #undef CYTHON_USE_TYPE_SLOTS
89   #define CYTHON_USE_TYPE_SLOTS 0
90   #undef CYTHON_USE_PYTYPE_LOOKUP
91   #define CYTHON_USE_PYTYPE_LOOKUP 0
92   #if PY_VERSION_HEX < 0x03050000
93     #undef CYTHON_USE_ASYNC_SLOTS
94     #define CYTHON_USE_ASYNC_SLOTS 0
95   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
96     #define CYTHON_USE_ASYNC_SLOTS 1
97   #endif
98   #undef CYTHON_USE_PYLIST_INTERNALS
99   #define CYTHON_USE_PYLIST_INTERNALS 0
100   #undef CYTHON_USE_UNICODE_INTERNALS
101   #define CYTHON_USE_UNICODE_INTERNALS 0
102   #undef CYTHON_USE_UNICODE_WRITER
103   #define CYTHON_USE_UNICODE_WRITER 0
104   #undef CYTHON_USE_PYLONG_INTERNALS
105   #define CYTHON_USE_PYLONG_INTERNALS 0
106   #undef CYTHON_AVOID_BORROWED_REFS
107   #define CYTHON_AVOID_BORROWED_REFS 1
108   #undef CYTHON_ASSUME_SAFE_MACROS
109   #define CYTHON_ASSUME_SAFE_MACROS 0
110   #undef CYTHON_UNPACK_METHODS
111   #define CYTHON_UNPACK_METHODS 0
112   #undef CYTHON_FAST_THREAD_STATE
113   #define CYTHON_FAST_THREAD_STATE 0
114   #undef CYTHON_FAST_PYCALL
115   #define CYTHON_FAST_PYCALL 0
116   #undef CYTHON_PEP489_MULTI_PHASE_INIT
117   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
118   #undef CYTHON_USE_TP_FINALIZE
119   #define CYTHON_USE_TP_FINALIZE 0
120   #undef CYTHON_USE_DICT_VERSIONS
121   #define CYTHON_USE_DICT_VERSIONS 0
122   #undef CYTHON_USE_EXC_INFO_STACK
123   #define CYTHON_USE_EXC_INFO_STACK 0
124 #elif defined(PYSTON_VERSION)
125   #define CYTHON_COMPILING_IN_PYPY 0
126   #define CYTHON_COMPILING_IN_PYSTON 1
127   #define CYTHON_COMPILING_IN_CPYTHON 0
128   #ifndef CYTHON_USE_TYPE_SLOTS
129     #define CYTHON_USE_TYPE_SLOTS 1
130   #endif
131   #undef CYTHON_USE_PYTYPE_LOOKUP
132   #define CYTHON_USE_PYTYPE_LOOKUP 0
133   #undef CYTHON_USE_ASYNC_SLOTS
134   #define CYTHON_USE_ASYNC_SLOTS 0
135   #undef CYTHON_USE_PYLIST_INTERNALS
136   #define CYTHON_USE_PYLIST_INTERNALS 0
137   #ifndef CYTHON_USE_UNICODE_INTERNALS
138     #define CYTHON_USE_UNICODE_INTERNALS 1
139   #endif
140   #undef CYTHON_USE_UNICODE_WRITER
141   #define CYTHON_USE_UNICODE_WRITER 0
142   #undef CYTHON_USE_PYLONG_INTERNALS
143   #define CYTHON_USE_PYLONG_INTERNALS 0
144   #ifndef CYTHON_AVOID_BORROWED_REFS
145     #define CYTHON_AVOID_BORROWED_REFS 0
146   #endif
147   #ifndef CYTHON_ASSUME_SAFE_MACROS
148     #define CYTHON_ASSUME_SAFE_MACROS 1
149   #endif
150   #ifndef CYTHON_UNPACK_METHODS
151     #define CYTHON_UNPACK_METHODS 1
152   #endif
153   #undef CYTHON_FAST_THREAD_STATE
154   #define CYTHON_FAST_THREAD_STATE 0
155   #undef CYTHON_FAST_PYCALL
156   #define CYTHON_FAST_PYCALL 0
157   #undef CYTHON_PEP489_MULTI_PHASE_INIT
158   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
159   #undef CYTHON_USE_TP_FINALIZE
160   #define CYTHON_USE_TP_FINALIZE 0
161   #undef CYTHON_USE_DICT_VERSIONS
162   #define CYTHON_USE_DICT_VERSIONS 0
163   #undef CYTHON_USE_EXC_INFO_STACK
164   #define CYTHON_USE_EXC_INFO_STACK 0
165 #else
166   #define CYTHON_COMPILING_IN_PYPY 0
167   #define CYTHON_COMPILING_IN_PYSTON 0
168   #define CYTHON_COMPILING_IN_CPYTHON 1
169   #ifndef CYTHON_USE_TYPE_SLOTS
170     #define CYTHON_USE_TYPE_SLOTS 1
171   #endif
172   #if PY_VERSION_HEX < 0x02070000
173     #undef CYTHON_USE_PYTYPE_LOOKUP
174     #define CYTHON_USE_PYTYPE_LOOKUP 0
175   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
176     #define CYTHON_USE_PYTYPE_LOOKUP 1
177   #endif
178   #if PY_MAJOR_VERSION < 3
179     #undef CYTHON_USE_ASYNC_SLOTS
180     #define CYTHON_USE_ASYNC_SLOTS 0
181   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
182     #define CYTHON_USE_ASYNC_SLOTS 1
183   #endif
184   #if PY_VERSION_HEX < 0x02070000
185     #undef CYTHON_USE_PYLONG_INTERNALS
186     #define CYTHON_USE_PYLONG_INTERNALS 0
187   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
188     #define CYTHON_USE_PYLONG_INTERNALS 1
189   #endif
190   #ifndef CYTHON_USE_PYLIST_INTERNALS
191     #define CYTHON_USE_PYLIST_INTERNALS 1
192   #endif
193   #ifndef CYTHON_USE_UNICODE_INTERNALS
194     #define CYTHON_USE_UNICODE_INTERNALS 1
195   #endif
196   #if PY_VERSION_HEX < 0x030300F0
197     #undef CYTHON_USE_UNICODE_WRITER
198     #define CYTHON_USE_UNICODE_WRITER 0
199   #elif !defined(CYTHON_USE_UNICODE_WRITER)
200     #define CYTHON_USE_UNICODE_WRITER 1
201   #endif
202   #ifndef CYTHON_AVOID_BORROWED_REFS
203     #define CYTHON_AVOID_BORROWED_REFS 0
204   #endif
205   #ifndef CYTHON_ASSUME_SAFE_MACROS
206     #define CYTHON_ASSUME_SAFE_MACROS 1
207   #endif
208   #ifndef CYTHON_UNPACK_METHODS
209     #define CYTHON_UNPACK_METHODS 1
210   #endif
211   #ifndef CYTHON_FAST_THREAD_STATE
212     #define CYTHON_FAST_THREAD_STATE 1
213   #endif
214   #ifndef CYTHON_FAST_PYCALL
215     #define CYTHON_FAST_PYCALL 1
216   #endif
217   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
218     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
219   #endif
220   #ifndef CYTHON_USE_TP_FINALIZE
221     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
222   #endif
223   #ifndef CYTHON_USE_DICT_VERSIONS
224     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
225   #endif
226   #ifndef CYTHON_USE_EXC_INFO_STACK
227     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
228   #endif
229 #endif
230 #if !defined(CYTHON_FAST_PYCCALL)
231 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
232 #endif
233 #if CYTHON_USE_PYLONG_INTERNALS
234   #include "longintrepr.h"
235   #undef SHIFT
236   #undef BASE
237   #undef MASK
238   #ifdef SIZEOF_VOID_P
239     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
240   #endif
241 #endif
242 #ifndef __has_attribute
243   #define __has_attribute(x) 0
244 #endif
245 #ifndef __has_cpp_attribute
246   #define __has_cpp_attribute(x) 0
247 #endif
248 #ifndef CYTHON_RESTRICT
249   #if defined(__GNUC__)
250     #define CYTHON_RESTRICT __restrict__
251   #elif defined(_MSC_VER) && _MSC_VER >= 1400
252     #define CYTHON_RESTRICT __restrict
253   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
254     #define CYTHON_RESTRICT restrict
255   #else
256     #define CYTHON_RESTRICT
257   #endif
258 #endif
259 #ifndef CYTHON_UNUSED
260 # if defined(__GNUC__)
261 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
262 #     define CYTHON_UNUSED __attribute__ ((__unused__))
263 #   else
264 #     define CYTHON_UNUSED
265 #   endif
266 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
267 #   define CYTHON_UNUSED __attribute__ ((__unused__))
268 # else
269 #   define CYTHON_UNUSED
270 # endif
271 #endif
272 #ifndef CYTHON_MAYBE_UNUSED_VAR
273 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)274      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
275 #  else
276 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
277 #  endif
278 #endif
279 #ifndef CYTHON_NCP_UNUSED
280 # if CYTHON_COMPILING_IN_CPYTHON
281 #  define CYTHON_NCP_UNUSED
282 # else
283 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
284 # endif
285 #endif
286 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
287 #ifdef _MSC_VER
288     #ifndef _MSC_STDINT_H_
289         #if _MSC_VER < 1300
290            typedef unsigned char     uint8_t;
291            typedef unsigned int      uint32_t;
292         #else
293            typedef unsigned __int8   uint8_t;
294            typedef unsigned __int32  uint32_t;
295         #endif
296     #endif
297 #else
298    #include <stdint.h>
299 #endif
300 #ifndef CYTHON_FALLTHROUGH
301   #if defined(__cplusplus) && __cplusplus >= 201103L
302     #if __has_cpp_attribute(fallthrough)
303       #define CYTHON_FALLTHROUGH [[fallthrough]]
304     #elif __has_cpp_attribute(clang::fallthrough)
305       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
306     #elif __has_cpp_attribute(gnu::fallthrough)
307       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
308     #endif
309   #endif
310   #ifndef CYTHON_FALLTHROUGH
311     #if __has_attribute(fallthrough)
312       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
313     #else
314       #define CYTHON_FALLTHROUGH
315     #endif
316   #endif
317   #if defined(__clang__ ) && defined(__apple_build_version__)
318     #if __apple_build_version__ < 7000000
319       #undef  CYTHON_FALLTHROUGH
320       #define CYTHON_FALLTHROUGH
321     #endif
322   #endif
323 #endif
324 
325 #ifndef CYTHON_INLINE
326   #if defined(__clang__)
327     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
328   #elif defined(__GNUC__)
329     #define CYTHON_INLINE __inline__
330   #elif defined(_MSC_VER)
331     #define CYTHON_INLINE __inline
332   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
333     #define CYTHON_INLINE inline
334   #else
335     #define CYTHON_INLINE
336   #endif
337 #endif
338 
339 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
340   #define Py_OptimizeFlag 0
341 #endif
342 #define __PYX_BUILD_PY_SSIZE_T "n"
343 #define CYTHON_FORMAT_SSIZE_T "z"
344 #if PY_MAJOR_VERSION < 3
345   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
346   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
347           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
348   #define __Pyx_DefaultClassType PyClass_Type
349 #else
350   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
351 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
352   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
353           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
354 #else
355   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
356           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
357 #endif
358   #define __Pyx_DefaultClassType PyType_Type
359 #endif
360 #ifndef Py_TPFLAGS_CHECKTYPES
361   #define Py_TPFLAGS_CHECKTYPES 0
362 #endif
363 #ifndef Py_TPFLAGS_HAVE_INDEX
364   #define Py_TPFLAGS_HAVE_INDEX 0
365 #endif
366 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
367   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
368 #endif
369 #ifndef Py_TPFLAGS_HAVE_FINALIZE
370   #define Py_TPFLAGS_HAVE_FINALIZE 0
371 #endif
372 #ifndef METH_STACKLESS
373   #define METH_STACKLESS 0
374 #endif
375 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
376   #ifndef METH_FASTCALL
377      #define METH_FASTCALL 0x80
378   #endif
379   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
380   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
381                                                           Py_ssize_t nargs, PyObject *kwnames);
382 #else
383   #define __Pyx_PyCFunctionFast _PyCFunctionFast
384   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
385 #endif
386 #if CYTHON_FAST_PYCCALL
387 #define __Pyx_PyFastCFunction_Check(func)\
388     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
389 #else
390 #define __Pyx_PyFastCFunction_Check(func) 0
391 #endif
392 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
393   #define PyObject_Malloc(s)   PyMem_Malloc(s)
394   #define PyObject_Free(p)     PyMem_Free(p)
395   #define PyObject_Realloc(p)  PyMem_Realloc(p)
396 #endif
397 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
398   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
399   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
400   #define PyMem_RawFree(p)             PyMem_Free(p)
401 #endif
402 #if CYTHON_COMPILING_IN_PYSTON
403   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
404   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
405 #else
406   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
407   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
408 #endif
409 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
410   #define __Pyx_PyThreadState_Current PyThreadState_GET()
411 #elif PY_VERSION_HEX >= 0x03060000
412   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
413 #elif PY_VERSION_HEX >= 0x03000000
414   #define __Pyx_PyThreadState_Current PyThreadState_GET()
415 #else
416   #define __Pyx_PyThreadState_Current _PyThreadState_Current
417 #endif
418 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
419 #include "pythread.h"
420 #define Py_tss_NEEDS_INIT 0
421 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)422 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
423   *key = PyThread_create_key();
424   return 0;
425 }
PyThread_tss_alloc(void)426 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
427   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
428   *key = Py_tss_NEEDS_INIT;
429   return key;
430 }
PyThread_tss_free(Py_tss_t * key)431 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
432   PyObject_Free(key);
433 }
PyThread_tss_is_created(Py_tss_t * key)434 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
435   return *key != Py_tss_NEEDS_INIT;
436 }
PyThread_tss_delete(Py_tss_t * key)437 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
438   PyThread_delete_key(*key);
439   *key = Py_tss_NEEDS_INIT;
440 }
PyThread_tss_set(Py_tss_t * key,void * value)441 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
442   return PyThread_set_key_value(*key, value);
443 }
PyThread_tss_get(Py_tss_t * key)444 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
445   return PyThread_get_key_value(*key);
446 }
447 #endif
448 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
449 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
450 #else
451 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
452 #endif
453 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
454   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
455   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
456 #else
457   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
458   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
459 #endif
460 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
461 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
462 #else
463 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
464 #endif
465 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
466   #define CYTHON_PEP393_ENABLED 1
467   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
468                                               0 : _PyUnicode_Ready((PyObject *)(op)))
469   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
470   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
471   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
472   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
473   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
474   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
475   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
476   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
477   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
478   #else
479   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
480   #endif
481 #else
482   #define CYTHON_PEP393_ENABLED 0
483   #define PyUnicode_1BYTE_KIND  1
484   #define PyUnicode_2BYTE_KIND  2
485   #define PyUnicode_4BYTE_KIND  4
486   #define __Pyx_PyUnicode_READY(op)       (0)
487   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
488   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
489   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
490   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
491   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
492   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
493   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
494   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
495 #endif
496 #if CYTHON_COMPILING_IN_PYPY
497   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
498   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
499 #else
500   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
501   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
502       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
503 #endif
504 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
505   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
506 #endif
507 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
508   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
509 #endif
510 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
511   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
512 #endif
513 #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))
514 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
515 #if PY_MAJOR_VERSION >= 3
516   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
517 #else
518   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
519 #endif
520 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
521   #define PyObject_ASCII(o)            PyObject_Repr(o)
522 #endif
523 #if PY_MAJOR_VERSION >= 3
524   #define PyBaseString_Type            PyUnicode_Type
525   #define PyStringObject               PyUnicodeObject
526   #define PyString_Type                PyUnicode_Type
527   #define PyString_Check               PyUnicode_Check
528   #define PyString_CheckExact          PyUnicode_CheckExact
529 #ifndef PyObject_Unicode
530   #define PyObject_Unicode             PyObject_Str
531 #endif
532 #endif
533 #if PY_MAJOR_VERSION >= 3
534   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
535   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
536 #else
537   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
538   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
539 #endif
540 #ifndef PySet_CheckExact
541   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
542 #endif
543 #if PY_VERSION_HEX >= 0x030900A4
544   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
545   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
546 #else
547   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
548   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
549 #endif
550 #if CYTHON_ASSUME_SAFE_MACROS
551   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
552 #else
553   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
554 #endif
555 #if PY_MAJOR_VERSION >= 3
556   #define PyIntObject                  PyLongObject
557   #define PyInt_Type                   PyLong_Type
558   #define PyInt_Check(op)              PyLong_Check(op)
559   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
560   #define PyInt_FromString             PyLong_FromString
561   #define PyInt_FromUnicode            PyLong_FromUnicode
562   #define PyInt_FromLong               PyLong_FromLong
563   #define PyInt_FromSize_t             PyLong_FromSize_t
564   #define PyInt_FromSsize_t            PyLong_FromSsize_t
565   #define PyInt_AsLong                 PyLong_AsLong
566   #define PyInt_AS_LONG                PyLong_AS_LONG
567   #define PyInt_AsSsize_t              PyLong_AsSsize_t
568   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
569   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
570   #define PyNumber_Int                 PyNumber_Long
571 #endif
572 #if PY_MAJOR_VERSION >= 3
573   #define PyBoolObject                 PyLongObject
574 #endif
575 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
576   #ifndef PyUnicode_InternFromString
577     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
578   #endif
579 #endif
580 #if PY_VERSION_HEX < 0x030200A4
581   typedef long Py_hash_t;
582   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
583   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
584 #else
585   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
586   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
587 #endif
588 #if PY_MAJOR_VERSION >= 3
589   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
590 #else
591   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
592 #endif
593 #if CYTHON_USE_ASYNC_SLOTS
594   #if PY_VERSION_HEX >= 0x030500B1
595     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
596     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
597   #else
598     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
599   #endif
600 #else
601   #define __Pyx_PyType_AsAsync(obj) NULL
602 #endif
603 #ifndef __Pyx_PyAsyncMethodsStruct
604     typedef struct {
605         unaryfunc am_await;
606         unaryfunc am_aiter;
607         unaryfunc am_anext;
608     } __Pyx_PyAsyncMethodsStruct;
609 #endif
610 
611 #if defined(WIN32) || defined(MS_WINDOWS)
612   #define _USE_MATH_DEFINES
613 #endif
614 #include <math.h>
615 #ifdef NAN
616 #define __PYX_NAN() ((float) NAN)
617 #else
__PYX_NAN()618 static CYTHON_INLINE float __PYX_NAN() {
619   float value;
620   memset(&value, 0xFF, sizeof(value));
621   return value;
622 }
623 #endif
624 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
625 #define __Pyx_truncl trunc
626 #else
627 #define __Pyx_truncl truncl
628 #endif
629 
630 #define __PYX_MARK_ERR_POS(f_index, lineno) \
631     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
632 #define __PYX_ERR(f_index, lineno, Ln_error) \
633     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
634 
635 #ifndef __PYX_EXTERN_C
636   #ifdef __cplusplus
637     #define __PYX_EXTERN_C extern "C"
638   #else
639     #define __PYX_EXTERN_C extern
640   #endif
641 #endif
642 
643 #define __PYX_HAVE__rasterio___base
644 #define __PYX_HAVE_API__rasterio___base
645 /* Early includes */
646 #include <string.h>
647 #include <stdio.h>
648 #include "cpl_conv.h"
649 #include "cpl_error.h"
650 #include "cpl_string.h"
651 #include "sys/stat.h"
652 #include "cpl_vsi.h"
653 #include "ogr_srs_api.h"
654 #include "gdal.h"
655 #include "ogr_api.h"
656 #include "gdalwarper.h"
657 #include "gdal_alg.h"
658 #include "ogr_core.h"
659 #include "pythread.h"
660 #include <stdlib.h>
661 #include "pystate.h"
662 #ifdef _OPENMP
663 #include <omp.h>
664 #endif /* _OPENMP */
665 
666 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
667 #define CYTHON_WITHOUT_ASSERTIONS
668 #endif
669 
670 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
671                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
672 
673 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
674 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 1
675 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
676 #define __PYX_DEFAULT_STRING_ENCODING "utf8"
677 #define __Pyx_PyObject_FromString __Pyx_PyUnicode_FromString
678 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
679 #define __Pyx_uchar_cast(c) ((unsigned char)c)
680 #define __Pyx_long_cast(x) ((long)x)
681 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
682     (sizeof(type) < sizeof(Py_ssize_t))  ||\
683     (sizeof(type) > sizeof(Py_ssize_t) &&\
684           likely(v < (type)PY_SSIZE_T_MAX ||\
685                  v == (type)PY_SSIZE_T_MAX)  &&\
686           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
687                                 v == (type)PY_SSIZE_T_MIN)))  ||\
688     (sizeof(type) == sizeof(Py_ssize_t) &&\
689           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
690                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)691 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
692     return (size_t) i < (size_t) limit;
693 }
694 #if defined (__cplusplus) && __cplusplus >= 201103L
695     #include <cstdlib>
696     #define __Pyx_sst_abs(value) std::abs(value)
697 #elif SIZEOF_INT >= SIZEOF_SIZE_T
698     #define __Pyx_sst_abs(value) abs(value)
699 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
700     #define __Pyx_sst_abs(value) labs(value)
701 #elif defined (_MSC_VER)
702     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
703 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
704     #define __Pyx_sst_abs(value) llabs(value)
705 #elif defined (__GNUC__)
706     #define __Pyx_sst_abs(value) __builtin_llabs(value)
707 #else
708     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
709 #endif
710 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
711 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
712 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
713 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
714 #define __Pyx_PyBytes_FromString        PyBytes_FromString
715 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
716 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
717 #if PY_MAJOR_VERSION < 3
718     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
719     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
720 #else
721     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
722     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
723 #endif
724 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
725 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
726 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
727 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
728 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
729 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
730 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
731 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
732 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
733 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
734 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
735 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
736 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
737 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
738 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
739 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)740 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
741     const Py_UNICODE *u_end = u;
742     while (*u_end++) ;
743     return (size_t)(u_end - u - 1);
744 }
745 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
746 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
747 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
748 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
749 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
750 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
751 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
752 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
753 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
754 #define __Pyx_PySequence_Tuple(obj)\
755     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
756 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
757 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
758 #if CYTHON_ASSUME_SAFE_MACROS
759 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
760 #else
761 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
762 #endif
763 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
764 #if PY_MAJOR_VERSION >= 3
765 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
766 #else
767 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
768 #endif
769 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
770 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
771 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)772 static int __Pyx_init_sys_getdefaultencoding_params(void) {
773     PyObject* sys;
774     PyObject* default_encoding = NULL;
775     PyObject* ascii_chars_u = NULL;
776     PyObject* ascii_chars_b = NULL;
777     const char* default_encoding_c;
778     sys = PyImport_ImportModule("sys");
779     if (!sys) goto bad;
780     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
781     Py_DECREF(sys);
782     if (!default_encoding) goto bad;
783     default_encoding_c = PyBytes_AsString(default_encoding);
784     if (!default_encoding_c) goto bad;
785     if (strcmp(default_encoding_c, "ascii") == 0) {
786         __Pyx_sys_getdefaultencoding_not_ascii = 0;
787     } else {
788         char ascii_chars[128];
789         int c;
790         for (c = 0; c < 128; c++) {
791             ascii_chars[c] = c;
792         }
793         __Pyx_sys_getdefaultencoding_not_ascii = 1;
794         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
795         if (!ascii_chars_u) goto bad;
796         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
797         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
798             PyErr_Format(
799                 PyExc_ValueError,
800                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
801                 default_encoding_c);
802             goto bad;
803         }
804         Py_DECREF(ascii_chars_u);
805         Py_DECREF(ascii_chars_b);
806     }
807     Py_DECREF(default_encoding);
808     return 0;
809 bad:
810     Py_XDECREF(default_encoding);
811     Py_XDECREF(ascii_chars_u);
812     Py_XDECREF(ascii_chars_b);
813     return -1;
814 }
815 #endif
816 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
817 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
818 #else
819 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
820 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
821 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)822 static int __Pyx_init_sys_getdefaultencoding_params(void) {
823     PyObject* sys;
824     PyObject* default_encoding = NULL;
825     char* default_encoding_c;
826     sys = PyImport_ImportModule("sys");
827     if (!sys) goto bad;
828     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
829     Py_DECREF(sys);
830     if (!default_encoding) goto bad;
831     default_encoding_c = PyBytes_AsString(default_encoding);
832     if (!default_encoding_c) goto bad;
833     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
834     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
835     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
836     Py_DECREF(default_encoding);
837     return 0;
838 bad:
839     Py_XDECREF(default_encoding);
840     return -1;
841 }
842 #endif
843 #endif
844 
845 
846 /* Test for GCC > 2.95 */
847 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
848   #define likely(x)   __builtin_expect(!!(x), 1)
849   #define unlikely(x) __builtin_expect(!!(x), 0)
850 #else /* !__GNUC__ or GCC < 2.95 */
851   #define likely(x)   (x)
852   #define unlikely(x) (x)
853 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)854 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
855 
856 static PyObject *__pyx_m = NULL;
857 static PyObject *__pyx_d;
858 static PyObject *__pyx_b;
859 static PyObject *__pyx_cython_runtime = NULL;
860 static PyObject *__pyx_empty_tuple;
861 static PyObject *__pyx_empty_bytes;
862 static PyObject *__pyx_empty_unicode;
863 static int __pyx_lineno;
864 static int __pyx_clineno = 0;
865 static const char * __pyx_cfilenm= __FILE__;
866 static const char *__pyx_filename;
867 
868 
869 static const char *__pyx_f[] = {
870   "rasterio/_base.pyx",
871   "stringsource",
872 };
873 /* NoFastGil.proto */
874 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
875 #define __Pyx_PyGILState_Release PyGILState_Release
876 #define __Pyx_FastGIL_Remember()
877 #define __Pyx_FastGIL_Forget()
878 #define __Pyx_FastGilFuncInit()
879 
880 /* ForceInitThreads.proto */
881 #ifndef __PYX_FORCE_INIT_THREADS
882   #define __PYX_FORCE_INIT_THREADS 0
883 #endif
884 
885 /* BufferFormatStructs.proto */
886 #define IS_UNSIGNED(type) (((type) -1) > 0)
887 struct __Pyx_StructField_;
888 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
889 typedef struct {
890   const char* name;
891   struct __Pyx_StructField_* fields;
892   size_t size;
893   size_t arraysize[8];
894   int ndim;
895   char typegroup;
896   char is_unsigned;
897   int flags;
898 } __Pyx_TypeInfo;
899 typedef struct __Pyx_StructField_ {
900   __Pyx_TypeInfo* type;
901   const char* name;
902   size_t offset;
903 } __Pyx_StructField;
904 typedef struct {
905   __Pyx_StructField* field;
906   size_t parent_offset;
907 } __Pyx_BufFmt_StackElem;
908 typedef struct {
909   __Pyx_StructField root;
910   __Pyx_BufFmt_StackElem* head;
911   size_t fmt_offset;
912   size_t new_count, enc_count;
913   size_t struct_alignment;
914   int is_complex;
915   char enc_type;
916   char new_packmode;
917   char enc_packmode;
918   char is_valid_array;
919 } __Pyx_BufFmt_Context;
920 
921 /* Atomics.proto */
922 #include <pythread.h>
923 #ifndef CYTHON_ATOMICS
924     #define CYTHON_ATOMICS 1
925 #endif
926 #define __pyx_atomic_int_type int
927 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
928                     (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
929                     !defined(__i386__)
930     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
931     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
932     #ifdef __PYX_DEBUG_ATOMICS
933         #warning "Using GNU atomics"
934     #endif
935 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
936     #include <Windows.h>
937     #undef __pyx_atomic_int_type
938     #define __pyx_atomic_int_type LONG
939     #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
940     #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
941     #ifdef __PYX_DEBUG_ATOMICS
942         #pragma message ("Using MSVC atomics")
943     #endif
944 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
945     #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
946     #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
947     #ifdef __PYX_DEBUG_ATOMICS
948         #warning "Using Intel atomics"
949     #endif
950 #else
951     #undef CYTHON_ATOMICS
952     #define CYTHON_ATOMICS 0
953     #ifdef __PYX_DEBUG_ATOMICS
954         #warning "Not using atomics"
955     #endif
956 #endif
957 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
958 #if CYTHON_ATOMICS
959     #define __pyx_add_acquisition_count(memview)\
960              __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
961     #define __pyx_sub_acquisition_count(memview)\
962             __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
963 #else
964     #define __pyx_add_acquisition_count(memview)\
965             __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
966     #define __pyx_sub_acquisition_count(memview)\
967             __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
968 #endif
969 
970 /* MemviewSliceStruct.proto */
971 struct __pyx_memoryview_obj;
972 typedef struct {
973   struct __pyx_memoryview_obj *memview;
974   char *data;
975   Py_ssize_t shape[8];
976   Py_ssize_t strides[8];
977   Py_ssize_t suboffsets[8];
978 } __Pyx_memviewslice;
979 #define __Pyx_MemoryView_Len(m)  (m.shape[0])
980 
981 
982 /*--- Type declarations ---*/
983 struct __pyx_obj_8rasterio_5_base_DatasetBase;
984 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags;
985 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr;
986 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__;
987 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr;
988 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__;
989 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr;
990 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__;
991 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr;
992 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows;
993 struct __pyx_array_obj;
994 struct __pyx_MemviewEnum_obj;
995 struct __pyx_memoryview_obj;
996 struct __pyx_memoryviewslice_obj;
997 struct __pyx_opt_args_8rasterio_5_shim_io_band;
998 struct __pyx_opt_args_8rasterio_5_shim_io_multi_band;
999 struct __pyx_opt_args_8rasterio_5_shim_io_multi_mask;
1000 
1001 /* "rasterio/_shim.pxd":7
1002  * cdef GDALDatasetH open_dataset(object filename, int mode, object allowed_drivers, object open_options, object siblings) except NULL
1003  * cdef int delete_nodata_value(GDALRasterBandH hBand) except 3
1004  * cdef int io_band(GDALRasterBandH band, int mode, double xoff, double yoff, double width, double height, object data, int resampling=*) except -1             # <<<<<<<<<<<<<<
1005  * cdef int io_multi_band(GDALDatasetH hds, int mode, double xoff, double yoff, double width, double height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1
1006  * cdef int io_multi_mask(GDALDatasetH hds, int mode, double xoff, double yoff, double width, double height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1
1007  */
1008 struct __pyx_opt_args_8rasterio_5_shim_io_band {
1009   int __pyx_n;
1010   int resampling;
1011 };
1012 
1013 /* "rasterio/_shim.pxd":8
1014  * cdef int delete_nodata_value(GDALRasterBandH hBand) except 3
1015  * cdef int io_band(GDALRasterBandH band, int mode, double xoff, double yoff, double width, double height, object data, int resampling=*) except -1
1016  * cdef int io_multi_band(GDALDatasetH hds, int mode, double xoff, double yoff, double width, double height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1             # <<<<<<<<<<<<<<
1017  * cdef int io_multi_mask(GDALDatasetH hds, int mode, double xoff, double yoff, double width, double height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1
1018  * cdef const char* osr_get_name(OGRSpatialReferenceH hSrs)
1019  */
1020 struct __pyx_opt_args_8rasterio_5_shim_io_multi_band {
1021   int __pyx_n;
1022   int resampling;
1023 };
1024 
1025 /* "rasterio/_shim.pxd":9
1026  * cdef int io_band(GDALRasterBandH band, int mode, double xoff, double yoff, double width, double height, object data, int resampling=*) except -1
1027  * cdef int io_multi_band(GDALDatasetH hds, int mode, double xoff, double yoff, double width, double height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1
1028  * cdef int io_multi_mask(GDALDatasetH hds, int mode, double xoff, double yoff, double width, double height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1             # <<<<<<<<<<<<<<
1029  * cdef const char* osr_get_name(OGRSpatialReferenceH hSrs)
1030  * cdef void osr_set_traditional_axis_mapping_strategy(OGRSpatialReferenceH hSrs)
1031  */
1032 struct __pyx_opt_args_8rasterio_5_shim_io_multi_mask {
1033   int __pyx_n;
1034   int resampling;
1035 };
1036 
1037 /* "rasterio/_base.pxd":6
1038  *
1039  *
1040  * cdef class DatasetBase:             # <<<<<<<<<<<<<<
1041  *
1042  *     cdef GDALDatasetH _hds
1043  */
1044 struct __pyx_obj_8rasterio_5_base_DatasetBase {
1045   PyObject_HEAD
1046   struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *__pyx_vtab;
1047   GDALDatasetH _hds;
1048   PyObject *name;
1049   PyObject *mode;
1050   PyObject *options;
1051   PyObject *width;
1052   PyObject *height;
1053   PyObject *shape;
1054   PyObject *driver;
1055   PyObject *_count;
1056   PyObject *_dtypes;
1057   PyObject *_closed;
1058   PyObject *_crs;
1059   PyObject *_crs_wkt;
1060   PyObject *_transform;
1061   PyObject *_block_shapes;
1062   PyObject *_nodatavals;
1063   PyObject *_units;
1064   PyObject *_descriptions;
1065   PyObject *_scales;
1066   PyObject *_offsets;
1067   PyObject *_read;
1068   PyObject *_gcps;
1069   PyObject *_rpcs;
1070   PyObject *_env;
1071 };
1072 
1073 
1074 /* "rasterio/_base.pyx":555
1075  *             self._set_nodatavals([value for old_val in self.nodatavals])
1076  *
1077  *     def _mask_flags(self):             # <<<<<<<<<<<<<<
1078  *         """Mask flags for each band."""
1079  *         cdef GDALRasterBandH band = NULL
1080  */
1081 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags {
1082   PyObject_HEAD
1083   struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self;
1084 };
1085 
1086 
1087 /* "rasterio/_base.pyx":558
1088  *         """Mask flags for each band."""
1089  *         cdef GDALRasterBandH band = NULL
1090  *         return tuple(GDALGetMaskFlags(self.band(j)) for j in self.indexes)             # <<<<<<<<<<<<<<
1091  *
1092  *     property mask_flag_enums:
1093  */
1094 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr {
1095   PyObject_HEAD
1096   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags *__pyx_outer_scope;
1097   PyObject *__pyx_v_j;
1098   PyObject *__pyx_t_0;
1099   Py_ssize_t __pyx_t_1;
1100   PyObject *(*__pyx_t_2)(PyObject *);
1101 };
1102 
1103 
1104 /* "rasterio/_base.pyx":590
1105  *         False
1106  *         """
1107  *         def __get__(self):             # <<<<<<<<<<<<<<
1108  *             return tuple(
1109  *                 [flag for flag in MaskFlags if x & flag.value]
1110  */
1111 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__ {
1112   PyObject_HEAD
1113   struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self;
1114 };
1115 
1116 
1117 /* "rasterio/_base.pyx":592
1118  *         def __get__(self):
1119  *             return tuple(
1120  *                 [flag for flag in MaskFlags if x & flag.value]             # <<<<<<<<<<<<<<
1121  *                 for x in self._mask_flags())
1122  *
1123  */
1124 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr {
1125   PyObject_HEAD
1126   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__ *__pyx_outer_scope;
1127   PyObject *__pyx_8genexpr4__pyx_v_flag;
1128   PyObject *__pyx_v_x;
1129   PyObject *__pyx_t_0;
1130   Py_ssize_t __pyx_t_1;
1131   PyObject *(*__pyx_t_2)(PyObject *);
1132 };
1133 
1134 
1135 /* "rasterio/_base.pyx":636
1136  *         list of str
1137  *         """
1138  *         def __get__(self):             # <<<<<<<<<<<<<<
1139  *             if not self._descriptions:
1140  *                 descr = [GDALGetDescription(self.band(j)) for j in self.indexes]
1141  */
1142 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__ {
1143   PyObject_HEAD
1144   PyObject *__pyx_v_descr;
1145 };
1146 
1147 
1148 /* "rasterio/_base.pyx":639
1149  *             if not self._descriptions:
1150  *                 descr = [GDALGetDescription(self.band(j)) for j in self.indexes]
1151  *                 self._descriptions = tuple((d or None) for d in descr)             # <<<<<<<<<<<<<<
1152  *             return self._descriptions
1153  *
1154  */
1155 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr {
1156   PyObject_HEAD
1157   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__ *__pyx_outer_scope;
1158   PyObject *__pyx_v_d;
1159   PyObject *__pyx_t_0;
1160   Py_ssize_t __pyx_t_1;
1161 };
1162 
1163 
1164 /* "rasterio/_base.pyx":715
1165  *         list of str
1166  *         """
1167  *         def __get__(self):             # <<<<<<<<<<<<<<
1168  *             if not self._units:
1169  *                 units = [GDALGetRasterUnitType(self.band(j)) for j in self.indexes]
1170  */
1171 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__ {
1172   PyObject_HEAD
1173   PyObject *__pyx_v_units;
1174 };
1175 
1176 
1177 /* "rasterio/_base.pyx":718
1178  *             if not self._units:
1179  *                 units = [GDALGetRasterUnitType(self.band(j)) for j in self.indexes]
1180  *                 self._units = tuple((u or None) for u in units)             # <<<<<<<<<<<<<<
1181  *             return self._units
1182  *
1183  */
1184 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr {
1185   PyObject_HEAD
1186   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__ *__pyx_outer_scope;
1187   PyObject *__pyx_v_u;
1188   PyObject *__pyx_t_0;
1189   Py_ssize_t __pyx_t_1;
1190 };
1191 
1192 
1193 /* "rasterio/_base.pyx":780
1194  *             return int(value)
1195  *
1196  *     def block_windows(self, bidx=0):             # <<<<<<<<<<<<<<
1197  *         """Iterator over a band's blocks and their windows
1198  *
1199  */
1200 struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows {
1201   PyObject_HEAD
1202   PyObject *__pyx_v_bidx;
1203   PyObject *__pyx_v_block_shapes;
1204   PyObject *__pyx_v_col;
1205   PyObject *__pyx_v_d;
1206   PyObject *__pyx_v_h;
1207   PyObject *__pyx_v_height;
1208   int __pyx_v_i;
1209   int __pyx_v_j;
1210   PyObject *__pyx_v_m;
1211   PyObject *__pyx_v_ncols;
1212   PyObject *__pyx_v_nrows;
1213   PyObject *__pyx_v_row;
1214   struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self;
1215   PyObject *__pyx_v_w;
1216   PyObject *__pyx_v_width;
1217   long __pyx_t_0;
1218   long __pyx_t_1;
1219   int __pyx_t_2;
1220   long __pyx_t_3;
1221   long __pyx_t_4;
1222   int __pyx_t_5;
1223 };
1224 
1225 
1226 /* "View.MemoryView":105
1227  *
1228  * @cname("__pyx_array")
1229  * cdef class array:             # <<<<<<<<<<<<<<
1230  *
1231  *     cdef:
1232  */
1233 struct __pyx_array_obj {
1234   PyObject_HEAD
1235   struct __pyx_vtabstruct_array *__pyx_vtab;
1236   char *data;
1237   Py_ssize_t len;
1238   char *format;
1239   int ndim;
1240   Py_ssize_t *_shape;
1241   Py_ssize_t *_strides;
1242   Py_ssize_t itemsize;
1243   PyObject *mode;
1244   PyObject *_format;
1245   void (*callback_free_data)(void *);
1246   int free_data;
1247   int dtype_is_object;
1248 };
1249 
1250 
1251 /* "View.MemoryView":279
1252  *
1253  * @cname('__pyx_MemviewEnum')
1254  * cdef class Enum(object):             # <<<<<<<<<<<<<<
1255  *     cdef object name
1256  *     def __init__(self, name):
1257  */
1258 struct __pyx_MemviewEnum_obj {
1259   PyObject_HEAD
1260   PyObject *name;
1261 };
1262 
1263 
1264 /* "View.MemoryView":330
1265  *
1266  * @cname('__pyx_memoryview')
1267  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1268  *
1269  *     cdef object obj
1270  */
1271 struct __pyx_memoryview_obj {
1272   PyObject_HEAD
1273   struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1274   PyObject *obj;
1275   PyObject *_size;
1276   PyObject *_array_interface;
1277   PyThread_type_lock lock;
1278   __pyx_atomic_int acquisition_count[2];
1279   __pyx_atomic_int *acquisition_count_aligned_p;
1280   Py_buffer view;
1281   int flags;
1282   int dtype_is_object;
1283   __Pyx_TypeInfo *typeinfo;
1284 };
1285 
1286 
1287 /* "View.MemoryView":965
1288  *
1289  * @cname('__pyx_memoryviewslice')
1290  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1291  *     "Internal class for passing memoryview slices to Python"
1292  *
1293  */
1294 struct __pyx_memoryviewslice_obj {
1295   struct __pyx_memoryview_obj __pyx_base;
1296   __Pyx_memviewslice from_slice;
1297   PyObject *from_object;
1298   PyObject *(*to_object_func)(char *);
1299   int (*to_dtype_func)(char *, PyObject *);
1300 };
1301 
1302 
1303 
1304 /* "rasterio/_base.pyx":179
1305  *
1306  *
1307  * cdef class DatasetBase(object):             # <<<<<<<<<<<<<<
1308  *     """Dataset base class
1309  *
1310  */
1311 
1312 struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase {
1313   GDALDatasetH (*handle)(struct __pyx_obj_8rasterio_5_base_DatasetBase *);
1314   GDALRasterBandH (*band)(struct __pyx_obj_8rasterio_5_base_DatasetBase *, int);
1315 };
1316 static struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *__pyx_vtabptr_8rasterio_5_base_DatasetBase;
1317 
1318 
1319 /* "View.MemoryView":105
1320  *
1321  * @cname("__pyx_array")
1322  * cdef class array:             # <<<<<<<<<<<<<<
1323  *
1324  *     cdef:
1325  */
1326 
1327 struct __pyx_vtabstruct_array {
1328   PyObject *(*get_memview)(struct __pyx_array_obj *);
1329 };
1330 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1331 
1332 
1333 /* "View.MemoryView":330
1334  *
1335  * @cname('__pyx_memoryview')
1336  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1337  *
1338  *     cdef object obj
1339  */
1340 
1341 struct __pyx_vtabstruct_memoryview {
1342   char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1343   PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1344   PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1345   PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1346   PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1347   PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1348   PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1349 };
1350 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1351 
1352 
1353 /* "View.MemoryView":965
1354  *
1355  * @cname('__pyx_memoryviewslice')
1356  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1357  *     "Internal class for passing memoryview slices to Python"
1358  *
1359  */
1360 
1361 struct __pyx_vtabstruct__memoryviewslice {
1362   struct __pyx_vtabstruct_memoryview __pyx_base;
1363 };
1364 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1365 
1366 /* --- Runtime support code (head) --- */
1367 /* Refnanny.proto */
1368 #ifndef CYTHON_REFNANNY
1369   #define CYTHON_REFNANNY 0
1370 #endif
1371 #if CYTHON_REFNANNY
1372   typedef struct {
1373     void (*INCREF)(void*, PyObject*, int);
1374     void (*DECREF)(void*, PyObject*, int);
1375     void (*GOTREF)(void*, PyObject*, int);
1376     void (*GIVEREF)(void*, PyObject*, int);
1377     void* (*SetupContext)(const char*, int, const char*);
1378     void (*FinishContext)(void**);
1379   } __Pyx_RefNannyAPIStruct;
1380   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1381   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1382   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1383 #ifdef WITH_THREAD
1384   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1385           if (acquire_gil) {\
1386               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1387               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1388               PyGILState_Release(__pyx_gilstate_save);\
1389           } else {\
1390               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1391           }
1392 #else
1393   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1394           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1395 #endif
1396   #define __Pyx_RefNannyFinishContext()\
1397           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1398   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1399   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1400   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1401   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1402   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1403   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1404   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1405   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1406 #else
1407   #define __Pyx_RefNannyDeclarations
1408   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1409   #define __Pyx_RefNannyFinishContext()
1410   #define __Pyx_INCREF(r) Py_INCREF(r)
1411   #define __Pyx_DECREF(r) Py_DECREF(r)
1412   #define __Pyx_GOTREF(r)
1413   #define __Pyx_GIVEREF(r)
1414   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1415   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1416   #define __Pyx_XGOTREF(r)
1417   #define __Pyx_XGIVEREF(r)
1418 #endif
1419 #define __Pyx_XDECREF_SET(r, v) do {\
1420         PyObject *tmp = (PyObject *) r;\
1421         r = v; __Pyx_XDECREF(tmp);\
1422     } while (0)
1423 #define __Pyx_DECREF_SET(r, v) do {\
1424         PyObject *tmp = (PyObject *) r;\
1425         r = v; __Pyx_DECREF(tmp);\
1426     } while (0)
1427 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1428 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1429 
1430 /* PyObjectGetAttrStr.proto */
1431 #if CYTHON_USE_TYPE_SLOTS
1432 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1433 #else
1434 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1435 #endif
1436 
1437 /* GetBuiltinName.proto */
1438 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1439 
1440 /* RaiseArgTupleInvalid.proto */
1441 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1442     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1443 
1444 /* RaiseDoubleKeywords.proto */
1445 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1446 
1447 /* ParseKeywords.proto */
1448 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1449     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1450     const char* function_name);
1451 
1452 /* PyDictVersioning.proto */
1453 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1454 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1455 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1456 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1457     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1458     (cache_var) = (value);
1459 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1460     static PY_UINT64_T __pyx_dict_version = 0;\
1461     static PyObject *__pyx_dict_cached_value = NULL;\
1462     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1463         (VAR) = __pyx_dict_cached_value;\
1464     } else {\
1465         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1466         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1467     }\
1468 }
1469 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1470 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1471 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1472 #else
1473 #define __PYX_GET_DICT_VERSION(dict)  (0)
1474 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1475 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1476 #endif
1477 
1478 /* GetModuleGlobalName.proto */
1479 #if CYTHON_USE_DICT_VERSIONS
1480 #define __Pyx_GetModuleGlobalName(var, name)  {\
1481     static PY_UINT64_T __pyx_dict_version = 0;\
1482     static PyObject *__pyx_dict_cached_value = NULL;\
1483     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1484         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1485         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1486 }
1487 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1488     PY_UINT64_T __pyx_dict_version;\
1489     PyObject *__pyx_dict_cached_value;\
1490     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1491 }
1492 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1493 #else
1494 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1495 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1496 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1497 #endif
1498 
1499 /* PyCFunctionFastCall.proto */
1500 #if CYTHON_FAST_PYCCALL
1501 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1502 #else
1503 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1504 #endif
1505 
1506 /* PyFunctionFastCall.proto */
1507 #if CYTHON_FAST_PYCALL
1508 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1509     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1510 #if 1 || PY_VERSION_HEX < 0x030600B1
1511 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1512 #else
1513 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1514 #endif
1515 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1516     (sizeof(char [1 - 2*!(cond)]) - 1)
1517 #ifndef Py_MEMBER_SIZE
1518 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1519 #endif
1520   static size_t __pyx_pyframe_localsplus_offset = 0;
1521   #include "frameobject.h"
1522   #define __Pxy_PyFrame_Initialize_Offsets()\
1523     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1524      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1525   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1526     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1527 #endif
1528 
1529 /* PyObjectCall.proto */
1530 #if CYTHON_COMPILING_IN_CPYTHON
1531 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1532 #else
1533 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1534 #endif
1535 
1536 /* PyObjectCall2Args.proto */
1537 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1538 
1539 /* PyObjectCallMethO.proto */
1540 #if CYTHON_COMPILING_IN_CPYTHON
1541 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1542 #endif
1543 
1544 /* PyObjectCallOneArg.proto */
1545 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1546 
1547 /* PyObjectCallNoArg.proto */
1548 #if CYTHON_COMPILING_IN_CPYTHON
1549 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1550 #else
1551 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1552 #endif
1553 
1554 /* GetTopmostException.proto */
1555 #if CYTHON_USE_EXC_INFO_STACK
1556 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1557 #endif
1558 
1559 /* PyThreadStateGet.proto */
1560 #if CYTHON_FAST_THREAD_STATE
1561 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1562 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1563 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1564 #else
1565 #define __Pyx_PyThreadState_declare
1566 #define __Pyx_PyThreadState_assign
1567 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1568 #endif
1569 
1570 /* SaveResetException.proto */
1571 #if CYTHON_FAST_THREAD_STATE
1572 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1573 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1574 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1575 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1576 #else
1577 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1578 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1579 #endif
1580 
1581 /* PyErrFetchRestore.proto */
1582 #if CYTHON_FAST_THREAD_STATE
1583 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1584 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1585 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1586 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1587 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1588 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1589 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1590 #if CYTHON_COMPILING_IN_CPYTHON
1591 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1592 #else
1593 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1594 #endif
1595 #else
1596 #define __Pyx_PyErr_Clear() PyErr_Clear()
1597 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1598 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1599 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1600 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1601 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1602 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1603 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1604 #endif
1605 
1606 /* FastTypeChecks.proto */
1607 #if CYTHON_COMPILING_IN_CPYTHON
1608 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1609 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1610 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1611 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1612 #else
1613 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1614 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1615 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1616 #endif
1617 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1618 
1619 /* GetException.proto */
1620 #if CYTHON_FAST_THREAD_STATE
1621 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1622 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1623 #else
1624 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1625 #endif
1626 
1627 /* RaiseException.proto */
1628 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1629 
1630 /* SwapException.proto */
1631 #if CYTHON_FAST_THREAD_STATE
1632 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1633 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1634 #else
1635 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1636 #endif
1637 
1638 /* PyErrExceptionMatches.proto */
1639 #if CYTHON_FAST_THREAD_STATE
1640 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1641 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1642 #else
1643 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1644 #endif
1645 
1646 /* None.proto */
1647 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1648 
1649 /* GetItemInt.proto */
1650 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1651     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1652     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1653     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1654                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1655 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1656     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1657     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1658     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1659 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1660                                                               int wraparound, int boundscheck);
1661 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1662     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1663     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1664     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1665 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1666                                                               int wraparound, int boundscheck);
1667 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1668 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1669                                                      int is_list, int wraparound, int boundscheck);
1670 
1671 /* PyObjectFormatAndDecref.proto */
1672 static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f);
1673 static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f);
1674 
1675 /* IncludeStringH.proto */
1676 #include <string.h>
1677 
1678 /* JoinPyUnicode.proto */
1679 static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
1680                                       Py_UCS4 max_char);
1681 
1682 /* ListCompAppend.proto */
1683 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_ListComp_Append(PyObject * list,PyObject * x)1684 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1685     PyListObject* L = (PyListObject*) list;
1686     Py_ssize_t len = Py_SIZE(list);
1687     if (likely(L->allocated > len)) {
1688         Py_INCREF(x);
1689         PyList_SET_ITEM(list, len, x);
1690         __Pyx_SET_SIZE(list, len + 1);
1691         return 0;
1692     }
1693     return PyList_Append(list, x);
1694 }
1695 #else
1696 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1697 #endif
1698 
1699 /* PyIntBinop.proto */
1700 #if !CYTHON_COMPILING_IN_PYPY
1701 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1702 #else
1703 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1704     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1705 #endif
1706 
1707 /* ListAppend.proto */
1708 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1709 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1710     PyListObject* L = (PyListObject*) list;
1711     Py_ssize_t len = Py_SIZE(list);
1712     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1713         Py_INCREF(x);
1714         PyList_SET_ITEM(list, len, x);
1715         __Pyx_SET_SIZE(list, len + 1);
1716         return 0;
1717     }
1718     return PyList_Append(list, x);
1719 }
1720 #else
1721 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1722 #endif
1723 
1724 /* PyObjectGetMethod.proto */
1725 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1726 
1727 /* PyObjectCallMethod1.proto */
1728 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
1729 
1730 /* append.proto */
1731 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
1732 
1733 /* BytesEquals.proto */
1734 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1735 
1736 /* UnicodeEquals.proto */
1737 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1738 
1739 /* PySequenceContains.proto */
__Pyx_PySequence_ContainsTF(PyObject * item,PyObject * seq,int eq)1740 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
1741     int result = PySequence_Contains(seq, item);
1742     return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1743 }
1744 
1745 /* ObjectGetItem.proto */
1746 #if CYTHON_USE_TYPE_SLOTS
1747 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1748 #else
1749 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1750 #endif
1751 
1752 /* PyIntCompare.proto */
1753 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
1754 
1755 /* None.proto */
1756 static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
1757 
1758 /* PyIntBinop.proto */
1759 #if !CYTHON_COMPILING_IN_PYPY
1760 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1761 #else
1762 #define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
1763     (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
1764 #endif
1765 
1766 /* RaiseTooManyValuesToUnpack.proto */
1767 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1768 
1769 /* RaiseNeedMoreValuesToUnpack.proto */
1770 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1771 
1772 /* IterFinish.proto */
1773 static CYTHON_INLINE int __Pyx_IterFinish(void);
1774 
1775 /* UnpackItemEndCheck.proto */
1776 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1777 
1778 /* PyIntBinop.proto */
1779 #if !CYTHON_COMPILING_IN_PYPY
1780 static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1781 #else
1782 #define __Pyx_PyInt_RemainderObjC(op1, op2, intval, inplace, zerodivision_check)\
1783     (inplace ? PyNumber_InPlaceRemainder(op1, op2) : PyNumber_Remainder(op1, op2))
1784 #endif
1785 
1786 /* PyFloatBinop.proto */
1787 #if !CYTHON_COMPILING_IN_PYPY
1788 static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
1789 #else
1790 #define __Pyx_PyFloat_TrueDivideObjC(op1, op2, floatval, inplace, zerodivision_check)\
1791     (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
1792 #endif
1793 
1794 /* PyObjectCallMethod0.proto */
1795 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
1796 
1797 /* pop.proto */
1798 static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L);
1799 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1800 static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L);
1801 #define __Pyx_PyObject_Pop(L) (likely(PyList_CheckExact(L)) ?\
1802     __Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L))
1803 #else
1804 #define __Pyx_PyList_Pop(L)  __Pyx__PyObject_Pop(L)
1805 #define __Pyx_PyObject_Pop(L)  __Pyx__PyObject_Pop(L)
1806 #endif
1807 
1808 /* UnpackUnboundCMethod.proto */
1809 typedef struct {
1810     PyObject *type;
1811     PyObject **method_name;
1812     PyCFunction func;
1813     PyObject *method;
1814     int flag;
1815 } __Pyx_CachedCFunction;
1816 
1817 /* CallUnboundCMethod0.proto */
1818 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
1819 #if CYTHON_COMPILING_IN_CPYTHON
1820 #define __Pyx_CallUnboundCMethod0(cfunc, self)\
1821     (likely((cfunc)->func) ?\
1822         (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
1823          (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
1824             (PY_VERSION_HEX >= 0x030700A0 ?\
1825                 (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
1826                 (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
1827           (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
1828             (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
1829             (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
1830                ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
1831                __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
1832         __Pyx__CallUnboundCMethod0(cfunc, self))
1833 #else
1834 #define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
1835 #endif
1836 
1837 /* RaiseNoneIterError.proto */
1838 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1839 
1840 /* UnpackTupleError.proto */
1841 static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);
1842 
1843 /* UnpackTuple2.proto */
1844 #define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
1845     (likely(is_tuple || PyTuple_Check(tuple)) ?\
1846         (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
1847             __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
1848             (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
1849         __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
1850 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
1851     PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
1852 static int __Pyx_unpack_tuple2_generic(
1853     PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);
1854 
1855 /* dict_iter.proto */
1856 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
1857                                                    Py_ssize_t* p_orig_length, int* p_is_dict);
1858 static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
1859                                               PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
1860 
1861 /* DictGetItem.proto */
1862 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1863 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1864 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1865     (likely(PyDict_CheckExact(obj)) ?\
1866      __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1867 #else
1868 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1869 #define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
1870 #endif
1871 
1872 /* pyobject_as_double.proto */
1873 static double __Pyx__PyObject_AsDouble(PyObject* obj);
1874 #if CYTHON_COMPILING_IN_PYPY
1875 #define __Pyx_PyObject_AsDouble(obj)\
1876 (likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
1877  likely(PyInt_CheckExact(obj)) ?\
1878  PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
1879 #else
1880 #define __Pyx_PyObject_AsDouble(obj)\
1881 ((likely(PyFloat_CheckExact(obj))) ?\
1882  PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
1883 #endif
1884 
1885 /* SetItemInt.proto */
1886 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1887     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1888     __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
1889     (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
1890                __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
1891 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
1892 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
1893                                                int is_list, int wraparound, int boundscheck);
1894 
1895 /* ArgTypeTest.proto */
1896 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1897     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1898         __Pyx__ArgTypeTest(obj, type, name, exact))
1899 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1900 
1901 /* StrEquals.proto */
1902 #if PY_MAJOR_VERSION >= 3
1903 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1904 #else
1905 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1906 #endif
1907 
1908 /* None.proto */
1909 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1910 
1911 /* UnaryNegOverflows.proto */
1912 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1913         (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1914 
1915 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1916 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1917 /* GetAttr.proto */
1918 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1919 
1920 /* decode_c_string_utf16.proto */
__Pyx_PyUnicode_DecodeUTF16(const char * s,Py_ssize_t size,const char * errors)1921 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1922     int byteorder = 0;
1923     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1924 }
__Pyx_PyUnicode_DecodeUTF16LE(const char * s,Py_ssize_t size,const char * errors)1925 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1926     int byteorder = -1;
1927     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1928 }
__Pyx_PyUnicode_DecodeUTF16BE(const char * s,Py_ssize_t size,const char * errors)1929 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1930     int byteorder = 1;
1931     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1932 }
1933 
1934 /* decode_c_string.proto */
1935 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1936          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1937          const char* encoding, const char* errors,
1938          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1939 
1940 /* GetAttr3.proto */
1941 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1942 
1943 /* ExtTypeTest.proto */
1944 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1945 
1946 /* Import.proto */
1947 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1948 
1949 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1950 /* ListExtend.proto */
__Pyx_PyList_Extend(PyObject * L,PyObject * v)1951 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
1952 #if CYTHON_COMPILING_IN_CPYTHON
1953     PyObject* none = _PyList_Extend((PyListObject*)L, v);
1954     if (unlikely(!none))
1955         return -1;
1956     Py_DECREF(none);
1957     return 0;
1958 #else
1959     return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1960 #endif
1961 }
1962 
1963 /* None.proto */
1964 static CYTHON_INLINE long __Pyx_div_long(long, long);
1965 
1966 /* ImportFrom.proto */
1967 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1968 
1969 /* HasAttr.proto */
1970 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1971 
1972 /* PyObject_GenericGetAttrNoDict.proto */
1973 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1974 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1975 #else
1976 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1977 #endif
1978 
1979 /* PyObject_GenericGetAttr.proto */
1980 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1981 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1982 #else
1983 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1984 #endif
1985 
1986 /* SetVTable.proto */
1987 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1988 
1989 /* PyObjectGetAttrStrNoError.proto */
1990 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1991 
1992 /* SetupReduce.proto */
1993 static int __Pyx_setup_reduce(PyObject* type_obj);
1994 
1995 /* CLineInTraceback.proto */
1996 #ifdef CYTHON_CLINE_IN_TRACEBACK
1997 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1998 #else
1999 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
2000 #endif
2001 
2002 /* CodeObjectCache.proto */
2003 typedef struct {
2004     PyCodeObject* code_object;
2005     int code_line;
2006 } __Pyx_CodeObjectCacheEntry;
2007 struct __Pyx_CodeObjectCache {
2008     int count;
2009     int max_count;
2010     __Pyx_CodeObjectCacheEntry* entries;
2011 };
2012 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2013 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
2014 static PyCodeObject *__pyx_find_code_object(int code_line);
2015 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
2016 
2017 /* AddTraceback.proto */
2018 static void __Pyx_AddTraceback(const char *funcname, int c_line,
2019                                int py_line, const char *filename);
2020 
2021 /* CIntToPy.proto */
2022 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2023 
2024 /* CIntToPy.proto */
2025 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2026 
2027 /* CIntToPy.proto */
2028 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value);
2029 
2030 #if PY_MAJOR_VERSION < 3
2031     static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
2032     static void __Pyx_ReleaseBuffer(Py_buffer *view);
2033 #else
2034     #define __Pyx_GetBuffer PyObject_GetBuffer
2035     #define __Pyx_ReleaseBuffer PyBuffer_Release
2036 #endif
2037 
2038 
2039 /* BufferStructDeclare.proto */
2040 typedef struct {
2041   Py_ssize_t shape, strides, suboffsets;
2042 } __Pyx_Buf_DimInfo;
2043 typedef struct {
2044   size_t refcount;
2045   Py_buffer pybuffer;
2046 } __Pyx_Buffer;
2047 typedef struct {
2048   __Pyx_Buffer *rcbuffer;
2049   char *data;
2050   __Pyx_Buf_DimInfo diminfo[8];
2051 } __Pyx_LocalBuf_ND;
2052 
2053 /* MemviewSliceIsContig.proto */
2054 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
2055 
2056 /* OverlappingSlices.proto */
2057 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2058                                 __Pyx_memviewslice *slice2,
2059                                 int ndim, size_t itemsize);
2060 
2061 /* Capsule.proto */
2062 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
2063 
2064 /* CIntFromPy.proto */
2065 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2066 
2067 /* CIntFromPy.proto */
2068 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2069 
2070 /* CIntFromPy.proto */
2071 static CYTHON_INLINE GDALColorInterp __Pyx_PyInt_As_GDALColorInterp(PyObject *);
2072 
2073 /* CIntFromPy.proto */
2074 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
2075 
2076 /* MemviewSliceCopyTemplate.proto */
2077 static __Pyx_memviewslice
2078 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2079                                  const char *mode, int ndim,
2080                                  size_t sizeof_dtype, int contig_flag,
2081                                  int dtype_is_object);
2082 
2083 /* MemviewSliceInit.proto */
2084 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
2085 #define __Pyx_MEMVIEW_DIRECT   1
2086 #define __Pyx_MEMVIEW_PTR      2
2087 #define __Pyx_MEMVIEW_FULL     4
2088 #define __Pyx_MEMVIEW_CONTIG   8
2089 #define __Pyx_MEMVIEW_STRIDED  16
2090 #define __Pyx_MEMVIEW_FOLLOW   32
2091 #define __Pyx_IS_C_CONTIG 1
2092 #define __Pyx_IS_F_CONTIG 2
2093 static int __Pyx_init_memviewslice(
2094                 struct __pyx_memoryview_obj *memview,
2095                 int ndim,
2096                 __Pyx_memviewslice *memviewslice,
2097                 int memview_is_new_reference);
2098 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
2099     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
2100 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
2101     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
2102 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
2103 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
2104 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
2105 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
2106 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
2107 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
2108 
2109 /* CIntFromPy.proto */
2110 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2111 
2112 /* FetchCommonType.proto */
2113 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
2114 
2115 /* CoroutineBase.proto */
2116 typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
2117 #if CYTHON_USE_EXC_INFO_STACK
2118 #define __Pyx_ExcInfoStruct  _PyErr_StackItem
2119 #else
2120 typedef struct {
2121     PyObject *exc_type;
2122     PyObject *exc_value;
2123     PyObject *exc_traceback;
2124 } __Pyx_ExcInfoStruct;
2125 #endif
2126 typedef struct {
2127     PyObject_HEAD
2128     __pyx_coroutine_body_t body;
2129     PyObject *closure;
2130     __Pyx_ExcInfoStruct gi_exc_state;
2131     PyObject *gi_weakreflist;
2132     PyObject *classobj;
2133     PyObject *yieldfrom;
2134     PyObject *gi_name;
2135     PyObject *gi_qualname;
2136     PyObject *gi_modulename;
2137     PyObject *gi_code;
2138     int resume_label;
2139     char is_running;
2140 } __pyx_CoroutineObject;
2141 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
2142     PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
2143     PyObject *name, PyObject *qualname, PyObject *module_name);
2144 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
2145             __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
2146             PyObject *name, PyObject *qualname, PyObject *module_name);
2147 static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
2148 static int __Pyx_Coroutine_clear(PyObject *self);
2149 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
2150 static PyObject *__Pyx_Coroutine_Close(PyObject *self);
2151 static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
2152 #if CYTHON_USE_EXC_INFO_STACK
2153 #define __Pyx_Coroutine_SwapException(self)
2154 #define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
2155 #else
2156 #define __Pyx_Coroutine_SwapException(self) {\
2157     __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
2158     __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
2159     }
2160 #define __Pyx_Coroutine_ResetAndClearException(self) {\
2161     __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
2162     (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
2163     }
2164 #endif
2165 #if CYTHON_FAST_THREAD_STATE
2166 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
2167     __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
2168 #else
2169 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
2170     __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
2171 #endif
2172 static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
2173 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
2174 
2175 /* PatchModuleWithCoroutine.proto */
2176 static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);
2177 
2178 /* PatchGeneratorABC.proto */
2179 static int __Pyx_patch_abc(void);
2180 
2181 /* Generator.proto */
2182 #define __Pyx_Generator_USED
2183 static PyTypeObject *__pyx_GeneratorType = 0;
2184 #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
2185 #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
2186     __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
2187 static PyObject *__Pyx_Generator_Next(PyObject *self);
2188 static int __pyx_Generator_init(void);
2189 
2190 /* CheckBinaryVersion.proto */
2191 static int __Pyx_check_binary_version(void);
2192 
2193 /* FunctionExport.proto */
2194 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
2195 
2196 /* FunctionImport.proto */
2197 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
2198 
2199 /* InitStrings.proto */
2200 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2201 
2202 static GDALDatasetH __pyx_f_8rasterio_5_base_11DatasetBase_handle(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto*/
2203 static GDALRasterBandH __pyx_f_8rasterio_5_base_11DatasetBase_band(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, int __pyx_v_bidx); /* proto*/
2204 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2205 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2206 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2207 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2208 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
2209 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2210 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2211 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2212 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2213 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2214 
2215 /* Module declarations from 'libc.string' */
2216 
2217 /* Module declarations from 'libc.stdio' */
2218 
2219 /* Module declarations from 'rasterio._err' */
2220 static int (*__pyx_f_8rasterio_4_err_exc_wrap)(int); /*proto*/
2221 static int (*__pyx_f_8rasterio_4_err_exc_wrap_int)(int); /*proto*/
2222 static void *(*__pyx_f_8rasterio_4_err_exc_wrap_pointer)(void *); /*proto*/
2223 
2224 /* Module declarations from 'rasterio._shim' */
2225 static GDALDatasetH (*__pyx_f_8rasterio_5_shim_open_dataset)(PyObject *, int, PyObject *, PyObject *, PyObject *); /*proto*/
2226 static char const *(*__pyx_f_8rasterio_5_shim_osr_get_name)(OGRSpatialReferenceH); /*proto*/
2227 static void (*__pyx_f_8rasterio_5_shim_osr_set_traditional_axis_mapping_strategy)(OGRSpatialReferenceH); /*proto*/
2228 
2229 /* Module declarations from 'cython.view' */
2230 
2231 /* Module declarations from 'cython' */
2232 
2233 /* Module declarations from 'rasterio._base' */
2234 static PyTypeObject *__pyx_ptype_8rasterio_5_base_DatasetBase = 0;
2235 static PyTypeObject *__pyx_ptype_8rasterio_5_base___pyx_scope_struct___mask_flags = 0;
2236 static PyTypeObject *__pyx_ptype_8rasterio_5_base___pyx_scope_struct_1_genexpr = 0;
2237 static PyTypeObject *__pyx_ptype_8rasterio_5_base___pyx_scope_struct_2___get__ = 0;
2238 static PyTypeObject *__pyx_ptype_8rasterio_5_base___pyx_scope_struct_3_genexpr = 0;
2239 static PyTypeObject *__pyx_ptype_8rasterio_5_base___pyx_scope_struct_4___get__ = 0;
2240 static PyTypeObject *__pyx_ptype_8rasterio_5_base___pyx_scope_struct_5_genexpr = 0;
2241 static PyTypeObject *__pyx_ptype_8rasterio_5_base___pyx_scope_struct_6___get__ = 0;
2242 static PyTypeObject *__pyx_ptype_8rasterio_5_base___pyx_scope_struct_7_genexpr = 0;
2243 static PyTypeObject *__pyx_ptype_8rasterio_5_base___pyx_scope_struct_8_block_windows = 0;
2244 static PyTypeObject *__pyx_array_type = 0;
2245 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2246 static PyTypeObject *__pyx_memoryview_type = 0;
2247 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2248 static PyObject *generic = 0;
2249 static PyObject *strided = 0;
2250 static PyObject *indirect = 0;
2251 static PyObject *contiguous = 0;
2252 static PyObject *indirect_contiguous = 0;
2253 static int __pyx_memoryview_thread_locks_used;
2254 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2255 static char const *__pyx_f_8rasterio_5_base_get_driver_name(GDALDriverH); /*proto*/
2256 static OGRSpatialReferenceH __pyx_f_8rasterio_5_base__osr_from_crs(PyObject *); /*proto*/
2257 static PyObject *__pyx_f_8rasterio_5_base__safe_osr_release(OGRSpatialReferenceH); /*proto*/
2258 static PyObject *__pyx_f_8rasterio_5_base__band_dtype(GDALRasterBandH); /*proto*/
2259 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2260 static void *__pyx_align_pointer(void *, size_t); /*proto*/
2261 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2262 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2263 static PyObject *_unellipsify(PyObject *, int); /*proto*/
2264 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2265 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2266 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
2267 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2268 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2269 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2270 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2271 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2272 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2273 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2274 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2275 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2276 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2277 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2278 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2279 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2280 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2281 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2282 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2283 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2284 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2285 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2286 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2287 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2288 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2289 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2290 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2291 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2292 #define __Pyx_MODULE_NAME "rasterio._base"
2293 extern int __pyx_module_is_main_rasterio___base;
2294 int __pyx_module_is_main_rasterio___base = 0;
2295 
2296 /* Implementation of 'rasterio._base' */
2297 static PyObject *__pyx_builtin_TypeError;
2298 static PyObject *__pyx_builtin_ValueError;
2299 static PyObject *__pyx_builtin_range;
2300 static PyObject *__pyx_builtin_AttributeError;
2301 static PyObject *__pyx_builtin_IndexError;
2302 static PyObject *__pyx_builtin_min;
2303 static PyObject *__pyx_builtin_max;
2304 static PyObject *__pyx_builtin_UnicodeDecodeError;
2305 static PyObject *__pyx_builtin_zip;
2306 static PyObject *__pyx_builtin_round;
2307 static PyObject *__pyx_builtin_MemoryError;
2308 static PyObject *__pyx_builtin_enumerate;
2309 static PyObject *__pyx_builtin_Ellipsis;
2310 static PyObject *__pyx_builtin_id;
2311 static const char __pyx_k_3[] = "3";
2312 static const char __pyx_k_O[] = "O";
2313 static const char __pyx_k_c[] = "c";
2314 static const char __pyx_k_i[] = "i";
2315 static const char __pyx_k_j[] = "j";
2316 static const char __pyx_k_n[] = "n";
2317 static const char __pyx_k_r[] = "r";
2318 static const char __pyx_k_x[] = "x";
2319 static const char __pyx_k_y[] = "y";
2320 static const char __pyx_k_z[] = "z";
2321 static const char __pyx_k__2[] = "<";
2322 static const char __pyx_k__3[] = "'>";
2323 static const char __pyx_k__8[] = " ";
2324 static const char __pyx_k__9[] = "_";
2325 static const char __pyx_k_dm[] = "dm";
2326 static const char __pyx_k_id[] = "id";
2327 static const char __pyx_k_ns[] = "ns";
2328 static const char __pyx_k_os[] = "os";
2329 static const char __pyx_k_xs[] = "xs";
2330 static const char __pyx_k_ys[] = "ys";
2331 static const char __pyx_k_zs[] = "zs";
2332 static const char __pyx_k_CRS[] = "CRS";
2333 static const char __pyx_k_Env[] = "Env";
2334 static const char __pyx_k_RPC[] = "RPC";
2335 static const char __pyx_k__11[] = "\"";
2336 static const char __pyx_k__12[] = "";
2337 static const char __pyx_k__18[] = ":";
2338 static const char __pyx_k_col[] = "col";
2339 static const char __pyx_k_crs[] = "crs";
2340 static const char __pyx_k_dst[] = "dst";
2341 static const char __pyx_k_exc[] = "exc";
2342 static const char __pyx_k_get[] = "get";
2343 static const char __pyx_k_iii[] = "iii";
2344 static const char __pyx_k_log[] = "log";
2345 static const char __pyx_k_max[] = "max";
2346 static const char __pyx_k_min[] = "min";
2347 static const char __pyx_k_new[] = "__new__";
2348 static const char __pyx_k_obj[] = "obj";
2349 static const char __pyx_k_osr[] = "osr";
2350 static const char __pyx_k_ovr[] = "ovr";
2351 static const char __pyx_k_pop[] = "pop";
2352 static const char __pyx_k_row[] = "row";
2353 static const char __pyx_k_src[] = "src";
2354 static const char __pyx_k_wkt[] = "wkt";
2355 static const char __pyx_k_zip[] = "zip";
2356 static const char __pyx_k_EPSG[] = "EPSG";
2357 static const char __pyx_k_args[] = "args";
2358 static const char __pyx_k_base[] = "base";
2359 static const char __pyx_k_bidx[] = "bidx";
2360 static const char __pyx_k_crop[] = "crop";
2361 static const char __pyx_k_desc[] = "desc";
2362 static const char __pyx_k_dict[] = "__dict__";
2363 static const char __pyx_k_exit[] = "__exit__";
2364 static const char __pyx_k_info[] = "info";
2365 static const char __pyx_k_init[] = "init";
2366 static const char __pyx_k_int8[] = "int8";
2367 static const char __pyx_k_keys[] = "keys";
2368 static const char __pyx_k_main[] = "__main__";
2369 static const char __pyx_k_math[] = "math";
2370 static const char __pyx_k_meta[] = "meta";
2371 static const char __pyx_k_mode[] = "' mode='";
2372 static const char __pyx_k_name[] = "name";
2373 static const char __pyx_k_ndim[] = "ndim";
2374 static const char __pyx_k_open[] = "open";
2375 static const char __pyx_k_pack[] = "pack";
2376 static const char __pyx_k_path[] = "path";
2377 static const char __pyx_k_send[] = "send";
2378 static const char __pyx_k_size[] = "size";
2379 static const char __pyx_k_sqrt[] = "sqrt";
2380 static const char __pyx_k_step[] = "step";
2381 static const char __pyx_k_stop[] = "stop";
2382 static const char __pyx_k_tags[] = "tags";
2383 static const char __pyx_k_test[] = "__test__";
2384 static const char __pyx_k_type[] = "type";
2385 static const char __pyx_k_warn[] = "warn";
2386 static const char __pyx_k_ASCII[] = "ASCII";
2387 static const char __pyx_k_class[] = "__class__";
2388 static const char __pyx_k_close[] = "close";
2389 static const char __pyx_k_count[] = "count";
2390 static const char __pyx_k_debug[] = "debug";
2391 static const char __pyx_k_dtype[] = "dtype";
2392 static const char __pyx_k_enter[] = "__enter__";
2393 static const char __pyx_k_error[] = "error";
2394 static const char __pyx_k_flags[] = "flags";
2395 static const char __pyx_k_float[] = "float_";
2396 static const char __pyx_k_int16[] = "int16";
2397 static const char __pyx_k_items[] = "items";
2398 static const char __pyx_k_lower[] = "lower";
2399 static const char __pyx_k_major[] = "major";
2400 static const char __pyx_k_minor[] = "minor";
2401 static const char __pyx_k_range[] = "range";
2402 static const char __pyx_k_round[] = "round";
2403 static const char __pyx_k_shape[] = "shape";
2404 static const char __pyx_k_split[] = "split";
2405 static const char __pyx_k_start[] = "start";
2406 static const char __pyx_k_strip[] = "strip";
2407 static const char __pyx_k_throw[] = "throw";
2408 static const char __pyx_k_tiled[] = "tiled";
2409 static const char __pyx_k_uint8[] = "uint8";
2410 static const char __pyx_k_upper[] = "upper";
2411 static const char __pyx_k_utf_8[] = "utf-8";
2412 static const char __pyx_k_value[] = "value";
2413 static const char __pyx_k_width[] = "width";
2414 static const char __pyx_k_Affine[] = "Affine";
2415 static const char __pyx_k_EPSG_2[] = "EPSG:{}";
2416 static const char __pyx_k_NETCDF[] = "NETCDF";
2417 static const char __pyx_k_Window[] = "Window";
2418 static const char __pyx_k_append[] = "append";
2419 static const char __pyx_k_as_vsi[] = "as_vsi";
2420 static const char __pyx_k_bounds[] = "bounds";
2421 static const char __pyx_k_closed[] = "closed";
2422 static const char __pyx_k_decode[] = "decode";
2423 static const char __pyx_k_driver[] = "driver";
2424 static const char __pyx_k_dtypes[] = "dtypes";
2425 static const char __pyx_k_encode[] = "encode";
2426 static const char __pyx_k_format[] = "format";
2427 static const char __pyx_k_height[] = "height";
2428 static const char __pyx_k_import[] = "__import__";
2429 static const char __pyx_k_mode_2[] = "mode";
2430 static const char __pyx_k_name_2[] = "__name__";
2431 static const char __pyx_k_netcdf[] = "netcdf";
2432 static const char __pyx_k_nodata[] = "nodata";
2433 static const char __pyx_k_pickle[] = "pickle";
2434 static const char __pyx_k_reduce[] = "__reduce__";
2435 static const char __pyx_k_res_xs[] = "res_xs";
2436 static const char __pyx_k_res_ys[] = "res_ys";
2437 static const char __pyx_k_res_zs[] = "res_zs";
2438 static const char __pyx_k_struct[] = "struct";
2439 static const char __pyx_k_unpack[] = "unpack";
2440 static const char __pyx_k_update[] = "update";
2441 static const char __pyx_k_window[] = "window";
2442 static const char __pyx_k_Profile[] = "Profile";
2443 static const char __pyx_k_col_off[] = "col_off";
2444 static const char __pyx_k_dataset[] = "dataset";
2445 static const char __pyx_k_dst_crs[] = "dst_crs";
2446 static const char __pyx_k_failure[] = "failure";
2447 static const char __pyx_k_float32[] = "float32";
2448 static const char __pyx_k_float64[] = "float64";
2449 static const char __pyx_k_fortran[] = "fortran";
2450 static const char __pyx_k_genexpr[] = "genexpr";
2451 static const char __pyx_k_get_crs[] = "_get_crs";
2452 static const char __pyx_k_indexes[] = "indexes";
2453 static const char __pyx_k_logging[] = "logging";
2454 static const char __pyx_k_memview[] = "memview";
2455 static const char __pyx_k_replace[] = "replace";
2456 static const char __pyx_k_row_off[] = "row_off";
2457 static const char __pyx_k_set_crs[] = "_set_crs";
2458 static const char __pyx_k_sharing[] = "sharing";
2459 static const char __pyx_k_src_crs[] = "src_crs";
2460 static const char __pyx_k_to_gdal[] = "to_gdal";
2461 static const char __pyx_k_warning[] = "warning";
2462 static const char __pyx_k_windows[] = "windows";
2463 static const char __pyx_k_CRSError[] = "CRSError";
2464 static const char __pyx_k_Ellipsis[] = "Ellipsis";
2465 static const char __pyx_k_compress[] = "compress";
2466 static const char __pyx_k_evaluate[] = "evaluate";
2467 static const char __pyx_k_from_wkt[] = "from_wkt";
2468 static const char __pyx_k_get_gcps[] = "get_gcps";
2469 static const char __pyx_k_get_rpcs[] = "_get_rpcs";
2470 static const char __pyx_k_getstate[] = "__getstate__";
2471 static const char __pyx_k_is_tiled[] = "is_tiled";
2472 static const char __pyx_k_itemsize[] = "itemsize";
2473 static const char __pyx_k_metadata[] = "metadata";
2474 static const char __pyx_k_pyx_type[] = "__pyx_type";
2475 static const char __pyx_k_rasterio[] = "rasterio";
2476 static const char __pyx_k_read_crs[] = "read_crs";
2477 static const char __pyx_k_set_gcps[] = "_set_gcps";
2478 static const char __pyx_k_set_rpcs[] = "_set_rpcs";
2479 static const char __pyx_k_setstate[] = "__setstate__";
2480 static const char __pyx_k_warnings[] = "warnings";
2481 static const char __pyx_k_GDALError[] = "GDALError";
2482 static const char __pyx_k_MaskFlags[] = "MaskFlags";
2483 static const char __pyx_k_TypeError[] = "TypeError";
2484 static const char __pyx_k_complex64[] = "complex64";
2485 static const char __pyx_k_dtype_fwd[] = "dtype_fwd";
2486 static const char __pyx_k_enumerate[] = "enumerate";
2487 static const char __pyx_k_epsg_4326[] = "epsg:4326";
2488 static const char __pyx_k_extension[] = "extension";
2489 static const char __pyx_k_from_gdal[] = "from_gdal";
2490 static const char __pyx_k_getLogger[] = "getLogger";
2491 static const char __pyx_k_pyx_state[] = "__pyx_state";
2492 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2493 static const char __pyx_k_to_string[] = "to_string";
2494 static const char __pyx_k_traceback[] = "traceback";
2495 static const char __pyx_k_transform[] = "transform";
2496 static const char __pyx_k_INTERLEAVE[] = "INTERLEAVE";
2497 static const char __pyx_k_IndexError[] = "IndexError";
2498 static const char __pyx_k_ValueError[] = "ValueError";
2499 static const char __pyx_k_blockxsize[] = "blockxsize";
2500 static const char __pyx_k_blockysize[] = "blockysize";
2501 static const char __pyx_k_complex128[] = "complex128";
2502 static const char __pyx_k_drivername[] = "drivername";
2503 static const char __pyx_k_extensions[] = "extensions";
2504 static const char __pyx_k_interleave[] = "interleave";
2505 static const char __pyx_k_mask_flags[] = "_mask_flags";
2506 static const char __pyx_k_nodatavals[] = "nodatavals";
2507 static const char __pyx_k_parse_path[] = "parse_path";
2508 static const char __pyx_k_pyx_result[] = "__pyx_result";
2509 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2510 static const char __pyx_k_startswith[] = "startswith";
2511 static const char __pyx_k_BoundingBox[] = "BoundingBox";
2512 static const char __pyx_k_COMPRESSION[] = "COMPRESSION";
2513 static const char __pyx_k_ColorInterp[] = "ColorInterp";
2514 static const char __pyx_k_Compression[] = "Compression";
2515 static const char __pyx_k_DCAP_CREATE[] = "DCAP_CREATE";
2516 static const char __pyx_k_DatasetBase[] = "DatasetBase";
2517 static const char __pyx_k_MemoryError[] = "MemoryError";
2518 static const char __pyx_k_PickleError[] = "PickleError";
2519 static const char __pyx_k_SUBDATASETS[] = "SUBDATASETS";
2520 static const char __pyx_k_collections[] = "collections";
2521 static const char __pyx_k_compression[] = "compression";
2522 static const char __pyx_k_defaultdict[] = "defaultdict";
2523 static const char __pyx_k_description[] = "description";
2524 static const char __pyx_k_photometric[] = "photometric";
2525 static const char __pyx_k_transform_2[] = "_transform";
2526 static const char __pyx_k_Interleaving[] = "Interleaving";
2527 static const char __pyx_k_Null_dataset[] = "Null dataset";
2528 static const char __pyx_k_block_shapes[] = "block_shapes";
2529 static const char __pyx_k_c_drivername[] = "c_drivername";
2530 static const char __pyx_k_c_extensions[] = "c_extensions";
2531 static const char __pyx_k_driver_count[] = "driver_count";
2532 static const char __pyx_k_dtype_ranges[] = "dtype_ranges";
2533 static const char __pyx_k_gdal_version[] = "gdal_version";
2534 static const char __pyx_k_interleaving[] = "interleaving";
2535 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2536 static const char __pyx_k_rasterio_crs[] = "rasterio.crs";
2537 static const char __pyx_k_rasterio_env[] = "rasterio.env";
2538 static const char __pyx_k_rasterio_rpc[] = "rasterio.rpc";
2539 static const char __pyx_k_stringsource[] = "stringsource";
2540 static const char __pyx_k_Color_d_d_d_d[] = "Color: (%d, %d, %d, %d)";
2541 static const char __pyx_k_Invalid_CRS_r[] = "Invalid CRS: {!r}";
2542 static const char __pyx_k_block_windows[] = "block_windows";
2543 static const char __pyx_k_complex_int16[] = "complex_int16";
2544 static const char __pyx_k_creation_mode[] = "creation_mode";
2545 static const char __pyx_k_get_transform[] = "get_transform";
2546 static const char __pyx_k_handle_crswkt[] = "_handle_crswkt";
2547 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2548 static const char __pyx_k_rasterio__err[] = "rasterio._err";
2549 static const char __pyx_k_rasterio_path[] = "rasterio.path";
2550 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2551 static const char __pyx_k_set_all_units[] = "_set_all_units";
2552 static const char __pyx_k_AttributeError[] = "AttributeError";
2553 static const char __pyx_k_CPLE_BaseError[] = "CPLE_BaseError";
2554 static const char __pyx_k_Sharing_flag_r[] = "Sharing flag: %r";
2555 static const char __pyx_k_can_create_osr[] = "_can_create_osr";
2556 static const char __pyx_k_get_nodatavals[] = "get_nodatavals";
2557 static const char __pyx_k_rasterio__base[] = "rasterio._base";
2558 static const char __pyx_k_rasterio_enums[] = "rasterio.enums";
2559 static const char __pyx_k_read_transform[] = "read_transform";
2560 static const char __pyx_k_set_all_scales[] = "_set_all_scales";
2561 static const char __pyx_k_set_nodatavals[] = "_set_nodatavals";
2562 static const char __pyx_k_DCAP_CREATECOPY[] = "DCAP_CREATECOPY";
2563 static const char __pyx_k_IMAGE_STRUCTURE[] = "IMAGE_STRUCTURE";
2564 static const char __pyx_k_RasterioIOError[] = "RasterioIOError";
2565 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2566 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2567 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2568 static const char __pyx_k_from_user_input[] = "from_user_input";
2569 static const char __pyx_k_guard_transform[] = "guard_transform";
2570 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2571 static const char __pyx_k_rasterio_coords[] = "rasterio.coords";
2572 static const char __pyx_k_rasterio_errors[] = "rasterio.errors";
2573 static const char __pyx_k_set_all_offsets[] = "_set_all_offsets";
2574 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2575 static const char __pyx_k_write_transform[] = "write_transform";
2576 static const char __pyx_k_DatasetBase_name[] = " DatasetBase name='";
2577 static const char __pyx_k_NULL_color_table[] = "NULL color table";
2578 static const char __pyx_k_RasterBlockError[] = "RasterBlockError";
2579 static const char __pyx_k_has_gcps_or_rpcs[] = "_has_gcps_or_rpcs";
2580 static const char __pyx_k_rasterio_control[] = "rasterio.control";
2581 static const char __pyx_k_tastes_like_gdal[] = "tastes_like_gdal";
2582 static const char __pyx_k_BLOCK_SIZE__0___1[] = "BLOCK_SIZE_{0}_{1}";
2583 static const char __pyx_k_BandOverviewError[] = "BandOverviewError";
2584 static const char __pyx_k_Dataset_is_closed[] = "Dataset is closed: {}";
2585 static const char __pyx_k_PhotometricInterp[] = "PhotometricInterp";
2586 static const char __pyx_k_driver_can_create[] = "driver_can_create";
2587 static const char __pyx_k_driver_extensions[] = "driver_extensions";
2588 static const char __pyx_k_env_ctx_if_needed[] = "env_ctx_if_needed";
2589 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2590 static const char __pyx_k_rasterio_profiles[] = "rasterio.profiles";
2591 static const char __pyx_k_GroundControlPoint[] = "GroundControlPoint";
2592 static const char __pyx_k_SOURCE_COLOR_SPACE[] = "SOURCE_COLOR_SPACE";
2593 static const char __pyx_k_UnicodeDecodeError[] = "UnicodeDecodeError";
2594 static const char __pyx_k_check_gdal_version[] = "check_gdal_version";
2595 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2596 static const char __pyx_k_get_dataset_driver[] = "get_dataset_driver";
2597 static const char __pyx_k_rasterio__base_pyx[] = "rasterio/_base.pyx";
2598 static const char __pyx_k_rasterio_transform[] = "rasterio.transform";
2599 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2600 static const char __pyx_k_read_only_attribute[] = "read-only attribute";
2601 static const char __pyx_k_CPLE_IllegalArgError[] = "CPLE_IllegalArgError";
2602 static const char __pyx_k_CPLE_OpenFailedError[] = "CPLE_OpenFailedError";
2603 static const char __pyx_k_Dataset_r_is_started[] = "Dataset %r is started.";
2604 static const char __pyx_k_No_such_band_index_s[] = "No such band index: {!s}";
2605 static const char __pyx_k_driver_supports_mode[] = "driver_supports_mode";
2606 static const char __pyx_k_set_all_descriptions[] = "_set_all_descriptions";
2607 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2608 static const char __pyx_k_DatasetAttributeError[] = "DatasetAttributeError";
2609 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2610 static const char __pyx_k_CPLE_NotSupportedError[] = "CPLE_NotSupportedError";
2611 static const char __pyx_k_Driver_has_no_metadata[] = "Driver has no metadata";
2612 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2613 static const char __pyx_k_driver_can_create_copy[] = "driver_can_create_copy";
2614 static const char __pyx_k_DriverRegistrationError[] = "DriverRegistrationError";
2615 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2616 static const char __pyx_k_NotGeoreferencedWarning[] = "NotGeoreferencedWarning";
2617 static const char __pyx_k_Numpy_free_base_classes[] = "Numpy-free base classes.";
2618 static const char __pyx_k_PROJ_4_to_be_imported_r[] = "PROJ.4 to be imported: %r";
2619 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2620 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2621 static const char __pyx_k_NULL_color_at_d_skipping[] = "NULL color at %d, skipping";
2622 static const char __pyx_k_raster_driver_extensions[] = "_raster_driver_extensions";
2623 static const char __pyx_k_DatasetBase_block_windows[] = "DatasetBase.block_windows";
2624 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2625 static const char __pyx_k_mask_flags_locals_genexpr[] = "_mask_flags.<locals>.genexpr";
2626 static const char __pyx_k_Failed_to_retrieve_overview[] = "Failed to retrieve overview {}";
2627 static const char __pyx_k_No_such_driver_registered_s[] = "No such driver registered: %s";
2628 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2629 static const char __pyx_k_Can_t_read_closed_raster_file[] = "Can't read closed raster file";
2630 static const char __pyx_k_set_attrs_from_dataset_handle[] = "_set_attrs_from_dataset_handle";
2631 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2632 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2633 static const char __pyx_k_Nodata_success_d_Nodata_value_f[] = "Nodata success: %d, Nodata value: %f";
2634 static const char __pyx_k_A_band_index_must_be_provided_wh[] = "A band index must be provided when band block shapesare inhomogeneous";
2635 static const char __pyx_k_Band_index_bidx_option_needed_fo[] = "Band index (bidx) option needed for overview level";
2636 static const char __pyx_k_Block_i_0_j_1_size_can_t_be_dete[] = "Block i={0}, j={1} size can't be determined";
2637 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2638 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2639 static const char __pyx_k_Can_only_set_color_interpretatio[] = "Can only set color interpretation when dataset is opened in 'r+' or 'w' mode, not '{}'.";
2640 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2641 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2642 static const char __pyx_k_DatasetBase___get___locals_genex[] = "DatasetBase.__get__.<locals>.genexpr";
2643 static const char __pyx_k_Dataset_has_no_geotransform_gcps[] = "Dataset has no geotransform, gcps, or rpcs. The identity matrix be returned.";
2644 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2645 static const char __pyx_k_Failed_to_decode_metadata_item_i[] = "Failed to decode metadata item: i=%r, item=%r";
2646 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
2647 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2648 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2649 static const char __pyx_k_Must_set_color_interpretation_fo[] = "Must set color interpretation for all bands.  Found {} bands but attempting to set color interpretation to: {}";
2650 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2651 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2652 static const char __pyx_k_Unexpected_NULL_spatial_referenc[] = "Unexpected NULL spatial reference";
2653 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2654 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2655 static const char __pyx_k_self__hds_cannot_be_converted_to[] = "self._hds cannot be converted to a Python object for pickling";
2656 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2657 static PyObject *__pyx_kp_u_3;
2658 static PyObject *__pyx_n_s_ASCII;
2659 static PyObject *__pyx_kp_u_A_band_index_must_be_provided_wh;
2660 static PyObject *__pyx_n_s_Affine;
2661 static PyObject *__pyx_n_s_AttributeError;
2662 static PyObject *__pyx_kp_u_BLOCK_SIZE__0___1;
2663 static PyObject *__pyx_n_s_BandOverviewError;
2664 static PyObject *__pyx_kp_u_Band_index_bidx_option_needed_fo;
2665 static PyObject *__pyx_kp_u_Block_i_0_j_1_size_can_t_be_dete;
2666 static PyObject *__pyx_n_s_BoundingBox;
2667 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2668 static PyObject *__pyx_n_u_COMPRESSION;
2669 static PyObject *__pyx_n_s_CPLE_BaseError;
2670 static PyObject *__pyx_n_s_CPLE_IllegalArgError;
2671 static PyObject *__pyx_n_s_CPLE_NotSupportedError;
2672 static PyObject *__pyx_n_s_CPLE_OpenFailedError;
2673 static PyObject *__pyx_n_s_CRS;
2674 static PyObject *__pyx_n_s_CRSError;
2675 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2676 static PyObject *__pyx_kp_u_Can_only_set_color_interpretatio;
2677 static PyObject *__pyx_kp_u_Can_t_read_closed_raster_file;
2678 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2679 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2680 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2681 static PyObject *__pyx_n_s_ColorInterp;
2682 static PyObject *__pyx_kp_u_Color_d_d_d_d;
2683 static PyObject *__pyx_n_s_Compression;
2684 static PyObject *__pyx_n_u_DCAP_CREATE;
2685 static PyObject *__pyx_n_u_DCAP_CREATECOPY;
2686 static PyObject *__pyx_n_s_DatasetAttributeError;
2687 static PyObject *__pyx_n_s_DatasetBase;
2688 static PyObject *__pyx_n_s_DatasetBase___get___locals_genex;
2689 static PyObject *__pyx_n_s_DatasetBase_block_windows;
2690 static PyObject *__pyx_kp_u_DatasetBase_name;
2691 static PyObject *__pyx_kp_u_Dataset_has_no_geotransform_gcps;
2692 static PyObject *__pyx_kp_u_Dataset_is_closed;
2693 static PyObject *__pyx_kp_u_Dataset_r_is_started;
2694 static PyObject *__pyx_n_s_DriverRegistrationError;
2695 static PyObject *__pyx_kp_u_Driver_has_no_metadata;
2696 static PyObject *__pyx_n_u_EPSG;
2697 static PyObject *__pyx_kp_u_EPSG_2;
2698 static PyObject *__pyx_n_s_Ellipsis;
2699 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2700 static PyObject *__pyx_n_s_Env;
2701 static PyObject *__pyx_kp_u_Failed_to_decode_metadata_item_i;
2702 static PyObject *__pyx_kp_u_Failed_to_retrieve_overview;
2703 static PyObject *__pyx_n_s_GDALError;
2704 static PyObject *__pyx_n_s_GroundControlPoint;
2705 static PyObject *__pyx_n_u_IMAGE_STRUCTURE;
2706 static PyObject *__pyx_n_u_INTERLEAVE;
2707 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2708 static PyObject *__pyx_n_s_IndexError;
2709 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2710 static PyObject *__pyx_n_s_Interleaving;
2711 static PyObject *__pyx_kp_u_Invalid_CRS_r;
2712 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2713 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2714 static PyObject *__pyx_n_s_MaskFlags;
2715 static PyObject *__pyx_n_s_MemoryError;
2716 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2717 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2718 static PyObject *__pyx_kp_u_Must_set_color_interpretation_fo;
2719 static PyObject *__pyx_n_u_NETCDF;
2720 static PyObject *__pyx_kp_u_NULL_color_at_d_skipping;
2721 static PyObject *__pyx_kp_u_NULL_color_table;
2722 static PyObject *__pyx_kp_u_No_such_band_index_s;
2723 static PyObject *__pyx_kp_u_No_such_driver_registered_s;
2724 static PyObject *__pyx_kp_u_Nodata_success_d_Nodata_value_f;
2725 static PyObject *__pyx_n_s_NotGeoreferencedWarning;
2726 static PyObject *__pyx_kp_u_Null_dataset;
2727 static PyObject *__pyx_n_b_O;
2728 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2729 static PyObject *__pyx_kp_u_PROJ_4_to_be_imported_r;
2730 static PyObject *__pyx_n_s_PhotometricInterp;
2731 static PyObject *__pyx_n_s_PickleError;
2732 static PyObject *__pyx_n_s_Profile;
2733 static PyObject *__pyx_n_s_RPC;
2734 static PyObject *__pyx_n_u_RPC;
2735 static PyObject *__pyx_n_s_RasterBlockError;
2736 static PyObject *__pyx_n_s_RasterioIOError;
2737 static PyObject *__pyx_n_u_SOURCE_COLOR_SPACE;
2738 static PyObject *__pyx_n_u_SUBDATASETS;
2739 static PyObject *__pyx_kp_u_Sharing_flag_r;
2740 static PyObject *__pyx_n_s_TypeError;
2741 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2742 static PyObject *__pyx_kp_u_Unexpected_NULL_spatial_referenc;
2743 static PyObject *__pyx_n_s_UnicodeDecodeError;
2744 static PyObject *__pyx_n_s_ValueError;
2745 static PyObject *__pyx_n_s_View_MemoryView;
2746 static PyObject *__pyx_n_s_Window;
2747 static PyObject *__pyx_kp_u__11;
2748 static PyObject *__pyx_kp_u__12;
2749 static PyObject *__pyx_kp_u__18;
2750 static PyObject *__pyx_kp_u__2;
2751 static PyObject *__pyx_kp_u__3;
2752 static PyObject *__pyx_kp_u__8;
2753 static PyObject *__pyx_n_u__9;
2754 static PyObject *__pyx_n_s_allocate_buffer;
2755 static PyObject *__pyx_n_s_append;
2756 static PyObject *__pyx_n_s_args;
2757 static PyObject *__pyx_n_s_as_vsi;
2758 static PyObject *__pyx_n_s_base;
2759 static PyObject *__pyx_n_s_bidx;
2760 static PyObject *__pyx_n_s_block_shapes;
2761 static PyObject *__pyx_n_s_block_windows;
2762 static PyObject *__pyx_n_s_blockxsize;
2763 static PyObject *__pyx_n_s_blockysize;
2764 static PyObject *__pyx_n_s_bounds;
2765 static PyObject *__pyx_n_s_c;
2766 static PyObject *__pyx_n_u_c;
2767 static PyObject *__pyx_n_s_c_drivername;
2768 static PyObject *__pyx_n_s_c_extensions;
2769 static PyObject *__pyx_n_s_can_create_osr;
2770 static PyObject *__pyx_n_s_check_gdal_version;
2771 static PyObject *__pyx_n_s_class;
2772 static PyObject *__pyx_n_s_cline_in_traceback;
2773 static PyObject *__pyx_n_s_close;
2774 static PyObject *__pyx_n_s_closed;
2775 static PyObject *__pyx_n_u_closed;
2776 static PyObject *__pyx_n_s_col;
2777 static PyObject *__pyx_n_s_col_off;
2778 static PyObject *__pyx_n_s_collections;
2779 static PyObject *__pyx_n_u_complex128;
2780 static PyObject *__pyx_n_u_complex64;
2781 static PyObject *__pyx_n_u_complex_int16;
2782 static PyObject *__pyx_n_u_compress;
2783 static PyObject *__pyx_n_s_compression;
2784 static PyObject *__pyx_kp_s_contiguous_and_direct;
2785 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2786 static PyObject *__pyx_n_s_count;
2787 static PyObject *__pyx_n_u_count;
2788 static PyObject *__pyx_n_s_creation_mode;
2789 static PyObject *__pyx_n_s_crop;
2790 static PyObject *__pyx_n_s_crs;
2791 static PyObject *__pyx_n_u_crs;
2792 static PyObject *__pyx_n_s_dataset;
2793 static PyObject *__pyx_n_s_debug;
2794 static PyObject *__pyx_n_s_decode;
2795 static PyObject *__pyx_n_s_defaultdict;
2796 static PyObject *__pyx_n_u_desc;
2797 static PyObject *__pyx_n_u_description;
2798 static PyObject *__pyx_n_s_dict;
2799 static PyObject *__pyx_n_s_dm;
2800 static PyObject *__pyx_n_s_driver;
2801 static PyObject *__pyx_n_u_driver;
2802 static PyObject *__pyx_n_s_driver_can_create;
2803 static PyObject *__pyx_n_s_driver_can_create_copy;
2804 static PyObject *__pyx_n_s_driver_count;
2805 static PyObject *__pyx_n_s_driver_extensions;
2806 static PyObject *__pyx_n_s_driver_supports_mode;
2807 static PyObject *__pyx_n_s_drivername;
2808 static PyObject *__pyx_n_s_dst;
2809 static PyObject *__pyx_n_s_dst_crs;
2810 static PyObject *__pyx_n_u_dtype;
2811 static PyObject *__pyx_n_s_dtype_fwd;
2812 static PyObject *__pyx_n_s_dtype_is_object;
2813 static PyObject *__pyx_n_s_dtype_ranges;
2814 static PyObject *__pyx_n_s_dtypes;
2815 static PyObject *__pyx_n_s_encode;
2816 static PyObject *__pyx_n_s_enter;
2817 static PyObject *__pyx_n_s_enumerate;
2818 static PyObject *__pyx_n_s_env_ctx_if_needed;
2819 static PyObject *__pyx_kp_u_epsg_4326;
2820 static PyObject *__pyx_n_s_error;
2821 static PyObject *__pyx_n_s_evaluate;
2822 static PyObject *__pyx_n_s_exc;
2823 static PyObject *__pyx_n_s_exit;
2824 static PyObject *__pyx_n_s_extension;
2825 static PyObject *__pyx_n_s_extensions;
2826 static PyObject *__pyx_n_s_failure;
2827 static PyObject *__pyx_n_s_flags;
2828 static PyObject *__pyx_n_u_float;
2829 static PyObject *__pyx_n_u_float32;
2830 static PyObject *__pyx_n_u_float64;
2831 static PyObject *__pyx_n_s_format;
2832 static PyObject *__pyx_n_s_fortran;
2833 static PyObject *__pyx_n_u_fortran;
2834 static PyObject *__pyx_n_s_from_gdal;
2835 static PyObject *__pyx_n_s_from_user_input;
2836 static PyObject *__pyx_n_s_from_wkt;
2837 static PyObject *__pyx_n_s_gdal_version;
2838 static PyObject *__pyx_n_s_genexpr;
2839 static PyObject *__pyx_n_s_get;
2840 static PyObject *__pyx_n_s_getLogger;
2841 static PyObject *__pyx_n_s_get_crs;
2842 static PyObject *__pyx_n_s_get_dataset_driver;
2843 static PyObject *__pyx_n_s_get_gcps;
2844 static PyObject *__pyx_n_s_get_nodatavals;
2845 static PyObject *__pyx_n_s_get_rpcs;
2846 static PyObject *__pyx_n_s_get_transform;
2847 static PyObject *__pyx_n_s_getstate;
2848 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2849 static PyObject *__pyx_n_s_guard_transform;
2850 static PyObject *__pyx_n_s_handle_crswkt;
2851 static PyObject *__pyx_n_s_has_gcps_or_rpcs;
2852 static PyObject *__pyx_n_s_height;
2853 static PyObject *__pyx_n_u_height;
2854 static PyObject *__pyx_n_s_i;
2855 static PyObject *__pyx_n_s_id;
2856 static PyObject *__pyx_n_s_iii;
2857 static PyObject *__pyx_n_s_import;
2858 static PyObject *__pyx_n_s_indexes;
2859 static PyObject *__pyx_n_s_info;
2860 static PyObject *__pyx_n_u_init;
2861 static PyObject *__pyx_n_u_int16;
2862 static PyObject *__pyx_n_u_int8;
2863 static PyObject *__pyx_n_u_interleave;
2864 static PyObject *__pyx_n_s_interleaving;
2865 static PyObject *__pyx_n_s_is_tiled;
2866 static PyObject *__pyx_n_s_items;
2867 static PyObject *__pyx_n_s_itemsize;
2868 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2869 static PyObject *__pyx_n_s_j;
2870 static PyObject *__pyx_n_s_keys;
2871 static PyObject *__pyx_n_s_log;
2872 static PyObject *__pyx_n_s_logging;
2873 static PyObject *__pyx_n_s_lower;
2874 static PyObject *__pyx_n_s_main;
2875 static PyObject *__pyx_n_s_major;
2876 static PyObject *__pyx_n_s_mask_flags;
2877 static PyObject *__pyx_n_s_mask_flags_locals_genexpr;
2878 static PyObject *__pyx_n_s_math;
2879 static PyObject *__pyx_n_s_max;
2880 static PyObject *__pyx_n_s_memview;
2881 static PyObject *__pyx_n_s_meta;
2882 static PyObject *__pyx_n_s_metadata;
2883 static PyObject *__pyx_n_s_min;
2884 static PyObject *__pyx_n_s_minor;
2885 static PyObject *__pyx_kp_u_mode;
2886 static PyObject *__pyx_n_s_mode_2;
2887 static PyObject *__pyx_n_s_n;
2888 static PyObject *__pyx_n_s_name;
2889 static PyObject *__pyx_n_u_name;
2890 static PyObject *__pyx_n_s_name_2;
2891 static PyObject *__pyx_n_s_ndim;
2892 static PyObject *__pyx_n_u_netcdf;
2893 static PyObject *__pyx_n_s_new;
2894 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2895 static PyObject *__pyx_n_s_nodata;
2896 static PyObject *__pyx_n_u_nodata;
2897 static PyObject *__pyx_n_s_nodatavals;
2898 static PyObject *__pyx_n_s_ns;
2899 static PyObject *__pyx_n_s_obj;
2900 static PyObject *__pyx_n_u_open;
2901 static PyObject *__pyx_n_s_os;
2902 static PyObject *__pyx_n_s_osr;
2903 static PyObject *__pyx_n_s_ovr;
2904 static PyObject *__pyx_n_s_pack;
2905 static PyObject *__pyx_n_s_parse_path;
2906 static PyObject *__pyx_n_s_path;
2907 static PyObject *__pyx_n_s_photometric;
2908 static PyObject *__pyx_n_u_photometric;
2909 static PyObject *__pyx_n_s_pickle;
2910 static PyObject *__pyx_n_s_pop;
2911 static PyObject *__pyx_n_s_pyx_PickleError;
2912 static PyObject *__pyx_n_s_pyx_checksum;
2913 static PyObject *__pyx_n_s_pyx_getbuffer;
2914 static PyObject *__pyx_n_s_pyx_result;
2915 static PyObject *__pyx_n_s_pyx_state;
2916 static PyObject *__pyx_n_s_pyx_type;
2917 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2918 static PyObject *__pyx_n_s_pyx_vtable;
2919 static PyObject *__pyx_n_u_r;
2920 static PyObject *__pyx_n_s_range;
2921 static PyObject *__pyx_n_s_raster_driver_extensions;
2922 static PyObject *__pyx_n_s_rasterio;
2923 static PyObject *__pyx_n_s_rasterio__base;
2924 static PyObject *__pyx_kp_s_rasterio__base_pyx;
2925 static PyObject *__pyx_n_s_rasterio__err;
2926 static PyObject *__pyx_n_s_rasterio_control;
2927 static PyObject *__pyx_n_s_rasterio_coords;
2928 static PyObject *__pyx_n_s_rasterio_crs;
2929 static PyObject *__pyx_n_s_rasterio_enums;
2930 static PyObject *__pyx_n_s_rasterio_env;
2931 static PyObject *__pyx_n_s_rasterio_errors;
2932 static PyObject *__pyx_n_s_rasterio_path;
2933 static PyObject *__pyx_n_s_rasterio_profiles;
2934 static PyObject *__pyx_n_s_rasterio_rpc;
2935 static PyObject *__pyx_n_s_rasterio_transform;
2936 static PyObject *__pyx_n_s_read_crs;
2937 static PyObject *__pyx_kp_u_read_only_attribute;
2938 static PyObject *__pyx_n_s_read_transform;
2939 static PyObject *__pyx_n_s_reduce;
2940 static PyObject *__pyx_n_s_reduce_cython;
2941 static PyObject *__pyx_n_s_reduce_ex;
2942 static PyObject *__pyx_n_s_replace;
2943 static PyObject *__pyx_n_s_res_xs;
2944 static PyObject *__pyx_n_s_res_ys;
2945 static PyObject *__pyx_n_s_res_zs;
2946 static PyObject *__pyx_n_s_round;
2947 static PyObject *__pyx_n_s_row;
2948 static PyObject *__pyx_n_s_row_off;
2949 static PyObject *__pyx_kp_s_self__hds_cannot_be_converted_to;
2950 static PyObject *__pyx_n_s_send;
2951 static PyObject *__pyx_n_s_set_all_descriptions;
2952 static PyObject *__pyx_n_s_set_all_offsets;
2953 static PyObject *__pyx_n_s_set_all_scales;
2954 static PyObject *__pyx_n_s_set_all_units;
2955 static PyObject *__pyx_n_s_set_attrs_from_dataset_handle;
2956 static PyObject *__pyx_n_s_set_crs;
2957 static PyObject *__pyx_n_s_set_gcps;
2958 static PyObject *__pyx_n_s_set_nodatavals;
2959 static PyObject *__pyx_n_s_set_rpcs;
2960 static PyObject *__pyx_n_s_setstate;
2961 static PyObject *__pyx_n_s_setstate_cython;
2962 static PyObject *__pyx_n_s_shape;
2963 static PyObject *__pyx_n_s_sharing;
2964 static PyObject *__pyx_n_s_size;
2965 static PyObject *__pyx_n_s_split;
2966 static PyObject *__pyx_n_s_sqrt;
2967 static PyObject *__pyx_n_s_src;
2968 static PyObject *__pyx_n_s_src_crs;
2969 static PyObject *__pyx_n_s_start;
2970 static PyObject *__pyx_n_s_startswith;
2971 static PyObject *__pyx_n_s_step;
2972 static PyObject *__pyx_n_s_stop;
2973 static PyObject *__pyx_kp_s_strided_and_direct;
2974 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2975 static PyObject *__pyx_kp_s_strided_and_indirect;
2976 static PyObject *__pyx_kp_s_stringsource;
2977 static PyObject *__pyx_n_s_strip;
2978 static PyObject *__pyx_n_s_struct;
2979 static PyObject *__pyx_n_s_tags;
2980 static PyObject *__pyx_n_s_tastes_like_gdal;
2981 static PyObject *__pyx_n_s_test;
2982 static PyObject *__pyx_n_s_throw;
2983 static PyObject *__pyx_n_s_tiled;
2984 static PyObject *__pyx_n_s_to_gdal;
2985 static PyObject *__pyx_n_s_to_string;
2986 static PyObject *__pyx_n_s_traceback;
2987 static PyObject *__pyx_n_s_transform;
2988 static PyObject *__pyx_n_u_transform;
2989 static PyObject *__pyx_n_s_transform_2;
2990 static PyObject *__pyx_n_s_type;
2991 static PyObject *__pyx_n_u_uint8;
2992 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2993 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2994 static PyObject *__pyx_n_s_unpack;
2995 static PyObject *__pyx_n_s_update;
2996 static PyObject *__pyx_n_s_upper;
2997 static PyObject *__pyx_kp_u_utf_8;
2998 static PyObject *__pyx_n_s_value;
2999 static PyObject *__pyx_n_s_warn;
3000 static PyObject *__pyx_n_s_warning;
3001 static PyObject *__pyx_n_s_warnings;
3002 static PyObject *__pyx_n_s_width;
3003 static PyObject *__pyx_n_u_width;
3004 static PyObject *__pyx_n_s_window;
3005 static PyObject *__pyx_n_s_windows;
3006 static PyObject *__pyx_n_s_wkt;
3007 static PyObject *__pyx_n_s_write_transform;
3008 static PyObject *__pyx_n_s_x;
3009 static PyObject *__pyx_n_s_xs;
3010 static PyObject *__pyx_n_s_y;
3011 static PyObject *__pyx_n_s_ys;
3012 static PyObject *__pyx_n_s_z;
3013 static PyObject *__pyx_n_s_zip;
3014 static PyObject *__pyx_n_s_zs;
3015 static PyObject *__pyx_pf_8rasterio_5_base_check_gdal_version(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_major, PyObject *__pyx_v_minor); /* proto */
3016 static PyObject *__pyx_pf_8rasterio_5_base_2gdal_version(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
3017 static PyObject *__pyx_pf_8rasterio_5_base_4get_dataset_driver(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_path); /* proto */
3018 static PyObject *__pyx_pf_8rasterio_5_base_6driver_supports_mode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_drivername, PyObject *__pyx_v_creation_mode); /* proto */
3019 static PyObject *__pyx_pf_8rasterio_5_base_8driver_can_create(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_drivername); /* proto */
3020 static PyObject *__pyx_pf_8rasterio_5_base_10driver_can_create_copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_drivername); /* proto */
3021 static PyObject *__pyx_pf_8rasterio_5_base_12_raster_driver_extensions(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
3022 static int __pyx_pf_8rasterio_5_base_11DatasetBase___init__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_driver, PyObject *__pyx_v_sharing, PyObject *__pyx_v_kwargs); /* proto */
3023 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_2__repr__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3024 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4_set_attrs_from_dataset_handle(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3025 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6_has_band(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx); /* proto */
3026 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_8_handle_crswkt(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_wkt); /* proto */
3027 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_10_has_gcps_or_rpcs(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3028 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_12read_crs(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3029 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_14read_transform(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3030 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_16start(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3031 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_18stop(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3032 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_20close(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3033 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_22__enter__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3034 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_24__exit__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback); /* proto */
3035 static void __pyx_pf_8rasterio_5_base_11DatasetBase_26__dealloc__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3036 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6closed___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3037 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5count___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3038 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_7indexes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3039 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6dtypes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3040 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_12block_shapes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3041 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_28get_nodatavals(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3042 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_10nodatavals___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3043 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_30_set_nodatavals(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
3044 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6nodata___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3045 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6nodata_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3046 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_11_mask_flags_genexpr(PyObject *__pyx_self); /* proto */
3047 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_32_mask_flags(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3048 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_15mask_flag_enums_7__get___genexpr(PyObject *__pyx_self); /* proto */
3049 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_15mask_flag_enums___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3050 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_34_set_crs(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
3051 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_3crs___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3052 static int __pyx_pf_8rasterio_5_base_11DatasetBase_3crs_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3053 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_36_set_all_descriptions(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
3054 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_38_set_all_scales(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
3055 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_40_set_all_offsets(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
3056 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_42_set_all_units(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
3057 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_12descriptions_7__get___genexpr(PyObject *__pyx_self); /* proto */
3058 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_12descriptions___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3059 static int __pyx_pf_8rasterio_5_base_11DatasetBase_12descriptions_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3060 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_44write_transform(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
3061 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_9transform___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3062 static int __pyx_pf_8rasterio_5_base_11DatasetBase_9transform_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3063 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_7offsets___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3064 static int __pyx_pf_8rasterio_5_base_11DatasetBase_7offsets_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3065 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6scales___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3066 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6scales_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3067 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5units_7__get___genexpr(PyObject *__pyx_self); /* proto */
3068 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5units___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3069 static int __pyx_pf_8rasterio_5_base_11DatasetBase_5units_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3070 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_46block_window(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */
3071 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_48block_size(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */
3072 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_50block_windows(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx); /* proto */
3073 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6bounds___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3074 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_3res___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3075 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4meta___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3076 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_11compression___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3077 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_12interleaving___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3078 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_11photometric___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3079 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_8is_tiled___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3080 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_7profile___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3081 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_53lnglat(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3082 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_55_get_crs(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3083 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_57get_transform(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3084 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_11subdatasets___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3085 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_59tag_namespaces(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx); /* proto */
3086 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_61tags(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx, PyObject *__pyx_v_ns); /* proto */
3087 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_63get_tag_item(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_ns, PyObject *__pyx_v_dm, PyObject *__pyx_v_bidx, PyObject *__pyx_v_ovr); /* proto */
3088 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_11colorinterp___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3089 static int __pyx_pf_8rasterio_5_base_11DatasetBase_11colorinterp_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3090 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_65colormap(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx); /* proto */
3091 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_67overviews(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx); /* proto */
3092 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_69checksum(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx, PyObject *__pyx_v_window); /* proto */
3093 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_71get_gcps(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3094 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_73_set_gcps(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_values); /* proto */
3095 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4gcps___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3096 static int __pyx_pf_8rasterio_5_base_11DatasetBase_4gcps_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3097 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_75_get_rpcs(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3098 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_77_set_rpcs(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_values); /* proto */
3099 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4rpcs___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3100 static int __pyx_pf_8rasterio_5_base_11DatasetBase_4rpcs_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3101 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5files___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3102 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4name___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3103 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4mode___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3104 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_7options___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3105 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5width___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3106 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6height___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3107 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5shape___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3108 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6driver___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3109 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6driver_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3110 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6driver_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3111 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6_count___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3112 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6_count_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3113 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6_count_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3114 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_7_dtypes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3115 static int __pyx_pf_8rasterio_5_base_11DatasetBase_7_dtypes_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3116 static int __pyx_pf_8rasterio_5_base_11DatasetBase_7_dtypes_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3117 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_7_closed___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3118 static int __pyx_pf_8rasterio_5_base_11DatasetBase_7_closed_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3119 static int __pyx_pf_8rasterio_5_base_11DatasetBase_7_closed_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3120 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4_crs___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3121 static int __pyx_pf_8rasterio_5_base_11DatasetBase_4_crs_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3122 static int __pyx_pf_8rasterio_5_base_11DatasetBase_4_crs_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3123 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_8_crs_wkt___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3124 static int __pyx_pf_8rasterio_5_base_11DatasetBase_8_crs_wkt_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3125 static int __pyx_pf_8rasterio_5_base_11DatasetBase_8_crs_wkt_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3126 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_10_transform___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3127 static int __pyx_pf_8rasterio_5_base_11DatasetBase_10_transform_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3128 static int __pyx_pf_8rasterio_5_base_11DatasetBase_10_transform_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3129 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_13_block_shapes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3130 static int __pyx_pf_8rasterio_5_base_11DatasetBase_13_block_shapes_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3131 static int __pyx_pf_8rasterio_5_base_11DatasetBase_13_block_shapes_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3132 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_11_nodatavals___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3133 static int __pyx_pf_8rasterio_5_base_11DatasetBase_11_nodatavals_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3134 static int __pyx_pf_8rasterio_5_base_11DatasetBase_11_nodatavals_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3135 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6_units___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3136 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6_units_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3137 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6_units_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3138 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_13_descriptions___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3139 static int __pyx_pf_8rasterio_5_base_11DatasetBase_13_descriptions_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3140 static int __pyx_pf_8rasterio_5_base_11DatasetBase_13_descriptions_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3141 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_7_scales___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3142 static int __pyx_pf_8rasterio_5_base_11DatasetBase_7_scales_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3143 static int __pyx_pf_8rasterio_5_base_11DatasetBase_7_scales_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3144 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_8_offsets___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3145 static int __pyx_pf_8rasterio_5_base_11DatasetBase_8_offsets_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3146 static int __pyx_pf_8rasterio_5_base_11DatasetBase_8_offsets_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3147 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5_read___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3148 static int __pyx_pf_8rasterio_5_base_11DatasetBase_5_read_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3149 static int __pyx_pf_8rasterio_5_base_11DatasetBase_5_read_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3150 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5_gcps___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3151 static int __pyx_pf_8rasterio_5_base_11DatasetBase_5_gcps_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3152 static int __pyx_pf_8rasterio_5_base_11DatasetBase_5_gcps_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3153 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5_rpcs___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3154 static int __pyx_pf_8rasterio_5_base_11DatasetBase_5_rpcs_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3155 static int __pyx_pf_8rasterio_5_base_11DatasetBase_5_rpcs_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3156 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4_env___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3157 static int __pyx_pf_8rasterio_5_base_11DatasetBase_4_env_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3158 static int __pyx_pf_8rasterio_5_base_11DatasetBase_4_env_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3159 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_79__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self); /* proto */
3160 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_81__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
3161 static PyObject *__pyx_pf_8rasterio_5_base_14_transform(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_src_crs, PyObject *__pyx_v_dst_crs, PyObject *__pyx_v_xs, PyObject *__pyx_v_ys, PyObject *__pyx_v_zs); /* proto */
3162 static PyObject *__pyx_pf_8rasterio_5_base_16_can_create_osr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_crs); /* proto */
3163 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
3164 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
3165 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
3166 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
3167 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
3168 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
3169 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
3170 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
3171 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
3172 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
3173 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
3174 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
3175 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
3176 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
3177 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
3178 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3179 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
3180 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
3181 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
3182 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3183 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3184 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3185 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3186 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3187 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3188 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3189 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3190 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3191 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3192 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3193 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3194 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3195 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3196 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3197 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3198 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3199 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
3200 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
3201 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
3202 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
3203 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
3204 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
3205 static PyObject *__pyx_tp_new_8rasterio_5_base_DatasetBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3206 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct___mask_flags(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3207 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3208 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_2___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3209 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3210 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_4___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3211 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3212 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_6___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3213 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_7_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3214 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_8_block_windows(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3215 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3216 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3217 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3218 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3219 static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_pop = {0, &__pyx_n_s_pop, 0, 0, 0};
3220 static PyObject *__pyx_float_2_0;
3221 static PyObject *__pyx_int_0;
3222 static PyObject *__pyx_int_1;
3223 static PyObject *__pyx_int_16;
3224 static PyObject *__pyx_int_184977713;
3225 static PyObject *__pyx_int_neg_1;
3226 static PyObject *__pyx_tuple_;
3227 static PyObject *__pyx_tuple__4;
3228 static PyObject *__pyx_tuple__5;
3229 static PyObject *__pyx_tuple__6;
3230 static PyObject *__pyx_tuple__7;
3231 static PyObject *__pyx_slice__33;
3232 static PyObject *__pyx_tuple__10;
3233 static PyObject *__pyx_tuple__13;
3234 static PyObject *__pyx_tuple__14;
3235 static PyObject *__pyx_tuple__15;
3236 static PyObject *__pyx_tuple__16;
3237 static PyObject *__pyx_tuple__17;
3238 static PyObject *__pyx_tuple__19;
3239 static PyObject *__pyx_tuple__20;
3240 static PyObject *__pyx_tuple__21;
3241 static PyObject *__pyx_tuple__22;
3242 static PyObject *__pyx_tuple__23;
3243 static PyObject *__pyx_tuple__24;
3244 static PyObject *__pyx_tuple__25;
3245 static PyObject *__pyx_tuple__26;
3246 static PyObject *__pyx_tuple__27;
3247 static PyObject *__pyx_tuple__28;
3248 static PyObject *__pyx_tuple__29;
3249 static PyObject *__pyx_tuple__30;
3250 static PyObject *__pyx_tuple__31;
3251 static PyObject *__pyx_tuple__32;
3252 static PyObject *__pyx_tuple__34;
3253 static PyObject *__pyx_tuple__35;
3254 static PyObject *__pyx_tuple__36;
3255 static PyObject *__pyx_tuple__37;
3256 static PyObject *__pyx_tuple__40;
3257 static PyObject *__pyx_tuple__42;
3258 static PyObject *__pyx_tuple__44;
3259 static PyObject *__pyx_tuple__46;
3260 static PyObject *__pyx_tuple__48;
3261 static PyObject *__pyx_tuple__50;
3262 static PyObject *__pyx_tuple__52;
3263 static PyObject *__pyx_tuple__54;
3264 static PyObject *__pyx_tuple__55;
3265 static PyObject *__pyx_tuple__56;
3266 static PyObject *__pyx_tuple__57;
3267 static PyObject *__pyx_tuple__58;
3268 static PyObject *__pyx_tuple__59;
3269 static PyObject *__pyx_codeobj__38;
3270 static PyObject *__pyx_codeobj__39;
3271 static PyObject *__pyx_codeobj__41;
3272 static PyObject *__pyx_codeobj__43;
3273 static PyObject *__pyx_codeobj__45;
3274 static PyObject *__pyx_codeobj__47;
3275 static PyObject *__pyx_codeobj__49;
3276 static PyObject *__pyx_codeobj__51;
3277 static PyObject *__pyx_codeobj__53;
3278 static PyObject *__pyx_codeobj__60;
3279 /* Late includes */
3280 
3281 /* "rasterio/_base.pyx":43
3282  *
3283  *
3284  * def check_gdal_version(major, minor):             # <<<<<<<<<<<<<<
3285  *     """Return True if the major and minor versions match."""
3286  *     return bool(GDALCheckVersion(int(major), int(minor), NULL))
3287  */
3288 
3289 /* Python wrapper */
3290 static PyObject *__pyx_pw_8rasterio_5_base_1check_gdal_version(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3291 static char __pyx_doc_8rasterio_5_base_check_gdal_version[] = "Return True if the major and minor versions match.";
3292 static PyMethodDef __pyx_mdef_8rasterio_5_base_1check_gdal_version = {"check_gdal_version", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8rasterio_5_base_1check_gdal_version, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8rasterio_5_base_check_gdal_version};
__pyx_pw_8rasterio_5_base_1check_gdal_version(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3293 static PyObject *__pyx_pw_8rasterio_5_base_1check_gdal_version(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3294   PyObject *__pyx_v_major = 0;
3295   PyObject *__pyx_v_minor = 0;
3296   int __pyx_lineno = 0;
3297   const char *__pyx_filename = NULL;
3298   int __pyx_clineno = 0;
3299   PyObject *__pyx_r = 0;
3300   __Pyx_RefNannyDeclarations
3301   __Pyx_RefNannySetupContext("check_gdal_version (wrapper)", 0);
3302   {
3303     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_major,&__pyx_n_s_minor,0};
3304     PyObject* values[2] = {0,0};
3305     if (unlikely(__pyx_kwds)) {
3306       Py_ssize_t kw_args;
3307       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3308       switch (pos_args) {
3309         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3310         CYTHON_FALLTHROUGH;
3311         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3312         CYTHON_FALLTHROUGH;
3313         case  0: break;
3314         default: goto __pyx_L5_argtuple_error;
3315       }
3316       kw_args = PyDict_Size(__pyx_kwds);
3317       switch (pos_args) {
3318         case  0:
3319         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_major)) != 0)) kw_args--;
3320         else goto __pyx_L5_argtuple_error;
3321         CYTHON_FALLTHROUGH;
3322         case  1:
3323         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_minor)) != 0)) kw_args--;
3324         else {
3325           __Pyx_RaiseArgtupleInvalid("check_gdal_version", 1, 2, 2, 1); __PYX_ERR(0, 43, __pyx_L3_error)
3326         }
3327       }
3328       if (unlikely(kw_args > 0)) {
3329         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "check_gdal_version") < 0)) __PYX_ERR(0, 43, __pyx_L3_error)
3330       }
3331     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3332       goto __pyx_L5_argtuple_error;
3333     } else {
3334       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3335       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3336     }
3337     __pyx_v_major = values[0];
3338     __pyx_v_minor = values[1];
3339   }
3340   goto __pyx_L4_argument_unpacking_done;
3341   __pyx_L5_argtuple_error:;
3342   __Pyx_RaiseArgtupleInvalid("check_gdal_version", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 43, __pyx_L3_error)
3343   __pyx_L3_error:;
3344   __Pyx_AddTraceback("rasterio._base.check_gdal_version", __pyx_clineno, __pyx_lineno, __pyx_filename);
3345   __Pyx_RefNannyFinishContext();
3346   return NULL;
3347   __pyx_L4_argument_unpacking_done:;
3348   __pyx_r = __pyx_pf_8rasterio_5_base_check_gdal_version(__pyx_self, __pyx_v_major, __pyx_v_minor);
3349 
3350   /* function exit code */
3351   __Pyx_RefNannyFinishContext();
3352   return __pyx_r;
3353 }
3354 
__pyx_pf_8rasterio_5_base_check_gdal_version(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_major,PyObject * __pyx_v_minor)3355 static PyObject *__pyx_pf_8rasterio_5_base_check_gdal_version(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_major, PyObject *__pyx_v_minor) {
3356   PyObject *__pyx_r = NULL;
3357   __Pyx_RefNannyDeclarations
3358   PyObject *__pyx_t_1 = NULL;
3359   int __pyx_t_2;
3360   int __pyx_t_3;
3361   int __pyx_t_4;
3362   int __pyx_lineno = 0;
3363   const char *__pyx_filename = NULL;
3364   int __pyx_clineno = 0;
3365   __Pyx_RefNannySetupContext("check_gdal_version", 0);
3366 
3367   /* "rasterio/_base.pyx":45
3368  * def check_gdal_version(major, minor):
3369  *     """Return True if the major and minor versions match."""
3370  *     return bool(GDALCheckVersion(int(major), int(minor), NULL))             # <<<<<<<<<<<<<<
3371  *
3372  *
3373  */
3374   __Pyx_XDECREF(__pyx_r);
3375   __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_major); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
3376   __Pyx_GOTREF(__pyx_t_1);
3377   __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L1_error)
3378   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3379   __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_minor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
3380   __Pyx_GOTREF(__pyx_t_1);
3381   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L1_error)
3382   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3383   __pyx_t_1 = __Pyx_PyInt_From_int(GDALCheckVersion(__pyx_t_2, __pyx_t_3, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
3384   __Pyx_GOTREF(__pyx_t_1);
3385   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 45, __pyx_L1_error)
3386   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3387   __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_4))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
3388   __Pyx_GOTREF(__pyx_t_1);
3389   __pyx_r = __pyx_t_1;
3390   __pyx_t_1 = 0;
3391   goto __pyx_L0;
3392 
3393   /* "rasterio/_base.pyx":43
3394  *
3395  *
3396  * def check_gdal_version(major, minor):             # <<<<<<<<<<<<<<
3397  *     """Return True if the major and minor versions match."""
3398  *     return bool(GDALCheckVersion(int(major), int(minor), NULL))
3399  */
3400 
3401   /* function exit code */
3402   __pyx_L1_error:;
3403   __Pyx_XDECREF(__pyx_t_1);
3404   __Pyx_AddTraceback("rasterio._base.check_gdal_version", __pyx_clineno, __pyx_lineno, __pyx_filename);
3405   __pyx_r = NULL;
3406   __pyx_L0:;
3407   __Pyx_XGIVEREF(__pyx_r);
3408   __Pyx_RefNannyFinishContext();
3409   return __pyx_r;
3410 }
3411 
3412 /* "rasterio/_base.pyx":48
3413  *
3414  *
3415  * def gdal_version():             # <<<<<<<<<<<<<<
3416  *     """Return the version as a major.minor.patchlevel string."""
3417  *     return GDALVersionInfo("RELEASE_NAME")
3418  */
3419 
3420 /* Python wrapper */
3421 static PyObject *__pyx_pw_8rasterio_5_base_3gdal_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3422 static char __pyx_doc_8rasterio_5_base_2gdal_version[] = "Return the version as a major.minor.patchlevel string.";
3423 static PyMethodDef __pyx_mdef_8rasterio_5_base_3gdal_version = {"gdal_version", (PyCFunction)__pyx_pw_8rasterio_5_base_3gdal_version, METH_NOARGS, __pyx_doc_8rasterio_5_base_2gdal_version};
__pyx_pw_8rasterio_5_base_3gdal_version(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)3424 static PyObject *__pyx_pw_8rasterio_5_base_3gdal_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
3425   PyObject *__pyx_r = 0;
3426   __Pyx_RefNannyDeclarations
3427   __Pyx_RefNannySetupContext("gdal_version (wrapper)", 0);
3428   __pyx_r = __pyx_pf_8rasterio_5_base_2gdal_version(__pyx_self);
3429 
3430   /* function exit code */
3431   __Pyx_RefNannyFinishContext();
3432   return __pyx_r;
3433 }
3434 
__pyx_pf_8rasterio_5_base_2gdal_version(CYTHON_UNUSED PyObject * __pyx_self)3435 static PyObject *__pyx_pf_8rasterio_5_base_2gdal_version(CYTHON_UNUSED PyObject *__pyx_self) {
3436   PyObject *__pyx_r = NULL;
3437   __Pyx_RefNannyDeclarations
3438   PyObject *__pyx_t_1 = NULL;
3439   int __pyx_lineno = 0;
3440   const char *__pyx_filename = NULL;
3441   int __pyx_clineno = 0;
3442   __Pyx_RefNannySetupContext("gdal_version", 0);
3443 
3444   /* "rasterio/_base.pyx":50
3445  * def gdal_version():
3446  *     """Return the version as a major.minor.patchlevel string."""
3447  *     return GDALVersionInfo("RELEASE_NAME")             # <<<<<<<<<<<<<<
3448  *
3449  *
3450  */
3451   __Pyx_XDECREF(__pyx_r);
3452   __pyx_t_1 = __Pyx_PyUnicode_FromString(GDALVersionInfo(((char const *)"RELEASE_NAME"))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
3453   __Pyx_GOTREF(__pyx_t_1);
3454   __pyx_r = __pyx_t_1;
3455   __pyx_t_1 = 0;
3456   goto __pyx_L0;
3457 
3458   /* "rasterio/_base.pyx":48
3459  *
3460  *
3461  * def gdal_version():             # <<<<<<<<<<<<<<
3462  *     """Return the version as a major.minor.patchlevel string."""
3463  *     return GDALVersionInfo("RELEASE_NAME")
3464  */
3465 
3466   /* function exit code */
3467   __pyx_L1_error:;
3468   __Pyx_XDECREF(__pyx_t_1);
3469   __Pyx_AddTraceback("rasterio._base.gdal_version", __pyx_clineno, __pyx_lineno, __pyx_filename);
3470   __pyx_r = NULL;
3471   __pyx_L0:;
3472   __Pyx_XGIVEREF(__pyx_r);
3473   __Pyx_RefNannyFinishContext();
3474   return __pyx_r;
3475 }
3476 
3477 /* "rasterio/_base.pyx":53
3478  *
3479  *
3480  * cdef const char *get_driver_name(GDALDriverH driver):             # <<<<<<<<<<<<<<
3481  *     """Return Python name of the driver"""
3482  *     return GDALGetDriverShortName(driver)
3483  */
3484 
__pyx_f_8rasterio_5_base_get_driver_name(GDALDriverH __pyx_v_driver)3485 static char const *__pyx_f_8rasterio_5_base_get_driver_name(GDALDriverH __pyx_v_driver) {
3486   char const *__pyx_r;
3487   __Pyx_RefNannyDeclarations
3488   __Pyx_RefNannySetupContext("get_driver_name", 0);
3489 
3490   /* "rasterio/_base.pyx":55
3491  * cdef const char *get_driver_name(GDALDriverH driver):
3492  *     """Return Python name of the driver"""
3493  *     return GDALGetDriverShortName(driver)             # <<<<<<<<<<<<<<
3494  *
3495  *
3496  */
3497   __pyx_r = GDALGetDriverShortName(__pyx_v_driver);
3498   goto __pyx_L0;
3499 
3500   /* "rasterio/_base.pyx":53
3501  *
3502  *
3503  * cdef const char *get_driver_name(GDALDriverH driver):             # <<<<<<<<<<<<<<
3504  *     """Return Python name of the driver"""
3505  *     return GDALGetDriverShortName(driver)
3506  */
3507 
3508   /* function exit code */
3509   __pyx_L0:;
3510   __Pyx_RefNannyFinishContext();
3511   return __pyx_r;
3512 }
3513 
3514 /* "rasterio/_base.pyx":58
3515  *
3516  *
3517  * def get_dataset_driver(path):             # <<<<<<<<<<<<<<
3518  *     """Return the name of the driver that opens a dataset
3519  *
3520  */
3521 
3522 /* Python wrapper */
3523 static PyObject *__pyx_pw_8rasterio_5_base_5get_dataset_driver(PyObject *__pyx_self, PyObject *__pyx_v_path); /*proto*/
3524 static char __pyx_doc_8rasterio_5_base_4get_dataset_driver[] = "Return the name of the driver that opens a dataset\n\n    Parameters\n    ----------\n    path : rasterio.path.Path or str\n        A remote or local dataset path.\n\n    Returns\n    -------\n    str\n    ";
3525 static PyMethodDef __pyx_mdef_8rasterio_5_base_5get_dataset_driver = {"get_dataset_driver", (PyCFunction)__pyx_pw_8rasterio_5_base_5get_dataset_driver, METH_O, __pyx_doc_8rasterio_5_base_4get_dataset_driver};
__pyx_pw_8rasterio_5_base_5get_dataset_driver(PyObject * __pyx_self,PyObject * __pyx_v_path)3526 static PyObject *__pyx_pw_8rasterio_5_base_5get_dataset_driver(PyObject *__pyx_self, PyObject *__pyx_v_path) {
3527   PyObject *__pyx_r = 0;
3528   __Pyx_RefNannyDeclarations
3529   __Pyx_RefNannySetupContext("get_dataset_driver (wrapper)", 0);
3530   __pyx_r = __pyx_pf_8rasterio_5_base_4get_dataset_driver(__pyx_self, ((PyObject *)__pyx_v_path));
3531 
3532   /* function exit code */
3533   __Pyx_RefNannyFinishContext();
3534   return __pyx_r;
3535 }
3536 
__pyx_pf_8rasterio_5_base_4get_dataset_driver(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_path)3537 static PyObject *__pyx_pf_8rasterio_5_base_4get_dataset_driver(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_path) {
3538   GDALDatasetH __pyx_v_dataset;
3539   GDALDriverH __pyx_v_driver;
3540   char const *__pyx_v_drivername;
3541   PyObject *__pyx_v_exc = NULL;
3542   PyObject *__pyx_r = NULL;
3543   __Pyx_RefNannyDeclarations
3544   PyObject *__pyx_t_1 = NULL;
3545   PyObject *__pyx_t_2 = NULL;
3546   PyObject *__pyx_t_3 = NULL;
3547   PyObject *__pyx_t_4 = NULL;
3548   PyObject *__pyx_t_5 = NULL;
3549   PyObject *__pyx_t_6 = NULL;
3550   PyObject *__pyx_t_7 = NULL;
3551   char const *__pyx_t_8;
3552   void *__pyx_t_9;
3553   int __pyx_t_10;
3554   PyObject *__pyx_t_11 = NULL;
3555   int __pyx_t_12;
3556   char const *__pyx_t_13;
3557   PyObject *__pyx_t_14 = NULL;
3558   PyObject *__pyx_t_15 = NULL;
3559   PyObject *__pyx_t_16 = NULL;
3560   PyObject *__pyx_t_17 = NULL;
3561   PyObject *__pyx_t_18 = NULL;
3562   PyObject *__pyx_t_19 = NULL;
3563   int __pyx_t_20;
3564   char const *__pyx_t_21;
3565   int __pyx_lineno = 0;
3566   const char *__pyx_filename = NULL;
3567   int __pyx_clineno = 0;
3568   __Pyx_RefNannySetupContext("get_dataset_driver", 0);
3569   __Pyx_INCREF(__pyx_v_path);
3570 
3571   /* "rasterio/_base.pyx":70
3572  *     str
3573  *     """
3574  *     cdef GDALDatasetH dataset = NULL             # <<<<<<<<<<<<<<
3575  *     cdef GDALDriverH driver = NULL
3576  *
3577  */
3578   __pyx_v_dataset = NULL;
3579 
3580   /* "rasterio/_base.pyx":71
3581  *     """
3582  *     cdef GDALDatasetH dataset = NULL
3583  *     cdef GDALDriverH driver = NULL             # <<<<<<<<<<<<<<
3584  *
3585  *     path = parse_path(path).as_vsi()
3586  */
3587   __pyx_v_driver = NULL;
3588 
3589   /* "rasterio/_base.pyx":73
3590  *     cdef GDALDriverH driver = NULL
3591  *
3592  *     path = parse_path(path).as_vsi()             # <<<<<<<<<<<<<<
3593  *     path = path.encode('utf-8')
3594  *
3595  */
3596   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_parse_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error)
3597   __Pyx_GOTREF(__pyx_t_3);
3598   __pyx_t_4 = NULL;
3599   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
3600     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
3601     if (likely(__pyx_t_4)) {
3602       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3603       __Pyx_INCREF(__pyx_t_4);
3604       __Pyx_INCREF(function);
3605       __Pyx_DECREF_SET(__pyx_t_3, function);
3606     }
3607   }
3608   __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_path) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_path);
3609   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3610   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error)
3611   __Pyx_GOTREF(__pyx_t_2);
3612   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3613   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_as_vsi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error)
3614   __Pyx_GOTREF(__pyx_t_3);
3615   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3616   __pyx_t_2 = NULL;
3617   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
3618     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
3619     if (likely(__pyx_t_2)) {
3620       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3621       __Pyx_INCREF(__pyx_t_2);
3622       __Pyx_INCREF(function);
3623       __Pyx_DECREF_SET(__pyx_t_3, function);
3624     }
3625   }
3626   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
3627   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3628   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error)
3629   __Pyx_GOTREF(__pyx_t_1);
3630   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3631   __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
3632   __pyx_t_1 = 0;
3633 
3634   /* "rasterio/_base.pyx":74
3635  *
3636  *     path = parse_path(path).as_vsi()
3637  *     path = path.encode('utf-8')             # <<<<<<<<<<<<<<
3638  *
3639  *     try:
3640  */
3641   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_path, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
3642   __Pyx_GOTREF(__pyx_t_3);
3643   __pyx_t_2 = NULL;
3644   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
3645     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
3646     if (likely(__pyx_t_2)) {
3647       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3648       __Pyx_INCREF(__pyx_t_2);
3649       __Pyx_INCREF(function);
3650       __Pyx_DECREF_SET(__pyx_t_3, function);
3651     }
3652   }
3653   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_utf_8);
3654   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3655   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
3656   __Pyx_GOTREF(__pyx_t_1);
3657   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3658   __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
3659   __pyx_t_1 = 0;
3660 
3661   /* "rasterio/_base.pyx":76
3662  *     path = path.encode('utf-8')
3663  *
3664  *     try:             # <<<<<<<<<<<<<<
3665  *         dataset = exc_wrap_pointer(GDALOpen(<const char *>path, <GDALAccess>0))
3666  *         driver = GDALGetDatasetDriver(dataset)
3667  */
3668   /*try:*/ {
3669     {
3670       __Pyx_PyThreadState_declare
3671       __Pyx_PyThreadState_assign
3672       __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
3673       __Pyx_XGOTREF(__pyx_t_5);
3674       __Pyx_XGOTREF(__pyx_t_6);
3675       __Pyx_XGOTREF(__pyx_t_7);
3676       /*try:*/ {
3677 
3678         /* "rasterio/_base.pyx":77
3679  *
3680  *     try:
3681  *         dataset = exc_wrap_pointer(GDALOpen(<const char *>path, <GDALAccess>0))             # <<<<<<<<<<<<<<
3682  *         driver = GDALGetDatasetDriver(dataset)
3683  *         drivername = get_driver_name(driver)
3684  */
3685         __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_path); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L6_error)
3686         __pyx_t_9 = __pyx_f_8rasterio_4_err_exc_wrap_pointer(GDALOpen(((char const *)__pyx_t_8), ((GDALAccess)0))); if (unlikely(__pyx_t_9 == ((void *)NULL))) __PYX_ERR(0, 77, __pyx_L6_error)
3687         __pyx_v_dataset = __pyx_t_9;
3688 
3689         /* "rasterio/_base.pyx":78
3690  *     try:
3691  *         dataset = exc_wrap_pointer(GDALOpen(<const char *>path, <GDALAccess>0))
3692  *         driver = GDALGetDatasetDriver(dataset)             # <<<<<<<<<<<<<<
3693  *         drivername = get_driver_name(driver)
3694  *
3695  */
3696         __pyx_v_driver = GDALGetDatasetDriver(__pyx_v_dataset);
3697 
3698         /* "rasterio/_base.pyx":79
3699  *         dataset = exc_wrap_pointer(GDALOpen(<const char *>path, <GDALAccess>0))
3700  *         driver = GDALGetDatasetDriver(dataset)
3701  *         drivername = get_driver_name(driver)             # <<<<<<<<<<<<<<
3702  *
3703  *     except CPLE_OpenFailedError as exc:
3704  */
3705         __pyx_v_drivername = __pyx_f_8rasterio_5_base_get_driver_name(__pyx_v_driver);
3706 
3707         /* "rasterio/_base.pyx":76
3708  *     path = path.encode('utf-8')
3709  *
3710  *     try:             # <<<<<<<<<<<<<<
3711  *         dataset = exc_wrap_pointer(GDALOpen(<const char *>path, <GDALAccess>0))
3712  *         driver = GDALGetDatasetDriver(dataset)
3713  */
3714       }
3715       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3716       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3717       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3718       goto __pyx_L11_try_end;
3719       __pyx_L6_error:;
3720       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3721       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3722       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3723       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3724 
3725       /* "rasterio/_base.pyx":81
3726  *         drivername = get_driver_name(driver)
3727  *
3728  *     except CPLE_OpenFailedError as exc:             # <<<<<<<<<<<<<<
3729  *         raise TypeError(str(exc))
3730  *
3731  */
3732       __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_3, &__pyx_t_2);
3733       __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CPLE_OpenFailedError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L8_except_error)
3734       __Pyx_GOTREF(__pyx_t_4);
3735       __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_4);
3736       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3737       __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_2);
3738       __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0;
3739       if (__pyx_t_10) {
3740         __Pyx_AddTraceback("rasterio._base.get_dataset_driver", __pyx_clineno, __pyx_lineno, __pyx_filename);
3741         if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 81, __pyx_L8_except_error)
3742         __Pyx_GOTREF(__pyx_t_2);
3743         __Pyx_GOTREF(__pyx_t_3);
3744         __Pyx_GOTREF(__pyx_t_1);
3745         __Pyx_INCREF(__pyx_t_3);
3746         __pyx_v_exc = __pyx_t_3;
3747         /*try:*/ {
3748 
3749           /* "rasterio/_base.pyx":82
3750  *
3751  *     except CPLE_OpenFailedError as exc:
3752  *         raise TypeError(str(exc))             # <<<<<<<<<<<<<<
3753  *
3754  *     finally:
3755  */
3756           __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_exc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L17_error)
3757           __Pyx_GOTREF(__pyx_t_4);
3758           __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 82, __pyx_L17_error)
3759           __Pyx_GOTREF(__pyx_t_11);
3760           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3761           __Pyx_Raise(__pyx_t_11, 0, 0, 0);
3762           __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3763           __PYX_ERR(0, 82, __pyx_L17_error)
3764         }
3765 
3766         /* "rasterio/_base.pyx":81
3767  *         drivername = get_driver_name(driver)
3768  *
3769  *     except CPLE_OpenFailedError as exc:             # <<<<<<<<<<<<<<
3770  *         raise TypeError(str(exc))
3771  *
3772  */
3773         /*finally:*/ {
3774           __pyx_L17_error:;
3775           /*exception exit:*/{
3776             __Pyx_PyThreadState_declare
3777             __Pyx_PyThreadState_assign
3778             __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
3779             __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
3780             __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3781             if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
3782             if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
3783             __Pyx_XGOTREF(__pyx_t_14);
3784             __Pyx_XGOTREF(__pyx_t_15);
3785             __Pyx_XGOTREF(__pyx_t_16);
3786             __Pyx_XGOTREF(__pyx_t_17);
3787             __Pyx_XGOTREF(__pyx_t_18);
3788             __Pyx_XGOTREF(__pyx_t_19);
3789             __pyx_t_10 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename;
3790             {
3791               __Pyx_DECREF(__pyx_v_exc);
3792               __pyx_v_exc = NULL;
3793             }
3794             if (PY_MAJOR_VERSION >= 3) {
3795               __Pyx_XGIVEREF(__pyx_t_17);
3796               __Pyx_XGIVEREF(__pyx_t_18);
3797               __Pyx_XGIVEREF(__pyx_t_19);
3798               __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
3799             }
3800             __Pyx_XGIVEREF(__pyx_t_14);
3801             __Pyx_XGIVEREF(__pyx_t_15);
3802             __Pyx_XGIVEREF(__pyx_t_16);
3803             __Pyx_ErrRestore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
3804             __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
3805             __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13;
3806             goto __pyx_L8_except_error;
3807           }
3808         }
3809       }
3810       goto __pyx_L8_except_error;
3811       __pyx_L8_except_error:;
3812 
3813       /* "rasterio/_base.pyx":76
3814  *     path = path.encode('utf-8')
3815  *
3816  *     try:             # <<<<<<<<<<<<<<
3817  *         dataset = exc_wrap_pointer(GDALOpen(<const char *>path, <GDALAccess>0))
3818  *         driver = GDALGetDatasetDriver(dataset)
3819  */
3820       __Pyx_XGIVEREF(__pyx_t_5);
3821       __Pyx_XGIVEREF(__pyx_t_6);
3822       __Pyx_XGIVEREF(__pyx_t_7);
3823       __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
3824       goto __pyx_L4_error;
3825       __pyx_L11_try_end:;
3826     }
3827   }
3828 
3829   /* "rasterio/_base.pyx":85
3830  *
3831  *     finally:
3832  *         if dataset != NULL:             # <<<<<<<<<<<<<<
3833  *             GDALClose(dataset)
3834  *
3835  */
3836   /*finally:*/ {
3837     /*normal exit:*/{
3838       __pyx_t_20 = ((__pyx_v_dataset != NULL) != 0);
3839       if (__pyx_t_20) {
3840 
3841         /* "rasterio/_base.pyx":86
3842  *     finally:
3843  *         if dataset != NULL:
3844  *             GDALClose(dataset)             # <<<<<<<<<<<<<<
3845  *
3846  *     return drivername
3847  */
3848         GDALClose(__pyx_v_dataset);
3849 
3850         /* "rasterio/_base.pyx":85
3851  *
3852  *     finally:
3853  *         if dataset != NULL:             # <<<<<<<<<<<<<<
3854  *             GDALClose(dataset)
3855  *
3856  */
3857       }
3858       goto __pyx_L5;
3859     }
3860     __pyx_L4_error:;
3861     /*exception exit:*/{
3862       __Pyx_PyThreadState_declare
3863       __Pyx_PyThreadState_assign
3864       __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0; __pyx_t_17 = 0;
3865       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3866       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
3867       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3868       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3869       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3870       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_19, &__pyx_t_18, &__pyx_t_17);
3871       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
3872       __Pyx_XGOTREF(__pyx_t_7);
3873       __Pyx_XGOTREF(__pyx_t_6);
3874       __Pyx_XGOTREF(__pyx_t_5);
3875       __Pyx_XGOTREF(__pyx_t_19);
3876       __Pyx_XGOTREF(__pyx_t_18);
3877       __Pyx_XGOTREF(__pyx_t_17);
3878       __pyx_t_12 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_21 = __pyx_filename;
3879       {
3880         __pyx_t_20 = ((__pyx_v_dataset != NULL) != 0);
3881         if (__pyx_t_20) {
3882 
3883           /* "rasterio/_base.pyx":86
3884  *     finally:
3885  *         if dataset != NULL:
3886  *             GDALClose(dataset)             # <<<<<<<<<<<<<<
3887  *
3888  *     return drivername
3889  */
3890           GDALClose(__pyx_v_dataset);
3891 
3892           /* "rasterio/_base.pyx":85
3893  *
3894  *     finally:
3895  *         if dataset != NULL:             # <<<<<<<<<<<<<<
3896  *             GDALClose(dataset)
3897  *
3898  */
3899         }
3900       }
3901       if (PY_MAJOR_VERSION >= 3) {
3902         __Pyx_XGIVEREF(__pyx_t_19);
3903         __Pyx_XGIVEREF(__pyx_t_18);
3904         __Pyx_XGIVEREF(__pyx_t_17);
3905         __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_18, __pyx_t_17);
3906       }
3907       __Pyx_XGIVEREF(__pyx_t_7);
3908       __Pyx_XGIVEREF(__pyx_t_6);
3909       __Pyx_XGIVEREF(__pyx_t_5);
3910       __Pyx_ErrRestore(__pyx_t_7, __pyx_t_6, __pyx_t_5);
3911       __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0; __pyx_t_17 = 0;
3912       __pyx_lineno = __pyx_t_12; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_21;
3913       goto __pyx_L1_error;
3914     }
3915     __pyx_L5:;
3916   }
3917 
3918   /* "rasterio/_base.pyx":88
3919  *             GDALClose(dataset)
3920  *
3921  *     return drivername             # <<<<<<<<<<<<<<
3922  *
3923  *
3924  */
3925   __Pyx_XDECREF(__pyx_r);
3926   __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_drivername); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
3927   __Pyx_GOTREF(__pyx_t_1);
3928   __pyx_r = __pyx_t_1;
3929   __pyx_t_1 = 0;
3930   goto __pyx_L0;
3931 
3932   /* "rasterio/_base.pyx":58
3933  *
3934  *
3935  * def get_dataset_driver(path):             # <<<<<<<<<<<<<<
3936  *     """Return the name of the driver that opens a dataset
3937  *
3938  */
3939 
3940   /* function exit code */
3941   __pyx_L1_error:;
3942   __Pyx_XDECREF(__pyx_t_1);
3943   __Pyx_XDECREF(__pyx_t_2);
3944   __Pyx_XDECREF(__pyx_t_3);
3945   __Pyx_XDECREF(__pyx_t_4);
3946   __Pyx_XDECREF(__pyx_t_11);
3947   __Pyx_AddTraceback("rasterio._base.get_dataset_driver", __pyx_clineno, __pyx_lineno, __pyx_filename);
3948   __pyx_r = NULL;
3949   __pyx_L0:;
3950   __Pyx_XDECREF(__pyx_v_exc);
3951   __Pyx_XDECREF(__pyx_v_path);
3952   __Pyx_XGIVEREF(__pyx_r);
3953   __Pyx_RefNannyFinishContext();
3954   return __pyx_r;
3955 }
3956 
3957 /* "rasterio/_base.pyx":91
3958  *
3959  *
3960  * def driver_supports_mode(drivername, creation_mode):             # <<<<<<<<<<<<<<
3961  *     """Return True if the driver supports the mode"""
3962  *     cdef GDALDriverH driver = NULL
3963  */
3964 
3965 /* Python wrapper */
3966 static PyObject *__pyx_pw_8rasterio_5_base_7driver_supports_mode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3967 static char __pyx_doc_8rasterio_5_base_6driver_supports_mode[] = "Return True if the driver supports the mode";
3968 static PyMethodDef __pyx_mdef_8rasterio_5_base_7driver_supports_mode = {"driver_supports_mode", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8rasterio_5_base_7driver_supports_mode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8rasterio_5_base_6driver_supports_mode};
__pyx_pw_8rasterio_5_base_7driver_supports_mode(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3969 static PyObject *__pyx_pw_8rasterio_5_base_7driver_supports_mode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3970   PyObject *__pyx_v_drivername = 0;
3971   PyObject *__pyx_v_creation_mode = 0;
3972   int __pyx_lineno = 0;
3973   const char *__pyx_filename = NULL;
3974   int __pyx_clineno = 0;
3975   PyObject *__pyx_r = 0;
3976   __Pyx_RefNannyDeclarations
3977   __Pyx_RefNannySetupContext("driver_supports_mode (wrapper)", 0);
3978   {
3979     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_drivername,&__pyx_n_s_creation_mode,0};
3980     PyObject* values[2] = {0,0};
3981     if (unlikely(__pyx_kwds)) {
3982       Py_ssize_t kw_args;
3983       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3984       switch (pos_args) {
3985         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3986         CYTHON_FALLTHROUGH;
3987         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3988         CYTHON_FALLTHROUGH;
3989         case  0: break;
3990         default: goto __pyx_L5_argtuple_error;
3991       }
3992       kw_args = PyDict_Size(__pyx_kwds);
3993       switch (pos_args) {
3994         case  0:
3995         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_drivername)) != 0)) kw_args--;
3996         else goto __pyx_L5_argtuple_error;
3997         CYTHON_FALLTHROUGH;
3998         case  1:
3999         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_creation_mode)) != 0)) kw_args--;
4000         else {
4001           __Pyx_RaiseArgtupleInvalid("driver_supports_mode", 1, 2, 2, 1); __PYX_ERR(0, 91, __pyx_L3_error)
4002         }
4003       }
4004       if (unlikely(kw_args > 0)) {
4005         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "driver_supports_mode") < 0)) __PYX_ERR(0, 91, __pyx_L3_error)
4006       }
4007     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4008       goto __pyx_L5_argtuple_error;
4009     } else {
4010       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4011       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4012     }
4013     __pyx_v_drivername = values[0];
4014     __pyx_v_creation_mode = values[1];
4015   }
4016   goto __pyx_L4_argument_unpacking_done;
4017   __pyx_L5_argtuple_error:;
4018   __Pyx_RaiseArgtupleInvalid("driver_supports_mode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error)
4019   __pyx_L3_error:;
4020   __Pyx_AddTraceback("rasterio._base.driver_supports_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
4021   __Pyx_RefNannyFinishContext();
4022   return NULL;
4023   __pyx_L4_argument_unpacking_done:;
4024   __pyx_r = __pyx_pf_8rasterio_5_base_6driver_supports_mode(__pyx_self, __pyx_v_drivername, __pyx_v_creation_mode);
4025 
4026   /* function exit code */
4027   __Pyx_RefNannyFinishContext();
4028   return __pyx_r;
4029 }
4030 
__pyx_pf_8rasterio_5_base_6driver_supports_mode(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_drivername,PyObject * __pyx_v_creation_mode)4031 static PyObject *__pyx_pf_8rasterio_5_base_6driver_supports_mode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_drivername, PyObject *__pyx_v_creation_mode) {
4032   GDALDriverH __pyx_v_driver;
4033   char **__pyx_v_metadata;
4034   PyObject *__pyx_r = NULL;
4035   __Pyx_RefNannyDeclarations
4036   PyObject *__pyx_t_1 = NULL;
4037   PyObject *__pyx_t_2 = NULL;
4038   PyObject *__pyx_t_3 = NULL;
4039   char const *__pyx_t_4;
4040   int __pyx_t_5;
4041   int __pyx_t_6;
4042   PyObject *__pyx_t_7 = NULL;
4043   char const *__pyx_t_8;
4044   int __pyx_lineno = 0;
4045   const char *__pyx_filename = NULL;
4046   int __pyx_clineno = 0;
4047   __Pyx_RefNannySetupContext("driver_supports_mode", 0);
4048   __Pyx_INCREF(__pyx_v_drivername);
4049   __Pyx_INCREF(__pyx_v_creation_mode);
4050 
4051   /* "rasterio/_base.pyx":93
4052  * def driver_supports_mode(drivername, creation_mode):
4053  *     """Return True if the driver supports the mode"""
4054  *     cdef GDALDriverH driver = NULL             # <<<<<<<<<<<<<<
4055  *     cdef char **metadata = NULL
4056  *
4057  */
4058   __pyx_v_driver = NULL;
4059 
4060   /* "rasterio/_base.pyx":94
4061  *     """Return True if the driver supports the mode"""
4062  *     cdef GDALDriverH driver = NULL
4063  *     cdef char **metadata = NULL             # <<<<<<<<<<<<<<
4064  *
4065  *     drivername = drivername.encode('utf-8')
4066  */
4067   __pyx_v_metadata = NULL;
4068 
4069   /* "rasterio/_base.pyx":96
4070  *     cdef char **metadata = NULL
4071  *
4072  *     drivername = drivername.encode('utf-8')             # <<<<<<<<<<<<<<
4073  *     creation_mode = creation_mode.encode('utf-8')
4074  *
4075  */
4076   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_drivername, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
4077   __Pyx_GOTREF(__pyx_t_2);
4078   __pyx_t_3 = NULL;
4079   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4080     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4081     if (likely(__pyx_t_3)) {
4082       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4083       __Pyx_INCREF(__pyx_t_3);
4084       __Pyx_INCREF(function);
4085       __Pyx_DECREF_SET(__pyx_t_2, function);
4086     }
4087   }
4088   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_utf_8);
4089   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4090   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
4091   __Pyx_GOTREF(__pyx_t_1);
4092   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4093   __Pyx_DECREF_SET(__pyx_v_drivername, __pyx_t_1);
4094   __pyx_t_1 = 0;
4095 
4096   /* "rasterio/_base.pyx":97
4097  *
4098  *     drivername = drivername.encode('utf-8')
4099  *     creation_mode = creation_mode.encode('utf-8')             # <<<<<<<<<<<<<<
4100  *
4101  *     driver = GDALGetDriverByName(<const char *>drivername)
4102  */
4103   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_creation_mode, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
4104   __Pyx_GOTREF(__pyx_t_2);
4105   __pyx_t_3 = NULL;
4106   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4107     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4108     if (likely(__pyx_t_3)) {
4109       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4110       __Pyx_INCREF(__pyx_t_3);
4111       __Pyx_INCREF(function);
4112       __Pyx_DECREF_SET(__pyx_t_2, function);
4113     }
4114   }
4115   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_utf_8);
4116   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4117   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
4118   __Pyx_GOTREF(__pyx_t_1);
4119   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4120   __Pyx_DECREF_SET(__pyx_v_creation_mode, __pyx_t_1);
4121   __pyx_t_1 = 0;
4122 
4123   /* "rasterio/_base.pyx":99
4124  *     creation_mode = creation_mode.encode('utf-8')
4125  *
4126  *     driver = GDALGetDriverByName(<const char *>drivername)             # <<<<<<<<<<<<<<
4127  *     if driver == NULL:
4128  *         raise DriverRegistrationError(
4129  */
4130   __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_drivername); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L1_error)
4131   __pyx_v_driver = GDALGetDriverByName(((char const *)__pyx_t_4));
4132 
4133   /* "rasterio/_base.pyx":100
4134  *
4135  *     driver = GDALGetDriverByName(<const char *>drivername)
4136  *     if driver == NULL:             # <<<<<<<<<<<<<<
4137  *         raise DriverRegistrationError(
4138  *             "No such driver registered: %s", drivername)
4139  */
4140   __pyx_t_5 = ((__pyx_v_driver == NULL) != 0);
4141   if (unlikely(__pyx_t_5)) {
4142 
4143     /* "rasterio/_base.pyx":101
4144  *     driver = GDALGetDriverByName(<const char *>drivername)
4145  *     if driver == NULL:
4146  *         raise DriverRegistrationError(             # <<<<<<<<<<<<<<
4147  *             "No such driver registered: %s", drivername)
4148  *
4149  */
4150     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DriverRegistrationError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error)
4151     __Pyx_GOTREF(__pyx_t_2);
4152 
4153     /* "rasterio/_base.pyx":102
4154  *     if driver == NULL:
4155  *         raise DriverRegistrationError(
4156  *             "No such driver registered: %s", drivername)             # <<<<<<<<<<<<<<
4157  *
4158  *     metadata = GDALGetMetadata(driver, NULL)
4159  */
4160     __pyx_t_3 = NULL;
4161     __pyx_t_6 = 0;
4162     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4163       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4164       if (likely(__pyx_t_3)) {
4165         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4166         __Pyx_INCREF(__pyx_t_3);
4167         __Pyx_INCREF(function);
4168         __Pyx_DECREF_SET(__pyx_t_2, function);
4169         __pyx_t_6 = 1;
4170       }
4171     }
4172     #if CYTHON_FAST_PYCALL
4173     if (PyFunction_Check(__pyx_t_2)) {
4174       PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_No_such_driver_registered_s, __pyx_v_drivername};
4175       __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
4176       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4177       __Pyx_GOTREF(__pyx_t_1);
4178     } else
4179     #endif
4180     #if CYTHON_FAST_PYCCALL
4181     if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
4182       PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_No_such_driver_registered_s, __pyx_v_drivername};
4183       __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
4184       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4185       __Pyx_GOTREF(__pyx_t_1);
4186     } else
4187     #endif
4188     {
4189       __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 101, __pyx_L1_error)
4190       __Pyx_GOTREF(__pyx_t_7);
4191       if (__pyx_t_3) {
4192         __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
4193       }
4194       __Pyx_INCREF(__pyx_kp_u_No_such_driver_registered_s);
4195       __Pyx_GIVEREF(__pyx_kp_u_No_such_driver_registered_s);
4196       PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_u_No_such_driver_registered_s);
4197       __Pyx_INCREF(__pyx_v_drivername);
4198       __Pyx_GIVEREF(__pyx_v_drivername);
4199       PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_drivername);
4200       __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
4201       __Pyx_GOTREF(__pyx_t_1);
4202       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4203     }
4204     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4205     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4206     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4207     __PYX_ERR(0, 101, __pyx_L1_error)
4208 
4209     /* "rasterio/_base.pyx":100
4210  *
4211  *     driver = GDALGetDriverByName(<const char *>drivername)
4212  *     if driver == NULL:             # <<<<<<<<<<<<<<
4213  *         raise DriverRegistrationError(
4214  *             "No such driver registered: %s", drivername)
4215  */
4216   }
4217 
4218   /* "rasterio/_base.pyx":104
4219  *             "No such driver registered: %s", drivername)
4220  *
4221  *     metadata = GDALGetMetadata(driver, NULL)             # <<<<<<<<<<<<<<
4222  *     if metadata == NULL:
4223  *         raise ValueError("Driver has no metadata")
4224  */
4225   __pyx_v_metadata = GDALGetMetadata(__pyx_v_driver, NULL);
4226 
4227   /* "rasterio/_base.pyx":105
4228  *
4229  *     metadata = GDALGetMetadata(driver, NULL)
4230  *     if metadata == NULL:             # <<<<<<<<<<<<<<
4231  *         raise ValueError("Driver has no metadata")
4232  *
4233  */
4234   __pyx_t_5 = ((__pyx_v_metadata == NULL) != 0);
4235   if (unlikely(__pyx_t_5)) {
4236 
4237     /* "rasterio/_base.pyx":106
4238  *     metadata = GDALGetMetadata(driver, NULL)
4239  *     if metadata == NULL:
4240  *         raise ValueError("Driver has no metadata")             # <<<<<<<<<<<<<<
4241  *
4242  *     return bool(CSLFetchBoolean(metadata, <const char *>creation_mode, 0))
4243  */
4244     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error)
4245     __Pyx_GOTREF(__pyx_t_1);
4246     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4247     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4248     __PYX_ERR(0, 106, __pyx_L1_error)
4249 
4250     /* "rasterio/_base.pyx":105
4251  *
4252  *     metadata = GDALGetMetadata(driver, NULL)
4253  *     if metadata == NULL:             # <<<<<<<<<<<<<<
4254  *         raise ValueError("Driver has no metadata")
4255  *
4256  */
4257   }
4258 
4259   /* "rasterio/_base.pyx":108
4260  *         raise ValueError("Driver has no metadata")
4261  *
4262  *     return bool(CSLFetchBoolean(metadata, <const char *>creation_mode, 0))             # <<<<<<<<<<<<<<
4263  *
4264  *
4265  */
4266   __Pyx_XDECREF(__pyx_r);
4267   __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_creation_mode); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L1_error)
4268   __pyx_t_1 = __Pyx_PyInt_From_int(CSLFetchBoolean(__pyx_v_metadata, ((char const *)__pyx_t_8), 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error)
4269   __Pyx_GOTREF(__pyx_t_1);
4270   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 108, __pyx_L1_error)
4271   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4272   __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_5))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error)
4273   __Pyx_GOTREF(__pyx_t_1);
4274   __pyx_r = __pyx_t_1;
4275   __pyx_t_1 = 0;
4276   goto __pyx_L0;
4277 
4278   /* "rasterio/_base.pyx":91
4279  *
4280  *
4281  * def driver_supports_mode(drivername, creation_mode):             # <<<<<<<<<<<<<<
4282  *     """Return True if the driver supports the mode"""
4283  *     cdef GDALDriverH driver = NULL
4284  */
4285 
4286   /* function exit code */
4287   __pyx_L1_error:;
4288   __Pyx_XDECREF(__pyx_t_1);
4289   __Pyx_XDECREF(__pyx_t_2);
4290   __Pyx_XDECREF(__pyx_t_3);
4291   __Pyx_XDECREF(__pyx_t_7);
4292   __Pyx_AddTraceback("rasterio._base.driver_supports_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
4293   __pyx_r = NULL;
4294   __pyx_L0:;
4295   __Pyx_XDECREF(__pyx_v_drivername);
4296   __Pyx_XDECREF(__pyx_v_creation_mode);
4297   __Pyx_XGIVEREF(__pyx_r);
4298   __Pyx_RefNannyFinishContext();
4299   return __pyx_r;
4300 }
4301 
4302 /* "rasterio/_base.pyx":111
4303  *
4304  *
4305  * def driver_can_create(drivername):             # <<<<<<<<<<<<<<
4306  *     """Return True if the driver has CREATE capability"""
4307  *     return driver_supports_mode(drivername, 'DCAP_CREATE')
4308  */
4309 
4310 /* Python wrapper */
4311 static PyObject *__pyx_pw_8rasterio_5_base_9driver_can_create(PyObject *__pyx_self, PyObject *__pyx_v_drivername); /*proto*/
4312 static char __pyx_doc_8rasterio_5_base_8driver_can_create[] = "Return True if the driver has CREATE capability";
4313 static PyMethodDef __pyx_mdef_8rasterio_5_base_9driver_can_create = {"driver_can_create", (PyCFunction)__pyx_pw_8rasterio_5_base_9driver_can_create, METH_O, __pyx_doc_8rasterio_5_base_8driver_can_create};
__pyx_pw_8rasterio_5_base_9driver_can_create(PyObject * __pyx_self,PyObject * __pyx_v_drivername)4314 static PyObject *__pyx_pw_8rasterio_5_base_9driver_can_create(PyObject *__pyx_self, PyObject *__pyx_v_drivername) {
4315   PyObject *__pyx_r = 0;
4316   __Pyx_RefNannyDeclarations
4317   __Pyx_RefNannySetupContext("driver_can_create (wrapper)", 0);
4318   __pyx_r = __pyx_pf_8rasterio_5_base_8driver_can_create(__pyx_self, ((PyObject *)__pyx_v_drivername));
4319 
4320   /* function exit code */
4321   __Pyx_RefNannyFinishContext();
4322   return __pyx_r;
4323 }
4324 
__pyx_pf_8rasterio_5_base_8driver_can_create(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_drivername)4325 static PyObject *__pyx_pf_8rasterio_5_base_8driver_can_create(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_drivername) {
4326   PyObject *__pyx_r = NULL;
4327   __Pyx_RefNannyDeclarations
4328   PyObject *__pyx_t_1 = NULL;
4329   PyObject *__pyx_t_2 = NULL;
4330   PyObject *__pyx_t_3 = NULL;
4331   int __pyx_t_4;
4332   PyObject *__pyx_t_5 = NULL;
4333   int __pyx_lineno = 0;
4334   const char *__pyx_filename = NULL;
4335   int __pyx_clineno = 0;
4336   __Pyx_RefNannySetupContext("driver_can_create", 0);
4337 
4338   /* "rasterio/_base.pyx":113
4339  * def driver_can_create(drivername):
4340  *     """Return True if the driver has CREATE capability"""
4341  *     return driver_supports_mode(drivername, 'DCAP_CREATE')             # <<<<<<<<<<<<<<
4342  *
4343  *
4344  */
4345   __Pyx_XDECREF(__pyx_r);
4346   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_driver_supports_mode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
4347   __Pyx_GOTREF(__pyx_t_2);
4348   __pyx_t_3 = NULL;
4349   __pyx_t_4 = 0;
4350   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4351     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4352     if (likely(__pyx_t_3)) {
4353       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4354       __Pyx_INCREF(__pyx_t_3);
4355       __Pyx_INCREF(function);
4356       __Pyx_DECREF_SET(__pyx_t_2, function);
4357       __pyx_t_4 = 1;
4358     }
4359   }
4360   #if CYTHON_FAST_PYCALL
4361   if (PyFunction_Check(__pyx_t_2)) {
4362     PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_drivername, __pyx_n_u_DCAP_CREATE};
4363     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
4364     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4365     __Pyx_GOTREF(__pyx_t_1);
4366   } else
4367   #endif
4368   #if CYTHON_FAST_PYCCALL
4369   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
4370     PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_drivername, __pyx_n_u_DCAP_CREATE};
4371     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
4372     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4373     __Pyx_GOTREF(__pyx_t_1);
4374   } else
4375   #endif
4376   {
4377     __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 113, __pyx_L1_error)
4378     __Pyx_GOTREF(__pyx_t_5);
4379     if (__pyx_t_3) {
4380       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
4381     }
4382     __Pyx_INCREF(__pyx_v_drivername);
4383     __Pyx_GIVEREF(__pyx_v_drivername);
4384     PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_drivername);
4385     __Pyx_INCREF(__pyx_n_u_DCAP_CREATE);
4386     __Pyx_GIVEREF(__pyx_n_u_DCAP_CREATE);
4387     PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_n_u_DCAP_CREATE);
4388     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
4389     __Pyx_GOTREF(__pyx_t_1);
4390     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4391   }
4392   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4393   __pyx_r = __pyx_t_1;
4394   __pyx_t_1 = 0;
4395   goto __pyx_L0;
4396 
4397   /* "rasterio/_base.pyx":111
4398  *
4399  *
4400  * def driver_can_create(drivername):             # <<<<<<<<<<<<<<
4401  *     """Return True if the driver has CREATE capability"""
4402  *     return driver_supports_mode(drivername, 'DCAP_CREATE')
4403  */
4404 
4405   /* function exit code */
4406   __pyx_L1_error:;
4407   __Pyx_XDECREF(__pyx_t_1);
4408   __Pyx_XDECREF(__pyx_t_2);
4409   __Pyx_XDECREF(__pyx_t_3);
4410   __Pyx_XDECREF(__pyx_t_5);
4411   __Pyx_AddTraceback("rasterio._base.driver_can_create", __pyx_clineno, __pyx_lineno, __pyx_filename);
4412   __pyx_r = NULL;
4413   __pyx_L0:;
4414   __Pyx_XGIVEREF(__pyx_r);
4415   __Pyx_RefNannyFinishContext();
4416   return __pyx_r;
4417 }
4418 
4419 /* "rasterio/_base.pyx":116
4420  *
4421  *
4422  * def driver_can_create_copy(drivername):             # <<<<<<<<<<<<<<
4423  *     """Return True if the driver has CREATE_COPY capability"""
4424  *     return driver_supports_mode(drivername, 'DCAP_CREATECOPY')
4425  */
4426 
4427 /* Python wrapper */
4428 static PyObject *__pyx_pw_8rasterio_5_base_11driver_can_create_copy(PyObject *__pyx_self, PyObject *__pyx_v_drivername); /*proto*/
4429 static char __pyx_doc_8rasterio_5_base_10driver_can_create_copy[] = "Return True if the driver has CREATE_COPY capability";
4430 static PyMethodDef __pyx_mdef_8rasterio_5_base_11driver_can_create_copy = {"driver_can_create_copy", (PyCFunction)__pyx_pw_8rasterio_5_base_11driver_can_create_copy, METH_O, __pyx_doc_8rasterio_5_base_10driver_can_create_copy};
__pyx_pw_8rasterio_5_base_11driver_can_create_copy(PyObject * __pyx_self,PyObject * __pyx_v_drivername)4431 static PyObject *__pyx_pw_8rasterio_5_base_11driver_can_create_copy(PyObject *__pyx_self, PyObject *__pyx_v_drivername) {
4432   PyObject *__pyx_r = 0;
4433   __Pyx_RefNannyDeclarations
4434   __Pyx_RefNannySetupContext("driver_can_create_copy (wrapper)", 0);
4435   __pyx_r = __pyx_pf_8rasterio_5_base_10driver_can_create_copy(__pyx_self, ((PyObject *)__pyx_v_drivername));
4436 
4437   /* function exit code */
4438   __Pyx_RefNannyFinishContext();
4439   return __pyx_r;
4440 }
4441 
__pyx_pf_8rasterio_5_base_10driver_can_create_copy(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_drivername)4442 static PyObject *__pyx_pf_8rasterio_5_base_10driver_can_create_copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_drivername) {
4443   PyObject *__pyx_r = NULL;
4444   __Pyx_RefNannyDeclarations
4445   PyObject *__pyx_t_1 = NULL;
4446   PyObject *__pyx_t_2 = NULL;
4447   PyObject *__pyx_t_3 = NULL;
4448   int __pyx_t_4;
4449   PyObject *__pyx_t_5 = NULL;
4450   int __pyx_lineno = 0;
4451   const char *__pyx_filename = NULL;
4452   int __pyx_clineno = 0;
4453   __Pyx_RefNannySetupContext("driver_can_create_copy", 0);
4454 
4455   /* "rasterio/_base.pyx":118
4456  * def driver_can_create_copy(drivername):
4457  *     """Return True if the driver has CREATE_COPY capability"""
4458  *     return driver_supports_mode(drivername, 'DCAP_CREATECOPY')             # <<<<<<<<<<<<<<
4459  *
4460  *
4461  */
4462   __Pyx_XDECREF(__pyx_r);
4463   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_driver_supports_mode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
4464   __Pyx_GOTREF(__pyx_t_2);
4465   __pyx_t_3 = NULL;
4466   __pyx_t_4 = 0;
4467   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4468     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4469     if (likely(__pyx_t_3)) {
4470       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4471       __Pyx_INCREF(__pyx_t_3);
4472       __Pyx_INCREF(function);
4473       __Pyx_DECREF_SET(__pyx_t_2, function);
4474       __pyx_t_4 = 1;
4475     }
4476   }
4477   #if CYTHON_FAST_PYCALL
4478   if (PyFunction_Check(__pyx_t_2)) {
4479     PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_drivername, __pyx_n_u_DCAP_CREATECOPY};
4480     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
4481     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4482     __Pyx_GOTREF(__pyx_t_1);
4483   } else
4484   #endif
4485   #if CYTHON_FAST_PYCCALL
4486   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
4487     PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_drivername, __pyx_n_u_DCAP_CREATECOPY};
4488     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
4489     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4490     __Pyx_GOTREF(__pyx_t_1);
4491   } else
4492   #endif
4493   {
4494     __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 118, __pyx_L1_error)
4495     __Pyx_GOTREF(__pyx_t_5);
4496     if (__pyx_t_3) {
4497       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
4498     }
4499     __Pyx_INCREF(__pyx_v_drivername);
4500     __Pyx_GIVEREF(__pyx_v_drivername);
4501     PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_drivername);
4502     __Pyx_INCREF(__pyx_n_u_DCAP_CREATECOPY);
4503     __Pyx_GIVEREF(__pyx_n_u_DCAP_CREATECOPY);
4504     PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_n_u_DCAP_CREATECOPY);
4505     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
4506     __Pyx_GOTREF(__pyx_t_1);
4507     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4508   }
4509   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4510   __pyx_r = __pyx_t_1;
4511   __pyx_t_1 = 0;
4512   goto __pyx_L0;
4513 
4514   /* "rasterio/_base.pyx":116
4515  *
4516  *
4517  * def driver_can_create_copy(drivername):             # <<<<<<<<<<<<<<
4518  *     """Return True if the driver has CREATE_COPY capability"""
4519  *     return driver_supports_mode(drivername, 'DCAP_CREATECOPY')
4520  */
4521 
4522   /* function exit code */
4523   __pyx_L1_error:;
4524   __Pyx_XDECREF(__pyx_t_1);
4525   __Pyx_XDECREF(__pyx_t_2);
4526   __Pyx_XDECREF(__pyx_t_3);
4527   __Pyx_XDECREF(__pyx_t_5);
4528   __Pyx_AddTraceback("rasterio._base.driver_can_create_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
4529   __pyx_r = NULL;
4530   __pyx_L0:;
4531   __Pyx_XGIVEREF(__pyx_r);
4532   __Pyx_RefNannyFinishContext();
4533   return __pyx_r;
4534 }
4535 
4536 /* "rasterio/_base.pyx":121
4537  *
4538  *
4539  * def _raster_driver_extensions():             # <<<<<<<<<<<<<<
4540  *     """
4541  *     Logic based on: https://github.com/mapbox/rasterio/issues/265#issuecomment-367044836
4542  */
4543 
4544 /* Python wrapper */
4545 static PyObject *__pyx_pw_8rasterio_5_base_13_raster_driver_extensions(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
4546 static char __pyx_doc_8rasterio_5_base_12_raster_driver_extensions[] = "\n    Logic based on: https://github.com/mapbox/rasterio/issues/265#issuecomment-367044836\n    ";
4547 static PyMethodDef __pyx_mdef_8rasterio_5_base_13_raster_driver_extensions = {"_raster_driver_extensions", (PyCFunction)__pyx_pw_8rasterio_5_base_13_raster_driver_extensions, METH_NOARGS, __pyx_doc_8rasterio_5_base_12_raster_driver_extensions};
__pyx_pw_8rasterio_5_base_13_raster_driver_extensions(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)4548 static PyObject *__pyx_pw_8rasterio_5_base_13_raster_driver_extensions(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
4549   PyObject *__pyx_r = 0;
4550   __Pyx_RefNannyDeclarations
4551   __Pyx_RefNannySetupContext("_raster_driver_extensions (wrapper)", 0);
4552   __pyx_r = __pyx_pf_8rasterio_5_base_12_raster_driver_extensions(__pyx_self);
4553 
4554   /* function exit code */
4555   __Pyx_RefNannyFinishContext();
4556   return __pyx_r;
4557 }
4558 
__pyx_pf_8rasterio_5_base_12_raster_driver_extensions(CYTHON_UNUSED PyObject * __pyx_self)4559 static PyObject *__pyx_pf_8rasterio_5_base_12_raster_driver_extensions(CYTHON_UNUSED PyObject *__pyx_self) {
4560   int __pyx_v_iii;
4561   int __pyx_v_driver_count;
4562   GDALDriverH __pyx_v_driver;
4563   char *__pyx_v_c_extensions;
4564   char *__pyx_v_c_drivername;
4565   PyObject *__pyx_v_driver_extensions = NULL;
4566   PyObject *__pyx_v_extensions = NULL;
4567   PyObject *__pyx_v_drivername = NULL;
4568   PyObject *__pyx_v_extension = NULL;
4569   PyObject *__pyx_r = NULL;
4570   __Pyx_RefNannyDeclarations
4571   PyObject *__pyx_t_1 = NULL;
4572   int __pyx_t_2;
4573   int __pyx_t_3;
4574   int __pyx_t_4;
4575   int __pyx_t_5;
4576   int __pyx_t_6;
4577   PyObject *__pyx_t_7 = NULL;
4578   PyObject *__pyx_t_8 = NULL;
4579   PyObject *__pyx_t_9 = NULL;
4580   PyObject *__pyx_t_10 = NULL;
4581   PyObject *__pyx_t_11 = NULL;
4582   int __pyx_t_12;
4583   Py_ssize_t __pyx_t_13;
4584   PyObject *(*__pyx_t_14)(PyObject *);
4585   int __pyx_lineno = 0;
4586   const char *__pyx_filename = NULL;
4587   int __pyx_clineno = 0;
4588   __Pyx_RefNannySetupContext("_raster_driver_extensions", 0);
4589 
4590   /* "rasterio/_base.pyx":125
4591  *     Logic based on: https://github.com/mapbox/rasterio/issues/265#issuecomment-367044836
4592  *     """
4593  *     cdef int iii = 0             # <<<<<<<<<<<<<<
4594  *     cdef int driver_count = GDALGetDriverCount()
4595  *     cdef GDALDriverH driver = NULL
4596  */
4597   __pyx_v_iii = 0;
4598 
4599   /* "rasterio/_base.pyx":126
4600  *     """
4601  *     cdef int iii = 0
4602  *     cdef int driver_count = GDALGetDriverCount()             # <<<<<<<<<<<<<<
4603  *     cdef GDALDriverH driver = NULL
4604  *     cdef char* c_extensions = NULL
4605  */
4606   __pyx_v_driver_count = GDALGetDriverCount();
4607 
4608   /* "rasterio/_base.pyx":127
4609  *     cdef int iii = 0
4610  *     cdef int driver_count = GDALGetDriverCount()
4611  *     cdef GDALDriverH driver = NULL             # <<<<<<<<<<<<<<
4612  *     cdef char* c_extensions = NULL
4613  *     cdef char* c_drivername = NULL
4614  */
4615   __pyx_v_driver = NULL;
4616 
4617   /* "rasterio/_base.pyx":128
4618  *     cdef int driver_count = GDALGetDriverCount()
4619  *     cdef GDALDriverH driver = NULL
4620  *     cdef char* c_extensions = NULL             # <<<<<<<<<<<<<<
4621  *     cdef char* c_drivername = NULL
4622  *     driver_extensions = {}
4623  */
4624   __pyx_v_c_extensions = NULL;
4625 
4626   /* "rasterio/_base.pyx":129
4627  *     cdef GDALDriverH driver = NULL
4628  *     cdef char* c_extensions = NULL
4629  *     cdef char* c_drivername = NULL             # <<<<<<<<<<<<<<
4630  *     driver_extensions = {}
4631  *     for iii in range(driver_count):
4632  */
4633   __pyx_v_c_drivername = NULL;
4634 
4635   /* "rasterio/_base.pyx":130
4636  *     cdef char* c_extensions = NULL
4637  *     cdef char* c_drivername = NULL
4638  *     driver_extensions = {}             # <<<<<<<<<<<<<<
4639  *     for iii in range(driver_count):
4640  *         driver = GDALGetDriver(iii)
4641  */
4642   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error)
4643   __Pyx_GOTREF(__pyx_t_1);
4644   __pyx_v_driver_extensions = ((PyObject*)__pyx_t_1);
4645   __pyx_t_1 = 0;
4646 
4647   /* "rasterio/_base.pyx":131
4648  *     cdef char* c_drivername = NULL
4649  *     driver_extensions = {}
4650  *     for iii in range(driver_count):             # <<<<<<<<<<<<<<
4651  *         driver = GDALGetDriver(iii)
4652  *         c_drivername = get_driver_name(driver)
4653  */
4654   __pyx_t_2 = __pyx_v_driver_count;
4655   __pyx_t_3 = __pyx_t_2;
4656   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
4657     __pyx_v_iii = __pyx_t_4;
4658 
4659     /* "rasterio/_base.pyx":132
4660  *     driver_extensions = {}
4661  *     for iii in range(driver_count):
4662  *         driver = GDALGetDriver(iii)             # <<<<<<<<<<<<<<
4663  *         c_drivername = get_driver_name(driver)
4664  *         if (
4665  */
4666     __pyx_v_driver = GDALGetDriver(__pyx_v_iii);
4667 
4668     /* "rasterio/_base.pyx":133
4669  *     for iii in range(driver_count):
4670  *         driver = GDALGetDriver(iii)
4671  *         c_drivername = get_driver_name(driver)             # <<<<<<<<<<<<<<
4672  *         if (
4673  *             GDALGetMetadataItem(driver, "DCAP_RASTER", NULL) == NULL
4674  */
4675     __pyx_v_c_drivername = __pyx_f_8rasterio_5_base_get_driver_name(__pyx_v_driver);
4676 
4677     /* "rasterio/_base.pyx":135
4678  *         c_drivername = get_driver_name(driver)
4679  *         if (
4680  *             GDALGetMetadataItem(driver, "DCAP_RASTER", NULL) == NULL             # <<<<<<<<<<<<<<
4681  *             or (
4682  *                 GDALGetMetadataItem(driver, "DCAP_CREATE", NULL) == NULL
4683  */
4684     __pyx_t_6 = ((GDALGetMetadataItem(__pyx_v_driver, ((char const *)"DCAP_RASTER"), NULL) == NULL) != 0);
4685     if (!__pyx_t_6) {
4686     } else {
4687       __pyx_t_5 = __pyx_t_6;
4688       goto __pyx_L6_bool_binop_done;
4689     }
4690 
4691     /* "rasterio/_base.pyx":137
4692  *             GDALGetMetadataItem(driver, "DCAP_RASTER", NULL) == NULL
4693  *             or (
4694  *                 GDALGetMetadataItem(driver, "DCAP_CREATE", NULL) == NULL             # <<<<<<<<<<<<<<
4695  *                 and GDALGetMetadataItem(driver, "DCAP_CREATECOPY", NULL) == NULL
4696  *             )
4697  */
4698     __pyx_t_6 = ((GDALGetMetadataItem(__pyx_v_driver, ((char const *)"DCAP_CREATE"), NULL) == NULL) != 0);
4699     if (__pyx_t_6) {
4700     } else {
4701       __pyx_t_5 = __pyx_t_6;
4702       goto __pyx_L6_bool_binop_done;
4703     }
4704 
4705     /* "rasterio/_base.pyx":138
4706  *             or (
4707  *                 GDALGetMetadataItem(driver, "DCAP_CREATE", NULL) == NULL
4708  *                 and GDALGetMetadataItem(driver, "DCAP_CREATECOPY", NULL) == NULL             # <<<<<<<<<<<<<<
4709  *             )
4710  *         ):
4711  */
4712     __pyx_t_6 = ((GDALGetMetadataItem(__pyx_v_driver, ((char const *)"DCAP_CREATECOPY"), NULL) == NULL) != 0);
4713     __pyx_t_5 = __pyx_t_6;
4714     __pyx_L6_bool_binop_done:;
4715 
4716     /* "rasterio/_base.pyx":134
4717  *         driver = GDALGetDriver(iii)
4718  *         c_drivername = get_driver_name(driver)
4719  *         if (             # <<<<<<<<<<<<<<
4720  *             GDALGetMetadataItem(driver, "DCAP_RASTER", NULL) == NULL
4721  *             or (
4722  */
4723     if (__pyx_t_5) {
4724 
4725       /* "rasterio/_base.pyx":141
4726  *             )
4727  *         ):
4728  *             continue             # <<<<<<<<<<<<<<
4729  *         c_extensions = GDALGetMetadataItem(driver, "DMD_EXTENSIONS", NULL)
4730  *         if c_extensions == NULL or c_drivername == NULL:
4731  */
4732       goto __pyx_L3_continue;
4733 
4734       /* "rasterio/_base.pyx":134
4735  *         driver = GDALGetDriver(iii)
4736  *         c_drivername = get_driver_name(driver)
4737  *         if (             # <<<<<<<<<<<<<<
4738  *             GDALGetMetadataItem(driver, "DCAP_RASTER", NULL) == NULL
4739  *             or (
4740  */
4741     }
4742 
4743     /* "rasterio/_base.pyx":142
4744  *         ):
4745  *             continue
4746  *         c_extensions = GDALGetMetadataItem(driver, "DMD_EXTENSIONS", NULL)             # <<<<<<<<<<<<<<
4747  *         if c_extensions == NULL or c_drivername == NULL:
4748  *             continue
4749  */
4750     __pyx_v_c_extensions = GDALGetMetadataItem(__pyx_v_driver, ((char const *)"DMD_EXTENSIONS"), NULL);
4751 
4752     /* "rasterio/_base.pyx":143
4753  *             continue
4754  *         c_extensions = GDALGetMetadataItem(driver, "DMD_EXTENSIONS", NULL)
4755  *         if c_extensions == NULL or c_drivername == NULL:             # <<<<<<<<<<<<<<
4756  *             continue
4757  *
4758  */
4759     __pyx_t_6 = ((__pyx_v_c_extensions == NULL) != 0);
4760     if (!__pyx_t_6) {
4761     } else {
4762       __pyx_t_5 = __pyx_t_6;
4763       goto __pyx_L10_bool_binop_done;
4764     }
4765     __pyx_t_6 = ((__pyx_v_c_drivername == NULL) != 0);
4766     __pyx_t_5 = __pyx_t_6;
4767     __pyx_L10_bool_binop_done:;
4768     if (__pyx_t_5) {
4769 
4770       /* "rasterio/_base.pyx":144
4771  *         c_extensions = GDALGetMetadataItem(driver, "DMD_EXTENSIONS", NULL)
4772  *         if c_extensions == NULL or c_drivername == NULL:
4773  *             continue             # <<<<<<<<<<<<<<
4774  *
4775  *         try:
4776  */
4777       goto __pyx_L3_continue;
4778 
4779       /* "rasterio/_base.pyx":143
4780  *             continue
4781  *         c_extensions = GDALGetMetadataItem(driver, "DMD_EXTENSIONS", NULL)
4782  *         if c_extensions == NULL or c_drivername == NULL:             # <<<<<<<<<<<<<<
4783  *             continue
4784  *
4785  */
4786     }
4787 
4788     /* "rasterio/_base.pyx":146
4789  *             continue
4790  *
4791  *         try:             # <<<<<<<<<<<<<<
4792  *             extensions = c_extensions
4793  *             extensions = extensions.decode("utf-8")
4794  */
4795     {
4796       __Pyx_PyThreadState_declare
4797       __Pyx_PyThreadState_assign
4798       __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
4799       __Pyx_XGOTREF(__pyx_t_7);
4800       __Pyx_XGOTREF(__pyx_t_8);
4801       __Pyx_XGOTREF(__pyx_t_9);
4802       /*try:*/ {
4803 
4804         /* "rasterio/_base.pyx":147
4805  *
4806  *         try:
4807  *             extensions = c_extensions             # <<<<<<<<<<<<<<
4808  *             extensions = extensions.decode("utf-8")
4809  *         except AttributeError:
4810  */
4811         __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_c_extensions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L12_error)
4812         __Pyx_GOTREF(__pyx_t_1);
4813         __Pyx_XDECREF_SET(__pyx_v_extensions, __pyx_t_1);
4814         __pyx_t_1 = 0;
4815 
4816         /* "rasterio/_base.pyx":148
4817  *         try:
4818  *             extensions = c_extensions
4819  *             extensions = extensions.decode("utf-8")             # <<<<<<<<<<<<<<
4820  *         except AttributeError:
4821  *             pass
4822  */
4823         __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_extensions, __pyx_n_s_decode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 148, __pyx_L12_error)
4824         __Pyx_GOTREF(__pyx_t_10);
4825         __pyx_t_11 = NULL;
4826         if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
4827           __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
4828           if (likely(__pyx_t_11)) {
4829             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
4830             __Pyx_INCREF(__pyx_t_11);
4831             __Pyx_INCREF(function);
4832             __Pyx_DECREF_SET(__pyx_t_10, function);
4833           }
4834         }
4835         __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_kp_u_utf_8);
4836         __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
4837         if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L12_error)
4838         __Pyx_GOTREF(__pyx_t_1);
4839         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4840         __Pyx_DECREF_SET(__pyx_v_extensions, __pyx_t_1);
4841         __pyx_t_1 = 0;
4842 
4843         /* "rasterio/_base.pyx":146
4844  *             continue
4845  *
4846  *         try:             # <<<<<<<<<<<<<<
4847  *             extensions = c_extensions
4848  *             extensions = extensions.decode("utf-8")
4849  */
4850       }
4851       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4852       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
4853       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
4854       goto __pyx_L19_try_end;
4855       __pyx_L12_error:;
4856       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4857       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
4858       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
4859 
4860       /* "rasterio/_base.pyx":149
4861  *             extensions = c_extensions
4862  *             extensions = extensions.decode("utf-8")
4863  *         except AttributeError:             # <<<<<<<<<<<<<<
4864  *             pass
4865  *
4866  */
4867       __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
4868       if (__pyx_t_12) {
4869         __Pyx_ErrRestore(0,0,0);
4870         goto __pyx_L13_exception_handled;
4871       }
4872       goto __pyx_L14_except_error;
4873       __pyx_L14_except_error:;
4874 
4875       /* "rasterio/_base.pyx":146
4876  *             continue
4877  *
4878  *         try:             # <<<<<<<<<<<<<<
4879  *             extensions = c_extensions
4880  *             extensions = extensions.decode("utf-8")
4881  */
4882       __Pyx_XGIVEREF(__pyx_t_7);
4883       __Pyx_XGIVEREF(__pyx_t_8);
4884       __Pyx_XGIVEREF(__pyx_t_9);
4885       __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
4886       goto __pyx_L1_error;
4887       __pyx_L13_exception_handled:;
4888       __Pyx_XGIVEREF(__pyx_t_7);
4889       __Pyx_XGIVEREF(__pyx_t_8);
4890       __Pyx_XGIVEREF(__pyx_t_9);
4891       __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
4892       __pyx_L19_try_end:;
4893     }
4894 
4895     /* "rasterio/_base.pyx":152
4896  *             pass
4897  *
4898  *         try:             # <<<<<<<<<<<<<<
4899  *             drivername = c_drivername
4900  *             drivername = drivername.decode("utf-8")
4901  */
4902     {
4903       __Pyx_PyThreadState_declare
4904       __Pyx_PyThreadState_assign
4905       __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
4906       __Pyx_XGOTREF(__pyx_t_9);
4907       __Pyx_XGOTREF(__pyx_t_8);
4908       __Pyx_XGOTREF(__pyx_t_7);
4909       /*try:*/ {
4910 
4911         /* "rasterio/_base.pyx":153
4912  *
4913  *         try:
4914  *             drivername = c_drivername             # <<<<<<<<<<<<<<
4915  *             drivername = drivername.decode("utf-8")
4916  *         except AttributeError:
4917  */
4918         __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_c_drivername); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L20_error)
4919         __Pyx_GOTREF(__pyx_t_1);
4920         __Pyx_XDECREF_SET(__pyx_v_drivername, __pyx_t_1);
4921         __pyx_t_1 = 0;
4922 
4923         /* "rasterio/_base.pyx":154
4924  *         try:
4925  *             drivername = c_drivername
4926  *             drivername = drivername.decode("utf-8")             # <<<<<<<<<<<<<<
4927  *         except AttributeError:
4928  *             pass
4929  */
4930         __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_drivername, __pyx_n_s_decode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 154, __pyx_L20_error)
4931         __Pyx_GOTREF(__pyx_t_10);
4932         __pyx_t_11 = NULL;
4933         if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
4934           __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
4935           if (likely(__pyx_t_11)) {
4936             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
4937             __Pyx_INCREF(__pyx_t_11);
4938             __Pyx_INCREF(function);
4939             __Pyx_DECREF_SET(__pyx_t_10, function);
4940           }
4941         }
4942         __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_kp_u_utf_8);
4943         __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
4944         if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L20_error)
4945         __Pyx_GOTREF(__pyx_t_1);
4946         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4947         __Pyx_DECREF_SET(__pyx_v_drivername, __pyx_t_1);
4948         __pyx_t_1 = 0;
4949 
4950         /* "rasterio/_base.pyx":152
4951  *             pass
4952  *
4953  *         try:             # <<<<<<<<<<<<<<
4954  *             drivername = c_drivername
4955  *             drivername = drivername.decode("utf-8")
4956  */
4957       }
4958       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
4959       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
4960       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4961       goto __pyx_L27_try_end;
4962       __pyx_L20_error:;
4963       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4964       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
4965       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
4966 
4967       /* "rasterio/_base.pyx":155
4968  *             drivername = c_drivername
4969  *             drivername = drivername.decode("utf-8")
4970  *         except AttributeError:             # <<<<<<<<<<<<<<
4971  *             pass
4972  *
4973  */
4974       __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
4975       if (__pyx_t_12) {
4976         __Pyx_ErrRestore(0,0,0);
4977         goto __pyx_L21_exception_handled;
4978       }
4979       goto __pyx_L22_except_error;
4980       __pyx_L22_except_error:;
4981 
4982       /* "rasterio/_base.pyx":152
4983  *             pass
4984  *
4985  *         try:             # <<<<<<<<<<<<<<
4986  *             drivername = c_drivername
4987  *             drivername = drivername.decode("utf-8")
4988  */
4989       __Pyx_XGIVEREF(__pyx_t_9);
4990       __Pyx_XGIVEREF(__pyx_t_8);
4991       __Pyx_XGIVEREF(__pyx_t_7);
4992       __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
4993       goto __pyx_L1_error;
4994       __pyx_L21_exception_handled:;
4995       __Pyx_XGIVEREF(__pyx_t_9);
4996       __Pyx_XGIVEREF(__pyx_t_8);
4997       __Pyx_XGIVEREF(__pyx_t_7);
4998       __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
4999       __pyx_L27_try_end:;
5000     }
5001 
5002     /* "rasterio/_base.pyx":158
5003  *             pass
5004  *
5005  *         for extension in extensions.split():             # <<<<<<<<<<<<<<
5006  *             driver_extensions[extension] = drivername
5007  *     return driver_extensions
5008  */
5009     if (unlikely(!__pyx_v_extensions)) { __Pyx_RaiseUnboundLocalError("extensions"); __PYX_ERR(0, 158, __pyx_L1_error) }
5010     __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_extensions, __pyx_n_s_split); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 158, __pyx_L1_error)
5011     __Pyx_GOTREF(__pyx_t_10);
5012     __pyx_t_11 = NULL;
5013     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
5014       __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
5015       if (likely(__pyx_t_11)) {
5016         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
5017         __Pyx_INCREF(__pyx_t_11);
5018         __Pyx_INCREF(function);
5019         __Pyx_DECREF_SET(__pyx_t_10, function);
5020       }
5021     }
5022     __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
5023     __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
5024     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
5025     __Pyx_GOTREF(__pyx_t_1);
5026     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5027     if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
5028       __pyx_t_10 = __pyx_t_1; __Pyx_INCREF(__pyx_t_10); __pyx_t_13 = 0;
5029       __pyx_t_14 = NULL;
5030     } else {
5031       __pyx_t_13 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 158, __pyx_L1_error)
5032       __Pyx_GOTREF(__pyx_t_10);
5033       __pyx_t_14 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 158, __pyx_L1_error)
5034     }
5035     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5036     for (;;) {
5037       if (likely(!__pyx_t_14)) {
5038         if (likely(PyList_CheckExact(__pyx_t_10))) {
5039           if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_10)) break;
5040           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5041           __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 158, __pyx_L1_error)
5042           #else
5043           __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
5044           __Pyx_GOTREF(__pyx_t_1);
5045           #endif
5046         } else {
5047           if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
5048           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5049           __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 158, __pyx_L1_error)
5050           #else
5051           __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
5052           __Pyx_GOTREF(__pyx_t_1);
5053           #endif
5054         }
5055       } else {
5056         __pyx_t_1 = __pyx_t_14(__pyx_t_10);
5057         if (unlikely(!__pyx_t_1)) {
5058           PyObject* exc_type = PyErr_Occurred();
5059           if (exc_type) {
5060             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5061             else __PYX_ERR(0, 158, __pyx_L1_error)
5062           }
5063           break;
5064         }
5065         __Pyx_GOTREF(__pyx_t_1);
5066       }
5067       __Pyx_XDECREF_SET(__pyx_v_extension, __pyx_t_1);
5068       __pyx_t_1 = 0;
5069 
5070       /* "rasterio/_base.pyx":159
5071  *
5072  *         for extension in extensions.split():
5073  *             driver_extensions[extension] = drivername             # <<<<<<<<<<<<<<
5074  *     return driver_extensions
5075  *
5076  */
5077       if (unlikely(!__pyx_v_drivername)) { __Pyx_RaiseUnboundLocalError("drivername"); __PYX_ERR(0, 159, __pyx_L1_error) }
5078       if (unlikely(PyDict_SetItem(__pyx_v_driver_extensions, __pyx_v_extension, __pyx_v_drivername) < 0)) __PYX_ERR(0, 159, __pyx_L1_error)
5079 
5080       /* "rasterio/_base.pyx":158
5081  *             pass
5082  *
5083  *         for extension in extensions.split():             # <<<<<<<<<<<<<<
5084  *             driver_extensions[extension] = drivername
5085  *     return driver_extensions
5086  */
5087     }
5088     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5089     __pyx_L3_continue:;
5090   }
5091 
5092   /* "rasterio/_base.pyx":160
5093  *         for extension in extensions.split():
5094  *             driver_extensions[extension] = drivername
5095  *     return driver_extensions             # <<<<<<<<<<<<<<
5096  *
5097  *
5098  */
5099   __Pyx_XDECREF(__pyx_r);
5100   __Pyx_INCREF(__pyx_v_driver_extensions);
5101   __pyx_r = __pyx_v_driver_extensions;
5102   goto __pyx_L0;
5103 
5104   /* "rasterio/_base.pyx":121
5105  *
5106  *
5107  * def _raster_driver_extensions():             # <<<<<<<<<<<<<<
5108  *     """
5109  *     Logic based on: https://github.com/mapbox/rasterio/issues/265#issuecomment-367044836
5110  */
5111 
5112   /* function exit code */
5113   __pyx_L1_error:;
5114   __Pyx_XDECREF(__pyx_t_1);
5115   __Pyx_XDECREF(__pyx_t_10);
5116   __Pyx_XDECREF(__pyx_t_11);
5117   __Pyx_AddTraceback("rasterio._base._raster_driver_extensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
5118   __pyx_r = NULL;
5119   __pyx_L0:;
5120   __Pyx_XDECREF(__pyx_v_driver_extensions);
5121   __Pyx_XDECREF(__pyx_v_extensions);
5122   __Pyx_XDECREF(__pyx_v_drivername);
5123   __Pyx_XDECREF(__pyx_v_extension);
5124   __Pyx_XGIVEREF(__pyx_r);
5125   __Pyx_RefNannyFinishContext();
5126   return __pyx_r;
5127 }
5128 
5129 /* "rasterio/_base.pyx":163
5130  *
5131  *
5132  * cdef _band_dtype(GDALRasterBandH band):             # <<<<<<<<<<<<<<
5133  *     """Resolve dtype of a given band, deals with signed/unsigned byte ambiguity"""
5134  *     cdef const char * ptype
5135  */
5136 
__pyx_f_8rasterio_5_base__band_dtype(GDALRasterBandH __pyx_v_band)5137 static PyObject *__pyx_f_8rasterio_5_base__band_dtype(GDALRasterBandH __pyx_v_band) {
5138   char const *__pyx_v_ptype;
5139   int __pyx_v_gdal_dtype;
5140   PyObject *__pyx_r = NULL;
5141   __Pyx_RefNannyDeclarations
5142   int __pyx_t_1;
5143   int __pyx_t_2;
5144   PyObject *__pyx_t_3 = NULL;
5145   PyObject *__pyx_t_4 = NULL;
5146   int __pyx_lineno = 0;
5147   const char *__pyx_filename = NULL;
5148   int __pyx_clineno = 0;
5149   __Pyx_RefNannySetupContext("_band_dtype", 0);
5150 
5151   /* "rasterio/_base.pyx":166
5152  *     """Resolve dtype of a given band, deals with signed/unsigned byte ambiguity"""
5153  *     cdef const char * ptype
5154  *     cdef int gdal_dtype = GDALGetRasterDataType(band)             # <<<<<<<<<<<<<<
5155  *     if gdal_dtype == GDT_Byte:
5156  *         # Can be uint8 or int8, need to check PIXELTYPE property
5157  */
5158   __pyx_v_gdal_dtype = GDALGetRasterDataType(__pyx_v_band);
5159 
5160   /* "rasterio/_base.pyx":167
5161  *     cdef const char * ptype
5162  *     cdef int gdal_dtype = GDALGetRasterDataType(band)
5163  *     if gdal_dtype == GDT_Byte:             # <<<<<<<<<<<<<<
5164  *         # Can be uint8 or int8, need to check PIXELTYPE property
5165  *         ptype = GDALGetMetadataItem(band, 'PIXELTYPE', 'IMAGE_STRUCTURE')
5166  */
5167   __pyx_t_1 = ((__pyx_v_gdal_dtype == GDT_Byte) != 0);
5168   if (__pyx_t_1) {
5169 
5170     /* "rasterio/_base.pyx":169
5171  *     if gdal_dtype == GDT_Byte:
5172  *         # Can be uint8 or int8, need to check PIXELTYPE property
5173  *         ptype = GDALGetMetadataItem(band, 'PIXELTYPE', 'IMAGE_STRUCTURE')             # <<<<<<<<<<<<<<
5174  *         if ptype and strncmp(ptype, 'SIGNEDBYTE', 10) == 0:
5175  *             return 'int8'
5176  */
5177     __pyx_v_ptype = GDALGetMetadataItem(__pyx_v_band, ((char const *)"PIXELTYPE"), ((char const *)"IMAGE_STRUCTURE"));
5178 
5179     /* "rasterio/_base.pyx":170
5180  *         # Can be uint8 or int8, need to check PIXELTYPE property
5181  *         ptype = GDALGetMetadataItem(band, 'PIXELTYPE', 'IMAGE_STRUCTURE')
5182  *         if ptype and strncmp(ptype, 'SIGNEDBYTE', 10) == 0:             # <<<<<<<<<<<<<<
5183  *             return 'int8'
5184  *         else:
5185  */
5186     __pyx_t_2 = (__pyx_v_ptype != 0);
5187     if (__pyx_t_2) {
5188     } else {
5189       __pyx_t_1 = __pyx_t_2;
5190       goto __pyx_L5_bool_binop_done;
5191     }
5192     __pyx_t_2 = ((strncmp(__pyx_v_ptype, ((char const *)"SIGNEDBYTE"), 10) == 0) != 0);
5193     __pyx_t_1 = __pyx_t_2;
5194     __pyx_L5_bool_binop_done:;
5195     if (__pyx_t_1) {
5196 
5197       /* "rasterio/_base.pyx":171
5198  *         ptype = GDALGetMetadataItem(band, 'PIXELTYPE', 'IMAGE_STRUCTURE')
5199  *         if ptype and strncmp(ptype, 'SIGNEDBYTE', 10) == 0:
5200  *             return 'int8'             # <<<<<<<<<<<<<<
5201  *         else:
5202  *             return 'uint8'
5203  */
5204       __Pyx_XDECREF(__pyx_r);
5205       __Pyx_INCREF(__pyx_n_u_int8);
5206       __pyx_r = __pyx_n_u_int8;
5207       goto __pyx_L0;
5208 
5209       /* "rasterio/_base.pyx":170
5210  *         # Can be uint8 or int8, need to check PIXELTYPE property
5211  *         ptype = GDALGetMetadataItem(band, 'PIXELTYPE', 'IMAGE_STRUCTURE')
5212  *         if ptype and strncmp(ptype, 'SIGNEDBYTE', 10) == 0:             # <<<<<<<<<<<<<<
5213  *             return 'int8'
5214  *         else:
5215  */
5216     }
5217 
5218     /* "rasterio/_base.pyx":173
5219  *             return 'int8'
5220  *         else:
5221  *             return 'uint8'             # <<<<<<<<<<<<<<
5222  *
5223  *
5224  */
5225     /*else*/ {
5226       __Pyx_XDECREF(__pyx_r);
5227       __Pyx_INCREF(__pyx_n_u_uint8);
5228       __pyx_r = __pyx_n_u_uint8;
5229       goto __pyx_L0;
5230     }
5231 
5232     /* "rasterio/_base.pyx":167
5233  *     cdef const char * ptype
5234  *     cdef int gdal_dtype = GDALGetRasterDataType(band)
5235  *     if gdal_dtype == GDT_Byte:             # <<<<<<<<<<<<<<
5236  *         # Can be uint8 or int8, need to check PIXELTYPE property
5237  *         ptype = GDALGetMetadataItem(band, 'PIXELTYPE', 'IMAGE_STRUCTURE')
5238  */
5239   }
5240 
5241   /* "rasterio/_base.pyx":176
5242  *
5243  *
5244  *     return dtypes.dtype_fwd[gdal_dtype]             # <<<<<<<<<<<<<<
5245  *
5246  *
5247  */
5248   __Pyx_XDECREF(__pyx_r);
5249   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error)
5250   __Pyx_GOTREF(__pyx_t_3);
5251   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dtype_fwd); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L1_error)
5252   __Pyx_GOTREF(__pyx_t_4);
5253   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5254   __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_gdal_dtype, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error)
5255   __Pyx_GOTREF(__pyx_t_3);
5256   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5257   __pyx_r = __pyx_t_3;
5258   __pyx_t_3 = 0;
5259   goto __pyx_L0;
5260 
5261   /* "rasterio/_base.pyx":163
5262  *
5263  *
5264  * cdef _band_dtype(GDALRasterBandH band):             # <<<<<<<<<<<<<<
5265  *     """Resolve dtype of a given band, deals with signed/unsigned byte ambiguity"""
5266  *     cdef const char * ptype
5267  */
5268 
5269   /* function exit code */
5270   __pyx_L1_error:;
5271   __Pyx_XDECREF(__pyx_t_3);
5272   __Pyx_XDECREF(__pyx_t_4);
5273   __Pyx_AddTraceback("rasterio._base._band_dtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
5274   __pyx_r = 0;
5275   __pyx_L0:;
5276   __Pyx_XGIVEREF(__pyx_r);
5277   __Pyx_RefNannyFinishContext();
5278   return __pyx_r;
5279 }
5280 
5281 /* "rasterio/_base.pyx":222
5282  *     """
5283  *
5284  *     def __init__(self, path=None, driver=None, sharing=False, **kwargs):             # <<<<<<<<<<<<<<
5285  *         """Construct a new dataset
5286  *
5287  */
5288 
5289 /* Python wrapper */
5290 static int __pyx_pw_8rasterio_5_base_11DatasetBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5291 static char __pyx_doc_8rasterio_5_base_11DatasetBase___init__[] = "Construct a new dataset\n\n        Parameters\n        ----------\n        path : rasterio.path.Path or str\n            Path of the local or remote dataset.\n        driver : str or list of str\n            A single driver name or a list of driver names to consider when\n            opening the dataset.\n        sharing : bool, optional\n            Whether to share underlying GDAL dataset handles (default: False).\n        kwargs : dict\n            GDAL dataset opening options.\n\n        Returns\n        -------\n        dataset\n        ";
5292 #if CYTHON_COMPILING_IN_CPYTHON
5293 struct wrapperbase __pyx_wrapperbase_8rasterio_5_base_11DatasetBase___init__;
5294 #endif
__pyx_pw_8rasterio_5_base_11DatasetBase_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5295 static int __pyx_pw_8rasterio_5_base_11DatasetBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5296   PyObject *__pyx_v_path = 0;
5297   PyObject *__pyx_v_driver = 0;
5298   PyObject *__pyx_v_sharing = 0;
5299   PyObject *__pyx_v_kwargs = 0;
5300   int __pyx_lineno = 0;
5301   const char *__pyx_filename = NULL;
5302   int __pyx_clineno = 0;
5303   int __pyx_r;
5304   __Pyx_RefNannyDeclarations
5305   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
5306   __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
5307   __Pyx_GOTREF(__pyx_v_kwargs);
5308   {
5309     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_driver,&__pyx_n_s_sharing,0};
5310     PyObject* values[3] = {0,0,0};
5311     values[0] = ((PyObject *)Py_None);
5312     values[1] = ((PyObject *)Py_None);
5313     values[2] = ((PyObject *)Py_False);
5314     if (unlikely(__pyx_kwds)) {
5315       Py_ssize_t kw_args;
5316       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5317       switch (pos_args) {
5318         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5319         CYTHON_FALLTHROUGH;
5320         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5321         CYTHON_FALLTHROUGH;
5322         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5323         CYTHON_FALLTHROUGH;
5324         case  0: break;
5325         default: goto __pyx_L5_argtuple_error;
5326       }
5327       kw_args = PyDict_Size(__pyx_kwds);
5328       switch (pos_args) {
5329         case  0:
5330         if (kw_args > 0) {
5331           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path);
5332           if (value) { values[0] = value; kw_args--; }
5333         }
5334         CYTHON_FALLTHROUGH;
5335         case  1:
5336         if (kw_args > 0) {
5337           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_driver);
5338           if (value) { values[1] = value; kw_args--; }
5339         }
5340         CYTHON_FALLTHROUGH;
5341         case  2:
5342         if (kw_args > 0) {
5343           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sharing);
5344           if (value) { values[2] = value; kw_args--; }
5345         }
5346       }
5347       if (unlikely(kw_args > 0)) {
5348         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 222, __pyx_L3_error)
5349       }
5350     } else {
5351       switch (PyTuple_GET_SIZE(__pyx_args)) {
5352         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5353         CYTHON_FALLTHROUGH;
5354         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5355         CYTHON_FALLTHROUGH;
5356         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5357         CYTHON_FALLTHROUGH;
5358         case  0: break;
5359         default: goto __pyx_L5_argtuple_error;
5360       }
5361     }
5362     __pyx_v_path = values[0];
5363     __pyx_v_driver = values[1];
5364     __pyx_v_sharing = values[2];
5365   }
5366   goto __pyx_L4_argument_unpacking_done;
5367   __pyx_L5_argtuple_error:;
5368   __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 222, __pyx_L3_error)
5369   __pyx_L3_error:;
5370   __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
5371   __Pyx_AddTraceback("rasterio._base.DatasetBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5372   __Pyx_RefNannyFinishContext();
5373   return -1;
5374   __pyx_L4_argument_unpacking_done:;
5375   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase___init__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), __pyx_v_path, __pyx_v_driver, __pyx_v_sharing, __pyx_v_kwargs);
5376 
5377   /* function exit code */
5378   __Pyx_XDECREF(__pyx_v_kwargs);
5379   __Pyx_RefNannyFinishContext();
5380   return __pyx_r;
5381 }
5382 
__pyx_pf_8rasterio_5_base_11DatasetBase___init__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_path,PyObject * __pyx_v_driver,PyObject * __pyx_v_sharing,PyObject * __pyx_v_kwargs)5383 static int __pyx_pf_8rasterio_5_base_11DatasetBase___init__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_driver, PyObject *__pyx_v_sharing, PyObject *__pyx_v_kwargs) {
5384   CYTHON_UNUSED GDALDatasetH __pyx_v_hds;
5385   int __pyx_v_flags;
5386   int __pyx_v_sharing_flag;
5387   PyObject *__pyx_v_filename = NULL;
5388   PyObject *__pyx_v_err = NULL;
5389   int __pyx_r;
5390   __Pyx_RefNannyDeclarations
5391   int __pyx_t_1;
5392   int __pyx_t_2;
5393   PyObject *__pyx_t_3 = NULL;
5394   PyObject *__pyx_t_4 = NULL;
5395   PyObject *__pyx_t_5 = NULL;
5396   PyObject *__pyx_t_6 = NULL;
5397   PyObject *__pyx_t_7 = NULL;
5398   int __pyx_t_8;
5399   PyObject *__pyx_t_9 = NULL;
5400   PyObject *__pyx_t_10 = NULL;
5401   PyObject *__pyx_t_11 = NULL;
5402   GDALDatasetH __pyx_t_12;
5403   PyObject *__pyx_t_13 = NULL;
5404   PyObject *__pyx_t_14 = NULL;
5405   int __pyx_t_15;
5406   char const *__pyx_t_16;
5407   PyObject *__pyx_t_17 = NULL;
5408   PyObject *__pyx_t_18 = NULL;
5409   PyObject *__pyx_t_19 = NULL;
5410   PyObject *__pyx_t_20 = NULL;
5411   PyObject *__pyx_t_21 = NULL;
5412   PyObject *__pyx_t_22 = NULL;
5413   int __pyx_lineno = 0;
5414   const char *__pyx_filename = NULL;
5415   int __pyx_clineno = 0;
5416   __Pyx_RefNannySetupContext("__init__", 0);
5417   __Pyx_INCREF(__pyx_v_driver);
5418 
5419   /* "rasterio/_base.pyx":241
5420  *         dataset
5421  *         """
5422  *         cdef GDALDatasetH hds = NULL             # <<<<<<<<<<<<<<
5423  *         cdef int flags = 0
5424  *         cdef int sharing_flag = (0x20 if sharing else 0x0)
5425  */
5426   __pyx_v_hds = NULL;
5427 
5428   /* "rasterio/_base.pyx":242
5429  *         """
5430  *         cdef GDALDatasetH hds = NULL
5431  *         cdef int flags = 0             # <<<<<<<<<<<<<<
5432  *         cdef int sharing_flag = (0x20 if sharing else 0x0)
5433  *
5434  */
5435   __pyx_v_flags = 0;
5436 
5437   /* "rasterio/_base.pyx":243
5438  *         cdef GDALDatasetH hds = NULL
5439  *         cdef int flags = 0
5440  *         cdef int sharing_flag = (0x20 if sharing else 0x0)             # <<<<<<<<<<<<<<
5441  *
5442  *         log.debug("Sharing flag: %r", sharing_flag)
5443  */
5444   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_sharing); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 243, __pyx_L1_error)
5445   if (__pyx_t_2) {
5446     __pyx_t_1 = 0x20;
5447   } else {
5448     __pyx_t_1 = 0x0;
5449   }
5450   __pyx_v_sharing_flag = __pyx_t_1;
5451 
5452   /* "rasterio/_base.pyx":245
5453  *         cdef int sharing_flag = (0x20 if sharing else 0x0)
5454  *
5455  *         log.debug("Sharing flag: %r", sharing_flag)             # <<<<<<<<<<<<<<
5456  *
5457  *         self._hds = NULL
5458  */
5459   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 245, __pyx_L1_error)
5460   __Pyx_GOTREF(__pyx_t_4);
5461   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __pyx_L1_error)
5462   __Pyx_GOTREF(__pyx_t_5);
5463   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5464   __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_sharing_flag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 245, __pyx_L1_error)
5465   __Pyx_GOTREF(__pyx_t_4);
5466   __pyx_t_6 = NULL;
5467   __pyx_t_1 = 0;
5468   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
5469     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
5470     if (likely(__pyx_t_6)) {
5471       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5472       __Pyx_INCREF(__pyx_t_6);
5473       __Pyx_INCREF(function);
5474       __Pyx_DECREF_SET(__pyx_t_5, function);
5475       __pyx_t_1 = 1;
5476     }
5477   }
5478   #if CYTHON_FAST_PYCALL
5479   if (PyFunction_Check(__pyx_t_5)) {
5480     PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_u_Sharing_flag_r, __pyx_t_4};
5481     __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error)
5482     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5483     __Pyx_GOTREF(__pyx_t_3);
5484     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5485   } else
5486   #endif
5487   #if CYTHON_FAST_PYCCALL
5488   if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
5489     PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_u_Sharing_flag_r, __pyx_t_4};
5490     __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error)
5491     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5492     __Pyx_GOTREF(__pyx_t_3);
5493     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5494   } else
5495   #endif
5496   {
5497     __pyx_t_7 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 245, __pyx_L1_error)
5498     __Pyx_GOTREF(__pyx_t_7);
5499     if (__pyx_t_6) {
5500       __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
5501     }
5502     __Pyx_INCREF(__pyx_kp_u_Sharing_flag_r);
5503     __Pyx_GIVEREF(__pyx_kp_u_Sharing_flag_r);
5504     PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_1, __pyx_kp_u_Sharing_flag_r);
5505     __Pyx_GIVEREF(__pyx_t_4);
5506     PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_1, __pyx_t_4);
5507     __pyx_t_4 = 0;
5508     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error)
5509     __Pyx_GOTREF(__pyx_t_3);
5510     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5511   }
5512   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5513   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5514 
5515   /* "rasterio/_base.pyx":247
5516  *         log.debug("Sharing flag: %r", sharing_flag)
5517  *
5518  *         self._hds = NULL             # <<<<<<<<<<<<<<
5519  *
5520  *         if path is not None:
5521  */
5522   __pyx_v_self->_hds = NULL;
5523 
5524   /* "rasterio/_base.pyx":249
5525  *         self._hds = NULL
5526  *
5527  *         if path is not None:             # <<<<<<<<<<<<<<
5528  *             filename = parse_path(path).as_vsi()
5529  *
5530  */
5531   __pyx_t_2 = (__pyx_v_path != Py_None);
5532   __pyx_t_8 = (__pyx_t_2 != 0);
5533   if (__pyx_t_8) {
5534 
5535     /* "rasterio/_base.pyx":250
5536  *
5537  *         if path is not None:
5538  *             filename = parse_path(path).as_vsi()             # <<<<<<<<<<<<<<
5539  *
5540  *             # driver may be a string or list of strings. If the
5541  */
5542     __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_parse_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 250, __pyx_L1_error)
5543     __Pyx_GOTREF(__pyx_t_7);
5544     __pyx_t_4 = NULL;
5545     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
5546       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
5547       if (likely(__pyx_t_4)) {
5548         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
5549         __Pyx_INCREF(__pyx_t_4);
5550         __Pyx_INCREF(function);
5551         __Pyx_DECREF_SET(__pyx_t_7, function);
5552       }
5553     }
5554     __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_4, __pyx_v_path) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_path);
5555     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5556     if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 250, __pyx_L1_error)
5557     __Pyx_GOTREF(__pyx_t_5);
5558     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5559     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_as_vsi); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 250, __pyx_L1_error)
5560     __Pyx_GOTREF(__pyx_t_7);
5561     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5562     __pyx_t_5 = NULL;
5563     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
5564       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
5565       if (likely(__pyx_t_5)) {
5566         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
5567         __Pyx_INCREF(__pyx_t_5);
5568         __Pyx_INCREF(function);
5569         __Pyx_DECREF_SET(__pyx_t_7, function);
5570       }
5571     }
5572     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
5573     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5574     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error)
5575     __Pyx_GOTREF(__pyx_t_3);
5576     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5577     __pyx_v_filename = __pyx_t_3;
5578     __pyx_t_3 = 0;
5579 
5580     /* "rasterio/_base.pyx":254
5581  *             # driver may be a string or list of strings. If the
5582  *             # former, we put it into a list.
5583  *             if isinstance(driver, str):             # <<<<<<<<<<<<<<
5584  *                 driver = [driver]
5585  *
5586  */
5587     __pyx_t_8 = PyUnicode_Check(__pyx_v_driver);
5588     __pyx_t_2 = (__pyx_t_8 != 0);
5589     if (__pyx_t_2) {
5590 
5591       /* "rasterio/_base.pyx":255
5592  *             # former, we put it into a list.
5593  *             if isinstance(driver, str):
5594  *                 driver = [driver]             # <<<<<<<<<<<<<<
5595  *
5596  *             # Read-only + Rasters + Sharing + Errors
5597  */
5598       __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error)
5599       __Pyx_GOTREF(__pyx_t_3);
5600       __Pyx_INCREF(__pyx_v_driver);
5601       __Pyx_GIVEREF(__pyx_v_driver);
5602       PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_driver);
5603       __Pyx_DECREF_SET(__pyx_v_driver, __pyx_t_3);
5604       __pyx_t_3 = 0;
5605 
5606       /* "rasterio/_base.pyx":254
5607  *             # driver may be a string or list of strings. If the
5608  *             # former, we put it into a list.
5609  *             if isinstance(driver, str):             # <<<<<<<<<<<<<<
5610  *                 driver = [driver]
5611  *
5612  */
5613     }
5614 
5615     /* "rasterio/_base.pyx":258
5616  *
5617  *             # Read-only + Rasters + Sharing + Errors
5618  *             flags = 0x00 | 0x02 | sharing_flag | 0x40             # <<<<<<<<<<<<<<
5619  *
5620  *             try:
5621  */
5622     __pyx_v_flags = ((2 | __pyx_v_sharing_flag) | 0x40);
5623 
5624     /* "rasterio/_base.pyx":260
5625  *             flags = 0x00 | 0x02 | sharing_flag | 0x40
5626  *
5627  *             try:             # <<<<<<<<<<<<<<
5628  *                 self._hds = open_dataset(filename, flags, driver, kwargs, None)
5629  *             except CPLE_BaseError as err:
5630  */
5631     {
5632       __Pyx_PyThreadState_declare
5633       __Pyx_PyThreadState_assign
5634       __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
5635       __Pyx_XGOTREF(__pyx_t_9);
5636       __Pyx_XGOTREF(__pyx_t_10);
5637       __Pyx_XGOTREF(__pyx_t_11);
5638       /*try:*/ {
5639 
5640         /* "rasterio/_base.pyx":261
5641  *
5642  *             try:
5643  *                 self._hds = open_dataset(filename, flags, driver, kwargs, None)             # <<<<<<<<<<<<<<
5644  *             except CPLE_BaseError as err:
5645  *                 raise RasterioIOError(str(err))
5646  */
5647         __pyx_t_12 = __pyx_f_8rasterio_5_shim_open_dataset(__pyx_v_filename, __pyx_v_flags, __pyx_v_driver, __pyx_v_kwargs, Py_None); if (unlikely(__pyx_t_12 == ((GDALDatasetH)NULL))) __PYX_ERR(0, 261, __pyx_L5_error)
5648         __pyx_v_self->_hds = __pyx_t_12;
5649 
5650         /* "rasterio/_base.pyx":260
5651  *             flags = 0x00 | 0x02 | sharing_flag | 0x40
5652  *
5653  *             try:             # <<<<<<<<<<<<<<
5654  *                 self._hds = open_dataset(filename, flags, driver, kwargs, None)
5655  *             except CPLE_BaseError as err:
5656  */
5657       }
5658       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5659       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
5660       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
5661       goto __pyx_L10_try_end;
5662       __pyx_L5_error:;
5663       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5664       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5665       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5666       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5667       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
5668 
5669       /* "rasterio/_base.pyx":262
5670  *             try:
5671  *                 self._hds = open_dataset(filename, flags, driver, kwargs, None)
5672  *             except CPLE_BaseError as err:             # <<<<<<<<<<<<<<
5673  *                 raise RasterioIOError(str(err))
5674  *
5675  */
5676       __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_7, &__pyx_t_5);
5677       __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CPLE_BaseError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 262, __pyx_L7_except_error)
5678       __Pyx_GOTREF(__pyx_t_4);
5679       __pyx_t_1 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_4);
5680       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5681       __Pyx_ErrRestore(__pyx_t_3, __pyx_t_7, __pyx_t_5);
5682       __pyx_t_3 = 0; __pyx_t_7 = 0; __pyx_t_5 = 0;
5683       if (__pyx_t_1) {
5684         __Pyx_AddTraceback("rasterio._base.DatasetBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5685         if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_3) < 0) __PYX_ERR(0, 262, __pyx_L7_except_error)
5686         __Pyx_GOTREF(__pyx_t_5);
5687         __Pyx_GOTREF(__pyx_t_7);
5688         __Pyx_GOTREF(__pyx_t_3);
5689         __Pyx_INCREF(__pyx_t_7);
5690         __pyx_v_err = __pyx_t_7;
5691         /*try:*/ {
5692 
5693           /* "rasterio/_base.pyx":263
5694  *                 self._hds = open_dataset(filename, flags, driver, kwargs, None)
5695  *             except CPLE_BaseError as err:
5696  *                 raise RasterioIOError(str(err))             # <<<<<<<<<<<<<<
5697  *
5698  *         self.name = path.name
5699  */
5700           __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_RasterioIOError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 263, __pyx_L16_error)
5701           __Pyx_GOTREF(__pyx_t_6);
5702           __pyx_t_13 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_err); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 263, __pyx_L16_error)
5703           __Pyx_GOTREF(__pyx_t_13);
5704           __pyx_t_14 = NULL;
5705           if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
5706             __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_6);
5707             if (likely(__pyx_t_14)) {
5708               PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
5709               __Pyx_INCREF(__pyx_t_14);
5710               __Pyx_INCREF(function);
5711               __Pyx_DECREF_SET(__pyx_t_6, function);
5712             }
5713           }
5714           __pyx_t_4 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_14, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_13);
5715           __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
5716           __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
5717           if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 263, __pyx_L16_error)
5718           __Pyx_GOTREF(__pyx_t_4);
5719           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5720           __Pyx_Raise(__pyx_t_4, 0, 0, 0);
5721           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5722           __PYX_ERR(0, 263, __pyx_L16_error)
5723         }
5724 
5725         /* "rasterio/_base.pyx":262
5726  *             try:
5727  *                 self._hds = open_dataset(filename, flags, driver, kwargs, None)
5728  *             except CPLE_BaseError as err:             # <<<<<<<<<<<<<<
5729  *                 raise RasterioIOError(str(err))
5730  *
5731  */
5732         /*finally:*/ {
5733           __pyx_L16_error:;
5734           /*exception exit:*/{
5735             __Pyx_PyThreadState_declare
5736             __Pyx_PyThreadState_assign
5737             __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
5738             __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
5739             __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
5740             __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5741             __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5742             if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
5743             if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
5744             __Pyx_XGOTREF(__pyx_t_17);
5745             __Pyx_XGOTREF(__pyx_t_18);
5746             __Pyx_XGOTREF(__pyx_t_19);
5747             __Pyx_XGOTREF(__pyx_t_20);
5748             __Pyx_XGOTREF(__pyx_t_21);
5749             __Pyx_XGOTREF(__pyx_t_22);
5750             __pyx_t_1 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
5751             {
5752               __Pyx_DECREF(__pyx_v_err);
5753               __pyx_v_err = NULL;
5754             }
5755             if (PY_MAJOR_VERSION >= 3) {
5756               __Pyx_XGIVEREF(__pyx_t_20);
5757               __Pyx_XGIVEREF(__pyx_t_21);
5758               __Pyx_XGIVEREF(__pyx_t_22);
5759               __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
5760             }
5761             __Pyx_XGIVEREF(__pyx_t_17);
5762             __Pyx_XGIVEREF(__pyx_t_18);
5763             __Pyx_XGIVEREF(__pyx_t_19);
5764             __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19);
5765             __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
5766             __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
5767             goto __pyx_L7_except_error;
5768           }
5769         }
5770       }
5771       goto __pyx_L7_except_error;
5772       __pyx_L7_except_error:;
5773 
5774       /* "rasterio/_base.pyx":260
5775  *             flags = 0x00 | 0x02 | sharing_flag | 0x40
5776  *
5777  *             try:             # <<<<<<<<<<<<<<
5778  *                 self._hds = open_dataset(filename, flags, driver, kwargs, None)
5779  *             except CPLE_BaseError as err:
5780  */
5781       __Pyx_XGIVEREF(__pyx_t_9);
5782       __Pyx_XGIVEREF(__pyx_t_10);
5783       __Pyx_XGIVEREF(__pyx_t_11);
5784       __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
5785       goto __pyx_L1_error;
5786       __pyx_L10_try_end:;
5787     }
5788 
5789     /* "rasterio/_base.pyx":249
5790  *         self._hds = NULL
5791  *
5792  *         if path is not None:             # <<<<<<<<<<<<<<
5793  *             filename = parse_path(path).as_vsi()
5794  *
5795  */
5796   }
5797 
5798   /* "rasterio/_base.pyx":265
5799  *                 raise RasterioIOError(str(err))
5800  *
5801  *         self.name = path.name             # <<<<<<<<<<<<<<
5802  *         self.mode = 'r'
5803  *         self.options = kwargs.copy()
5804  */
5805   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_path, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error)
5806   __Pyx_GOTREF(__pyx_t_3);
5807   __Pyx_GIVEREF(__pyx_t_3);
5808   __Pyx_GOTREF(__pyx_v_self->name);
5809   __Pyx_DECREF(__pyx_v_self->name);
5810   __pyx_v_self->name = __pyx_t_3;
5811   __pyx_t_3 = 0;
5812 
5813   /* "rasterio/_base.pyx":266
5814  *
5815  *         self.name = path.name
5816  *         self.mode = 'r'             # <<<<<<<<<<<<<<
5817  *         self.options = kwargs.copy()
5818  *         self._dtypes = []
5819  */
5820   __Pyx_INCREF(__pyx_n_u_r);
5821   __Pyx_GIVEREF(__pyx_n_u_r);
5822   __Pyx_GOTREF(__pyx_v_self->mode);
5823   __Pyx_DECREF(__pyx_v_self->mode);
5824   __pyx_v_self->mode = __pyx_n_u_r;
5825 
5826   /* "rasterio/_base.pyx":267
5827  *         self.name = path.name
5828  *         self.mode = 'r'
5829  *         self.options = kwargs.copy()             # <<<<<<<<<<<<<<
5830  *         self._dtypes = []
5831  *         self._block_shapes = None
5832  */
5833   __pyx_t_3 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error)
5834   __Pyx_GOTREF(__pyx_t_3);
5835   __Pyx_GIVEREF(__pyx_t_3);
5836   __Pyx_GOTREF(__pyx_v_self->options);
5837   __Pyx_DECREF(__pyx_v_self->options);
5838   __pyx_v_self->options = __pyx_t_3;
5839   __pyx_t_3 = 0;
5840 
5841   /* "rasterio/_base.pyx":268
5842  *         self.mode = 'r'
5843  *         self.options = kwargs.copy()
5844  *         self._dtypes = []             # <<<<<<<<<<<<<<
5845  *         self._block_shapes = None
5846  *         self._nodatavals = []
5847  */
5848   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L1_error)
5849   __Pyx_GOTREF(__pyx_t_3);
5850   __Pyx_GIVEREF(__pyx_t_3);
5851   __Pyx_GOTREF(__pyx_v_self->_dtypes);
5852   __Pyx_DECREF(__pyx_v_self->_dtypes);
5853   __pyx_v_self->_dtypes = __pyx_t_3;
5854   __pyx_t_3 = 0;
5855 
5856   /* "rasterio/_base.pyx":269
5857  *         self.options = kwargs.copy()
5858  *         self._dtypes = []
5859  *         self._block_shapes = None             # <<<<<<<<<<<<<<
5860  *         self._nodatavals = []
5861  *         self._units = ()
5862  */
5863   __Pyx_INCREF(Py_None);
5864   __Pyx_GIVEREF(Py_None);
5865   __Pyx_GOTREF(__pyx_v_self->_block_shapes);
5866   __Pyx_DECREF(__pyx_v_self->_block_shapes);
5867   __pyx_v_self->_block_shapes = Py_None;
5868 
5869   /* "rasterio/_base.pyx":270
5870  *         self._dtypes = []
5871  *         self._block_shapes = None
5872  *         self._nodatavals = []             # <<<<<<<<<<<<<<
5873  *         self._units = ()
5874  *         self._descriptions = ()
5875  */
5876   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error)
5877   __Pyx_GOTREF(__pyx_t_3);
5878   __Pyx_GIVEREF(__pyx_t_3);
5879   __Pyx_GOTREF(__pyx_v_self->_nodatavals);
5880   __Pyx_DECREF(__pyx_v_self->_nodatavals);
5881   __pyx_v_self->_nodatavals = __pyx_t_3;
5882   __pyx_t_3 = 0;
5883 
5884   /* "rasterio/_base.pyx":271
5885  *         self._block_shapes = None
5886  *         self._nodatavals = []
5887  *         self._units = ()             # <<<<<<<<<<<<<<
5888  *         self._descriptions = ()
5889  *         self._scales = ()
5890  */
5891   __Pyx_INCREF(__pyx_empty_tuple);
5892   __Pyx_GIVEREF(__pyx_empty_tuple);
5893   __Pyx_GOTREF(__pyx_v_self->_units);
5894   __Pyx_DECREF(__pyx_v_self->_units);
5895   __pyx_v_self->_units = __pyx_empty_tuple;
5896 
5897   /* "rasterio/_base.pyx":272
5898  *         self._nodatavals = []
5899  *         self._units = ()
5900  *         self._descriptions = ()             # <<<<<<<<<<<<<<
5901  *         self._scales = ()
5902  *         self._offsets = ()
5903  */
5904   __Pyx_INCREF(__pyx_empty_tuple);
5905   __Pyx_GIVEREF(__pyx_empty_tuple);
5906   __Pyx_GOTREF(__pyx_v_self->_descriptions);
5907   __Pyx_DECREF(__pyx_v_self->_descriptions);
5908   __pyx_v_self->_descriptions = __pyx_empty_tuple;
5909 
5910   /* "rasterio/_base.pyx":273
5911  *         self._units = ()
5912  *         self._descriptions = ()
5913  *         self._scales = ()             # <<<<<<<<<<<<<<
5914  *         self._offsets = ()
5915  *         self._gcps = None
5916  */
5917   __Pyx_INCREF(__pyx_empty_tuple);
5918   __Pyx_GIVEREF(__pyx_empty_tuple);
5919   __Pyx_GOTREF(__pyx_v_self->_scales);
5920   __Pyx_DECREF(__pyx_v_self->_scales);
5921   __pyx_v_self->_scales = __pyx_empty_tuple;
5922 
5923   /* "rasterio/_base.pyx":274
5924  *         self._descriptions = ()
5925  *         self._scales = ()
5926  *         self._offsets = ()             # <<<<<<<<<<<<<<
5927  *         self._gcps = None
5928  *         self._rpcs = None
5929  */
5930   __Pyx_INCREF(__pyx_empty_tuple);
5931   __Pyx_GIVEREF(__pyx_empty_tuple);
5932   __Pyx_GOTREF(__pyx_v_self->_offsets);
5933   __Pyx_DECREF(__pyx_v_self->_offsets);
5934   __pyx_v_self->_offsets = __pyx_empty_tuple;
5935 
5936   /* "rasterio/_base.pyx":275
5937  *         self._scales = ()
5938  *         self._offsets = ()
5939  *         self._gcps = None             # <<<<<<<<<<<<<<
5940  *         self._rpcs = None
5941  *         self._read = False
5942  */
5943   __Pyx_INCREF(Py_None);
5944   __Pyx_GIVEREF(Py_None);
5945   __Pyx_GOTREF(__pyx_v_self->_gcps);
5946   __Pyx_DECREF(__pyx_v_self->_gcps);
5947   __pyx_v_self->_gcps = Py_None;
5948 
5949   /* "rasterio/_base.pyx":276
5950  *         self._offsets = ()
5951  *         self._gcps = None
5952  *         self._rpcs = None             # <<<<<<<<<<<<<<
5953  *         self._read = False
5954  *
5955  */
5956   __Pyx_INCREF(Py_None);
5957   __Pyx_GIVEREF(Py_None);
5958   __Pyx_GOTREF(__pyx_v_self->_rpcs);
5959   __Pyx_DECREF(__pyx_v_self->_rpcs);
5960   __pyx_v_self->_rpcs = Py_None;
5961 
5962   /* "rasterio/_base.pyx":277
5963  *         self._gcps = None
5964  *         self._rpcs = None
5965  *         self._read = False             # <<<<<<<<<<<<<<
5966  *
5967  *         self._set_attrs_from_dataset_handle()
5968  */
5969   __Pyx_INCREF(Py_False);
5970   __Pyx_GIVEREF(Py_False);
5971   __Pyx_GOTREF(__pyx_v_self->_read);
5972   __Pyx_DECREF(__pyx_v_self->_read);
5973   __pyx_v_self->_read = Py_False;
5974 
5975   /* "rasterio/_base.pyx":279
5976  *         self._read = False
5977  *
5978  *         self._set_attrs_from_dataset_handle()             # <<<<<<<<<<<<<<
5979  *
5980  *     def __repr__(self):
5981  */
5982   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_attrs_from_dataset_handle); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 279, __pyx_L1_error)
5983   __Pyx_GOTREF(__pyx_t_7);
5984   __pyx_t_5 = NULL;
5985   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
5986     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
5987     if (likely(__pyx_t_5)) {
5988       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
5989       __Pyx_INCREF(__pyx_t_5);
5990       __Pyx_INCREF(function);
5991       __Pyx_DECREF_SET(__pyx_t_7, function);
5992     }
5993   }
5994   __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
5995   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5996   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __pyx_L1_error)
5997   __Pyx_GOTREF(__pyx_t_3);
5998   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5999   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6000 
6001   /* "rasterio/_base.pyx":222
6002  *     """
6003  *
6004  *     def __init__(self, path=None, driver=None, sharing=False, **kwargs):             # <<<<<<<<<<<<<<
6005  *         """Construct a new dataset
6006  *
6007  */
6008 
6009   /* function exit code */
6010   __pyx_r = 0;
6011   goto __pyx_L0;
6012   __pyx_L1_error:;
6013   __Pyx_XDECREF(__pyx_t_3);
6014   __Pyx_XDECREF(__pyx_t_4);
6015   __Pyx_XDECREF(__pyx_t_5);
6016   __Pyx_XDECREF(__pyx_t_6);
6017   __Pyx_XDECREF(__pyx_t_7);
6018   __Pyx_XDECREF(__pyx_t_13);
6019   __Pyx_XDECREF(__pyx_t_14);
6020   __Pyx_AddTraceback("rasterio._base.DatasetBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6021   __pyx_r = -1;
6022   __pyx_L0:;
6023   __Pyx_XDECREF(__pyx_v_filename);
6024   __Pyx_XDECREF(__pyx_v_err);
6025   __Pyx_XDECREF(__pyx_v_driver);
6026   __Pyx_RefNannyFinishContext();
6027   return __pyx_r;
6028 }
6029 
6030 /* "rasterio/_base.pyx":281
6031  *         self._set_attrs_from_dataset_handle()
6032  *
6033  *     def __repr__(self):             # <<<<<<<<<<<<<<
6034  *         return "<%s DatasetBase name='%s' mode='%s'>" % (
6035  *             self.closed and 'closed' or 'open',
6036  */
6037 
6038 /* Python wrapper */
6039 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_3__repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_3__repr__(PyObject * __pyx_v_self)6040 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_3__repr__(PyObject *__pyx_v_self) {
6041   PyObject *__pyx_r = 0;
6042   __Pyx_RefNannyDeclarations
6043   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
6044   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_2__repr__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
6045 
6046   /* function exit code */
6047   __Pyx_RefNannyFinishContext();
6048   return __pyx_r;
6049 }
6050 
__pyx_pf_8rasterio_5_base_11DatasetBase_2__repr__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)6051 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_2__repr__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
6052   PyObject *__pyx_r = NULL;
6053   __Pyx_RefNannyDeclarations
6054   PyObject *__pyx_t_1 = NULL;
6055   Py_ssize_t __pyx_t_2;
6056   Py_UCS4 __pyx_t_3;
6057   PyObject *__pyx_t_4 = NULL;
6058   PyObject *__pyx_t_5 = NULL;
6059   int __pyx_t_6;
6060   int __pyx_lineno = 0;
6061   const char *__pyx_filename = NULL;
6062   int __pyx_clineno = 0;
6063   __Pyx_RefNannySetupContext("__repr__", 0);
6064 
6065   /* "rasterio/_base.pyx":282
6066  *
6067  *     def __repr__(self):
6068  *         return "<%s DatasetBase name='%s' mode='%s'>" % (             # <<<<<<<<<<<<<<
6069  *             self.closed and 'closed' or 'open',
6070  *             self.name,
6071  */
6072   __Pyx_XDECREF(__pyx_r);
6073   __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error)
6074   __Pyx_GOTREF(__pyx_t_1);
6075   __pyx_t_2 = 0;
6076   __pyx_t_3 = 127;
6077   __Pyx_INCREF(__pyx_kp_u__2);
6078   __pyx_t_2 += 1;
6079   __Pyx_GIVEREF(__pyx_kp_u__2);
6080   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__2);
6081 
6082   /* "rasterio/_base.pyx":283
6083  *     def __repr__(self):
6084  *         return "<%s DatasetBase name='%s' mode='%s'>" % (
6085  *             self.closed and 'closed' or 'open',             # <<<<<<<<<<<<<<
6086  *             self.name,
6087  *             self.mode)
6088  */
6089   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_closed); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 283, __pyx_L1_error)
6090   __Pyx_GOTREF(__pyx_t_5);
6091   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 283, __pyx_L1_error)
6092   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6093   if (!__pyx_t_6) {
6094     goto __pyx_L4_next_or;
6095   } else {
6096   }
6097   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_n_u_closed); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 283, __pyx_L1_error)
6098   if (!__pyx_t_6) {
6099   } else {
6100     __Pyx_INCREF(__pyx_n_u_closed);
6101     __pyx_t_4 = __pyx_n_u_closed;
6102     goto __pyx_L3_bool_binop_done;
6103   }
6104   __pyx_L4_next_or:;
6105   __Pyx_INCREF(__pyx_n_u_open);
6106   __pyx_t_4 = __pyx_n_u_open;
6107   __pyx_L3_bool_binop_done:;
6108   __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 283, __pyx_L1_error)
6109   __Pyx_GOTREF(__pyx_t_5);
6110   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6111   __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
6112   __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
6113   __Pyx_GIVEREF(__pyx_t_5);
6114   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
6115   __pyx_t_5 = 0;
6116   __Pyx_INCREF(__pyx_kp_u_DatasetBase_name);
6117   __pyx_t_2 += 19;
6118   __Pyx_GIVEREF(__pyx_kp_u_DatasetBase_name);
6119   PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_DatasetBase_name);
6120 
6121   /* "rasterio/_base.pyx":284
6122  *         return "<%s DatasetBase name='%s' mode='%s'>" % (
6123  *             self.closed and 'closed' or 'open',
6124  *             self.name,             # <<<<<<<<<<<<<<
6125  *             self.mode)
6126  *
6127  */
6128   __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_self->name), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 284, __pyx_L1_error)
6129   __Pyx_GOTREF(__pyx_t_5);
6130   __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
6131   __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
6132   __Pyx_GIVEREF(__pyx_t_5);
6133   PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
6134   __pyx_t_5 = 0;
6135   __Pyx_INCREF(__pyx_kp_u_mode);
6136   __pyx_t_2 += 8;
6137   __Pyx_GIVEREF(__pyx_kp_u_mode);
6138   PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_mode);
6139 
6140   /* "rasterio/_base.pyx":285
6141  *             self.closed and 'closed' or 'open',
6142  *             self.name,
6143  *             self.mode)             # <<<<<<<<<<<<<<
6144  *
6145  *     def _set_attrs_from_dataset_handle(self):
6146  */
6147   __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_self->mode), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 285, __pyx_L1_error)
6148   __Pyx_GOTREF(__pyx_t_5);
6149   __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
6150   __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
6151   __Pyx_GIVEREF(__pyx_t_5);
6152   PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_5);
6153   __pyx_t_5 = 0;
6154   __Pyx_INCREF(__pyx_kp_u__3);
6155   __pyx_t_2 += 2;
6156   __Pyx_GIVEREF(__pyx_kp_u__3);
6157   PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__3);
6158 
6159   /* "rasterio/_base.pyx":282
6160  *
6161  *     def __repr__(self):
6162  *         return "<%s DatasetBase name='%s' mode='%s'>" % (             # <<<<<<<<<<<<<<
6163  *             self.closed and 'closed' or 'open',
6164  *             self.name,
6165  */
6166   __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 282, __pyx_L1_error)
6167   __Pyx_GOTREF(__pyx_t_5);
6168   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6169   __pyx_r = __pyx_t_5;
6170   __pyx_t_5 = 0;
6171   goto __pyx_L0;
6172 
6173   /* "rasterio/_base.pyx":281
6174  *         self._set_attrs_from_dataset_handle()
6175  *
6176  *     def __repr__(self):             # <<<<<<<<<<<<<<
6177  *         return "<%s DatasetBase name='%s' mode='%s'>" % (
6178  *             self.closed and 'closed' or 'open',
6179  */
6180 
6181   /* function exit code */
6182   __pyx_L1_error:;
6183   __Pyx_XDECREF(__pyx_t_1);
6184   __Pyx_XDECREF(__pyx_t_4);
6185   __Pyx_XDECREF(__pyx_t_5);
6186   __Pyx_AddTraceback("rasterio._base.DatasetBase.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6187   __pyx_r = NULL;
6188   __pyx_L0:;
6189   __Pyx_XGIVEREF(__pyx_r);
6190   __Pyx_RefNannyFinishContext();
6191   return __pyx_r;
6192 }
6193 
6194 /* "rasterio/_base.pyx":287
6195  *             self.mode)
6196  *
6197  *     def _set_attrs_from_dataset_handle(self):             # <<<<<<<<<<<<<<
6198  *         cdef GDALDriverH driver = NULL
6199  *         driver = GDALGetDatasetDriver(self._hds)
6200  */
6201 
6202 /* Python wrapper */
6203 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5_set_attrs_from_dataset_handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5_set_attrs_from_dataset_handle(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)6204 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5_set_attrs_from_dataset_handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6205   PyObject *__pyx_r = 0;
6206   __Pyx_RefNannyDeclarations
6207   __Pyx_RefNannySetupContext("_set_attrs_from_dataset_handle (wrapper)", 0);
6208   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_4_set_attrs_from_dataset_handle(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
6209 
6210   /* function exit code */
6211   __Pyx_RefNannyFinishContext();
6212   return __pyx_r;
6213 }
6214 
__pyx_pf_8rasterio_5_base_11DatasetBase_4_set_attrs_from_dataset_handle(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)6215 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4_set_attrs_from_dataset_handle(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
6216   GDALDriverH __pyx_v_driver;
6217   CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
6218   PyObject *__pyx_r = NULL;
6219   __Pyx_RefNannyDeclarations
6220   PyObject *__pyx_t_1 = NULL;
6221   PyObject *__pyx_t_2 = NULL;
6222   PyObject *__pyx_t_3 = NULL;
6223   int __pyx_t_4;
6224   PyObject *__pyx_t_5 = NULL;
6225   int __pyx_lineno = 0;
6226   const char *__pyx_filename = NULL;
6227   int __pyx_clineno = 0;
6228   __Pyx_RefNannySetupContext("_set_attrs_from_dataset_handle", 0);
6229 
6230   /* "rasterio/_base.pyx":288
6231  *
6232  *     def _set_attrs_from_dataset_handle(self):
6233  *         cdef GDALDriverH driver = NULL             # <<<<<<<<<<<<<<
6234  *         driver = GDALGetDatasetDriver(self._hds)
6235  *         self.driver = get_driver_name(driver)
6236  */
6237   __pyx_v_driver = NULL;
6238 
6239   /* "rasterio/_base.pyx":289
6240  *     def _set_attrs_from_dataset_handle(self):
6241  *         cdef GDALDriverH driver = NULL
6242  *         driver = GDALGetDatasetDriver(self._hds)             # <<<<<<<<<<<<<<
6243  *         self.driver = get_driver_name(driver)
6244  *         self._count = GDALGetRasterCount(self._hds)
6245  */
6246   __pyx_v_driver = GDALGetDatasetDriver(__pyx_v_self->_hds);
6247 
6248   /* "rasterio/_base.pyx":290
6249  *         cdef GDALDriverH driver = NULL
6250  *         driver = GDALGetDatasetDriver(self._hds)
6251  *         self.driver = get_driver_name(driver)             # <<<<<<<<<<<<<<
6252  *         self._count = GDALGetRasterCount(self._hds)
6253  *         self.width = GDALGetRasterXSize(self._hds)
6254  */
6255   __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_f_8rasterio_5_base_get_driver_name(__pyx_v_driver)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error)
6256   __Pyx_GOTREF(__pyx_t_1);
6257   __Pyx_GIVEREF(__pyx_t_1);
6258   __Pyx_GOTREF(__pyx_v_self->driver);
6259   __Pyx_DECREF(__pyx_v_self->driver);
6260   __pyx_v_self->driver = __pyx_t_1;
6261   __pyx_t_1 = 0;
6262 
6263   /* "rasterio/_base.pyx":291
6264  *         driver = GDALGetDatasetDriver(self._hds)
6265  *         self.driver = get_driver_name(driver)
6266  *         self._count = GDALGetRasterCount(self._hds)             # <<<<<<<<<<<<<<
6267  *         self.width = GDALGetRasterXSize(self._hds)
6268  *         self.height = GDALGetRasterYSize(self._hds)
6269  */
6270   __pyx_t_1 = __Pyx_PyInt_From_int(GDALGetRasterCount(__pyx_v_self->_hds)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error)
6271   __Pyx_GOTREF(__pyx_t_1);
6272   __Pyx_GIVEREF(__pyx_t_1);
6273   __Pyx_GOTREF(__pyx_v_self->_count);
6274   __Pyx_DECREF(__pyx_v_self->_count);
6275   __pyx_v_self->_count = __pyx_t_1;
6276   __pyx_t_1 = 0;
6277 
6278   /* "rasterio/_base.pyx":292
6279  *         self.driver = get_driver_name(driver)
6280  *         self._count = GDALGetRasterCount(self._hds)
6281  *         self.width = GDALGetRasterXSize(self._hds)             # <<<<<<<<<<<<<<
6282  *         self.height = GDALGetRasterYSize(self._hds)
6283  *         self.shape = (self.height, self.width)
6284  */
6285   __pyx_t_1 = __Pyx_PyInt_From_int(GDALGetRasterXSize(__pyx_v_self->_hds)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
6286   __Pyx_GOTREF(__pyx_t_1);
6287   __Pyx_GIVEREF(__pyx_t_1);
6288   __Pyx_GOTREF(__pyx_v_self->width);
6289   __Pyx_DECREF(__pyx_v_self->width);
6290   __pyx_v_self->width = __pyx_t_1;
6291   __pyx_t_1 = 0;
6292 
6293   /* "rasterio/_base.pyx":293
6294  *         self._count = GDALGetRasterCount(self._hds)
6295  *         self.width = GDALGetRasterXSize(self._hds)
6296  *         self.height = GDALGetRasterYSize(self._hds)             # <<<<<<<<<<<<<<
6297  *         self.shape = (self.height, self.width)
6298  *         self._transform = self.read_transform()
6299  */
6300   __pyx_t_1 = __Pyx_PyInt_From_int(GDALGetRasterYSize(__pyx_v_self->_hds)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
6301   __Pyx_GOTREF(__pyx_t_1);
6302   __Pyx_GIVEREF(__pyx_t_1);
6303   __Pyx_GOTREF(__pyx_v_self->height);
6304   __Pyx_DECREF(__pyx_v_self->height);
6305   __pyx_v_self->height = __pyx_t_1;
6306   __pyx_t_1 = 0;
6307 
6308   /* "rasterio/_base.pyx":294
6309  *         self.width = GDALGetRasterXSize(self._hds)
6310  *         self.height = GDALGetRasterYSize(self._hds)
6311  *         self.shape = (self.height, self.width)             # <<<<<<<<<<<<<<
6312  *         self._transform = self.read_transform()
6313  *         self._crs = self.read_crs()
6314  */
6315   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error)
6316   __Pyx_GOTREF(__pyx_t_1);
6317   __Pyx_INCREF(__pyx_v_self->height);
6318   __Pyx_GIVEREF(__pyx_v_self->height);
6319   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->height);
6320   __Pyx_INCREF(__pyx_v_self->width);
6321   __Pyx_GIVEREF(__pyx_v_self->width);
6322   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->width);
6323   __Pyx_GIVEREF(__pyx_t_1);
6324   __Pyx_GOTREF(__pyx_v_self->shape);
6325   __Pyx_DECREF(__pyx_v_self->shape);
6326   __pyx_v_self->shape = __pyx_t_1;
6327   __pyx_t_1 = 0;
6328 
6329   /* "rasterio/_base.pyx":295
6330  *         self.height = GDALGetRasterYSize(self._hds)
6331  *         self.shape = (self.height, self.width)
6332  *         self._transform = self.read_transform()             # <<<<<<<<<<<<<<
6333  *         self._crs = self.read_crs()
6334  *
6335  */
6336   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_transform); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error)
6337   __Pyx_GOTREF(__pyx_t_2);
6338   __pyx_t_3 = NULL;
6339   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
6340     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
6341     if (likely(__pyx_t_3)) {
6342       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6343       __Pyx_INCREF(__pyx_t_3);
6344       __Pyx_INCREF(function);
6345       __Pyx_DECREF_SET(__pyx_t_2, function);
6346     }
6347   }
6348   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
6349   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6350   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
6351   __Pyx_GOTREF(__pyx_t_1);
6352   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6353   __Pyx_GIVEREF(__pyx_t_1);
6354   __Pyx_GOTREF(__pyx_v_self->_transform);
6355   __Pyx_DECREF(__pyx_v_self->_transform);
6356   __pyx_v_self->_transform = __pyx_t_1;
6357   __pyx_t_1 = 0;
6358 
6359   /* "rasterio/_base.pyx":296
6360  *         self.shape = (self.height, self.width)
6361  *         self._transform = self.read_transform()
6362  *         self._crs = self.read_crs()             # <<<<<<<<<<<<<<
6363  *
6364  *         # touch self.meta, triggering data type evaluation.
6365  */
6366   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_crs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error)
6367   __Pyx_GOTREF(__pyx_t_2);
6368   __pyx_t_3 = NULL;
6369   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
6370     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
6371     if (likely(__pyx_t_3)) {
6372       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6373       __Pyx_INCREF(__pyx_t_3);
6374       __Pyx_INCREF(function);
6375       __Pyx_DECREF_SET(__pyx_t_2, function);
6376     }
6377   }
6378   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
6379   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6380   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error)
6381   __Pyx_GOTREF(__pyx_t_1);
6382   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6383   __Pyx_GIVEREF(__pyx_t_1);
6384   __Pyx_GOTREF(__pyx_v_self->_crs);
6385   __Pyx_DECREF(__pyx_v_self->_crs);
6386   __pyx_v_self->_crs = __pyx_t_1;
6387   __pyx_t_1 = 0;
6388 
6389   /* "rasterio/_base.pyx":299
6390  *
6391  *         # touch self.meta, triggering data type evaluation.
6392  *         _ = self.meta             # <<<<<<<<<<<<<<
6393  *
6394  *         self._closed = False
6395  */
6396   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_meta); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error)
6397   __Pyx_GOTREF(__pyx_t_1);
6398   __pyx_v__ = __pyx_t_1;
6399   __pyx_t_1 = 0;
6400 
6401   /* "rasterio/_base.pyx":301
6402  *         _ = self.meta
6403  *
6404  *         self._closed = False             # <<<<<<<<<<<<<<
6405  *         log.debug("Dataset %r is started.", self)
6406  *
6407  */
6408   __Pyx_INCREF(Py_False);
6409   __Pyx_GIVEREF(Py_False);
6410   __Pyx_GOTREF(__pyx_v_self->_closed);
6411   __Pyx_DECREF(__pyx_v_self->_closed);
6412   __pyx_v_self->_closed = Py_False;
6413 
6414   /* "rasterio/_base.pyx":302
6415  *
6416  *         self._closed = False
6417  *         log.debug("Dataset %r is started.", self)             # <<<<<<<<<<<<<<
6418  *
6419  *     cdef GDALDatasetH handle(self) except NULL:
6420  */
6421   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error)
6422   __Pyx_GOTREF(__pyx_t_2);
6423   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error)
6424   __Pyx_GOTREF(__pyx_t_3);
6425   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6426   __pyx_t_2 = NULL;
6427   __pyx_t_4 = 0;
6428   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
6429     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
6430     if (likely(__pyx_t_2)) {
6431       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
6432       __Pyx_INCREF(__pyx_t_2);
6433       __Pyx_INCREF(function);
6434       __Pyx_DECREF_SET(__pyx_t_3, function);
6435       __pyx_t_4 = 1;
6436     }
6437   }
6438   #if CYTHON_FAST_PYCALL
6439   if (PyFunction_Check(__pyx_t_3)) {
6440     PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_u_Dataset_r_is_started, ((PyObject *)__pyx_v_self)};
6441     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
6442     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6443     __Pyx_GOTREF(__pyx_t_1);
6444   } else
6445   #endif
6446   #if CYTHON_FAST_PYCCALL
6447   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
6448     PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_u_Dataset_r_is_started, ((PyObject *)__pyx_v_self)};
6449     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
6450     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6451     __Pyx_GOTREF(__pyx_t_1);
6452   } else
6453   #endif
6454   {
6455     __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 302, __pyx_L1_error)
6456     __Pyx_GOTREF(__pyx_t_5);
6457     if (__pyx_t_2) {
6458       __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
6459     }
6460     __Pyx_INCREF(__pyx_kp_u_Dataset_r_is_started);
6461     __Pyx_GIVEREF(__pyx_kp_u_Dataset_r_is_started);
6462     PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_kp_u_Dataset_r_is_started);
6463     __Pyx_INCREF(((PyObject *)__pyx_v_self));
6464     __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
6465     PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, ((PyObject *)__pyx_v_self));
6466     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
6467     __Pyx_GOTREF(__pyx_t_1);
6468     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6469   }
6470   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6471   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6472 
6473   /* "rasterio/_base.pyx":287
6474  *             self.mode)
6475  *
6476  *     def _set_attrs_from_dataset_handle(self):             # <<<<<<<<<<<<<<
6477  *         cdef GDALDriverH driver = NULL
6478  *         driver = GDALGetDatasetDriver(self._hds)
6479  */
6480 
6481   /* function exit code */
6482   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6483   goto __pyx_L0;
6484   __pyx_L1_error:;
6485   __Pyx_XDECREF(__pyx_t_1);
6486   __Pyx_XDECREF(__pyx_t_2);
6487   __Pyx_XDECREF(__pyx_t_3);
6488   __Pyx_XDECREF(__pyx_t_5);
6489   __Pyx_AddTraceback("rasterio._base.DatasetBase._set_attrs_from_dataset_handle", __pyx_clineno, __pyx_lineno, __pyx_filename);
6490   __pyx_r = NULL;
6491   __pyx_L0:;
6492   __Pyx_XDECREF(__pyx_v__);
6493   __Pyx_XGIVEREF(__pyx_r);
6494   __Pyx_RefNannyFinishContext();
6495   return __pyx_r;
6496 }
6497 
6498 /* "rasterio/_base.pyx":304
6499  *         log.debug("Dataset %r is started.", self)
6500  *
6501  *     cdef GDALDatasetH handle(self) except NULL:             # <<<<<<<<<<<<<<
6502  *         """Return the object's GDAL dataset handle"""
6503  *         if self._hds == NULL:
6504  */
6505 
__pyx_f_8rasterio_5_base_11DatasetBase_handle(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)6506 static GDALDatasetH __pyx_f_8rasterio_5_base_11DatasetBase_handle(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
6507   GDALDatasetH __pyx_r;
6508   __Pyx_RefNannyDeclarations
6509   int __pyx_t_1;
6510   PyObject *__pyx_t_2 = NULL;
6511   PyObject *__pyx_t_3 = NULL;
6512   PyObject *__pyx_t_4 = NULL;
6513   PyObject *__pyx_t_5 = NULL;
6514   PyObject *__pyx_t_6 = NULL;
6515   int __pyx_lineno = 0;
6516   const char *__pyx_filename = NULL;
6517   int __pyx_clineno = 0;
6518   __Pyx_RefNannySetupContext("handle", 0);
6519 
6520   /* "rasterio/_base.pyx":306
6521  *     cdef GDALDatasetH handle(self) except NULL:
6522  *         """Return the object's GDAL dataset handle"""
6523  *         if self._hds == NULL:             # <<<<<<<<<<<<<<
6524  *             raise RasterioIOError("Dataset is closed: {}".format(self.name))
6525  *         else:
6526  */
6527   __pyx_t_1 = ((__pyx_v_self->_hds == NULL) != 0);
6528   if (unlikely(__pyx_t_1)) {
6529 
6530     /* "rasterio/_base.pyx":307
6531  *         """Return the object's GDAL dataset handle"""
6532  *         if self._hds == NULL:
6533  *             raise RasterioIOError("Dataset is closed: {}".format(self.name))             # <<<<<<<<<<<<<<
6534  *         else:
6535  *             return self._hds
6536  */
6537     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RasterioIOError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 307, __pyx_L1_error)
6538     __Pyx_GOTREF(__pyx_t_3);
6539     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Dataset_is_closed, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 307, __pyx_L1_error)
6540     __Pyx_GOTREF(__pyx_t_5);
6541     __pyx_t_6 = NULL;
6542     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6543       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
6544       if (likely(__pyx_t_6)) {
6545         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6546         __Pyx_INCREF(__pyx_t_6);
6547         __Pyx_INCREF(function);
6548         __Pyx_DECREF_SET(__pyx_t_5, function);
6549       }
6550     }
6551     __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_self->name) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_self->name);
6552     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6553     if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 307, __pyx_L1_error)
6554     __Pyx_GOTREF(__pyx_t_4);
6555     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6556     __pyx_t_5 = NULL;
6557     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
6558       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
6559       if (likely(__pyx_t_5)) {
6560         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
6561         __Pyx_INCREF(__pyx_t_5);
6562         __Pyx_INCREF(function);
6563         __Pyx_DECREF_SET(__pyx_t_3, function);
6564       }
6565     }
6566     __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
6567     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6568     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6569     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error)
6570     __Pyx_GOTREF(__pyx_t_2);
6571     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6572     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
6573     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6574     __PYX_ERR(0, 307, __pyx_L1_error)
6575 
6576     /* "rasterio/_base.pyx":306
6577  *     cdef GDALDatasetH handle(self) except NULL:
6578  *         """Return the object's GDAL dataset handle"""
6579  *         if self._hds == NULL:             # <<<<<<<<<<<<<<
6580  *             raise RasterioIOError("Dataset is closed: {}".format(self.name))
6581  *         else:
6582  */
6583   }
6584 
6585   /* "rasterio/_base.pyx":309
6586  *             raise RasterioIOError("Dataset is closed: {}".format(self.name))
6587  *         else:
6588  *             return self._hds             # <<<<<<<<<<<<<<
6589  *
6590  *     cdef GDALRasterBandH band(self, int bidx) except NULL:
6591  */
6592   /*else*/ {
6593     __pyx_r = __pyx_v_self->_hds;
6594     goto __pyx_L0;
6595   }
6596 
6597   /* "rasterio/_base.pyx":304
6598  *         log.debug("Dataset %r is started.", self)
6599  *
6600  *     cdef GDALDatasetH handle(self) except NULL:             # <<<<<<<<<<<<<<
6601  *         """Return the object's GDAL dataset handle"""
6602  *         if self._hds == NULL:
6603  */
6604 
6605   /* function exit code */
6606   __pyx_L1_error:;
6607   __Pyx_XDECREF(__pyx_t_2);
6608   __Pyx_XDECREF(__pyx_t_3);
6609   __Pyx_XDECREF(__pyx_t_4);
6610   __Pyx_XDECREF(__pyx_t_5);
6611   __Pyx_XDECREF(__pyx_t_6);
6612   __Pyx_AddTraceback("rasterio._base.DatasetBase.handle", __pyx_clineno, __pyx_lineno, __pyx_filename);
6613   __pyx_r = NULL;
6614   __pyx_L0:;
6615   __Pyx_RefNannyFinishContext();
6616   return __pyx_r;
6617 }
6618 
6619 /* "rasterio/_base.pyx":311
6620  *             return self._hds
6621  *
6622  *     cdef GDALRasterBandH band(self, int bidx) except NULL:             # <<<<<<<<<<<<<<
6623  *         """Return a GDAL raster band handle"""
6624  *         cdef GDALRasterBandH band = NULL
6625  */
6626 
__pyx_f_8rasterio_5_base_11DatasetBase_band(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,int __pyx_v_bidx)6627 static GDALRasterBandH __pyx_f_8rasterio_5_base_11DatasetBase_band(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, int __pyx_v_bidx) {
6628   GDALRasterBandH __pyx_v_band;
6629   GDALRasterBandH __pyx_r;
6630   __Pyx_RefNannyDeclarations
6631   GDALDatasetH __pyx_t_1;
6632   int __pyx_t_2;
6633   PyObject *__pyx_t_3 = NULL;
6634   PyObject *__pyx_t_4 = NULL;
6635   PyObject *__pyx_t_5 = NULL;
6636   PyObject *__pyx_t_6 = NULL;
6637   int __pyx_lineno = 0;
6638   const char *__pyx_filename = NULL;
6639   int __pyx_clineno = 0;
6640   __Pyx_RefNannySetupContext("band", 0);
6641 
6642   /* "rasterio/_base.pyx":313
6643  *     cdef GDALRasterBandH band(self, int bidx) except NULL:
6644  *         """Return a GDAL raster band handle"""
6645  *         cdef GDALRasterBandH band = NULL             # <<<<<<<<<<<<<<
6646  *         band = GDALGetRasterBand(self.handle(), bidx)
6647  *         if band == NULL:
6648  */
6649   __pyx_v_band = NULL;
6650 
6651   /* "rasterio/_base.pyx":314
6652  *         """Return a GDAL raster band handle"""
6653  *         cdef GDALRasterBandH band = NULL
6654  *         band = GDALGetRasterBand(self.handle(), bidx)             # <<<<<<<<<<<<<<
6655  *         if band == NULL:
6656  *             raise IndexError("No such band index: {!s}".format(bidx))
6657  */
6658   __pyx_t_1 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->handle(__pyx_v_self); if (unlikely(__pyx_t_1 == ((GDALDatasetH)NULL))) __PYX_ERR(0, 314, __pyx_L1_error)
6659   __pyx_v_band = GDALGetRasterBand(__pyx_t_1, __pyx_v_bidx);
6660 
6661   /* "rasterio/_base.pyx":315
6662  *         cdef GDALRasterBandH band = NULL
6663  *         band = GDALGetRasterBand(self.handle(), bidx)
6664  *         if band == NULL:             # <<<<<<<<<<<<<<
6665  *             raise IndexError("No such band index: {!s}".format(bidx))
6666  *         return band
6667  */
6668   __pyx_t_2 = ((__pyx_v_band == NULL) != 0);
6669   if (unlikely(__pyx_t_2)) {
6670 
6671     /* "rasterio/_base.pyx":316
6672  *         band = GDALGetRasterBand(self.handle(), bidx)
6673  *         if band == NULL:
6674  *             raise IndexError("No such band index: {!s}".format(bidx))             # <<<<<<<<<<<<<<
6675  *         return band
6676  *
6677  */
6678     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_No_such_band_index_s, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 316, __pyx_L1_error)
6679     __Pyx_GOTREF(__pyx_t_4);
6680     __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_bidx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 316, __pyx_L1_error)
6681     __Pyx_GOTREF(__pyx_t_5);
6682     __pyx_t_6 = NULL;
6683     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
6684       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
6685       if (likely(__pyx_t_6)) {
6686         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
6687         __Pyx_INCREF(__pyx_t_6);
6688         __Pyx_INCREF(function);
6689         __Pyx_DECREF_SET(__pyx_t_4, function);
6690       }
6691     }
6692     __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
6693     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6694     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6695     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
6696     __Pyx_GOTREF(__pyx_t_3);
6697     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6698     __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 316, __pyx_L1_error)
6699     __Pyx_GOTREF(__pyx_t_4);
6700     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6701     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6702     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6703     __PYX_ERR(0, 316, __pyx_L1_error)
6704 
6705     /* "rasterio/_base.pyx":315
6706  *         cdef GDALRasterBandH band = NULL
6707  *         band = GDALGetRasterBand(self.handle(), bidx)
6708  *         if band == NULL:             # <<<<<<<<<<<<<<
6709  *             raise IndexError("No such band index: {!s}".format(bidx))
6710  *         return band
6711  */
6712   }
6713 
6714   /* "rasterio/_base.pyx":317
6715  *         if band == NULL:
6716  *             raise IndexError("No such band index: {!s}".format(bidx))
6717  *         return band             # <<<<<<<<<<<<<<
6718  *
6719  *     def _has_band(self, bidx):
6720  */
6721   __pyx_r = __pyx_v_band;
6722   goto __pyx_L0;
6723 
6724   /* "rasterio/_base.pyx":311
6725  *             return self._hds
6726  *
6727  *     cdef GDALRasterBandH band(self, int bidx) except NULL:             # <<<<<<<<<<<<<<
6728  *         """Return a GDAL raster band handle"""
6729  *         cdef GDALRasterBandH band = NULL
6730  */
6731 
6732   /* function exit code */
6733   __pyx_L1_error:;
6734   __Pyx_XDECREF(__pyx_t_3);
6735   __Pyx_XDECREF(__pyx_t_4);
6736   __Pyx_XDECREF(__pyx_t_5);
6737   __Pyx_XDECREF(__pyx_t_6);
6738   __Pyx_AddTraceback("rasterio._base.DatasetBase.band", __pyx_clineno, __pyx_lineno, __pyx_filename);
6739   __pyx_r = NULL;
6740   __pyx_L0:;
6741   __Pyx_RefNannyFinishContext();
6742   return __pyx_r;
6743 }
6744 
6745 /* "rasterio/_base.pyx":319
6746  *         return band
6747  *
6748  *     def _has_band(self, bidx):             # <<<<<<<<<<<<<<
6749  *         cdef GDALRasterBandH band = NULL
6750  *         try:
6751  */
6752 
6753 /* Python wrapper */
6754 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7_has_band(PyObject *__pyx_v_self, PyObject *__pyx_v_bidx); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7_has_band(PyObject * __pyx_v_self,PyObject * __pyx_v_bidx)6755 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7_has_band(PyObject *__pyx_v_self, PyObject *__pyx_v_bidx) {
6756   PyObject *__pyx_r = 0;
6757   __Pyx_RefNannyDeclarations
6758   __Pyx_RefNannySetupContext("_has_band (wrapper)", 0);
6759   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6_has_band(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_bidx));
6760 
6761   /* function exit code */
6762   __Pyx_RefNannyFinishContext();
6763   return __pyx_r;
6764 }
6765 
__pyx_pf_8rasterio_5_base_11DatasetBase_6_has_band(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_bidx)6766 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6_has_band(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx) {
6767   CYTHON_UNUSED GDALRasterBandH __pyx_v_band;
6768   PyObject *__pyx_r = NULL;
6769   __Pyx_RefNannyDeclarations
6770   PyObject *__pyx_t_1 = NULL;
6771   PyObject *__pyx_t_2 = NULL;
6772   PyObject *__pyx_t_3 = NULL;
6773   int __pyx_t_4;
6774   GDALRasterBandH __pyx_t_5;
6775   PyObject *__pyx_t_6 = NULL;
6776   PyObject *__pyx_t_7 = NULL;
6777   PyObject *__pyx_t_8 = NULL;
6778   int __pyx_lineno = 0;
6779   const char *__pyx_filename = NULL;
6780   int __pyx_clineno = 0;
6781   __Pyx_RefNannySetupContext("_has_band", 0);
6782 
6783   /* "rasterio/_base.pyx":320
6784  *
6785  *     def _has_band(self, bidx):
6786  *         cdef GDALRasterBandH band = NULL             # <<<<<<<<<<<<<<
6787  *         try:
6788  *             band = self.band(bidx)
6789  */
6790   __pyx_v_band = NULL;
6791 
6792   /* "rasterio/_base.pyx":321
6793  *     def _has_band(self, bidx):
6794  *         cdef GDALRasterBandH band = NULL
6795  *         try:             # <<<<<<<<<<<<<<
6796  *             band = self.band(bidx)
6797  *             return True
6798  */
6799   {
6800     __Pyx_PyThreadState_declare
6801     __Pyx_PyThreadState_assign
6802     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6803     __Pyx_XGOTREF(__pyx_t_1);
6804     __Pyx_XGOTREF(__pyx_t_2);
6805     __Pyx_XGOTREF(__pyx_t_3);
6806     /*try:*/ {
6807 
6808       /* "rasterio/_base.pyx":322
6809  *         cdef GDALRasterBandH band = NULL
6810  *         try:
6811  *             band = self.band(bidx)             # <<<<<<<<<<<<<<
6812  *             return True
6813  *         except:
6814  */
6815       __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_bidx); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L3_error)
6816       __pyx_t_5 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_4); if (unlikely(__pyx_t_5 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 322, __pyx_L3_error)
6817       __pyx_v_band = __pyx_t_5;
6818 
6819       /* "rasterio/_base.pyx":323
6820  *         try:
6821  *             band = self.band(bidx)
6822  *             return True             # <<<<<<<<<<<<<<
6823  *         except:
6824  *             return False
6825  */
6826       __Pyx_XDECREF(__pyx_r);
6827       __Pyx_INCREF(Py_True);
6828       __pyx_r = Py_True;
6829       goto __pyx_L7_try_return;
6830 
6831       /* "rasterio/_base.pyx":321
6832  *     def _has_band(self, bidx):
6833  *         cdef GDALRasterBandH band = NULL
6834  *         try:             # <<<<<<<<<<<<<<
6835  *             band = self.band(bidx)
6836  *             return True
6837  */
6838     }
6839     __pyx_L3_error:;
6840 
6841     /* "rasterio/_base.pyx":324
6842  *             band = self.band(bidx)
6843  *             return True
6844  *         except:             # <<<<<<<<<<<<<<
6845  *             return False
6846  *
6847  */
6848     /*except:*/ {
6849       __Pyx_AddTraceback("rasterio._base.DatasetBase._has_band", __pyx_clineno, __pyx_lineno, __pyx_filename);
6850       if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(0, 324, __pyx_L5_except_error)
6851       __Pyx_GOTREF(__pyx_t_6);
6852       __Pyx_GOTREF(__pyx_t_7);
6853       __Pyx_GOTREF(__pyx_t_8);
6854 
6855       /* "rasterio/_base.pyx":325
6856  *             return True
6857  *         except:
6858  *             return False             # <<<<<<<<<<<<<<
6859  *
6860  *     def _handle_crswkt(self, wkt):
6861  */
6862       __Pyx_XDECREF(__pyx_r);
6863       __Pyx_INCREF(Py_False);
6864       __pyx_r = Py_False;
6865       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6866       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6867       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6868       goto __pyx_L6_except_return;
6869     }
6870     __pyx_L5_except_error:;
6871 
6872     /* "rasterio/_base.pyx":321
6873  *     def _has_band(self, bidx):
6874  *         cdef GDALRasterBandH band = NULL
6875  *         try:             # <<<<<<<<<<<<<<
6876  *             band = self.band(bidx)
6877  *             return True
6878  */
6879     __Pyx_XGIVEREF(__pyx_t_1);
6880     __Pyx_XGIVEREF(__pyx_t_2);
6881     __Pyx_XGIVEREF(__pyx_t_3);
6882     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6883     goto __pyx_L1_error;
6884     __pyx_L7_try_return:;
6885     __Pyx_XGIVEREF(__pyx_t_1);
6886     __Pyx_XGIVEREF(__pyx_t_2);
6887     __Pyx_XGIVEREF(__pyx_t_3);
6888     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6889     goto __pyx_L0;
6890     __pyx_L6_except_return:;
6891     __Pyx_XGIVEREF(__pyx_t_1);
6892     __Pyx_XGIVEREF(__pyx_t_2);
6893     __Pyx_XGIVEREF(__pyx_t_3);
6894     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6895     goto __pyx_L0;
6896   }
6897 
6898   /* "rasterio/_base.pyx":319
6899  *         return band
6900  *
6901  *     def _has_band(self, bidx):             # <<<<<<<<<<<<<<
6902  *         cdef GDALRasterBandH band = NULL
6903  *         try:
6904  */
6905 
6906   /* function exit code */
6907   __pyx_L1_error:;
6908   __Pyx_XDECREF(__pyx_t_6);
6909   __Pyx_XDECREF(__pyx_t_7);
6910   __Pyx_XDECREF(__pyx_t_8);
6911   __Pyx_AddTraceback("rasterio._base.DatasetBase._has_band", __pyx_clineno, __pyx_lineno, __pyx_filename);
6912   __pyx_r = NULL;
6913   __pyx_L0:;
6914   __Pyx_XGIVEREF(__pyx_r);
6915   __Pyx_RefNannyFinishContext();
6916   return __pyx_r;
6917 }
6918 
6919 /* "rasterio/_base.pyx":327
6920  *             return False
6921  *
6922  *     def _handle_crswkt(self, wkt):             # <<<<<<<<<<<<<<
6923  *         """Return the GDAL dataset's stored CRS"""
6924  *         # No dialect morphing, if the dataset was created using software
6925  */
6926 
6927 /* Python wrapper */
6928 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_9_handle_crswkt(PyObject *__pyx_v_self, PyObject *__pyx_v_wkt); /*proto*/
6929 static char __pyx_doc_8rasterio_5_base_11DatasetBase_8_handle_crswkt[] = "Return the GDAL dataset's stored CRS";
__pyx_pw_8rasterio_5_base_11DatasetBase_9_handle_crswkt(PyObject * __pyx_v_self,PyObject * __pyx_v_wkt)6930 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_9_handle_crswkt(PyObject *__pyx_v_self, PyObject *__pyx_v_wkt) {
6931   PyObject *__pyx_r = 0;
6932   __Pyx_RefNannyDeclarations
6933   __Pyx_RefNannySetupContext("_handle_crswkt (wrapper)", 0);
6934   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_8_handle_crswkt(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_wkt));
6935 
6936   /* function exit code */
6937   __Pyx_RefNannyFinishContext();
6938   return __pyx_r;
6939 }
6940 
__pyx_pf_8rasterio_5_base_11DatasetBase_8_handle_crswkt(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_wkt)6941 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_8_handle_crswkt(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_wkt) {
6942   PyObject *__pyx_r = NULL;
6943   __Pyx_RefNannyDeclarations
6944   int __pyx_t_1;
6945   PyObject *__pyx_t_2 = NULL;
6946   PyObject *__pyx_t_3 = NULL;
6947   PyObject *__pyx_t_4 = NULL;
6948   int __pyx_lineno = 0;
6949   const char *__pyx_filename = NULL;
6950   int __pyx_clineno = 0;
6951   __Pyx_RefNannySetupContext("_handle_crswkt", 0);
6952 
6953   /* "rasterio/_base.pyx":331
6954  *         # No dialect morphing, if the dataset was created using software
6955  *         # "speaking" the Esri dialect, we will read Esri WKT.
6956  *         if wkt:             # <<<<<<<<<<<<<<
6957  *             return CRS.from_wkt(wkt)
6958  *         else:
6959  */
6960   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_wkt); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 331, __pyx_L1_error)
6961   if (__pyx_t_1) {
6962 
6963     /* "rasterio/_base.pyx":332
6964  *         # "speaking" the Esri dialect, we will read Esri WKT.
6965  *         if wkt:
6966  *             return CRS.from_wkt(wkt)             # <<<<<<<<<<<<<<
6967  *         else:
6968  *             return None
6969  */
6970     __Pyx_XDECREF(__pyx_r);
6971     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CRS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
6972     __Pyx_GOTREF(__pyx_t_3);
6973     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_from_wkt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error)
6974     __Pyx_GOTREF(__pyx_t_4);
6975     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6976     __pyx_t_3 = NULL;
6977     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
6978       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
6979       if (likely(__pyx_t_3)) {
6980         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
6981         __Pyx_INCREF(__pyx_t_3);
6982         __Pyx_INCREF(function);
6983         __Pyx_DECREF_SET(__pyx_t_4, function);
6984       }
6985     }
6986     __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_wkt) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_wkt);
6987     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6988     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error)
6989     __Pyx_GOTREF(__pyx_t_2);
6990     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6991     __pyx_r = __pyx_t_2;
6992     __pyx_t_2 = 0;
6993     goto __pyx_L0;
6994 
6995     /* "rasterio/_base.pyx":331
6996  *         # No dialect morphing, if the dataset was created using software
6997  *         # "speaking" the Esri dialect, we will read Esri WKT.
6998  *         if wkt:             # <<<<<<<<<<<<<<
6999  *             return CRS.from_wkt(wkt)
7000  *         else:
7001  */
7002   }
7003 
7004   /* "rasterio/_base.pyx":334
7005  *             return CRS.from_wkt(wkt)
7006  *         else:
7007  *             return None             # <<<<<<<<<<<<<<
7008  *
7009  *     def _has_gcps_or_rpcs(self):
7010  */
7011   /*else*/ {
7012     __Pyx_XDECREF(__pyx_r);
7013     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7014     goto __pyx_L0;
7015   }
7016 
7017   /* "rasterio/_base.pyx":327
7018  *             return False
7019  *
7020  *     def _handle_crswkt(self, wkt):             # <<<<<<<<<<<<<<
7021  *         """Return the GDAL dataset's stored CRS"""
7022  *         # No dialect morphing, if the dataset was created using software
7023  */
7024 
7025   /* function exit code */
7026   __pyx_L1_error:;
7027   __Pyx_XDECREF(__pyx_t_2);
7028   __Pyx_XDECREF(__pyx_t_3);
7029   __Pyx_XDECREF(__pyx_t_4);
7030   __Pyx_AddTraceback("rasterio._base.DatasetBase._handle_crswkt", __pyx_clineno, __pyx_lineno, __pyx_filename);
7031   __pyx_r = NULL;
7032   __pyx_L0:;
7033   __Pyx_XGIVEREF(__pyx_r);
7034   __Pyx_RefNannyFinishContext();
7035   return __pyx_r;
7036 }
7037 
7038 /* "rasterio/_base.pyx":336
7039  *             return None
7040  *
7041  *     def _has_gcps_or_rpcs(self):             # <<<<<<<<<<<<<<
7042  *         """Check if we have gcps or rpcs"""
7043  *         cdef int num_gcps
7044  */
7045 
7046 /* Python wrapper */
7047 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_11_has_gcps_or_rpcs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
7048 static char __pyx_doc_8rasterio_5_base_11DatasetBase_10_has_gcps_or_rpcs[] = "Check if we have gcps or rpcs";
__pyx_pw_8rasterio_5_base_11DatasetBase_11_has_gcps_or_rpcs(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)7049 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_11_has_gcps_or_rpcs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7050   PyObject *__pyx_r = 0;
7051   __Pyx_RefNannyDeclarations
7052   __Pyx_RefNannySetupContext("_has_gcps_or_rpcs (wrapper)", 0);
7053   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_10_has_gcps_or_rpcs(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
7054 
7055   /* function exit code */
7056   __Pyx_RefNannyFinishContext();
7057   return __pyx_r;
7058 }
7059 
__pyx_pf_8rasterio_5_base_11DatasetBase_10_has_gcps_or_rpcs(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)7060 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_10_has_gcps_or_rpcs(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
7061   int __pyx_v_num_gcps;
7062   PyObject *__pyx_v_rpcs = NULL;
7063   PyObject *__pyx_r = NULL;
7064   __Pyx_RefNannyDeclarations
7065   GDALDatasetH __pyx_t_1;
7066   int __pyx_t_2;
7067   PyObject *__pyx_t_3 = NULL;
7068   PyObject *__pyx_t_4 = NULL;
7069   PyObject *__pyx_t_5 = NULL;
7070   int __pyx_lineno = 0;
7071   const char *__pyx_filename = NULL;
7072   int __pyx_clineno = 0;
7073   __Pyx_RefNannySetupContext("_has_gcps_or_rpcs", 0);
7074 
7075   /* "rasterio/_base.pyx":340
7076  *         cdef int num_gcps
7077  *
7078  *         num_gcps = GDALGetGCPCount(self.handle())             # <<<<<<<<<<<<<<
7079  *         if num_gcps:
7080  *             return True
7081  */
7082   __pyx_t_1 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->handle(__pyx_v_self); if (unlikely(__pyx_t_1 == ((GDALDatasetH)NULL))) __PYX_ERR(0, 340, __pyx_L1_error)
7083   __pyx_v_num_gcps = GDALGetGCPCount(__pyx_t_1);
7084 
7085   /* "rasterio/_base.pyx":341
7086  *
7087  *         num_gcps = GDALGetGCPCount(self.handle())
7088  *         if num_gcps:             # <<<<<<<<<<<<<<
7089  *             return True
7090  *
7091  */
7092   __pyx_t_2 = (__pyx_v_num_gcps != 0);
7093   if (__pyx_t_2) {
7094 
7095     /* "rasterio/_base.pyx":342
7096  *         num_gcps = GDALGetGCPCount(self.handle())
7097  *         if num_gcps:
7098  *             return True             # <<<<<<<<<<<<<<
7099  *
7100  *         rpcs = self.tags(ns="RPC")
7101  */
7102     __Pyx_XDECREF(__pyx_r);
7103     __Pyx_INCREF(Py_True);
7104     __pyx_r = Py_True;
7105     goto __pyx_L0;
7106 
7107     /* "rasterio/_base.pyx":341
7108  *
7109  *         num_gcps = GDALGetGCPCount(self.handle())
7110  *         if num_gcps:             # <<<<<<<<<<<<<<
7111  *             return True
7112  *
7113  */
7114   }
7115 
7116   /* "rasterio/_base.pyx":344
7117  *             return True
7118  *
7119  *         rpcs = self.tags(ns="RPC")             # <<<<<<<<<<<<<<
7120  *         if rpcs:
7121  *             return True
7122  */
7123   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 344, __pyx_L1_error)
7124   __Pyx_GOTREF(__pyx_t_3);
7125   __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 344, __pyx_L1_error)
7126   __Pyx_GOTREF(__pyx_t_4);
7127   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_ns, __pyx_n_u_RPC) < 0) __PYX_ERR(0, 344, __pyx_L1_error)
7128   __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 344, __pyx_L1_error)
7129   __Pyx_GOTREF(__pyx_t_5);
7130   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7131   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7132   __pyx_v_rpcs = __pyx_t_5;
7133   __pyx_t_5 = 0;
7134 
7135   /* "rasterio/_base.pyx":345
7136  *
7137  *         rpcs = self.tags(ns="RPC")
7138  *         if rpcs:             # <<<<<<<<<<<<<<
7139  *             return True
7140  *
7141  */
7142   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_rpcs); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 345, __pyx_L1_error)
7143   if (__pyx_t_2) {
7144 
7145     /* "rasterio/_base.pyx":346
7146  *         rpcs = self.tags(ns="RPC")
7147  *         if rpcs:
7148  *             return True             # <<<<<<<<<<<<<<
7149  *
7150  *         return False
7151  */
7152     __Pyx_XDECREF(__pyx_r);
7153     __Pyx_INCREF(Py_True);
7154     __pyx_r = Py_True;
7155     goto __pyx_L0;
7156 
7157     /* "rasterio/_base.pyx":345
7158  *
7159  *         rpcs = self.tags(ns="RPC")
7160  *         if rpcs:             # <<<<<<<<<<<<<<
7161  *             return True
7162  *
7163  */
7164   }
7165 
7166   /* "rasterio/_base.pyx":348
7167  *             return True
7168  *
7169  *         return False             # <<<<<<<<<<<<<<
7170  *
7171  *     def read_crs(self):
7172  */
7173   __Pyx_XDECREF(__pyx_r);
7174   __Pyx_INCREF(Py_False);
7175   __pyx_r = Py_False;
7176   goto __pyx_L0;
7177 
7178   /* "rasterio/_base.pyx":336
7179  *             return None
7180  *
7181  *     def _has_gcps_or_rpcs(self):             # <<<<<<<<<<<<<<
7182  *         """Check if we have gcps or rpcs"""
7183  *         cdef int num_gcps
7184  */
7185 
7186   /* function exit code */
7187   __pyx_L1_error:;
7188   __Pyx_XDECREF(__pyx_t_3);
7189   __Pyx_XDECREF(__pyx_t_4);
7190   __Pyx_XDECREF(__pyx_t_5);
7191   __Pyx_AddTraceback("rasterio._base.DatasetBase._has_gcps_or_rpcs", __pyx_clineno, __pyx_lineno, __pyx_filename);
7192   __pyx_r = NULL;
7193   __pyx_L0:;
7194   __Pyx_XDECREF(__pyx_v_rpcs);
7195   __Pyx_XGIVEREF(__pyx_r);
7196   __Pyx_RefNannyFinishContext();
7197   return __pyx_r;
7198 }
7199 
7200 /* "rasterio/_base.pyx":350
7201  *         return False
7202  *
7203  *     def read_crs(self):             # <<<<<<<<<<<<<<
7204  *         """Return the GDAL dataset's stored CRS"""
7205  *         cdef const char *wkt = GDALGetProjectionRef(self.handle())
7206  */
7207 
7208 /* Python wrapper */
7209 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_13read_crs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
7210 static char __pyx_doc_8rasterio_5_base_11DatasetBase_12read_crs[] = "Return the GDAL dataset's stored CRS";
__pyx_pw_8rasterio_5_base_11DatasetBase_13read_crs(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)7211 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_13read_crs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7212   PyObject *__pyx_r = 0;
7213   __Pyx_RefNannyDeclarations
7214   __Pyx_RefNannySetupContext("read_crs (wrapper)", 0);
7215   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_12read_crs(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
7216 
7217   /* function exit code */
7218   __Pyx_RefNannyFinishContext();
7219   return __pyx_r;
7220 }
7221 
__pyx_pf_8rasterio_5_base_11DatasetBase_12read_crs(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)7222 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_12read_crs(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
7223   char const *__pyx_v_wkt;
7224   PyObject *__pyx_r = NULL;
7225   __Pyx_RefNannyDeclarations
7226   GDALDatasetH __pyx_t_1;
7227   int __pyx_t_2;
7228   PyObject *__pyx_t_3 = NULL;
7229   PyObject *__pyx_t_4 = NULL;
7230   PyObject *__pyx_t_5 = NULL;
7231   PyObject *__pyx_t_6 = NULL;
7232   int __pyx_lineno = 0;
7233   const char *__pyx_filename = NULL;
7234   int __pyx_clineno = 0;
7235   __Pyx_RefNannySetupContext("read_crs", 0);
7236 
7237   /* "rasterio/_base.pyx":352
7238  *     def read_crs(self):
7239  *         """Return the GDAL dataset's stored CRS"""
7240  *         cdef const char *wkt = GDALGetProjectionRef(self.handle())             # <<<<<<<<<<<<<<
7241  *         if wkt == NULL:
7242  *             raise ValueError("Unexpected NULL spatial reference")
7243  */
7244   __pyx_t_1 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->handle(__pyx_v_self); if (unlikely(__pyx_t_1 == ((GDALDatasetH)NULL))) __PYX_ERR(0, 352, __pyx_L1_error)
7245   __pyx_v_wkt = GDALGetProjectionRef(__pyx_t_1);
7246 
7247   /* "rasterio/_base.pyx":353
7248  *         """Return the GDAL dataset's stored CRS"""
7249  *         cdef const char *wkt = GDALGetProjectionRef(self.handle())
7250  *         if wkt == NULL:             # <<<<<<<<<<<<<<
7251  *             raise ValueError("Unexpected NULL spatial reference")
7252  *         return self._handle_crswkt(wkt)
7253  */
7254   __pyx_t_2 = ((__pyx_v_wkt == NULL) != 0);
7255   if (unlikely(__pyx_t_2)) {
7256 
7257     /* "rasterio/_base.pyx":354
7258  *         cdef const char *wkt = GDALGetProjectionRef(self.handle())
7259  *         if wkt == NULL:
7260  *             raise ValueError("Unexpected NULL spatial reference")             # <<<<<<<<<<<<<<
7261  *         return self._handle_crswkt(wkt)
7262  *
7263  */
7264     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error)
7265     __Pyx_GOTREF(__pyx_t_3);
7266     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7267     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7268     __PYX_ERR(0, 354, __pyx_L1_error)
7269 
7270     /* "rasterio/_base.pyx":353
7271  *         """Return the GDAL dataset's stored CRS"""
7272  *         cdef const char *wkt = GDALGetProjectionRef(self.handle())
7273  *         if wkt == NULL:             # <<<<<<<<<<<<<<
7274  *             raise ValueError("Unexpected NULL spatial reference")
7275  *         return self._handle_crswkt(wkt)
7276  */
7277   }
7278 
7279   /* "rasterio/_base.pyx":355
7280  *         if wkt == NULL:
7281  *             raise ValueError("Unexpected NULL spatial reference")
7282  *         return self._handle_crswkt(wkt)             # <<<<<<<<<<<<<<
7283  *
7284  *     def read_transform(self):
7285  */
7286   __Pyx_XDECREF(__pyx_r);
7287   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_handle_crswkt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 355, __pyx_L1_error)
7288   __Pyx_GOTREF(__pyx_t_4);
7289   __pyx_t_5 = __Pyx_PyUnicode_FromString(__pyx_v_wkt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 355, __pyx_L1_error)
7290   __Pyx_GOTREF(__pyx_t_5);
7291   __pyx_t_6 = NULL;
7292   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
7293     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
7294     if (likely(__pyx_t_6)) {
7295       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
7296       __Pyx_INCREF(__pyx_t_6);
7297       __Pyx_INCREF(function);
7298       __Pyx_DECREF_SET(__pyx_t_4, function);
7299     }
7300   }
7301   __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
7302   __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7303   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7304   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 355, __pyx_L1_error)
7305   __Pyx_GOTREF(__pyx_t_3);
7306   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7307   __pyx_r = __pyx_t_3;
7308   __pyx_t_3 = 0;
7309   goto __pyx_L0;
7310 
7311   /* "rasterio/_base.pyx":350
7312  *         return False
7313  *
7314  *     def read_crs(self):             # <<<<<<<<<<<<<<
7315  *         """Return the GDAL dataset's stored CRS"""
7316  *         cdef const char *wkt = GDALGetProjectionRef(self.handle())
7317  */
7318 
7319   /* function exit code */
7320   __pyx_L1_error:;
7321   __Pyx_XDECREF(__pyx_t_3);
7322   __Pyx_XDECREF(__pyx_t_4);
7323   __Pyx_XDECREF(__pyx_t_5);
7324   __Pyx_XDECREF(__pyx_t_6);
7325   __Pyx_AddTraceback("rasterio._base.DatasetBase.read_crs", __pyx_clineno, __pyx_lineno, __pyx_filename);
7326   __pyx_r = NULL;
7327   __pyx_L0:;
7328   __Pyx_XGIVEREF(__pyx_r);
7329   __Pyx_RefNannyFinishContext();
7330   return __pyx_r;
7331 }
7332 
7333 /* "rasterio/_base.pyx":357
7334  *         return self._handle_crswkt(wkt)
7335  *
7336  *     def read_transform(self):             # <<<<<<<<<<<<<<
7337  *         """Return the stored GDAL GeoTransform"""
7338  *         cdef double gt[6]
7339  */
7340 
7341 /* Python wrapper */
7342 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_15read_transform(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
7343 static char __pyx_doc_8rasterio_5_base_11DatasetBase_14read_transform[] = "Return the stored GDAL GeoTransform";
__pyx_pw_8rasterio_5_base_11DatasetBase_15read_transform(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)7344 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_15read_transform(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7345   PyObject *__pyx_r = 0;
7346   __Pyx_RefNannyDeclarations
7347   __Pyx_RefNannySetupContext("read_transform (wrapper)", 0);
7348   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_14read_transform(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
7349 
7350   /* function exit code */
7351   __Pyx_RefNannyFinishContext();
7352   return __pyx_r;
7353 }
7354 
__pyx_pf_8rasterio_5_base_11DatasetBase_14read_transform(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)7355 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_14read_transform(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
7356   double __pyx_v_gt[6];
7357   int __pyx_v_err;
7358   long __pyx_7genexpr__pyx_v_i;
7359   PyObject *__pyx_r = NULL;
7360   __Pyx_RefNannyDeclarations
7361   int __pyx_t_1;
7362   PyObject *__pyx_t_2 = NULL;
7363   PyObject *__pyx_t_3 = NULL;
7364   PyObject *__pyx_t_4 = NULL;
7365   int __pyx_t_5;
7366   int __pyx_t_6;
7367   PyObject *__pyx_t_7 = NULL;
7368   int __pyx_t_8;
7369   PyObject *__pyx_t_9 = NULL;
7370   long __pyx_t_10;
7371   int __pyx_lineno = 0;
7372   const char *__pyx_filename = NULL;
7373   int __pyx_clineno = 0;
7374   __Pyx_RefNannySetupContext("read_transform", 0);
7375 
7376   /* "rasterio/_base.pyx":361
7377  *         cdef double gt[6]
7378  *
7379  *         if self._hds == NULL:             # <<<<<<<<<<<<<<
7380  *             raise ValueError("Null dataset")
7381  *         err = GDALGetGeoTransform(self._hds, gt)
7382  */
7383   __pyx_t_1 = ((__pyx_v_self->_hds == NULL) != 0);
7384   if (unlikely(__pyx_t_1)) {
7385 
7386     /* "rasterio/_base.pyx":362
7387  *
7388  *         if self._hds == NULL:
7389  *             raise ValueError("Null dataset")             # <<<<<<<<<<<<<<
7390  *         err = GDALGetGeoTransform(self._hds, gt)
7391  *         if err == GDALError.failure and not self._has_gcps_or_rpcs():
7392  */
7393     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error)
7394     __Pyx_GOTREF(__pyx_t_2);
7395     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7396     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7397     __PYX_ERR(0, 362, __pyx_L1_error)
7398 
7399     /* "rasterio/_base.pyx":361
7400  *         cdef double gt[6]
7401  *
7402  *         if self._hds == NULL:             # <<<<<<<<<<<<<<
7403  *             raise ValueError("Null dataset")
7404  *         err = GDALGetGeoTransform(self._hds, gt)
7405  */
7406   }
7407 
7408   /* "rasterio/_base.pyx":363
7409  *         if self._hds == NULL:
7410  *             raise ValueError("Null dataset")
7411  *         err = GDALGetGeoTransform(self._hds, gt)             # <<<<<<<<<<<<<<
7412  *         if err == GDALError.failure and not self._has_gcps_or_rpcs():
7413  *             warnings.warn(
7414  */
7415   __pyx_v_err = GDALGetGeoTransform(__pyx_v_self->_hds, __pyx_v_gt);
7416 
7417   /* "rasterio/_base.pyx":364
7418  *             raise ValueError("Null dataset")
7419  *         err = GDALGetGeoTransform(self._hds, gt)
7420  *         if err == GDALError.failure and not self._has_gcps_or_rpcs():             # <<<<<<<<<<<<<<
7421  *             warnings.warn(
7422  *                 ("Dataset has no geotransform, gcps, or rpcs. "
7423  */
7424   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error)
7425   __Pyx_GOTREF(__pyx_t_2);
7426   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_GDALError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error)
7427   __Pyx_GOTREF(__pyx_t_3);
7428   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_failure); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 364, __pyx_L1_error)
7429   __Pyx_GOTREF(__pyx_t_4);
7430   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7431   __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error)
7432   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7433   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7434   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 364, __pyx_L1_error)
7435   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7436   if (__pyx_t_5) {
7437   } else {
7438     __pyx_t_1 = __pyx_t_5;
7439     goto __pyx_L5_bool_binop_done;
7440   }
7441   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_gcps_or_rpcs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 364, __pyx_L1_error)
7442   __Pyx_GOTREF(__pyx_t_4);
7443   __pyx_t_2 = NULL;
7444   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
7445     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
7446     if (likely(__pyx_t_2)) {
7447       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
7448       __Pyx_INCREF(__pyx_t_2);
7449       __Pyx_INCREF(function);
7450       __Pyx_DECREF_SET(__pyx_t_4, function);
7451     }
7452   }
7453   __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
7454   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7455   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error)
7456   __Pyx_GOTREF(__pyx_t_3);
7457   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7458   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 364, __pyx_L1_error)
7459   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7460   __pyx_t_6 = ((!__pyx_t_5) != 0);
7461   __pyx_t_1 = __pyx_t_6;
7462   __pyx_L5_bool_binop_done:;
7463   if (__pyx_t_1) {
7464 
7465     /* "rasterio/_base.pyx":365
7466  *         err = GDALGetGeoTransform(self._hds, gt)
7467  *         if err == GDALError.failure and not self._has_gcps_or_rpcs():
7468  *             warnings.warn(             # <<<<<<<<<<<<<<
7469  *                 ("Dataset has no geotransform, gcps, or rpcs. "
7470  *                 "The identity matrix be returned."),
7471  */
7472     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_warnings); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 365, __pyx_L1_error)
7473     __Pyx_GOTREF(__pyx_t_4);
7474     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error)
7475     __Pyx_GOTREF(__pyx_t_2);
7476     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7477 
7478     /* "rasterio/_base.pyx":368
7479  *                 ("Dataset has no geotransform, gcps, or rpcs. "
7480  *                 "The identity matrix be returned."),
7481  *                 NotGeoreferencedWarning)             # <<<<<<<<<<<<<<
7482  *
7483  *         return [gt[i] for i in range(6)]
7484  */
7485     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_NotGeoreferencedWarning); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 368, __pyx_L1_error)
7486     __Pyx_GOTREF(__pyx_t_4);
7487     __pyx_t_7 = NULL;
7488     __pyx_t_8 = 0;
7489     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
7490       __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
7491       if (likely(__pyx_t_7)) {
7492         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7493         __Pyx_INCREF(__pyx_t_7);
7494         __Pyx_INCREF(function);
7495         __Pyx_DECREF_SET(__pyx_t_2, function);
7496         __pyx_t_8 = 1;
7497       }
7498     }
7499     #if CYTHON_FAST_PYCALL
7500     if (PyFunction_Check(__pyx_t_2)) {
7501       PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_u_Dataset_has_no_geotransform_gcps, __pyx_t_4};
7502       __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 365, __pyx_L1_error)
7503       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
7504       __Pyx_GOTREF(__pyx_t_3);
7505       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7506     } else
7507     #endif
7508     #if CYTHON_FAST_PYCCALL
7509     if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
7510       PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_u_Dataset_has_no_geotransform_gcps, __pyx_t_4};
7511       __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 365, __pyx_L1_error)
7512       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
7513       __Pyx_GOTREF(__pyx_t_3);
7514       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7515     } else
7516     #endif
7517     {
7518       __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 365, __pyx_L1_error)
7519       __Pyx_GOTREF(__pyx_t_9);
7520       if (__pyx_t_7) {
7521         __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
7522       }
7523       __Pyx_INCREF(__pyx_kp_u_Dataset_has_no_geotransform_gcps);
7524       __Pyx_GIVEREF(__pyx_kp_u_Dataset_has_no_geotransform_gcps);
7525       PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_kp_u_Dataset_has_no_geotransform_gcps);
7526       __Pyx_GIVEREF(__pyx_t_4);
7527       PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
7528       __pyx_t_4 = 0;
7529       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 365, __pyx_L1_error)
7530       __Pyx_GOTREF(__pyx_t_3);
7531       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
7532     }
7533     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7534     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7535 
7536     /* "rasterio/_base.pyx":364
7537  *             raise ValueError("Null dataset")
7538  *         err = GDALGetGeoTransform(self._hds, gt)
7539  *         if err == GDALError.failure and not self._has_gcps_or_rpcs():             # <<<<<<<<<<<<<<
7540  *             warnings.warn(
7541  *                 ("Dataset has no geotransform, gcps, or rpcs. "
7542  */
7543   }
7544 
7545   /* "rasterio/_base.pyx":370
7546  *                 NotGeoreferencedWarning)
7547  *
7548  *         return [gt[i] for i in range(6)]             # <<<<<<<<<<<<<<
7549  *
7550  *     def start(self):
7551  */
7552   __Pyx_XDECREF(__pyx_r);
7553   { /* enter inner scope */
7554     __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 370, __pyx_L1_error)
7555     __Pyx_GOTREF(__pyx_t_3);
7556     for (__pyx_t_10 = 0; __pyx_t_10 < 6; __pyx_t_10+=1) {
7557       __pyx_7genexpr__pyx_v_i = __pyx_t_10;
7558       __pyx_t_2 = PyFloat_FromDouble((__pyx_v_gt[__pyx_7genexpr__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 370, __pyx_L1_error)
7559       __Pyx_GOTREF(__pyx_t_2);
7560       if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 370, __pyx_L1_error)
7561       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7562     }
7563   } /* exit inner scope */
7564   __pyx_r = __pyx_t_3;
7565   __pyx_t_3 = 0;
7566   goto __pyx_L0;
7567 
7568   /* "rasterio/_base.pyx":357
7569  *         return self._handle_crswkt(wkt)
7570  *
7571  *     def read_transform(self):             # <<<<<<<<<<<<<<
7572  *         """Return the stored GDAL GeoTransform"""
7573  *         cdef double gt[6]
7574  */
7575 
7576   /* function exit code */
7577   __pyx_L1_error:;
7578   __Pyx_XDECREF(__pyx_t_2);
7579   __Pyx_XDECREF(__pyx_t_3);
7580   __Pyx_XDECREF(__pyx_t_4);
7581   __Pyx_XDECREF(__pyx_t_7);
7582   __Pyx_XDECREF(__pyx_t_9);
7583   __Pyx_AddTraceback("rasterio._base.DatasetBase.read_transform", __pyx_clineno, __pyx_lineno, __pyx_filename);
7584   __pyx_r = NULL;
7585   __pyx_L0:;
7586   __Pyx_XGIVEREF(__pyx_r);
7587   __Pyx_RefNannyFinishContext();
7588   return __pyx_r;
7589 }
7590 
7591 /* "rasterio/_base.pyx":372
7592  *         return [gt[i] for i in range(6)]
7593  *
7594  *     def start(self):             # <<<<<<<<<<<<<<
7595  *         """Start the dataset's life cycle"""
7596  *         pass
7597  */
7598 
7599 /* Python wrapper */
7600 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_17start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
7601 static char __pyx_doc_8rasterio_5_base_11DatasetBase_16start[] = "Start the dataset's life cycle";
__pyx_pw_8rasterio_5_base_11DatasetBase_17start(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)7602 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_17start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7603   PyObject *__pyx_r = 0;
7604   __Pyx_RefNannyDeclarations
7605   __Pyx_RefNannySetupContext("start (wrapper)", 0);
7606   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_16start(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
7607 
7608   /* function exit code */
7609   __Pyx_RefNannyFinishContext();
7610   return __pyx_r;
7611 }
7612 
__pyx_pf_8rasterio_5_base_11DatasetBase_16start(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)7613 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_16start(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
7614   PyObject *__pyx_r = NULL;
7615   __Pyx_RefNannyDeclarations
7616   __Pyx_RefNannySetupContext("start", 0);
7617 
7618   /* function exit code */
7619   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7620   __Pyx_XGIVEREF(__pyx_r);
7621   __Pyx_RefNannyFinishContext();
7622   return __pyx_r;
7623 }
7624 
7625 /* "rasterio/_base.pyx":376
7626  *         pass
7627  *
7628  *     def stop(self):             # <<<<<<<<<<<<<<
7629  *         """Close the GDAL dataset handle"""
7630  *         if self._hds != NULL:
7631  */
7632 
7633 /* Python wrapper */
7634 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_19stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
7635 static char __pyx_doc_8rasterio_5_base_11DatasetBase_18stop[] = "Close the GDAL dataset handle";
__pyx_pw_8rasterio_5_base_11DatasetBase_19stop(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)7636 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_19stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7637   PyObject *__pyx_r = 0;
7638   __Pyx_RefNannyDeclarations
7639   __Pyx_RefNannySetupContext("stop (wrapper)", 0);
7640   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_18stop(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
7641 
7642   /* function exit code */
7643   __Pyx_RefNannyFinishContext();
7644   return __pyx_r;
7645 }
7646 
__pyx_pf_8rasterio_5_base_11DatasetBase_18stop(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)7647 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_18stop(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
7648   int __pyx_v_refcount;
7649   PyObject *__pyx_r = NULL;
7650   __Pyx_RefNannyDeclarations
7651   int __pyx_t_1;
7652   __Pyx_RefNannySetupContext("stop", 0);
7653 
7654   /* "rasterio/_base.pyx":378
7655  *     def stop(self):
7656  *         """Close the GDAL dataset handle"""
7657  *         if self._hds != NULL:             # <<<<<<<<<<<<<<
7658  *             refcount = GDALDereferenceDataset(self._hds)
7659  *             if refcount == 0:
7660  */
7661   __pyx_t_1 = ((__pyx_v_self->_hds != NULL) != 0);
7662   if (__pyx_t_1) {
7663 
7664     /* "rasterio/_base.pyx":379
7665  *         """Close the GDAL dataset handle"""
7666  *         if self._hds != NULL:
7667  *             refcount = GDALDereferenceDataset(self._hds)             # <<<<<<<<<<<<<<
7668  *             if refcount == 0:
7669  *                 GDALClose(self._hds)
7670  */
7671     __pyx_v_refcount = GDALDereferenceDataset(__pyx_v_self->_hds);
7672 
7673     /* "rasterio/_base.pyx":380
7674  *         if self._hds != NULL:
7675  *             refcount = GDALDereferenceDataset(self._hds)
7676  *             if refcount == 0:             # <<<<<<<<<<<<<<
7677  *                 GDALClose(self._hds)
7678  *         self._hds = NULL
7679  */
7680     __pyx_t_1 = ((__pyx_v_refcount == 0) != 0);
7681     if (__pyx_t_1) {
7682 
7683       /* "rasterio/_base.pyx":381
7684  *             refcount = GDALDereferenceDataset(self._hds)
7685  *             if refcount == 0:
7686  *                 GDALClose(self._hds)             # <<<<<<<<<<<<<<
7687  *         self._hds = NULL
7688  *
7689  */
7690       GDALClose(__pyx_v_self->_hds);
7691 
7692       /* "rasterio/_base.pyx":380
7693  *         if self._hds != NULL:
7694  *             refcount = GDALDereferenceDataset(self._hds)
7695  *             if refcount == 0:             # <<<<<<<<<<<<<<
7696  *                 GDALClose(self._hds)
7697  *         self._hds = NULL
7698  */
7699     }
7700 
7701     /* "rasterio/_base.pyx":378
7702  *     def stop(self):
7703  *         """Close the GDAL dataset handle"""
7704  *         if self._hds != NULL:             # <<<<<<<<<<<<<<
7705  *             refcount = GDALDereferenceDataset(self._hds)
7706  *             if refcount == 0:
7707  */
7708   }
7709 
7710   /* "rasterio/_base.pyx":382
7711  *             if refcount == 0:
7712  *                 GDALClose(self._hds)
7713  *         self._hds = NULL             # <<<<<<<<<<<<<<
7714  *
7715  *     def close(self):
7716  */
7717   __pyx_v_self->_hds = NULL;
7718 
7719   /* "rasterio/_base.pyx":376
7720  *         pass
7721  *
7722  *     def stop(self):             # <<<<<<<<<<<<<<
7723  *         """Close the GDAL dataset handle"""
7724  *         if self._hds != NULL:
7725  */
7726 
7727   /* function exit code */
7728   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7729   __Pyx_XGIVEREF(__pyx_r);
7730   __Pyx_RefNannyFinishContext();
7731   return __pyx_r;
7732 }
7733 
7734 /* "rasterio/_base.pyx":384
7735  *         self._hds = NULL
7736  *
7737  *     def close(self):             # <<<<<<<<<<<<<<
7738  *         """Close the dataset"""
7739  *         self.stop()
7740  */
7741 
7742 /* Python wrapper */
7743 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_21close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
7744 static char __pyx_doc_8rasterio_5_base_11DatasetBase_20close[] = "Close the dataset";
__pyx_pw_8rasterio_5_base_11DatasetBase_21close(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)7745 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_21close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7746   PyObject *__pyx_r = 0;
7747   __Pyx_RefNannyDeclarations
7748   __Pyx_RefNannySetupContext("close (wrapper)", 0);
7749   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_20close(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
7750 
7751   /* function exit code */
7752   __Pyx_RefNannyFinishContext();
7753   return __pyx_r;
7754 }
7755 
__pyx_pf_8rasterio_5_base_11DatasetBase_20close(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)7756 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_20close(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
7757   PyObject *__pyx_r = NULL;
7758   __Pyx_RefNannyDeclarations
7759   PyObject *__pyx_t_1 = NULL;
7760   PyObject *__pyx_t_2 = NULL;
7761   PyObject *__pyx_t_3 = NULL;
7762   int __pyx_lineno = 0;
7763   const char *__pyx_filename = NULL;
7764   int __pyx_clineno = 0;
7765   __Pyx_RefNannySetupContext("close", 0);
7766 
7767   /* "rasterio/_base.pyx":386
7768  *     def close(self):
7769  *         """Close the dataset"""
7770  *         self.stop()             # <<<<<<<<<<<<<<
7771  *         self._closed = True
7772  *
7773  */
7774   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error)
7775   __Pyx_GOTREF(__pyx_t_2);
7776   __pyx_t_3 = NULL;
7777   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7778     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7779     if (likely(__pyx_t_3)) {
7780       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7781       __Pyx_INCREF(__pyx_t_3);
7782       __Pyx_INCREF(function);
7783       __Pyx_DECREF_SET(__pyx_t_2, function);
7784     }
7785   }
7786   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
7787   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7788   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error)
7789   __Pyx_GOTREF(__pyx_t_1);
7790   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7791   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7792 
7793   /* "rasterio/_base.pyx":387
7794  *         """Close the dataset"""
7795  *         self.stop()
7796  *         self._closed = True             # <<<<<<<<<<<<<<
7797  *
7798  *     def __enter__(self):
7799  */
7800   __Pyx_INCREF(Py_True);
7801   __Pyx_GIVEREF(Py_True);
7802   __Pyx_GOTREF(__pyx_v_self->_closed);
7803   __Pyx_DECREF(__pyx_v_self->_closed);
7804   __pyx_v_self->_closed = Py_True;
7805 
7806   /* "rasterio/_base.pyx":384
7807  *         self._hds = NULL
7808  *
7809  *     def close(self):             # <<<<<<<<<<<<<<
7810  *         """Close the dataset"""
7811  *         self.stop()
7812  */
7813 
7814   /* function exit code */
7815   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7816   goto __pyx_L0;
7817   __pyx_L1_error:;
7818   __Pyx_XDECREF(__pyx_t_1);
7819   __Pyx_XDECREF(__pyx_t_2);
7820   __Pyx_XDECREF(__pyx_t_3);
7821   __Pyx_AddTraceback("rasterio._base.DatasetBase.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
7822   __pyx_r = NULL;
7823   __pyx_L0:;
7824   __Pyx_XGIVEREF(__pyx_r);
7825   __Pyx_RefNannyFinishContext();
7826   return __pyx_r;
7827 }
7828 
7829 /* "rasterio/_base.pyx":389
7830  *         self._closed = True
7831  *
7832  *     def __enter__(self):             # <<<<<<<<<<<<<<
7833  *         self._env = env_ctx_if_needed()
7834  *         self._env.__enter__()
7835  */
7836 
7837 /* Python wrapper */
7838 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_23__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_23__enter__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)7839 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_23__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7840   PyObject *__pyx_r = 0;
7841   __Pyx_RefNannyDeclarations
7842   __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
7843   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_22__enter__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
7844 
7845   /* function exit code */
7846   __Pyx_RefNannyFinishContext();
7847   return __pyx_r;
7848 }
7849 
__pyx_pf_8rasterio_5_base_11DatasetBase_22__enter__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)7850 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_22__enter__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
7851   PyObject *__pyx_r = NULL;
7852   __Pyx_RefNannyDeclarations
7853   PyObject *__pyx_t_1 = NULL;
7854   PyObject *__pyx_t_2 = NULL;
7855   PyObject *__pyx_t_3 = NULL;
7856   int __pyx_lineno = 0;
7857   const char *__pyx_filename = NULL;
7858   int __pyx_clineno = 0;
7859   __Pyx_RefNannySetupContext("__enter__", 0);
7860 
7861   /* "rasterio/_base.pyx":390
7862  *
7863  *     def __enter__(self):
7864  *         self._env = env_ctx_if_needed()             # <<<<<<<<<<<<<<
7865  *         self._env.__enter__()
7866  *         return self
7867  */
7868   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_env_ctx_if_needed); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 390, __pyx_L1_error)
7869   __Pyx_GOTREF(__pyx_t_2);
7870   __pyx_t_3 = NULL;
7871   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
7872     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7873     if (likely(__pyx_t_3)) {
7874       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7875       __Pyx_INCREF(__pyx_t_3);
7876       __Pyx_INCREF(function);
7877       __Pyx_DECREF_SET(__pyx_t_2, function);
7878     }
7879   }
7880   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
7881   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7882   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 390, __pyx_L1_error)
7883   __Pyx_GOTREF(__pyx_t_1);
7884   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7885   __Pyx_GIVEREF(__pyx_t_1);
7886   __Pyx_GOTREF(__pyx_v_self->_env);
7887   __Pyx_DECREF(__pyx_v_self->_env);
7888   __pyx_v_self->_env = __pyx_t_1;
7889   __pyx_t_1 = 0;
7890 
7891   /* "rasterio/_base.pyx":391
7892  *     def __enter__(self):
7893  *         self._env = env_ctx_if_needed()
7894  *         self._env.__enter__()             # <<<<<<<<<<<<<<
7895  *         return self
7896  *
7897  */
7898   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_env, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error)
7899   __Pyx_GOTREF(__pyx_t_2);
7900   __pyx_t_3 = NULL;
7901   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7902     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7903     if (likely(__pyx_t_3)) {
7904       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7905       __Pyx_INCREF(__pyx_t_3);
7906       __Pyx_INCREF(function);
7907       __Pyx_DECREF_SET(__pyx_t_2, function);
7908     }
7909   }
7910   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
7911   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7912   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error)
7913   __Pyx_GOTREF(__pyx_t_1);
7914   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7915   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7916 
7917   /* "rasterio/_base.pyx":392
7918  *         self._env = env_ctx_if_needed()
7919  *         self._env.__enter__()
7920  *         return self             # <<<<<<<<<<<<<<
7921  *
7922  *     def __exit__(self, type, value, traceback):
7923  */
7924   __Pyx_XDECREF(__pyx_r);
7925   __Pyx_INCREF(((PyObject *)__pyx_v_self));
7926   __pyx_r = ((PyObject *)__pyx_v_self);
7927   goto __pyx_L0;
7928 
7929   /* "rasterio/_base.pyx":389
7930  *         self._closed = True
7931  *
7932  *     def __enter__(self):             # <<<<<<<<<<<<<<
7933  *         self._env = env_ctx_if_needed()
7934  *         self._env.__enter__()
7935  */
7936 
7937   /* function exit code */
7938   __pyx_L1_error:;
7939   __Pyx_XDECREF(__pyx_t_1);
7940   __Pyx_XDECREF(__pyx_t_2);
7941   __Pyx_XDECREF(__pyx_t_3);
7942   __Pyx_AddTraceback("rasterio._base.DatasetBase.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7943   __pyx_r = NULL;
7944   __pyx_L0:;
7945   __Pyx_XGIVEREF(__pyx_r);
7946   __Pyx_RefNannyFinishContext();
7947   return __pyx_r;
7948 }
7949 
7950 /* "rasterio/_base.pyx":394
7951  *         return self
7952  *
7953  *     def __exit__(self, type, value, traceback):             # <<<<<<<<<<<<<<
7954  *         self.close()
7955  *         self._env.__exit__()
7956  */
7957 
7958 /* Python wrapper */
7959 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_25__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_25__exit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7960 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_25__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7961   CYTHON_UNUSED PyObject *__pyx_v_type = 0;
7962   CYTHON_UNUSED PyObject *__pyx_v_value = 0;
7963   CYTHON_UNUSED PyObject *__pyx_v_traceback = 0;
7964   int __pyx_lineno = 0;
7965   const char *__pyx_filename = NULL;
7966   int __pyx_clineno = 0;
7967   PyObject *__pyx_r = 0;
7968   __Pyx_RefNannyDeclarations
7969   __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
7970   {
7971     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_value,&__pyx_n_s_traceback,0};
7972     PyObject* values[3] = {0,0,0};
7973     if (unlikely(__pyx_kwds)) {
7974       Py_ssize_t kw_args;
7975       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7976       switch (pos_args) {
7977         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7978         CYTHON_FALLTHROUGH;
7979         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7980         CYTHON_FALLTHROUGH;
7981         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7982         CYTHON_FALLTHROUGH;
7983         case  0: break;
7984         default: goto __pyx_L5_argtuple_error;
7985       }
7986       kw_args = PyDict_Size(__pyx_kwds);
7987       switch (pos_args) {
7988         case  0:
7989         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--;
7990         else goto __pyx_L5_argtuple_error;
7991         CYTHON_FALLTHROUGH;
7992         case  1:
7993         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
7994         else {
7995           __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 394, __pyx_L3_error)
7996         }
7997         CYTHON_FALLTHROUGH;
7998         case  2:
7999         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--;
8000         else {
8001           __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 394, __pyx_L3_error)
8002         }
8003       }
8004       if (unlikely(kw_args > 0)) {
8005         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(0, 394, __pyx_L3_error)
8006       }
8007     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
8008       goto __pyx_L5_argtuple_error;
8009     } else {
8010       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8011       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8012       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8013     }
8014     __pyx_v_type = values[0];
8015     __pyx_v_value = values[1];
8016     __pyx_v_traceback = values[2];
8017   }
8018   goto __pyx_L4_argument_unpacking_done;
8019   __pyx_L5_argtuple_error:;
8020   __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 394, __pyx_L3_error)
8021   __pyx_L3_error:;
8022   __Pyx_AddTraceback("rasterio._base.DatasetBase.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8023   __Pyx_RefNannyFinishContext();
8024   return NULL;
8025   __pyx_L4_argument_unpacking_done:;
8026   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_24__exit__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback);
8027 
8028   /* function exit code */
8029   __Pyx_RefNannyFinishContext();
8030   return __pyx_r;
8031 }
8032 
__pyx_pf_8rasterio_5_base_11DatasetBase_24__exit__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_type,CYTHON_UNUSED PyObject * __pyx_v_value,CYTHON_UNUSED PyObject * __pyx_v_traceback)8033 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_24__exit__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) {
8034   PyObject *__pyx_r = NULL;
8035   __Pyx_RefNannyDeclarations
8036   PyObject *__pyx_t_1 = NULL;
8037   PyObject *__pyx_t_2 = NULL;
8038   PyObject *__pyx_t_3 = NULL;
8039   int __pyx_lineno = 0;
8040   const char *__pyx_filename = NULL;
8041   int __pyx_clineno = 0;
8042   __Pyx_RefNannySetupContext("__exit__", 0);
8043 
8044   /* "rasterio/_base.pyx":395
8045  *
8046  *     def __exit__(self, type, value, traceback):
8047  *         self.close()             # <<<<<<<<<<<<<<
8048  *         self._env.__exit__()
8049  *
8050  */
8051   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error)
8052   __Pyx_GOTREF(__pyx_t_2);
8053   __pyx_t_3 = NULL;
8054   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
8055     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
8056     if (likely(__pyx_t_3)) {
8057       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8058       __Pyx_INCREF(__pyx_t_3);
8059       __Pyx_INCREF(function);
8060       __Pyx_DECREF_SET(__pyx_t_2, function);
8061     }
8062   }
8063   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
8064   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8065   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __pyx_L1_error)
8066   __Pyx_GOTREF(__pyx_t_1);
8067   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8068   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8069 
8070   /* "rasterio/_base.pyx":396
8071  *     def __exit__(self, type, value, traceback):
8072  *         self.close()
8073  *         self._env.__exit__()             # <<<<<<<<<<<<<<
8074  *
8075  *     def __dealloc__(self):
8076  */
8077   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_env, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 396, __pyx_L1_error)
8078   __Pyx_GOTREF(__pyx_t_2);
8079   __pyx_t_3 = NULL;
8080   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
8081     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
8082     if (likely(__pyx_t_3)) {
8083       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8084       __Pyx_INCREF(__pyx_t_3);
8085       __Pyx_INCREF(function);
8086       __Pyx_DECREF_SET(__pyx_t_2, function);
8087     }
8088   }
8089   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
8090   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8091   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error)
8092   __Pyx_GOTREF(__pyx_t_1);
8093   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8094   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8095 
8096   /* "rasterio/_base.pyx":394
8097  *         return self
8098  *
8099  *     def __exit__(self, type, value, traceback):             # <<<<<<<<<<<<<<
8100  *         self.close()
8101  *         self._env.__exit__()
8102  */
8103 
8104   /* function exit code */
8105   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8106   goto __pyx_L0;
8107   __pyx_L1_error:;
8108   __Pyx_XDECREF(__pyx_t_1);
8109   __Pyx_XDECREF(__pyx_t_2);
8110   __Pyx_XDECREF(__pyx_t_3);
8111   __Pyx_AddTraceback("rasterio._base.DatasetBase.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8112   __pyx_r = NULL;
8113   __pyx_L0:;
8114   __Pyx_XGIVEREF(__pyx_r);
8115   __Pyx_RefNannyFinishContext();
8116   return __pyx_r;
8117 }
8118 
8119 /* "rasterio/_base.pyx":398
8120  *         self._env.__exit__()
8121  *
8122  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
8123  *         if self._hds != NULL:
8124  *             GDALClose(self._hds)
8125  */
8126 
8127 /* Python wrapper */
8128 static void __pyx_pw_8rasterio_5_base_11DatasetBase_27__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_27__dealloc__(PyObject * __pyx_v_self)8129 static void __pyx_pw_8rasterio_5_base_11DatasetBase_27__dealloc__(PyObject *__pyx_v_self) {
8130   __Pyx_RefNannyDeclarations
8131   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
8132   __pyx_pf_8rasterio_5_base_11DatasetBase_26__dealloc__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
8133 
8134   /* function exit code */
8135   __Pyx_RefNannyFinishContext();
8136 }
8137 
__pyx_pf_8rasterio_5_base_11DatasetBase_26__dealloc__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)8138 static void __pyx_pf_8rasterio_5_base_11DatasetBase_26__dealloc__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
8139   __Pyx_RefNannyDeclarations
8140   int __pyx_t_1;
8141   __Pyx_RefNannySetupContext("__dealloc__", 0);
8142 
8143   /* "rasterio/_base.pyx":399
8144  *
8145  *     def __dealloc__(self):
8146  *         if self._hds != NULL:             # <<<<<<<<<<<<<<
8147  *             GDALClose(self._hds)
8148  *
8149  */
8150   __pyx_t_1 = ((__pyx_v_self->_hds != NULL) != 0);
8151   if (__pyx_t_1) {
8152 
8153     /* "rasterio/_base.pyx":400
8154  *     def __dealloc__(self):
8155  *         if self._hds != NULL:
8156  *             GDALClose(self._hds)             # <<<<<<<<<<<<<<
8157  *
8158  *     @property
8159  */
8160     GDALClose(__pyx_v_self->_hds);
8161 
8162     /* "rasterio/_base.pyx":399
8163  *
8164  *     def __dealloc__(self):
8165  *         if self._hds != NULL:             # <<<<<<<<<<<<<<
8166  *             GDALClose(self._hds)
8167  *
8168  */
8169   }
8170 
8171   /* "rasterio/_base.pyx":398
8172  *         self._env.__exit__()
8173  *
8174  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
8175  *         if self._hds != NULL:
8176  *             GDALClose(self._hds)
8177  */
8178 
8179   /* function exit code */
8180   __Pyx_RefNannyFinishContext();
8181 }
8182 
8183 /* "rasterio/_base.pyx":403
8184  *
8185  *     @property
8186  *     def closed(self):             # <<<<<<<<<<<<<<
8187  *         """Test if the dataset is closed
8188  *
8189  */
8190 
8191 /* Python wrapper */
8192 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6closed_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6closed_1__get__(PyObject * __pyx_v_self)8193 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6closed_1__get__(PyObject *__pyx_v_self) {
8194   PyObject *__pyx_r = 0;
8195   __Pyx_RefNannyDeclarations
8196   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
8197   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6closed___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
8198 
8199   /* function exit code */
8200   __Pyx_RefNannyFinishContext();
8201   return __pyx_r;
8202 }
8203 
__pyx_pf_8rasterio_5_base_11DatasetBase_6closed___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)8204 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6closed___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
8205   PyObject *__pyx_r = NULL;
8206   __Pyx_RefNannyDeclarations
8207   __Pyx_RefNannySetupContext("__get__", 0);
8208 
8209   /* "rasterio/_base.pyx":410
8210  *         bool
8211  *         """
8212  *         return self._closed             # <<<<<<<<<<<<<<
8213  *
8214  *     @property
8215  */
8216   __Pyx_XDECREF(__pyx_r);
8217   __Pyx_INCREF(__pyx_v_self->_closed);
8218   __pyx_r = __pyx_v_self->_closed;
8219   goto __pyx_L0;
8220 
8221   /* "rasterio/_base.pyx":403
8222  *
8223  *     @property
8224  *     def closed(self):             # <<<<<<<<<<<<<<
8225  *         """Test if the dataset is closed
8226  *
8227  */
8228 
8229   /* function exit code */
8230   __pyx_L0:;
8231   __Pyx_XGIVEREF(__pyx_r);
8232   __Pyx_RefNannyFinishContext();
8233   return __pyx_r;
8234 }
8235 
8236 /* "rasterio/_base.pyx":413
8237  *
8238  *     @property
8239  *     def count(self):             # <<<<<<<<<<<<<<
8240  *         """The number of raster bands in the dataset
8241  *
8242  */
8243 
8244 /* Python wrapper */
8245 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5count_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5count_1__get__(PyObject * __pyx_v_self)8246 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5count_1__get__(PyObject *__pyx_v_self) {
8247   PyObject *__pyx_r = 0;
8248   __Pyx_RefNannyDeclarations
8249   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
8250   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5count___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
8251 
8252   /* function exit code */
8253   __Pyx_RefNannyFinishContext();
8254   return __pyx_r;
8255 }
8256 
__pyx_pf_8rasterio_5_base_11DatasetBase_5count___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)8257 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5count___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
8258   PyObject *__pyx_r = NULL;
8259   __Pyx_RefNannyDeclarations
8260   int __pyx_t_1;
8261   int __pyx_t_2;
8262   PyObject *__pyx_t_3 = NULL;
8263   int __pyx_lineno = 0;
8264   const char *__pyx_filename = NULL;
8265   int __pyx_clineno = 0;
8266   __Pyx_RefNannySetupContext("__get__", 0);
8267 
8268   /* "rasterio/_base.pyx":420
8269  *         int
8270  *         """
8271  *         if not self._count:             # <<<<<<<<<<<<<<
8272  *             if self._hds == NULL:
8273  *                 raise ValueError("Can't read closed raster file")
8274  */
8275   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_count); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 420, __pyx_L1_error)
8276   __pyx_t_2 = ((!__pyx_t_1) != 0);
8277   if (__pyx_t_2) {
8278 
8279     /* "rasterio/_base.pyx":421
8280  *         """
8281  *         if not self._count:
8282  *             if self._hds == NULL:             # <<<<<<<<<<<<<<
8283  *                 raise ValueError("Can't read closed raster file")
8284  *             self._count = GDALGetRasterCount(self._hds)
8285  */
8286     __pyx_t_2 = ((__pyx_v_self->_hds == NULL) != 0);
8287     if (unlikely(__pyx_t_2)) {
8288 
8289       /* "rasterio/_base.pyx":422
8290  *         if not self._count:
8291  *             if self._hds == NULL:
8292  *                 raise ValueError("Can't read closed raster file")             # <<<<<<<<<<<<<<
8293  *             self._count = GDALGetRasterCount(self._hds)
8294  *         return self._count
8295  */
8296       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error)
8297       __Pyx_GOTREF(__pyx_t_3);
8298       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8299       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8300       __PYX_ERR(0, 422, __pyx_L1_error)
8301 
8302       /* "rasterio/_base.pyx":421
8303  *         """
8304  *         if not self._count:
8305  *             if self._hds == NULL:             # <<<<<<<<<<<<<<
8306  *                 raise ValueError("Can't read closed raster file")
8307  *             self._count = GDALGetRasterCount(self._hds)
8308  */
8309     }
8310 
8311     /* "rasterio/_base.pyx":423
8312  *             if self._hds == NULL:
8313  *                 raise ValueError("Can't read closed raster file")
8314  *             self._count = GDALGetRasterCount(self._hds)             # <<<<<<<<<<<<<<
8315  *         return self._count
8316  *
8317  */
8318     __pyx_t_3 = __Pyx_PyInt_From_int(GDALGetRasterCount(__pyx_v_self->_hds)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error)
8319     __Pyx_GOTREF(__pyx_t_3);
8320     __Pyx_GIVEREF(__pyx_t_3);
8321     __Pyx_GOTREF(__pyx_v_self->_count);
8322     __Pyx_DECREF(__pyx_v_self->_count);
8323     __pyx_v_self->_count = __pyx_t_3;
8324     __pyx_t_3 = 0;
8325 
8326     /* "rasterio/_base.pyx":420
8327  *         int
8328  *         """
8329  *         if not self._count:             # <<<<<<<<<<<<<<
8330  *             if self._hds == NULL:
8331  *                 raise ValueError("Can't read closed raster file")
8332  */
8333   }
8334 
8335   /* "rasterio/_base.pyx":424
8336  *                 raise ValueError("Can't read closed raster file")
8337  *             self._count = GDALGetRasterCount(self._hds)
8338  *         return self._count             # <<<<<<<<<<<<<<
8339  *
8340  *     @property
8341  */
8342   __Pyx_XDECREF(__pyx_r);
8343   __Pyx_INCREF(__pyx_v_self->_count);
8344   __pyx_r = __pyx_v_self->_count;
8345   goto __pyx_L0;
8346 
8347   /* "rasterio/_base.pyx":413
8348  *
8349  *     @property
8350  *     def count(self):             # <<<<<<<<<<<<<<
8351  *         """The number of raster bands in the dataset
8352  *
8353  */
8354 
8355   /* function exit code */
8356   __pyx_L1_error:;
8357   __Pyx_XDECREF(__pyx_t_3);
8358   __Pyx_AddTraceback("rasterio._base.DatasetBase.count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8359   __pyx_r = NULL;
8360   __pyx_L0:;
8361   __Pyx_XGIVEREF(__pyx_r);
8362   __Pyx_RefNannyFinishContext();
8363   return __pyx_r;
8364 }
8365 
8366 /* "rasterio/_base.pyx":427
8367  *
8368  *     @property
8369  *     def indexes(self):             # <<<<<<<<<<<<<<
8370  *         """The 1-based indexes of each band in the dataset
8371  *
8372  */
8373 
8374 /* Python wrapper */
8375 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7indexes_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7indexes_1__get__(PyObject * __pyx_v_self)8376 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7indexes_1__get__(PyObject *__pyx_v_self) {
8377   PyObject *__pyx_r = 0;
8378   __Pyx_RefNannyDeclarations
8379   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
8380   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_7indexes___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
8381 
8382   /* function exit code */
8383   __Pyx_RefNannyFinishContext();
8384   return __pyx_r;
8385 }
8386 
__pyx_pf_8rasterio_5_base_11DatasetBase_7indexes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)8387 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_7indexes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
8388   PyObject *__pyx_r = NULL;
8389   __Pyx_RefNannyDeclarations
8390   PyObject *__pyx_t_1 = NULL;
8391   PyObject *__pyx_t_2 = NULL;
8392   int __pyx_lineno = 0;
8393   const char *__pyx_filename = NULL;
8394   int __pyx_clineno = 0;
8395   __Pyx_RefNannySetupContext("__get__", 0);
8396 
8397   /* "rasterio/_base.pyx":436
8398  *         list of int
8399  *         """
8400  *         return tuple(range(1, self.count+1))             # <<<<<<<<<<<<<<
8401  *
8402  *     @property
8403  */
8404   __Pyx_XDECREF(__pyx_r);
8405   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error)
8406   __Pyx_GOTREF(__pyx_t_1);
8407   __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error)
8408   __Pyx_GOTREF(__pyx_t_2);
8409   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8410   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error)
8411   __Pyx_GOTREF(__pyx_t_1);
8412   __Pyx_INCREF(__pyx_int_1);
8413   __Pyx_GIVEREF(__pyx_int_1);
8414   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_1);
8415   __Pyx_GIVEREF(__pyx_t_2);
8416   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
8417   __pyx_t_2 = 0;
8418   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error)
8419   __Pyx_GOTREF(__pyx_t_2);
8420   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8421   __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error)
8422   __Pyx_GOTREF(__pyx_t_1);
8423   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8424   __pyx_r = __pyx_t_1;
8425   __pyx_t_1 = 0;
8426   goto __pyx_L0;
8427 
8428   /* "rasterio/_base.pyx":427
8429  *
8430  *     @property
8431  *     def indexes(self):             # <<<<<<<<<<<<<<
8432  *         """The 1-based indexes of each band in the dataset
8433  *
8434  */
8435 
8436   /* function exit code */
8437   __pyx_L1_error:;
8438   __Pyx_XDECREF(__pyx_t_1);
8439   __Pyx_XDECREF(__pyx_t_2);
8440   __Pyx_AddTraceback("rasterio._base.DatasetBase.indexes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8441   __pyx_r = NULL;
8442   __pyx_L0:;
8443   __Pyx_XGIVEREF(__pyx_r);
8444   __Pyx_RefNannyFinishContext();
8445   return __pyx_r;
8446 }
8447 
8448 /* "rasterio/_base.pyx":439
8449  *
8450  *     @property
8451  *     def dtypes(self):             # <<<<<<<<<<<<<<
8452  *         """The data types of each band in index order
8453  *
8454  */
8455 
8456 /* Python wrapper */
8457 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6dtypes_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6dtypes_1__get__(PyObject * __pyx_v_self)8458 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6dtypes_1__get__(PyObject *__pyx_v_self) {
8459   PyObject *__pyx_r = 0;
8460   __Pyx_RefNannyDeclarations
8461   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
8462   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6dtypes___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
8463 
8464   /* function exit code */
8465   __Pyx_RefNannyFinishContext();
8466   return __pyx_r;
8467 }
8468 
__pyx_pf_8rasterio_5_base_11DatasetBase_6dtypes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)8469 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6dtypes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
8470   GDALRasterBandH __pyx_v_band;
8471   PyObject *__pyx_v_i = NULL;
8472   PyObject *__pyx_r = NULL;
8473   __Pyx_RefNannyDeclarations
8474   int __pyx_t_1;
8475   int __pyx_t_2;
8476   PyObject *__pyx_t_3 = NULL;
8477   PyObject *__pyx_t_4 = NULL;
8478   Py_ssize_t __pyx_t_5;
8479   PyObject *(*__pyx_t_6)(PyObject *);
8480   int __pyx_t_7;
8481   GDALRasterBandH __pyx_t_8;
8482   int __pyx_t_9;
8483   int __pyx_lineno = 0;
8484   const char *__pyx_filename = NULL;
8485   int __pyx_clineno = 0;
8486   __Pyx_RefNannySetupContext("__get__", 0);
8487 
8488   /* "rasterio/_base.pyx":446
8489  *         list of str
8490  *         """
8491  *         cdef GDALRasterBandH band = NULL             # <<<<<<<<<<<<<<
8492  *
8493  *         if not self._dtypes:
8494  */
8495   __pyx_v_band = NULL;
8496 
8497   /* "rasterio/_base.pyx":448
8498  *         cdef GDALRasterBandH band = NULL
8499  *
8500  *         if not self._dtypes:             # <<<<<<<<<<<<<<
8501  *             for i in range(self._count):
8502  *                 band = self.band(i + 1)
8503  */
8504   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_dtypes); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 448, __pyx_L1_error)
8505   __pyx_t_2 = ((!__pyx_t_1) != 0);
8506   if (__pyx_t_2) {
8507 
8508     /* "rasterio/_base.pyx":449
8509  *
8510  *         if not self._dtypes:
8511  *             for i in range(self._count):             # <<<<<<<<<<<<<<
8512  *                 band = self.band(i + 1)
8513  *                 self._dtypes.append(_band_dtype(band))
8514  */
8515     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_self->_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error)
8516     __Pyx_GOTREF(__pyx_t_3);
8517     if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
8518       __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
8519       __pyx_t_6 = NULL;
8520     } else {
8521       __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 449, __pyx_L1_error)
8522       __Pyx_GOTREF(__pyx_t_4);
8523       __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 449, __pyx_L1_error)
8524     }
8525     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8526     for (;;) {
8527       if (likely(!__pyx_t_6)) {
8528         if (likely(PyList_CheckExact(__pyx_t_4))) {
8529           if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
8530           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8531           __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 449, __pyx_L1_error)
8532           #else
8533           __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error)
8534           __Pyx_GOTREF(__pyx_t_3);
8535           #endif
8536         } else {
8537           if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
8538           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8539           __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 449, __pyx_L1_error)
8540           #else
8541           __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error)
8542           __Pyx_GOTREF(__pyx_t_3);
8543           #endif
8544         }
8545       } else {
8546         __pyx_t_3 = __pyx_t_6(__pyx_t_4);
8547         if (unlikely(!__pyx_t_3)) {
8548           PyObject* exc_type = PyErr_Occurred();
8549           if (exc_type) {
8550             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8551             else __PYX_ERR(0, 449, __pyx_L1_error)
8552           }
8553           break;
8554         }
8555         __Pyx_GOTREF(__pyx_t_3);
8556       }
8557       __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
8558       __pyx_t_3 = 0;
8559 
8560       /* "rasterio/_base.pyx":450
8561  *         if not self._dtypes:
8562  *             for i in range(self._count):
8563  *                 band = self.band(i + 1)             # <<<<<<<<<<<<<<
8564  *                 self._dtypes.append(_band_dtype(band))
8565  *
8566  */
8567       __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 450, __pyx_L1_error)
8568       __Pyx_GOTREF(__pyx_t_3);
8569       __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 450, __pyx_L1_error)
8570       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8571       __pyx_t_8 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_7); if (unlikely(__pyx_t_8 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 450, __pyx_L1_error)
8572       __pyx_v_band = __pyx_t_8;
8573 
8574       /* "rasterio/_base.pyx":451
8575  *             for i in range(self._count):
8576  *                 band = self.band(i + 1)
8577  *                 self._dtypes.append(_band_dtype(band))             # <<<<<<<<<<<<<<
8578  *
8579  *         return tuple(self._dtypes)
8580  */
8581       __pyx_t_3 = __pyx_f_8rasterio_5_base__band_dtype(__pyx_v_band); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 451, __pyx_L1_error)
8582       __Pyx_GOTREF(__pyx_t_3);
8583       __pyx_t_9 = __Pyx_PyObject_Append(__pyx_v_self->_dtypes, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 451, __pyx_L1_error)
8584       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8585 
8586       /* "rasterio/_base.pyx":449
8587  *
8588  *         if not self._dtypes:
8589  *             for i in range(self._count):             # <<<<<<<<<<<<<<
8590  *                 band = self.band(i + 1)
8591  *                 self._dtypes.append(_band_dtype(band))
8592  */
8593     }
8594     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8595 
8596     /* "rasterio/_base.pyx":448
8597  *         cdef GDALRasterBandH band = NULL
8598  *
8599  *         if not self._dtypes:             # <<<<<<<<<<<<<<
8600  *             for i in range(self._count):
8601  *                 band = self.band(i + 1)
8602  */
8603   }
8604 
8605   /* "rasterio/_base.pyx":453
8606  *                 self._dtypes.append(_band_dtype(band))
8607  *
8608  *         return tuple(self._dtypes)             # <<<<<<<<<<<<<<
8609  *
8610  *     @property
8611  */
8612   __Pyx_XDECREF(__pyx_r);
8613   __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_self->_dtypes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 453, __pyx_L1_error)
8614   __Pyx_GOTREF(__pyx_t_4);
8615   __pyx_r = __pyx_t_4;
8616   __pyx_t_4 = 0;
8617   goto __pyx_L0;
8618 
8619   /* "rasterio/_base.pyx":439
8620  *
8621  *     @property
8622  *     def dtypes(self):             # <<<<<<<<<<<<<<
8623  *         """The data types of each band in index order
8624  *
8625  */
8626 
8627   /* function exit code */
8628   __pyx_L1_error:;
8629   __Pyx_XDECREF(__pyx_t_3);
8630   __Pyx_XDECREF(__pyx_t_4);
8631   __Pyx_AddTraceback("rasterio._base.DatasetBase.dtypes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8632   __pyx_r = NULL;
8633   __pyx_L0:;
8634   __Pyx_XDECREF(__pyx_v_i);
8635   __Pyx_XGIVEREF(__pyx_r);
8636   __Pyx_RefNannyFinishContext();
8637   return __pyx_r;
8638 }
8639 
8640 /* "rasterio/_base.pyx":456
8641  *
8642  *     @property
8643  *     def block_shapes(self):             # <<<<<<<<<<<<<<
8644  *         """An ordered list of block shapes for each bands
8645  *
8646  */
8647 
8648 /* Python wrapper */
8649 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_12block_shapes_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_12block_shapes_1__get__(PyObject * __pyx_v_self)8650 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_12block_shapes_1__get__(PyObject *__pyx_v_self) {
8651   PyObject *__pyx_r = 0;
8652   __Pyx_RefNannyDeclarations
8653   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
8654   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_12block_shapes___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
8655 
8656   /* function exit code */
8657   __Pyx_RefNannyFinishContext();
8658   return __pyx_r;
8659 }
8660 
__pyx_pf_8rasterio_5_base_11DatasetBase_12block_shapes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)8661 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_12block_shapes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
8662   GDALRasterBandH __pyx_v_band;
8663   int __pyx_v_xsize;
8664   int __pyx_v_ysize;
8665   PyObject *__pyx_v_i = NULL;
8666   PyObject *__pyx_r = NULL;
8667   __Pyx_RefNannyDeclarations
8668   int __pyx_t_1;
8669   int __pyx_t_2;
8670   PyObject *__pyx_t_3 = NULL;
8671   PyObject *__pyx_t_4 = NULL;
8672   Py_ssize_t __pyx_t_5;
8673   PyObject *(*__pyx_t_6)(PyObject *);
8674   int __pyx_t_7;
8675   GDALRasterBandH __pyx_t_8;
8676   PyObject *__pyx_t_9 = NULL;
8677   PyObject *__pyx_t_10 = NULL;
8678   int __pyx_t_11;
8679   int __pyx_lineno = 0;
8680   const char *__pyx_filename = NULL;
8681   int __pyx_clineno = 0;
8682   __Pyx_RefNannySetupContext("__get__", 0);
8683 
8684   /* "rasterio/_base.pyx":466
8685  *         list
8686  *         """
8687  *         cdef GDALRasterBandH band = NULL             # <<<<<<<<<<<<<<
8688  *         cdef int xsize
8689  *         cdef int ysize
8690  */
8691   __pyx_v_band = NULL;
8692 
8693   /* "rasterio/_base.pyx":470
8694  *         cdef int ysize
8695  *
8696  *         if self._block_shapes is None:             # <<<<<<<<<<<<<<
8697  *             self._block_shapes = []
8698  *
8699  */
8700   __pyx_t_1 = (__pyx_v_self->_block_shapes == Py_None);
8701   __pyx_t_2 = (__pyx_t_1 != 0);
8702   if (__pyx_t_2) {
8703 
8704     /* "rasterio/_base.pyx":471
8705  *
8706  *         if self._block_shapes is None:
8707  *             self._block_shapes = []             # <<<<<<<<<<<<<<
8708  *
8709  *             for i in range(self._count):
8710  */
8711     __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error)
8712     __Pyx_GOTREF(__pyx_t_3);
8713     __Pyx_GIVEREF(__pyx_t_3);
8714     __Pyx_GOTREF(__pyx_v_self->_block_shapes);
8715     __Pyx_DECREF(__pyx_v_self->_block_shapes);
8716     __pyx_v_self->_block_shapes = __pyx_t_3;
8717     __pyx_t_3 = 0;
8718 
8719     /* "rasterio/_base.pyx":473
8720  *             self._block_shapes = []
8721  *
8722  *             for i in range(self._count):             # <<<<<<<<<<<<<<
8723  *                 band = self.band(i + 1)
8724  *                 GDALGetBlockSize(band, &xsize, &ysize)
8725  */
8726     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_self->_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error)
8727     __Pyx_GOTREF(__pyx_t_3);
8728     if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
8729       __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
8730       __pyx_t_6 = NULL;
8731     } else {
8732       __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 473, __pyx_L1_error)
8733       __Pyx_GOTREF(__pyx_t_4);
8734       __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 473, __pyx_L1_error)
8735     }
8736     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8737     for (;;) {
8738       if (likely(!__pyx_t_6)) {
8739         if (likely(PyList_CheckExact(__pyx_t_4))) {
8740           if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
8741           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8742           __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 473, __pyx_L1_error)
8743           #else
8744           __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error)
8745           __Pyx_GOTREF(__pyx_t_3);
8746           #endif
8747         } else {
8748           if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
8749           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8750           __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 473, __pyx_L1_error)
8751           #else
8752           __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error)
8753           __Pyx_GOTREF(__pyx_t_3);
8754           #endif
8755         }
8756       } else {
8757         __pyx_t_3 = __pyx_t_6(__pyx_t_4);
8758         if (unlikely(!__pyx_t_3)) {
8759           PyObject* exc_type = PyErr_Occurred();
8760           if (exc_type) {
8761             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8762             else __PYX_ERR(0, 473, __pyx_L1_error)
8763           }
8764           break;
8765         }
8766         __Pyx_GOTREF(__pyx_t_3);
8767       }
8768       __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
8769       __pyx_t_3 = 0;
8770 
8771       /* "rasterio/_base.pyx":474
8772  *
8773  *             for i in range(self._count):
8774  *                 band = self.band(i + 1)             # <<<<<<<<<<<<<<
8775  *                 GDALGetBlockSize(band, &xsize, &ysize)
8776  *                 self._block_shapes.append((ysize, xsize))
8777  */
8778       __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 474, __pyx_L1_error)
8779       __Pyx_GOTREF(__pyx_t_3);
8780       __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 474, __pyx_L1_error)
8781       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8782       __pyx_t_8 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_7); if (unlikely(__pyx_t_8 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 474, __pyx_L1_error)
8783       __pyx_v_band = __pyx_t_8;
8784 
8785       /* "rasterio/_base.pyx":475
8786  *             for i in range(self._count):
8787  *                 band = self.band(i + 1)
8788  *                 GDALGetBlockSize(band, &xsize, &ysize)             # <<<<<<<<<<<<<<
8789  *                 self._block_shapes.append((ysize, xsize))
8790  *
8791  */
8792       GDALGetBlockSize(__pyx_v_band, (&__pyx_v_xsize), (&__pyx_v_ysize));
8793 
8794       /* "rasterio/_base.pyx":476
8795  *                 band = self.band(i + 1)
8796  *                 GDALGetBlockSize(band, &xsize, &ysize)
8797  *                 self._block_shapes.append((ysize, xsize))             # <<<<<<<<<<<<<<
8798  *
8799  *         return list(self._block_shapes)
8800  */
8801       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_ysize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 476, __pyx_L1_error)
8802       __Pyx_GOTREF(__pyx_t_3);
8803       __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_xsize); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 476, __pyx_L1_error)
8804       __Pyx_GOTREF(__pyx_t_9);
8805       __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 476, __pyx_L1_error)
8806       __Pyx_GOTREF(__pyx_t_10);
8807       __Pyx_GIVEREF(__pyx_t_3);
8808       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3);
8809       __Pyx_GIVEREF(__pyx_t_9);
8810       PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
8811       __pyx_t_3 = 0;
8812       __pyx_t_9 = 0;
8813       __pyx_t_11 = __Pyx_PyObject_Append(__pyx_v_self->_block_shapes, __pyx_t_10); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 476, __pyx_L1_error)
8814       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8815 
8816       /* "rasterio/_base.pyx":473
8817  *             self._block_shapes = []
8818  *
8819  *             for i in range(self._count):             # <<<<<<<<<<<<<<
8820  *                 band = self.band(i + 1)
8821  *                 GDALGetBlockSize(band, &xsize, &ysize)
8822  */
8823     }
8824     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8825 
8826     /* "rasterio/_base.pyx":470
8827  *         cdef int ysize
8828  *
8829  *         if self._block_shapes is None:             # <<<<<<<<<<<<<<
8830  *             self._block_shapes = []
8831  *
8832  */
8833   }
8834 
8835   /* "rasterio/_base.pyx":478
8836  *                 self._block_shapes.append((ysize, xsize))
8837  *
8838  *         return list(self._block_shapes)             # <<<<<<<<<<<<<<
8839  *
8840  *     def get_nodatavals(self):
8841  */
8842   __Pyx_XDECREF(__pyx_r);
8843   __pyx_t_4 = PySequence_List(__pyx_v_self->_block_shapes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 478, __pyx_L1_error)
8844   __Pyx_GOTREF(__pyx_t_4);
8845   __pyx_r = __pyx_t_4;
8846   __pyx_t_4 = 0;
8847   goto __pyx_L0;
8848 
8849   /* "rasterio/_base.pyx":456
8850  *
8851  *     @property
8852  *     def block_shapes(self):             # <<<<<<<<<<<<<<
8853  *         """An ordered list of block shapes for each bands
8854  *
8855  */
8856 
8857   /* function exit code */
8858   __pyx_L1_error:;
8859   __Pyx_XDECREF(__pyx_t_3);
8860   __Pyx_XDECREF(__pyx_t_4);
8861   __Pyx_XDECREF(__pyx_t_9);
8862   __Pyx_XDECREF(__pyx_t_10);
8863   __Pyx_AddTraceback("rasterio._base.DatasetBase.block_shapes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8864   __pyx_r = NULL;
8865   __pyx_L0:;
8866   __Pyx_XDECREF(__pyx_v_i);
8867   __Pyx_XGIVEREF(__pyx_r);
8868   __Pyx_RefNannyFinishContext();
8869   return __pyx_r;
8870 }
8871 
8872 /* "rasterio/_base.pyx":480
8873  *         return list(self._block_shapes)
8874  *
8875  *     def get_nodatavals(self):             # <<<<<<<<<<<<<<
8876  *         cdef GDALRasterBandH band = NULL
8877  *         cdef double nodataval
8878  */
8879 
8880 /* Python wrapper */
8881 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_29get_nodatavals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_29get_nodatavals(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)8882 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_29get_nodatavals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8883   PyObject *__pyx_r = 0;
8884   __Pyx_RefNannyDeclarations
8885   __Pyx_RefNannySetupContext("get_nodatavals (wrapper)", 0);
8886   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_28get_nodatavals(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
8887 
8888   /* function exit code */
8889   __Pyx_RefNannyFinishContext();
8890   return __pyx_r;
8891 }
8892 
__pyx_pf_8rasterio_5_base_11DatasetBase_28get_nodatavals(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)8893 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_28get_nodatavals(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
8894   GDALRasterBandH __pyx_v_band;
8895   double __pyx_v_nodataval;
8896   int __pyx_v_success;
8897   PyObject *__pyx_v_i = NULL;
8898   PyObject *__pyx_v_dtype = NULL;
8899   PyObject *__pyx_v_val = NULL;
8900   PyObject *__pyx_r = NULL;
8901   __Pyx_RefNannyDeclarations
8902   int __pyx_t_1;
8903   int __pyx_t_2;
8904   PyObject *__pyx_t_3 = NULL;
8905   PyObject *__pyx_t_4 = NULL;
8906   Py_ssize_t __pyx_t_5;
8907   PyObject *(*__pyx_t_6)(PyObject *);
8908   int __pyx_t_7;
8909   GDALRasterBandH __pyx_t_8;
8910   PyObject *__pyx_t_9 = NULL;
8911   PyObject *__pyx_t_10 = NULL;
8912   PyObject *__pyx_t_11 = NULL;
8913   PyObject *__pyx_t_12 = NULL;
8914   PyObject *__pyx_t_13 = NULL;
8915   int __pyx_t_14;
8916   int __pyx_lineno = 0;
8917   const char *__pyx_filename = NULL;
8918   int __pyx_clineno = 0;
8919   __Pyx_RefNannySetupContext("get_nodatavals", 0);
8920 
8921   /* "rasterio/_base.pyx":481
8922  *
8923  *     def get_nodatavals(self):
8924  *         cdef GDALRasterBandH band = NULL             # <<<<<<<<<<<<<<
8925  *         cdef double nodataval
8926  *         cdef int success = 0
8927  */
8928   __pyx_v_band = NULL;
8929 
8930   /* "rasterio/_base.pyx":483
8931  *         cdef GDALRasterBandH band = NULL
8932  *         cdef double nodataval
8933  *         cdef int success = 0             # <<<<<<<<<<<<<<
8934  *
8935  *         if not self._nodatavals:
8936  */
8937   __pyx_v_success = 0;
8938 
8939   /* "rasterio/_base.pyx":485
8940  *         cdef int success = 0
8941  *
8942  *         if not self._nodatavals:             # <<<<<<<<<<<<<<
8943  *
8944  *             for i in range(self._count):
8945  */
8946   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_nodatavals); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 485, __pyx_L1_error)
8947   __pyx_t_2 = ((!__pyx_t_1) != 0);
8948   if (__pyx_t_2) {
8949 
8950     /* "rasterio/_base.pyx":487
8951  *         if not self._nodatavals:
8952  *
8953  *             for i in range(self._count):             # <<<<<<<<<<<<<<
8954  *                 band = self.band(i + 1)
8955  *                 dtype = _band_dtype(band)
8956  */
8957     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_self->_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 487, __pyx_L1_error)
8958     __Pyx_GOTREF(__pyx_t_3);
8959     if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
8960       __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
8961       __pyx_t_6 = NULL;
8962     } else {
8963       __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 487, __pyx_L1_error)
8964       __Pyx_GOTREF(__pyx_t_4);
8965       __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 487, __pyx_L1_error)
8966     }
8967     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8968     for (;;) {
8969       if (likely(!__pyx_t_6)) {
8970         if (likely(PyList_CheckExact(__pyx_t_4))) {
8971           if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
8972           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8973           __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 487, __pyx_L1_error)
8974           #else
8975           __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 487, __pyx_L1_error)
8976           __Pyx_GOTREF(__pyx_t_3);
8977           #endif
8978         } else {
8979           if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
8980           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8981           __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 487, __pyx_L1_error)
8982           #else
8983           __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 487, __pyx_L1_error)
8984           __Pyx_GOTREF(__pyx_t_3);
8985           #endif
8986         }
8987       } else {
8988         __pyx_t_3 = __pyx_t_6(__pyx_t_4);
8989         if (unlikely(!__pyx_t_3)) {
8990           PyObject* exc_type = PyErr_Occurred();
8991           if (exc_type) {
8992             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8993             else __PYX_ERR(0, 487, __pyx_L1_error)
8994           }
8995           break;
8996         }
8997         __Pyx_GOTREF(__pyx_t_3);
8998       }
8999       __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
9000       __pyx_t_3 = 0;
9001 
9002       /* "rasterio/_base.pyx":488
9003  *
9004  *             for i in range(self._count):
9005  *                 band = self.band(i + 1)             # <<<<<<<<<<<<<<
9006  *                 dtype = _band_dtype(band)
9007  *
9008  */
9009       __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 488, __pyx_L1_error)
9010       __Pyx_GOTREF(__pyx_t_3);
9011       __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 488, __pyx_L1_error)
9012       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9013       __pyx_t_8 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_7); if (unlikely(__pyx_t_8 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 488, __pyx_L1_error)
9014       __pyx_v_band = __pyx_t_8;
9015 
9016       /* "rasterio/_base.pyx":489
9017  *             for i in range(self._count):
9018  *                 band = self.band(i + 1)
9019  *                 dtype = _band_dtype(band)             # <<<<<<<<<<<<<<
9020  *
9021  *                 # To address the issue in #1747.
9022  */
9023       __pyx_t_3 = __pyx_f_8rasterio_5_base__band_dtype(__pyx_v_band); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 489, __pyx_L1_error)
9024       __Pyx_GOTREF(__pyx_t_3);
9025       __Pyx_XDECREF_SET(__pyx_v_dtype, __pyx_t_3);
9026       __pyx_t_3 = 0;
9027 
9028       /* "rasterio/_base.pyx":492
9029  *
9030  *                 # To address the issue in #1747.
9031  *                 if dtype == "complex128":             # <<<<<<<<<<<<<<
9032  *                     dtype = "float64"
9033  *                 elif dtype == "complex64":
9034  */
9035       __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_dtype, __pyx_n_u_complex128, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 492, __pyx_L1_error)
9036       if (__pyx_t_2) {
9037 
9038         /* "rasterio/_base.pyx":493
9039  *                 # To address the issue in #1747.
9040  *                 if dtype == "complex128":
9041  *                     dtype = "float64"             # <<<<<<<<<<<<<<
9042  *                 elif dtype == "complex64":
9043  *                     dtype = "float32"
9044  */
9045         __Pyx_INCREF(__pyx_n_u_float64);
9046         __Pyx_DECREF_SET(__pyx_v_dtype, __pyx_n_u_float64);
9047 
9048         /* "rasterio/_base.pyx":492
9049  *
9050  *                 # To address the issue in #1747.
9051  *                 if dtype == "complex128":             # <<<<<<<<<<<<<<
9052  *                     dtype = "float64"
9053  *                 elif dtype == "complex64":
9054  */
9055         goto __pyx_L6;
9056       }
9057 
9058       /* "rasterio/_base.pyx":494
9059  *                 if dtype == "complex128":
9060  *                     dtype = "float64"
9061  *                 elif dtype == "complex64":             # <<<<<<<<<<<<<<
9062  *                     dtype = "float32"
9063  *                 elif dtype == "complex_int16":
9064  */
9065       __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_dtype, __pyx_n_u_complex64, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 494, __pyx_L1_error)
9066       if (__pyx_t_2) {
9067 
9068         /* "rasterio/_base.pyx":495
9069  *                     dtype = "float64"
9070  *                 elif dtype == "complex64":
9071  *                     dtype = "float32"             # <<<<<<<<<<<<<<
9072  *                 elif dtype == "complex_int16":
9073  *                     dtype = "int16"
9074  */
9075         __Pyx_INCREF(__pyx_n_u_float32);
9076         __Pyx_DECREF_SET(__pyx_v_dtype, __pyx_n_u_float32);
9077 
9078         /* "rasterio/_base.pyx":494
9079  *                 if dtype == "complex128":
9080  *                     dtype = "float64"
9081  *                 elif dtype == "complex64":             # <<<<<<<<<<<<<<
9082  *                     dtype = "float32"
9083  *                 elif dtype == "complex_int16":
9084  */
9085         goto __pyx_L6;
9086       }
9087 
9088       /* "rasterio/_base.pyx":496
9089  *                 elif dtype == "complex64":
9090  *                     dtype = "float32"
9091  *                 elif dtype == "complex_int16":             # <<<<<<<<<<<<<<
9092  *                     dtype = "int16"
9093  *
9094  */
9095       __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_dtype, __pyx_n_u_complex_int16, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 496, __pyx_L1_error)
9096       if (__pyx_t_2) {
9097 
9098         /* "rasterio/_base.pyx":497
9099  *                     dtype = "float32"
9100  *                 elif dtype == "complex_int16":
9101  *                     dtype = "int16"             # <<<<<<<<<<<<<<
9102  *
9103  *                 nodataval = GDALGetRasterNoDataValue(band, &success)
9104  */
9105         __Pyx_INCREF(__pyx_n_u_int16);
9106         __Pyx_DECREF_SET(__pyx_v_dtype, __pyx_n_u_int16);
9107 
9108         /* "rasterio/_base.pyx":496
9109  *                 elif dtype == "complex64":
9110  *                     dtype = "float32"
9111  *                 elif dtype == "complex_int16":             # <<<<<<<<<<<<<<
9112  *                     dtype = "int16"
9113  *
9114  */
9115       }
9116       __pyx_L6:;
9117 
9118       /* "rasterio/_base.pyx":499
9119  *                     dtype = "int16"
9120  *
9121  *                 nodataval = GDALGetRasterNoDataValue(band, &success)             # <<<<<<<<<<<<<<
9122  *                 val = nodataval
9123  *
9124  */
9125       __pyx_v_nodataval = GDALGetRasterNoDataValue(__pyx_v_band, (&__pyx_v_success));
9126 
9127       /* "rasterio/_base.pyx":500
9128  *
9129  *                 nodataval = GDALGetRasterNoDataValue(band, &success)
9130  *                 val = nodataval             # <<<<<<<<<<<<<<
9131  *
9132  *                 # GDALGetRasterNoDataValue() has two ways of telling you that
9133  */
9134       __pyx_t_3 = PyFloat_FromDouble(__pyx_v_nodataval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 500, __pyx_L1_error)
9135       __Pyx_GOTREF(__pyx_t_3);
9136       __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_3);
9137       __pyx_t_3 = 0;
9138 
9139       /* "rasterio/_base.pyx":508
9140  *                 # data type. If so, the band has a nodata value. If not,
9141  *                 # there's no nodata value.
9142  *                 if dtype not in dtypes.dtype_ranges:             # <<<<<<<<<<<<<<
9143  *                     pass
9144  *                 elif (success == 0 or val < dtypes.dtype_ranges[dtype][0] or val > dtypes.dtype_ranges[dtype][1]):
9145  */
9146       __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error)
9147       __Pyx_GOTREF(__pyx_t_3);
9148       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dtype_ranges); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 508, __pyx_L1_error)
9149       __Pyx_GOTREF(__pyx_t_9);
9150       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9151       __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_dtype, __pyx_t_9, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 508, __pyx_L1_error)
9152       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9153       __pyx_t_1 = (__pyx_t_2 != 0);
9154       if (__pyx_t_1) {
9155         goto __pyx_L7;
9156       }
9157 
9158       /* "rasterio/_base.pyx":510
9159  *                 if dtype not in dtypes.dtype_ranges:
9160  *                     pass
9161  *                 elif (success == 0 or val < dtypes.dtype_ranges[dtype][0] or val > dtypes.dtype_ranges[dtype][1]):             # <<<<<<<<<<<<<<
9162  *                     val = None
9163  *                 log.debug(
9164  */
9165       __pyx_t_2 = ((__pyx_v_success == 0) != 0);
9166       if (!__pyx_t_2) {
9167       } else {
9168         __pyx_t_1 = __pyx_t_2;
9169         goto __pyx_L8_bool_binop_done;
9170       }
9171       __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 510, __pyx_L1_error)
9172       __Pyx_GOTREF(__pyx_t_9);
9173       __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_dtype_ranges); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 510, __pyx_L1_error)
9174       __Pyx_GOTREF(__pyx_t_3);
9175       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9176       __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_dtype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 510, __pyx_L1_error)
9177       __Pyx_GOTREF(__pyx_t_9);
9178       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9179       __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 510, __pyx_L1_error)
9180       __Pyx_GOTREF(__pyx_t_3);
9181       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9182       __pyx_t_9 = PyObject_RichCompare(__pyx_v_val, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 510, __pyx_L1_error)
9183       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9184       __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 510, __pyx_L1_error)
9185       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9186       if (!__pyx_t_2) {
9187       } else {
9188         __pyx_t_1 = __pyx_t_2;
9189         goto __pyx_L8_bool_binop_done;
9190       }
9191       __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 510, __pyx_L1_error)
9192       __Pyx_GOTREF(__pyx_t_9);
9193       __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_dtype_ranges); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 510, __pyx_L1_error)
9194       __Pyx_GOTREF(__pyx_t_3);
9195       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9196       __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_dtype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 510, __pyx_L1_error)
9197       __Pyx_GOTREF(__pyx_t_9);
9198       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9199       __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_9, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 510, __pyx_L1_error)
9200       __Pyx_GOTREF(__pyx_t_3);
9201       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9202       __pyx_t_9 = PyObject_RichCompare(__pyx_v_val, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 510, __pyx_L1_error)
9203       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9204       __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 510, __pyx_L1_error)
9205       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9206       __pyx_t_1 = __pyx_t_2;
9207       __pyx_L8_bool_binop_done:;
9208       if (__pyx_t_1) {
9209 
9210         /* "rasterio/_base.pyx":511
9211  *                     pass
9212  *                 elif (success == 0 or val < dtypes.dtype_ranges[dtype][0] or val > dtypes.dtype_ranges[dtype][1]):
9213  *                     val = None             # <<<<<<<<<<<<<<
9214  *                 log.debug(
9215  *                     "Nodata success: %d, Nodata value: %f", success, nodataval)
9216  */
9217         __Pyx_INCREF(Py_None);
9218         __Pyx_DECREF_SET(__pyx_v_val, Py_None);
9219 
9220         /* "rasterio/_base.pyx":510
9221  *                 if dtype not in dtypes.dtype_ranges:
9222  *                     pass
9223  *                 elif (success == 0 or val < dtypes.dtype_ranges[dtype][0] or val > dtypes.dtype_ranges[dtype][1]):             # <<<<<<<<<<<<<<
9224  *                     val = None
9225  *                 log.debug(
9226  */
9227       }
9228       __pyx_L7:;
9229 
9230       /* "rasterio/_base.pyx":512
9231  *                 elif (success == 0 or val < dtypes.dtype_ranges[dtype][0] or val > dtypes.dtype_ranges[dtype][1]):
9232  *                     val = None
9233  *                 log.debug(             # <<<<<<<<<<<<<<
9234  *                     "Nodata success: %d, Nodata value: %f", success, nodataval)
9235  *                 self._nodatavals.append(val)
9236  */
9237       __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 512, __pyx_L1_error)
9238       __Pyx_GOTREF(__pyx_t_3);
9239       __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 512, __pyx_L1_error)
9240       __Pyx_GOTREF(__pyx_t_10);
9241       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9242 
9243       /* "rasterio/_base.pyx":513
9244  *                     val = None
9245  *                 log.debug(
9246  *                     "Nodata success: %d, Nodata value: %f", success, nodataval)             # <<<<<<<<<<<<<<
9247  *                 self._nodatavals.append(val)
9248  *
9249  */
9250       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_success); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L1_error)
9251       __Pyx_GOTREF(__pyx_t_3);
9252       __pyx_t_11 = PyFloat_FromDouble(__pyx_v_nodataval); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 513, __pyx_L1_error)
9253       __Pyx_GOTREF(__pyx_t_11);
9254       __pyx_t_12 = NULL;
9255       __pyx_t_7 = 0;
9256       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
9257         __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
9258         if (likely(__pyx_t_12)) {
9259           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
9260           __Pyx_INCREF(__pyx_t_12);
9261           __Pyx_INCREF(function);
9262           __Pyx_DECREF_SET(__pyx_t_10, function);
9263           __pyx_t_7 = 1;
9264         }
9265       }
9266       #if CYTHON_FAST_PYCALL
9267       if (PyFunction_Check(__pyx_t_10)) {
9268         PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_kp_u_Nodata_success_d_Nodata_value_f, __pyx_t_3, __pyx_t_11};
9269         __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 512, __pyx_L1_error)
9270         __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
9271         __Pyx_GOTREF(__pyx_t_9);
9272         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9273         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
9274       } else
9275       #endif
9276       #if CYTHON_FAST_PYCCALL
9277       if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
9278         PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_kp_u_Nodata_success_d_Nodata_value_f, __pyx_t_3, __pyx_t_11};
9279         __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 512, __pyx_L1_error)
9280         __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
9281         __Pyx_GOTREF(__pyx_t_9);
9282         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9283         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
9284       } else
9285       #endif
9286       {
9287         __pyx_t_13 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 512, __pyx_L1_error)
9288         __Pyx_GOTREF(__pyx_t_13);
9289         if (__pyx_t_12) {
9290           __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
9291         }
9292         __Pyx_INCREF(__pyx_kp_u_Nodata_success_d_Nodata_value_f);
9293         __Pyx_GIVEREF(__pyx_kp_u_Nodata_success_d_Nodata_value_f);
9294         PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_7, __pyx_kp_u_Nodata_success_d_Nodata_value_f);
9295         __Pyx_GIVEREF(__pyx_t_3);
9296         PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_7, __pyx_t_3);
9297         __Pyx_GIVEREF(__pyx_t_11);
9298         PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_7, __pyx_t_11);
9299         __pyx_t_3 = 0;
9300         __pyx_t_11 = 0;
9301         __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_13, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 512, __pyx_L1_error)
9302         __Pyx_GOTREF(__pyx_t_9);
9303         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
9304       }
9305       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9306       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9307 
9308       /* "rasterio/_base.pyx":514
9309  *                 log.debug(
9310  *                     "Nodata success: %d, Nodata value: %f", success, nodataval)
9311  *                 self._nodatavals.append(val)             # <<<<<<<<<<<<<<
9312  *
9313  *         return tuple(self._nodatavals)
9314  */
9315       __pyx_t_14 = __Pyx_PyObject_Append(__pyx_v_self->_nodatavals, __pyx_v_val); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 514, __pyx_L1_error)
9316 
9317       /* "rasterio/_base.pyx":487
9318  *         if not self._nodatavals:
9319  *
9320  *             for i in range(self._count):             # <<<<<<<<<<<<<<
9321  *                 band = self.band(i + 1)
9322  *                 dtype = _band_dtype(band)
9323  */
9324     }
9325     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9326 
9327     /* "rasterio/_base.pyx":485
9328  *         cdef int success = 0
9329  *
9330  *         if not self._nodatavals:             # <<<<<<<<<<<<<<
9331  *
9332  *             for i in range(self._count):
9333  */
9334   }
9335 
9336   /* "rasterio/_base.pyx":516
9337  *                 self._nodatavals.append(val)
9338  *
9339  *         return tuple(self._nodatavals)             # <<<<<<<<<<<<<<
9340  *
9341  *     property nodatavals:
9342  */
9343   __Pyx_XDECREF(__pyx_r);
9344   __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_self->_nodatavals); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 516, __pyx_L1_error)
9345   __Pyx_GOTREF(__pyx_t_4);
9346   __pyx_r = __pyx_t_4;
9347   __pyx_t_4 = 0;
9348   goto __pyx_L0;
9349 
9350   /* "rasterio/_base.pyx":480
9351  *         return list(self._block_shapes)
9352  *
9353  *     def get_nodatavals(self):             # <<<<<<<<<<<<<<
9354  *         cdef GDALRasterBandH band = NULL
9355  *         cdef double nodataval
9356  */
9357 
9358   /* function exit code */
9359   __pyx_L1_error:;
9360   __Pyx_XDECREF(__pyx_t_3);
9361   __Pyx_XDECREF(__pyx_t_4);
9362   __Pyx_XDECREF(__pyx_t_9);
9363   __Pyx_XDECREF(__pyx_t_10);
9364   __Pyx_XDECREF(__pyx_t_11);
9365   __Pyx_XDECREF(__pyx_t_12);
9366   __Pyx_XDECREF(__pyx_t_13);
9367   __Pyx_AddTraceback("rasterio._base.DatasetBase.get_nodatavals", __pyx_clineno, __pyx_lineno, __pyx_filename);
9368   __pyx_r = NULL;
9369   __pyx_L0:;
9370   __Pyx_XDECREF(__pyx_v_i);
9371   __Pyx_XDECREF(__pyx_v_dtype);
9372   __Pyx_XDECREF(__pyx_v_val);
9373   __Pyx_XGIVEREF(__pyx_r);
9374   __Pyx_RefNannyFinishContext();
9375   return __pyx_r;
9376 }
9377 
9378 /* "rasterio/_base.pyx":529
9379  *         list of float
9380  *         """
9381  *         def __get__(self):             # <<<<<<<<<<<<<<
9382  *             return self.get_nodatavals()
9383  *
9384  */
9385 
9386 /* Python wrapper */
9387 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_10nodatavals_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_10nodatavals_1__get__(PyObject * __pyx_v_self)9388 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_10nodatavals_1__get__(PyObject *__pyx_v_self) {
9389   PyObject *__pyx_r = 0;
9390   __Pyx_RefNannyDeclarations
9391   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
9392   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_10nodatavals___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
9393 
9394   /* function exit code */
9395   __Pyx_RefNannyFinishContext();
9396   return __pyx_r;
9397 }
9398 
__pyx_pf_8rasterio_5_base_11DatasetBase_10nodatavals___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)9399 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_10nodatavals___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
9400   PyObject *__pyx_r = NULL;
9401   __Pyx_RefNannyDeclarations
9402   PyObject *__pyx_t_1 = NULL;
9403   PyObject *__pyx_t_2 = NULL;
9404   PyObject *__pyx_t_3 = NULL;
9405   int __pyx_lineno = 0;
9406   const char *__pyx_filename = NULL;
9407   int __pyx_clineno = 0;
9408   __Pyx_RefNannySetupContext("__get__", 0);
9409 
9410   /* "rasterio/_base.pyx":530
9411  *         """
9412  *         def __get__(self):
9413  *             return self.get_nodatavals()             # <<<<<<<<<<<<<<
9414  *
9415  *     def _set_nodatavals(self, value):
9416  */
9417   __Pyx_XDECREF(__pyx_r);
9418   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_nodatavals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error)
9419   __Pyx_GOTREF(__pyx_t_2);
9420   __pyx_t_3 = NULL;
9421   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
9422     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
9423     if (likely(__pyx_t_3)) {
9424       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
9425       __Pyx_INCREF(__pyx_t_3);
9426       __Pyx_INCREF(function);
9427       __Pyx_DECREF_SET(__pyx_t_2, function);
9428     }
9429   }
9430   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
9431   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9432   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
9433   __Pyx_GOTREF(__pyx_t_1);
9434   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9435   __pyx_r = __pyx_t_1;
9436   __pyx_t_1 = 0;
9437   goto __pyx_L0;
9438 
9439   /* "rasterio/_base.pyx":529
9440  *         list of float
9441  *         """
9442  *         def __get__(self):             # <<<<<<<<<<<<<<
9443  *             return self.get_nodatavals()
9444  *
9445  */
9446 
9447   /* function exit code */
9448   __pyx_L1_error:;
9449   __Pyx_XDECREF(__pyx_t_1);
9450   __Pyx_XDECREF(__pyx_t_2);
9451   __Pyx_XDECREF(__pyx_t_3);
9452   __Pyx_AddTraceback("rasterio._base.DatasetBase.nodatavals.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9453   __pyx_r = NULL;
9454   __pyx_L0:;
9455   __Pyx_XGIVEREF(__pyx_r);
9456   __Pyx_RefNannyFinishContext();
9457   return __pyx_r;
9458 }
9459 
9460 /* "rasterio/_base.pyx":532
9461  *             return self.get_nodatavals()
9462  *
9463  *     def _set_nodatavals(self, value):             # <<<<<<<<<<<<<<
9464  *         raise DatasetAttributeError("read-only attribute")
9465  *
9466  */
9467 
9468 /* Python wrapper */
9469 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_31_set_nodatavals(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_31_set_nodatavals(PyObject * __pyx_v_self,PyObject * __pyx_v_value)9470 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_31_set_nodatavals(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
9471   PyObject *__pyx_r = 0;
9472   __Pyx_RefNannyDeclarations
9473   __Pyx_RefNannySetupContext("_set_nodatavals (wrapper)", 0);
9474   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_30_set_nodatavals(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
9475 
9476   /* function exit code */
9477   __Pyx_RefNannyFinishContext();
9478   return __pyx_r;
9479 }
9480 
__pyx_pf_8rasterio_5_base_11DatasetBase_30_set_nodatavals(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_value)9481 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_30_set_nodatavals(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value) {
9482   PyObject *__pyx_r = NULL;
9483   __Pyx_RefNannyDeclarations
9484   PyObject *__pyx_t_1 = NULL;
9485   PyObject *__pyx_t_2 = NULL;
9486   PyObject *__pyx_t_3 = NULL;
9487   int __pyx_lineno = 0;
9488   const char *__pyx_filename = NULL;
9489   int __pyx_clineno = 0;
9490   __Pyx_RefNannySetupContext("_set_nodatavals", 0);
9491 
9492   /* "rasterio/_base.pyx":533
9493  *
9494  *     def _set_nodatavals(self, value):
9495  *         raise DatasetAttributeError("read-only attribute")             # <<<<<<<<<<<<<<
9496  *
9497  *     property nodata:
9498  */
9499   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DatasetAttributeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 533, __pyx_L1_error)
9500   __Pyx_GOTREF(__pyx_t_2);
9501   __pyx_t_3 = NULL;
9502   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
9503     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
9504     if (likely(__pyx_t_3)) {
9505       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
9506       __Pyx_INCREF(__pyx_t_3);
9507       __Pyx_INCREF(function);
9508       __Pyx_DECREF_SET(__pyx_t_2, function);
9509     }
9510   }
9511   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_read_only_attribute) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_read_only_attribute);
9512   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9513   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __pyx_L1_error)
9514   __Pyx_GOTREF(__pyx_t_1);
9515   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9516   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
9517   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9518   __PYX_ERR(0, 533, __pyx_L1_error)
9519 
9520   /* "rasterio/_base.pyx":532
9521  *             return self.get_nodatavals()
9522  *
9523  *     def _set_nodatavals(self, value):             # <<<<<<<<<<<<<<
9524  *         raise DatasetAttributeError("read-only attribute")
9525  *
9526  */
9527 
9528   /* function exit code */
9529   __pyx_L1_error:;
9530   __Pyx_XDECREF(__pyx_t_1);
9531   __Pyx_XDECREF(__pyx_t_2);
9532   __Pyx_XDECREF(__pyx_t_3);
9533   __Pyx_AddTraceback("rasterio._base.DatasetBase._set_nodatavals", __pyx_clineno, __pyx_lineno, __pyx_filename);
9534   __pyx_r = NULL;
9535   __Pyx_XGIVEREF(__pyx_r);
9536   __Pyx_RefNannyFinishContext();
9537   return __pyx_r;
9538 }
9539 
9540 /* "rasterio/_base.pyx":547
9541  *         """
9542  *
9543  *         def __get__(self):             # <<<<<<<<<<<<<<
9544  *             if self.count == 0:
9545  *                 return None
9546  */
9547 
9548 /* Python wrapper */
9549 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6nodata_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6nodata_1__get__(PyObject * __pyx_v_self)9550 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6nodata_1__get__(PyObject *__pyx_v_self) {
9551   PyObject *__pyx_r = 0;
9552   __Pyx_RefNannyDeclarations
9553   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
9554   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6nodata___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
9555 
9556   /* function exit code */
9557   __Pyx_RefNannyFinishContext();
9558   return __pyx_r;
9559 }
9560 
__pyx_pf_8rasterio_5_base_11DatasetBase_6nodata___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)9561 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6nodata___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
9562   PyObject *__pyx_r = NULL;
9563   __Pyx_RefNannyDeclarations
9564   PyObject *__pyx_t_1 = NULL;
9565   PyObject *__pyx_t_2 = NULL;
9566   int __pyx_t_3;
9567   int __pyx_lineno = 0;
9568   const char *__pyx_filename = NULL;
9569   int __pyx_clineno = 0;
9570   __Pyx_RefNannySetupContext("__get__", 0);
9571 
9572   /* "rasterio/_base.pyx":548
9573  *
9574  *         def __get__(self):
9575  *             if self.count == 0:             # <<<<<<<<<<<<<<
9576  *                 return None
9577  *             return self.nodatavals[0]
9578  */
9579   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
9580   __Pyx_GOTREF(__pyx_t_1);
9581   __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L1_error)
9582   __Pyx_GOTREF(__pyx_t_2);
9583   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9584   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 548, __pyx_L1_error)
9585   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9586   if (__pyx_t_3) {
9587 
9588     /* "rasterio/_base.pyx":549
9589  *         def __get__(self):
9590  *             if self.count == 0:
9591  *                 return None             # <<<<<<<<<<<<<<
9592  *             return self.nodatavals[0]
9593  *
9594  */
9595     __Pyx_XDECREF(__pyx_r);
9596     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9597     goto __pyx_L0;
9598 
9599     /* "rasterio/_base.pyx":548
9600  *
9601  *         def __get__(self):
9602  *             if self.count == 0:             # <<<<<<<<<<<<<<
9603  *                 return None
9604  *             return self.nodatavals[0]
9605  */
9606   }
9607 
9608   /* "rasterio/_base.pyx":550
9609  *             if self.count == 0:
9610  *                 return None
9611  *             return self.nodatavals[0]             # <<<<<<<<<<<<<<
9612  *
9613  *         def __set__(self, value):
9614  */
9615   __Pyx_XDECREF(__pyx_r);
9616   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_nodatavals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 550, __pyx_L1_error)
9617   __Pyx_GOTREF(__pyx_t_2);
9618   __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error)
9619   __Pyx_GOTREF(__pyx_t_1);
9620   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9621   __pyx_r = __pyx_t_1;
9622   __pyx_t_1 = 0;
9623   goto __pyx_L0;
9624 
9625   /* "rasterio/_base.pyx":547
9626  *         """
9627  *
9628  *         def __get__(self):             # <<<<<<<<<<<<<<
9629  *             if self.count == 0:
9630  *                 return None
9631  */
9632 
9633   /* function exit code */
9634   __pyx_L1_error:;
9635   __Pyx_XDECREF(__pyx_t_1);
9636   __Pyx_XDECREF(__pyx_t_2);
9637   __Pyx_AddTraceback("rasterio._base.DatasetBase.nodata.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9638   __pyx_r = NULL;
9639   __pyx_L0:;
9640   __Pyx_XGIVEREF(__pyx_r);
9641   __Pyx_RefNannyFinishContext();
9642   return __pyx_r;
9643 }
9644 
9645 /* "rasterio/_base.pyx":552
9646  *             return self.nodatavals[0]
9647  *
9648  *         def __set__(self, value):             # <<<<<<<<<<<<<<
9649  *             self._set_nodatavals([value for old_val in self.nodatavals])
9650  *
9651  */
9652 
9653 /* Python wrapper */
9654 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6nodata_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6nodata_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)9655 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6nodata_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
9656   int __pyx_r;
9657   __Pyx_RefNannyDeclarations
9658   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
9659   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6nodata_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
9660 
9661   /* function exit code */
9662   __Pyx_RefNannyFinishContext();
9663   return __pyx_r;
9664 }
9665 
__pyx_pf_8rasterio_5_base_11DatasetBase_6nodata_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)9666 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6nodata_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
9667   CYTHON_UNUSED PyObject *__pyx_8genexpr1__pyx_v_old_val = NULL;
9668   int __pyx_r;
9669   __Pyx_RefNannyDeclarations
9670   PyObject *__pyx_t_1 = NULL;
9671   PyObject *__pyx_t_2 = NULL;
9672   PyObject *__pyx_t_3 = NULL;
9673   PyObject *__pyx_t_4 = NULL;
9674   PyObject *__pyx_t_5 = NULL;
9675   Py_ssize_t __pyx_t_6;
9676   PyObject *(*__pyx_t_7)(PyObject *);
9677   int __pyx_lineno = 0;
9678   const char *__pyx_filename = NULL;
9679   int __pyx_clineno = 0;
9680   __Pyx_RefNannySetupContext("__set__", 0);
9681 
9682   /* "rasterio/_base.pyx":553
9683  *
9684  *         def __set__(self, value):
9685  *             self._set_nodatavals([value for old_val in self.nodatavals])             # <<<<<<<<<<<<<<
9686  *
9687  *     def _mask_flags(self):
9688  */
9689   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_nodatavals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 553, __pyx_L1_error)
9690   __Pyx_GOTREF(__pyx_t_2);
9691   { /* enter inner scope */
9692     __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 553, __pyx_L5_error)
9693     __Pyx_GOTREF(__pyx_t_3);
9694     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_nodatavals); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 553, __pyx_L5_error)
9695     __Pyx_GOTREF(__pyx_t_4);
9696     if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
9697       __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
9698       __pyx_t_7 = NULL;
9699     } else {
9700       __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 553, __pyx_L5_error)
9701       __Pyx_GOTREF(__pyx_t_5);
9702       __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 553, __pyx_L5_error)
9703     }
9704     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9705     for (;;) {
9706       if (likely(!__pyx_t_7)) {
9707         if (likely(PyList_CheckExact(__pyx_t_5))) {
9708           if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
9709           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9710           __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 553, __pyx_L5_error)
9711           #else
9712           __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 553, __pyx_L5_error)
9713           __Pyx_GOTREF(__pyx_t_4);
9714           #endif
9715         } else {
9716           if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
9717           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9718           __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 553, __pyx_L5_error)
9719           #else
9720           __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 553, __pyx_L5_error)
9721           __Pyx_GOTREF(__pyx_t_4);
9722           #endif
9723         }
9724       } else {
9725         __pyx_t_4 = __pyx_t_7(__pyx_t_5);
9726         if (unlikely(!__pyx_t_4)) {
9727           PyObject* exc_type = PyErr_Occurred();
9728           if (exc_type) {
9729             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9730             else __PYX_ERR(0, 553, __pyx_L5_error)
9731           }
9732           break;
9733         }
9734         __Pyx_GOTREF(__pyx_t_4);
9735       }
9736       __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_old_val, __pyx_t_4);
9737       __pyx_t_4 = 0;
9738       if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_v_value))) __PYX_ERR(0, 553, __pyx_L5_error)
9739     }
9740     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9741     __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_old_val); __pyx_8genexpr1__pyx_v_old_val = 0;
9742     goto __pyx_L8_exit_scope;
9743     __pyx_L5_error:;
9744     __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_old_val); __pyx_8genexpr1__pyx_v_old_val = 0;
9745     goto __pyx_L1_error;
9746     __pyx_L8_exit_scope:;
9747   } /* exit inner scope */
9748   __pyx_t_5 = NULL;
9749   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
9750     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
9751     if (likely(__pyx_t_5)) {
9752       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
9753       __Pyx_INCREF(__pyx_t_5);
9754       __Pyx_INCREF(function);
9755       __Pyx_DECREF_SET(__pyx_t_2, function);
9756     }
9757   }
9758   __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
9759   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9760   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9761   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 553, __pyx_L1_error)
9762   __Pyx_GOTREF(__pyx_t_1);
9763   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9764   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9765 
9766   /* "rasterio/_base.pyx":552
9767  *             return self.nodatavals[0]
9768  *
9769  *         def __set__(self, value):             # <<<<<<<<<<<<<<
9770  *             self._set_nodatavals([value for old_val in self.nodatavals])
9771  *
9772  */
9773 
9774   /* function exit code */
9775   __pyx_r = 0;
9776   goto __pyx_L0;
9777   __pyx_L1_error:;
9778   __Pyx_XDECREF(__pyx_t_1);
9779   __Pyx_XDECREF(__pyx_t_2);
9780   __Pyx_XDECREF(__pyx_t_3);
9781   __Pyx_XDECREF(__pyx_t_4);
9782   __Pyx_XDECREF(__pyx_t_5);
9783   __Pyx_AddTraceback("rasterio._base.DatasetBase.nodata.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9784   __pyx_r = -1;
9785   __pyx_L0:;
9786   __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_old_val);
9787   __Pyx_RefNannyFinishContext();
9788   return __pyx_r;
9789 }
9790 
9791 /* "rasterio/_base.pyx":555
9792  *             self._set_nodatavals([value for old_val in self.nodatavals])
9793  *
9794  *     def _mask_flags(self):             # <<<<<<<<<<<<<<
9795  *         """Mask flags for each band."""
9796  *         cdef GDALRasterBandH band = NULL
9797  */
9798 
9799 /* Python wrapper */
9800 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_33_mask_flags(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
9801 static char __pyx_doc_8rasterio_5_base_11DatasetBase_32_mask_flags[] = "Mask flags for each band.";
__pyx_pw_8rasterio_5_base_11DatasetBase_33_mask_flags(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)9802 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_33_mask_flags(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9803   PyObject *__pyx_r = 0;
9804   __Pyx_RefNannyDeclarations
9805   __Pyx_RefNannySetupContext("_mask_flags (wrapper)", 0);
9806   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_32_mask_flags(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
9807 
9808   /* function exit code */
9809   __Pyx_RefNannyFinishContext();
9810   return __pyx_r;
9811 }
9812 static PyObject *__pyx_gb_8rasterio_5_base_11DatasetBase_11_mask_flags_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
9813 
9814 /* "rasterio/_base.pyx":558
9815  *         """Mask flags for each band."""
9816  *         cdef GDALRasterBandH band = NULL
9817  *         return tuple(GDALGetMaskFlags(self.band(j)) for j in self.indexes)             # <<<<<<<<<<<<<<
9818  *
9819  *     property mask_flag_enums:
9820  */
9821 
__pyx_pf_8rasterio_5_base_11DatasetBase_11_mask_flags_genexpr(PyObject * __pyx_self)9822 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_11_mask_flags_genexpr(PyObject *__pyx_self) {
9823   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
9824   PyObject *__pyx_r = NULL;
9825   __Pyx_RefNannyDeclarations
9826   int __pyx_lineno = 0;
9827   const char *__pyx_filename = NULL;
9828   int __pyx_clineno = 0;
9829   __Pyx_RefNannySetupContext("genexpr", 0);
9830   __pyx_cur_scope = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr *)__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_1_genexpr(__pyx_ptype_8rasterio_5_base___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
9831   if (unlikely(!__pyx_cur_scope)) {
9832     __pyx_cur_scope = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr *)Py_None);
9833     __Pyx_INCREF(Py_None);
9834     __PYX_ERR(0, 558, __pyx_L1_error)
9835   } else {
9836     __Pyx_GOTREF(__pyx_cur_scope);
9837   }
9838   __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags *) __pyx_self;
9839   __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
9840   __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
9841   {
9842     __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_8rasterio_5_base_11DatasetBase_11_mask_flags_2generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_mask_flags_locals_genexpr, __pyx_n_s_rasterio__base); if (unlikely(!gen)) __PYX_ERR(0, 558, __pyx_L1_error)
9843     __Pyx_DECREF(__pyx_cur_scope);
9844     __Pyx_RefNannyFinishContext();
9845     return (PyObject *) gen;
9846   }
9847 
9848   /* function exit code */
9849   __pyx_L1_error:;
9850   __Pyx_AddTraceback("rasterio._base.DatasetBase._mask_flags.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
9851   __pyx_r = NULL;
9852   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
9853   __Pyx_XGIVEREF(__pyx_r);
9854   __Pyx_RefNannyFinishContext();
9855   return __pyx_r;
9856 }
9857 
__pyx_gb_8rasterio_5_base_11DatasetBase_11_mask_flags_2generator1(__pyx_CoroutineObject * __pyx_generator,CYTHON_UNUSED PyThreadState * __pyx_tstate,PyObject * __pyx_sent_value)9858 static PyObject *__pyx_gb_8rasterio_5_base_11DatasetBase_11_mask_flags_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
9859 {
9860   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
9861   PyObject *__pyx_r = NULL;
9862   PyObject *__pyx_t_1 = NULL;
9863   PyObject *__pyx_t_2 = NULL;
9864   Py_ssize_t __pyx_t_3;
9865   PyObject *(*__pyx_t_4)(PyObject *);
9866   int __pyx_t_5;
9867   GDALRasterBandH __pyx_t_6;
9868   int __pyx_lineno = 0;
9869   const char *__pyx_filename = NULL;
9870   int __pyx_clineno = 0;
9871   __Pyx_RefNannyDeclarations
9872   __Pyx_RefNannySetupContext("genexpr", 0);
9873   switch (__pyx_generator->resume_label) {
9874     case 0: goto __pyx_L3_first_run;
9875     case 1: goto __pyx_L6_resume_from_yield;
9876     default: /* CPython raises the right error here */
9877     __Pyx_RefNannyFinishContext();
9878     return NULL;
9879   }
9880   __pyx_L3_first_run:;
9881   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 558, __pyx_L1_error)
9882   if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 558, __pyx_L1_error) }
9883   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_indexes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
9884   __Pyx_GOTREF(__pyx_t_1);
9885   if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
9886     __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
9887     __pyx_t_4 = NULL;
9888   } else {
9889     __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error)
9890     __Pyx_GOTREF(__pyx_t_2);
9891     __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 558, __pyx_L1_error)
9892   }
9893   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9894   for (;;) {
9895     if (likely(!__pyx_t_4)) {
9896       if (likely(PyList_CheckExact(__pyx_t_2))) {
9897         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
9898         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9899         __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 558, __pyx_L1_error)
9900         #else
9901         __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
9902         __Pyx_GOTREF(__pyx_t_1);
9903         #endif
9904       } else {
9905         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
9906         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9907         __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 558, __pyx_L1_error)
9908         #else
9909         __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
9910         __Pyx_GOTREF(__pyx_t_1);
9911         #endif
9912       }
9913     } else {
9914       __pyx_t_1 = __pyx_t_4(__pyx_t_2);
9915       if (unlikely(!__pyx_t_1)) {
9916         PyObject* exc_type = PyErr_Occurred();
9917         if (exc_type) {
9918           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9919           else __PYX_ERR(0, 558, __pyx_L1_error)
9920         }
9921         break;
9922       }
9923       __Pyx_GOTREF(__pyx_t_1);
9924     }
9925     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_j);
9926     __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_j, __pyx_t_1);
9927     __Pyx_GIVEREF(__pyx_t_1);
9928     __pyx_t_1 = 0;
9929     if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 558, __pyx_L1_error) }
9930     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_cur_scope->__pyx_v_j); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 558, __pyx_L1_error)
9931     __pyx_t_6 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->__pyx_vtab)->band(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_t_5); if (unlikely(__pyx_t_6 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 558, __pyx_L1_error)
9932     __pyx_t_1 = __Pyx_PyInt_From_int(GDALGetMaskFlags(__pyx_t_6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
9933     __Pyx_GOTREF(__pyx_t_1);
9934     __pyx_r = __pyx_t_1;
9935     __pyx_t_1 = 0;
9936     __Pyx_XGIVEREF(__pyx_t_2);
9937     __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
9938     __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
9939     __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
9940     __Pyx_XGIVEREF(__pyx_r);
9941     __Pyx_RefNannyFinishContext();
9942     __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
9943     /* return from generator, yielding value */
9944     __pyx_generator->resume_label = 1;
9945     return __pyx_r;
9946     __pyx_L6_resume_from_yield:;
9947     __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
9948     __pyx_cur_scope->__pyx_t_0 = 0;
9949     __Pyx_XGOTREF(__pyx_t_2);
9950     __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
9951     __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
9952     if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 558, __pyx_L1_error)
9953   }
9954   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9955   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
9956 
9957   /* function exit code */
9958   PyErr_SetNone(PyExc_StopIteration);
9959   goto __pyx_L0;
9960   __pyx_L1_error:;
9961   __Pyx_XDECREF(__pyx_t_1);
9962   __Pyx_XDECREF(__pyx_t_2);
9963   __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
9964   __pyx_L0:;
9965   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
9966   #if !CYTHON_USE_EXC_INFO_STACK
9967   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
9968   #endif
9969   __pyx_generator->resume_label = -1;
9970   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
9971   __Pyx_RefNannyFinishContext();
9972   return __pyx_r;
9973 }
9974 
9975 /* "rasterio/_base.pyx":555
9976  *             self._set_nodatavals([value for old_val in self.nodatavals])
9977  *
9978  *     def _mask_flags(self):             # <<<<<<<<<<<<<<
9979  *         """Mask flags for each band."""
9980  *         cdef GDALRasterBandH band = NULL
9981  */
9982 
__pyx_pf_8rasterio_5_base_11DatasetBase_32_mask_flags(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)9983 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_32_mask_flags(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
9984   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags *__pyx_cur_scope;
9985   CYTHON_UNUSED GDALRasterBandH __pyx_v_band;
9986   PyObject *__pyx_r = NULL;
9987   __Pyx_RefNannyDeclarations
9988   PyObject *__pyx_t_1 = NULL;
9989   PyObject *__pyx_t_2 = NULL;
9990   int __pyx_lineno = 0;
9991   const char *__pyx_filename = NULL;
9992   int __pyx_clineno = 0;
9993   __Pyx_RefNannySetupContext("_mask_flags", 0);
9994   __pyx_cur_scope = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags *)__pyx_tp_new_8rasterio_5_base___pyx_scope_struct___mask_flags(__pyx_ptype_8rasterio_5_base___pyx_scope_struct___mask_flags, __pyx_empty_tuple, NULL);
9995   if (unlikely(!__pyx_cur_scope)) {
9996     __pyx_cur_scope = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags *)Py_None);
9997     __Pyx_INCREF(Py_None);
9998     __PYX_ERR(0, 555, __pyx_L1_error)
9999   } else {
10000     __Pyx_GOTREF(__pyx_cur_scope);
10001   }
10002   __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
10003   __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
10004   __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
10005 
10006   /* "rasterio/_base.pyx":557
10007  *     def _mask_flags(self):
10008  *         """Mask flags for each band."""
10009  *         cdef GDALRasterBandH band = NULL             # <<<<<<<<<<<<<<
10010  *         return tuple(GDALGetMaskFlags(self.band(j)) for j in self.indexes)
10011  *
10012  */
10013   __pyx_v_band = NULL;
10014 
10015   /* "rasterio/_base.pyx":558
10016  *         """Mask flags for each band."""
10017  *         cdef GDALRasterBandH band = NULL
10018  *         return tuple(GDALGetMaskFlags(self.band(j)) for j in self.indexes)             # <<<<<<<<<<<<<<
10019  *
10020  *     property mask_flag_enums:
10021  */
10022   __Pyx_XDECREF(__pyx_r);
10023   __pyx_t_1 = __pyx_pf_8rasterio_5_base_11DatasetBase_11_mask_flags_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
10024   __Pyx_GOTREF(__pyx_t_1);
10025   __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error)
10026   __Pyx_GOTREF(__pyx_t_2);
10027   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10028   __pyx_r = __pyx_t_2;
10029   __pyx_t_2 = 0;
10030   goto __pyx_L0;
10031 
10032   /* "rasterio/_base.pyx":555
10033  *             self._set_nodatavals([value for old_val in self.nodatavals])
10034  *
10035  *     def _mask_flags(self):             # <<<<<<<<<<<<<<
10036  *         """Mask flags for each band."""
10037  *         cdef GDALRasterBandH band = NULL
10038  */
10039 
10040   /* function exit code */
10041   __pyx_L1_error:;
10042   __Pyx_XDECREF(__pyx_t_1);
10043   __Pyx_XDECREF(__pyx_t_2);
10044   __Pyx_AddTraceback("rasterio._base.DatasetBase._mask_flags", __pyx_clineno, __pyx_lineno, __pyx_filename);
10045   __pyx_r = NULL;
10046   __pyx_L0:;
10047   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
10048   __Pyx_XGIVEREF(__pyx_r);
10049   __Pyx_RefNannyFinishContext();
10050   return __pyx_r;
10051 }
10052 
10053 /* "rasterio/_base.pyx":590
10054  *         False
10055  *         """
10056  *         def __get__(self):             # <<<<<<<<<<<<<<
10057  *             return tuple(
10058  *                 [flag for flag in MaskFlags if x & flag.value]
10059  */
10060 
10061 /* Python wrapper */
10062 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_15mask_flag_enums_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_15mask_flag_enums_1__get__(PyObject * __pyx_v_self)10063 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_15mask_flag_enums_1__get__(PyObject *__pyx_v_self) {
10064   PyObject *__pyx_r = 0;
10065   __Pyx_RefNannyDeclarations
10066   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10067   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_15mask_flag_enums___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
10068 
10069   /* function exit code */
10070   __Pyx_RefNannyFinishContext();
10071   return __pyx_r;
10072 }
10073 static PyObject *__pyx_gb_8rasterio_5_base_11DatasetBase_15mask_flag_enums_7__get___2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
10074 
10075 /* "rasterio/_base.pyx":592
10076  *         def __get__(self):
10077  *             return tuple(
10078  *                 [flag for flag in MaskFlags if x & flag.value]             # <<<<<<<<<<<<<<
10079  *                 for x in self._mask_flags())
10080  *
10081  */
10082 
__pyx_pf_8rasterio_5_base_11DatasetBase_15mask_flag_enums_7__get___genexpr(PyObject * __pyx_self)10083 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_15mask_flag_enums_7__get___genexpr(PyObject *__pyx_self) {
10084   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
10085   PyObject *__pyx_r = NULL;
10086   __Pyx_RefNannyDeclarations
10087   int __pyx_lineno = 0;
10088   const char *__pyx_filename = NULL;
10089   int __pyx_clineno = 0;
10090   __Pyx_RefNannySetupContext("genexpr", 0);
10091   __pyx_cur_scope = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr *)__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_3_genexpr(__pyx_ptype_8rasterio_5_base___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL);
10092   if (unlikely(!__pyx_cur_scope)) {
10093     __pyx_cur_scope = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr *)Py_None);
10094     __Pyx_INCREF(Py_None);
10095     __PYX_ERR(0, 592, __pyx_L1_error)
10096   } else {
10097     __Pyx_GOTREF(__pyx_cur_scope);
10098   }
10099   __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__ *) __pyx_self;
10100   __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
10101   __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
10102   {
10103     __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_8rasterio_5_base_11DatasetBase_15mask_flag_enums_7__get___2generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_DatasetBase___get___locals_genex, __pyx_n_s_rasterio__base); if (unlikely(!gen)) __PYX_ERR(0, 592, __pyx_L1_error)
10104     __Pyx_DECREF(__pyx_cur_scope);
10105     __Pyx_RefNannyFinishContext();
10106     return (PyObject *) gen;
10107   }
10108 
10109   /* function exit code */
10110   __pyx_L1_error:;
10111   __Pyx_AddTraceback("rasterio._base.DatasetBase.mask_flag_enums.__get__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
10112   __pyx_r = NULL;
10113   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
10114   __Pyx_XGIVEREF(__pyx_r);
10115   __Pyx_RefNannyFinishContext();
10116   return __pyx_r;
10117 }
10118 
__pyx_gb_8rasterio_5_base_11DatasetBase_15mask_flag_enums_7__get___2generator2(__pyx_CoroutineObject * __pyx_generator,CYTHON_UNUSED PyThreadState * __pyx_tstate,PyObject * __pyx_sent_value)10119 static PyObject *__pyx_gb_8rasterio_5_base_11DatasetBase_15mask_flag_enums_7__get___2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
10120 {
10121   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
10122   PyObject *__pyx_r = NULL;
10123   PyObject *__pyx_t_1 = NULL;
10124   PyObject *__pyx_t_2 = NULL;
10125   PyObject *__pyx_t_3 = NULL;
10126   Py_ssize_t __pyx_t_4;
10127   PyObject *(*__pyx_t_5)(PyObject *);
10128   PyObject *__pyx_t_6 = NULL;
10129   Py_ssize_t __pyx_t_7;
10130   PyObject *(*__pyx_t_8)(PyObject *);
10131   PyObject *__pyx_t_9 = NULL;
10132   int __pyx_t_10;
10133   int __pyx_lineno = 0;
10134   const char *__pyx_filename = NULL;
10135   int __pyx_clineno = 0;
10136   __Pyx_RefNannyDeclarations
10137   __Pyx_RefNannySetupContext("genexpr", 0);
10138   switch (__pyx_generator->resume_label) {
10139     case 0: goto __pyx_L3_first_run;
10140     case 1: goto __pyx_L9_resume_from_yield;
10141     default: /* CPython raises the right error here */
10142     __Pyx_RefNannyFinishContext();
10143     return NULL;
10144   }
10145   __pyx_L3_first_run:;
10146   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 592, __pyx_L1_error)
10147 
10148   /* "rasterio/_base.pyx":593
10149  *             return tuple(
10150  *                 [flag for flag in MaskFlags if x & flag.value]
10151  *                 for x in self._mask_flags())             # <<<<<<<<<<<<<<
10152  *
10153  *     def _set_crs(self, value):
10154  */
10155   if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 593, __pyx_L1_error) }
10156   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_mask_flags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 593, __pyx_L1_error)
10157   __Pyx_GOTREF(__pyx_t_2);
10158   __pyx_t_3 = NULL;
10159   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
10160     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
10161     if (likely(__pyx_t_3)) {
10162       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10163       __Pyx_INCREF(__pyx_t_3);
10164       __Pyx_INCREF(function);
10165       __Pyx_DECREF_SET(__pyx_t_2, function);
10166     }
10167   }
10168   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
10169   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10170   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error)
10171   __Pyx_GOTREF(__pyx_t_1);
10172   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10173   if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
10174     __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
10175     __pyx_t_5 = NULL;
10176   } else {
10177     __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 593, __pyx_L1_error)
10178     __Pyx_GOTREF(__pyx_t_2);
10179     __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 593, __pyx_L1_error)
10180   }
10181   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10182   for (;;) {
10183     if (likely(!__pyx_t_5)) {
10184       if (likely(PyList_CheckExact(__pyx_t_2))) {
10185         if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
10186         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10187         __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 593, __pyx_L1_error)
10188         #else
10189         __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error)
10190         __Pyx_GOTREF(__pyx_t_1);
10191         #endif
10192       } else {
10193         if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
10194         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10195         __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 593, __pyx_L1_error)
10196         #else
10197         __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error)
10198         __Pyx_GOTREF(__pyx_t_1);
10199         #endif
10200       }
10201     } else {
10202       __pyx_t_1 = __pyx_t_5(__pyx_t_2);
10203       if (unlikely(!__pyx_t_1)) {
10204         PyObject* exc_type = PyErr_Occurred();
10205         if (exc_type) {
10206           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
10207           else __PYX_ERR(0, 593, __pyx_L1_error)
10208         }
10209         break;
10210       }
10211       __Pyx_GOTREF(__pyx_t_1);
10212     }
10213     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x);
10214     __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x, __pyx_t_1);
10215     __Pyx_GIVEREF(__pyx_t_1);
10216     __pyx_t_1 = 0;
10217 
10218     /* "rasterio/_base.pyx":592
10219  *         def __get__(self):
10220  *             return tuple(
10221  *                 [flag for flag in MaskFlags if x & flag.value]             # <<<<<<<<<<<<<<
10222  *                 for x in self._mask_flags())
10223  *
10224  */
10225     { /* enter inner scope */
10226       __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L1_error)
10227       __Pyx_GOTREF(__pyx_t_1);
10228       __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MaskFlags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 592, __pyx_L1_error)
10229       __Pyx_GOTREF(__pyx_t_3);
10230       if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
10231         __pyx_t_6 = __pyx_t_3; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
10232         __pyx_t_8 = NULL;
10233       } else {
10234         __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 592, __pyx_L1_error)
10235         __Pyx_GOTREF(__pyx_t_6);
10236         __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 592, __pyx_L1_error)
10237       }
10238       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10239       for (;;) {
10240         if (likely(!__pyx_t_8)) {
10241           if (likely(PyList_CheckExact(__pyx_t_6))) {
10242             if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
10243             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10244             __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 592, __pyx_L1_error)
10245             #else
10246             __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 592, __pyx_L1_error)
10247             __Pyx_GOTREF(__pyx_t_3);
10248             #endif
10249           } else {
10250             if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
10251             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10252             __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 592, __pyx_L1_error)
10253             #else
10254             __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 592, __pyx_L1_error)
10255             __Pyx_GOTREF(__pyx_t_3);
10256             #endif
10257           }
10258         } else {
10259           __pyx_t_3 = __pyx_t_8(__pyx_t_6);
10260           if (unlikely(!__pyx_t_3)) {
10261             PyObject* exc_type = PyErr_Occurred();
10262             if (exc_type) {
10263               if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
10264               else __PYX_ERR(0, 592, __pyx_L1_error)
10265             }
10266             break;
10267           }
10268           __Pyx_GOTREF(__pyx_t_3);
10269         }
10270         __Pyx_XGOTREF(__pyx_cur_scope->__pyx_8genexpr4__pyx_v_flag);
10271         __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_8genexpr4__pyx_v_flag, __pyx_t_3);
10272         __Pyx_GIVEREF(__pyx_t_3);
10273         __pyx_t_3 = 0;
10274         __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_8genexpr4__pyx_v_flag, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 592, __pyx_L1_error)
10275         __Pyx_GOTREF(__pyx_t_3);
10276         __pyx_t_9 = PyNumber_And(__pyx_cur_scope->__pyx_v_x, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 592, __pyx_L1_error)
10277         __Pyx_GOTREF(__pyx_t_9);
10278         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10279         __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 592, __pyx_L1_error)
10280         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
10281         if (__pyx_t_10) {
10282           if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_cur_scope->__pyx_8genexpr4__pyx_v_flag))) __PYX_ERR(0, 592, __pyx_L1_error)
10283         }
10284       }
10285       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10286     } /* exit inner scope */
10287     __pyx_r = __pyx_t_1;
10288     __pyx_t_1 = 0;
10289     __Pyx_XGIVEREF(__pyx_t_2);
10290     __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
10291     __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
10292     __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
10293     __Pyx_XGIVEREF(__pyx_r);
10294     __Pyx_RefNannyFinishContext();
10295     __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
10296     /* return from generator, yielding value */
10297     __pyx_generator->resume_label = 1;
10298     return __pyx_r;
10299     __pyx_L9_resume_from_yield:;
10300     __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
10301     __pyx_cur_scope->__pyx_t_0 = 0;
10302     __Pyx_XGOTREF(__pyx_t_2);
10303     __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
10304     __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
10305     if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 592, __pyx_L1_error)
10306 
10307     /* "rasterio/_base.pyx":593
10308  *             return tuple(
10309  *                 [flag for flag in MaskFlags if x & flag.value]
10310  *                 for x in self._mask_flags())             # <<<<<<<<<<<<<<
10311  *
10312  *     def _set_crs(self, value):
10313  */
10314   }
10315   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10316   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
10317 
10318   /* "rasterio/_base.pyx":592
10319  *         def __get__(self):
10320  *             return tuple(
10321  *                 [flag for flag in MaskFlags if x & flag.value]             # <<<<<<<<<<<<<<
10322  *                 for x in self._mask_flags())
10323  *
10324  */
10325 
10326   /* function exit code */
10327   PyErr_SetNone(PyExc_StopIteration);
10328   goto __pyx_L0;
10329   __pyx_L1_error:;
10330   __Pyx_XDECREF(__pyx_t_1);
10331   __Pyx_XDECREF(__pyx_t_2);
10332   __Pyx_XDECREF(__pyx_t_3);
10333   __Pyx_XDECREF(__pyx_t_6);
10334   __Pyx_XDECREF(__pyx_t_9);
10335   __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
10336   __pyx_L0:;
10337   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
10338   #if !CYTHON_USE_EXC_INFO_STACK
10339   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
10340   #endif
10341   __pyx_generator->resume_label = -1;
10342   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
10343   __Pyx_RefNannyFinishContext();
10344   return __pyx_r;
10345 }
10346 
10347 /* "rasterio/_base.pyx":590
10348  *         False
10349  *         """
10350  *         def __get__(self):             # <<<<<<<<<<<<<<
10351  *             return tuple(
10352  *                 [flag for flag in MaskFlags if x & flag.value]
10353  */
10354 
__pyx_pf_8rasterio_5_base_11DatasetBase_15mask_flag_enums___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)10355 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_15mask_flag_enums___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
10356   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__ *__pyx_cur_scope;
10357   PyObject *__pyx_r = NULL;
10358   __Pyx_RefNannyDeclarations
10359   PyObject *__pyx_t_1 = NULL;
10360   PyObject *__pyx_t_2 = NULL;
10361   int __pyx_lineno = 0;
10362   const char *__pyx_filename = NULL;
10363   int __pyx_clineno = 0;
10364   __Pyx_RefNannySetupContext("__get__", 0);
10365   __pyx_cur_scope = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__ *)__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_2___get__(__pyx_ptype_8rasterio_5_base___pyx_scope_struct_2___get__, __pyx_empty_tuple, NULL);
10366   if (unlikely(!__pyx_cur_scope)) {
10367     __pyx_cur_scope = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__ *)Py_None);
10368     __Pyx_INCREF(Py_None);
10369     __PYX_ERR(0, 590, __pyx_L1_error)
10370   } else {
10371     __Pyx_GOTREF(__pyx_cur_scope);
10372   }
10373   __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
10374   __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
10375   __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
10376 
10377   /* "rasterio/_base.pyx":591
10378  *         """
10379  *         def __get__(self):
10380  *             return tuple(             # <<<<<<<<<<<<<<
10381  *                 [flag for flag in MaskFlags if x & flag.value]
10382  *                 for x in self._mask_flags())
10383  */
10384   __Pyx_XDECREF(__pyx_r);
10385 
10386   /* "rasterio/_base.pyx":592
10387  *         def __get__(self):
10388  *             return tuple(
10389  *                 [flag for flag in MaskFlags if x & flag.value]             # <<<<<<<<<<<<<<
10390  *                 for x in self._mask_flags())
10391  *
10392  */
10393   __pyx_t_1 = __pyx_pf_8rasterio_5_base_11DatasetBase_15mask_flag_enums_7__get___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L1_error)
10394   __Pyx_GOTREF(__pyx_t_1);
10395 
10396   /* "rasterio/_base.pyx":591
10397  *         """
10398  *         def __get__(self):
10399  *             return tuple(             # <<<<<<<<<<<<<<
10400  *                 [flag for flag in MaskFlags if x & flag.value]
10401  *                 for x in self._mask_flags())
10402  */
10403   __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 591, __pyx_L1_error)
10404   __Pyx_GOTREF(__pyx_t_2);
10405   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10406   __pyx_r = __pyx_t_2;
10407   __pyx_t_2 = 0;
10408   goto __pyx_L0;
10409 
10410   /* "rasterio/_base.pyx":590
10411  *         False
10412  *         """
10413  *         def __get__(self):             # <<<<<<<<<<<<<<
10414  *             return tuple(
10415  *                 [flag for flag in MaskFlags if x & flag.value]
10416  */
10417 
10418   /* function exit code */
10419   __pyx_L1_error:;
10420   __Pyx_XDECREF(__pyx_t_1);
10421   __Pyx_XDECREF(__pyx_t_2);
10422   __Pyx_AddTraceback("rasterio._base.DatasetBase.mask_flag_enums.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10423   __pyx_r = NULL;
10424   __pyx_L0:;
10425   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
10426   __Pyx_XGIVEREF(__pyx_r);
10427   __Pyx_RefNannyFinishContext();
10428   return __pyx_r;
10429 }
10430 
10431 /* "rasterio/_base.pyx":595
10432  *                 for x in self._mask_flags())
10433  *
10434  *     def _set_crs(self, value):             # <<<<<<<<<<<<<<
10435  *         raise DatasetAttributeError("read-only attribute")
10436  *
10437  */
10438 
10439 /* Python wrapper */
10440 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_35_set_crs(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_35_set_crs(PyObject * __pyx_v_self,PyObject * __pyx_v_value)10441 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_35_set_crs(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
10442   PyObject *__pyx_r = 0;
10443   __Pyx_RefNannyDeclarations
10444   __Pyx_RefNannySetupContext("_set_crs (wrapper)", 0);
10445   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_34_set_crs(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
10446 
10447   /* function exit code */
10448   __Pyx_RefNannyFinishContext();
10449   return __pyx_r;
10450 }
10451 
__pyx_pf_8rasterio_5_base_11DatasetBase_34_set_crs(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_value)10452 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_34_set_crs(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value) {
10453   PyObject *__pyx_r = NULL;
10454   __Pyx_RefNannyDeclarations
10455   PyObject *__pyx_t_1 = NULL;
10456   PyObject *__pyx_t_2 = NULL;
10457   PyObject *__pyx_t_3 = NULL;
10458   int __pyx_lineno = 0;
10459   const char *__pyx_filename = NULL;
10460   int __pyx_clineno = 0;
10461   __Pyx_RefNannySetupContext("_set_crs", 0);
10462 
10463   /* "rasterio/_base.pyx":596
10464  *
10465  *     def _set_crs(self, value):
10466  *         raise DatasetAttributeError("read-only attribute")             # <<<<<<<<<<<<<<
10467  *
10468  *     property crs:
10469  */
10470   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DatasetAttributeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error)
10471   __Pyx_GOTREF(__pyx_t_2);
10472   __pyx_t_3 = NULL;
10473   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
10474     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
10475     if (likely(__pyx_t_3)) {
10476       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10477       __Pyx_INCREF(__pyx_t_3);
10478       __Pyx_INCREF(function);
10479       __Pyx_DECREF_SET(__pyx_t_2, function);
10480     }
10481   }
10482   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_read_only_attribute) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_read_only_attribute);
10483   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10484   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error)
10485   __Pyx_GOTREF(__pyx_t_1);
10486   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10487   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10488   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10489   __PYX_ERR(0, 596, __pyx_L1_error)
10490 
10491   /* "rasterio/_base.pyx":595
10492  *                 for x in self._mask_flags())
10493  *
10494  *     def _set_crs(self, value):             # <<<<<<<<<<<<<<
10495  *         raise DatasetAttributeError("read-only attribute")
10496  *
10497  */
10498 
10499   /* function exit code */
10500   __pyx_L1_error:;
10501   __Pyx_XDECREF(__pyx_t_1);
10502   __Pyx_XDECREF(__pyx_t_2);
10503   __Pyx_XDECREF(__pyx_t_3);
10504   __Pyx_AddTraceback("rasterio._base.DatasetBase._set_crs", __pyx_clineno, __pyx_lineno, __pyx_filename);
10505   __pyx_r = NULL;
10506   __Pyx_XGIVEREF(__pyx_r);
10507   __Pyx_RefNannyFinishContext();
10508   return __pyx_r;
10509 }
10510 
10511 /* "rasterio/_base.pyx":609
10512  *         """
10513  *
10514  *         def __get__(self):             # <<<<<<<<<<<<<<
10515  *             return self._get_crs()
10516  *
10517  */
10518 
10519 /* Python wrapper */
10520 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_3crs_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_3crs_1__get__(PyObject * __pyx_v_self)10521 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_3crs_1__get__(PyObject *__pyx_v_self) {
10522   PyObject *__pyx_r = 0;
10523   __Pyx_RefNannyDeclarations
10524   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10525   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_3crs___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
10526 
10527   /* function exit code */
10528   __Pyx_RefNannyFinishContext();
10529   return __pyx_r;
10530 }
10531 
__pyx_pf_8rasterio_5_base_11DatasetBase_3crs___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)10532 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_3crs___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
10533   PyObject *__pyx_r = NULL;
10534   __Pyx_RefNannyDeclarations
10535   PyObject *__pyx_t_1 = NULL;
10536   PyObject *__pyx_t_2 = NULL;
10537   PyObject *__pyx_t_3 = NULL;
10538   int __pyx_lineno = 0;
10539   const char *__pyx_filename = NULL;
10540   int __pyx_clineno = 0;
10541   __Pyx_RefNannySetupContext("__get__", 0);
10542 
10543   /* "rasterio/_base.pyx":610
10544  *
10545  *         def __get__(self):
10546  *             return self._get_crs()             # <<<<<<<<<<<<<<
10547  *
10548  *         def __set__(self, value):
10549  */
10550   __Pyx_XDECREF(__pyx_r);
10551   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_crs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error)
10552   __Pyx_GOTREF(__pyx_t_2);
10553   __pyx_t_3 = NULL;
10554   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
10555     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
10556     if (likely(__pyx_t_3)) {
10557       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10558       __Pyx_INCREF(__pyx_t_3);
10559       __Pyx_INCREF(function);
10560       __Pyx_DECREF_SET(__pyx_t_2, function);
10561     }
10562   }
10563   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
10564   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10565   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error)
10566   __Pyx_GOTREF(__pyx_t_1);
10567   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10568   __pyx_r = __pyx_t_1;
10569   __pyx_t_1 = 0;
10570   goto __pyx_L0;
10571 
10572   /* "rasterio/_base.pyx":609
10573  *         """
10574  *
10575  *         def __get__(self):             # <<<<<<<<<<<<<<
10576  *             return self._get_crs()
10577  *
10578  */
10579 
10580   /* function exit code */
10581   __pyx_L1_error:;
10582   __Pyx_XDECREF(__pyx_t_1);
10583   __Pyx_XDECREF(__pyx_t_2);
10584   __Pyx_XDECREF(__pyx_t_3);
10585   __Pyx_AddTraceback("rasterio._base.DatasetBase.crs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10586   __pyx_r = NULL;
10587   __pyx_L0:;
10588   __Pyx_XGIVEREF(__pyx_r);
10589   __Pyx_RefNannyFinishContext();
10590   return __pyx_r;
10591 }
10592 
10593 /* "rasterio/_base.pyx":612
10594  *             return self._get_crs()
10595  *
10596  *         def __set__(self, value):             # <<<<<<<<<<<<<<
10597  *             self._set_crs(value)
10598  *
10599  */
10600 
10601 /* Python wrapper */
10602 static int __pyx_pw_8rasterio_5_base_11DatasetBase_3crs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_3crs_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)10603 static int __pyx_pw_8rasterio_5_base_11DatasetBase_3crs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
10604   int __pyx_r;
10605   __Pyx_RefNannyDeclarations
10606   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
10607   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_3crs_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
10608 
10609   /* function exit code */
10610   __Pyx_RefNannyFinishContext();
10611   return __pyx_r;
10612 }
10613 
__pyx_pf_8rasterio_5_base_11DatasetBase_3crs_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)10614 static int __pyx_pf_8rasterio_5_base_11DatasetBase_3crs_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
10615   int __pyx_r;
10616   __Pyx_RefNannyDeclarations
10617   PyObject *__pyx_t_1 = NULL;
10618   PyObject *__pyx_t_2 = NULL;
10619   PyObject *__pyx_t_3 = NULL;
10620   int __pyx_lineno = 0;
10621   const char *__pyx_filename = NULL;
10622   int __pyx_clineno = 0;
10623   __Pyx_RefNannySetupContext("__set__", 0);
10624 
10625   /* "rasterio/_base.pyx":613
10626  *
10627  *         def __set__(self, value):
10628  *             self._set_crs(value)             # <<<<<<<<<<<<<<
10629  *
10630  *     def _set_all_descriptions(self, value):
10631  */
10632   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_crs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error)
10633   __Pyx_GOTREF(__pyx_t_2);
10634   __pyx_t_3 = NULL;
10635   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
10636     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
10637     if (likely(__pyx_t_3)) {
10638       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10639       __Pyx_INCREF(__pyx_t_3);
10640       __Pyx_INCREF(function);
10641       __Pyx_DECREF_SET(__pyx_t_2, function);
10642     }
10643   }
10644   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_value) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_value);
10645   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10646   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error)
10647   __Pyx_GOTREF(__pyx_t_1);
10648   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10649   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10650 
10651   /* "rasterio/_base.pyx":612
10652  *             return self._get_crs()
10653  *
10654  *         def __set__(self, value):             # <<<<<<<<<<<<<<
10655  *             self._set_crs(value)
10656  *
10657  */
10658 
10659   /* function exit code */
10660   __pyx_r = 0;
10661   goto __pyx_L0;
10662   __pyx_L1_error:;
10663   __Pyx_XDECREF(__pyx_t_1);
10664   __Pyx_XDECREF(__pyx_t_2);
10665   __Pyx_XDECREF(__pyx_t_3);
10666   __Pyx_AddTraceback("rasterio._base.DatasetBase.crs.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10667   __pyx_r = -1;
10668   __pyx_L0:;
10669   __Pyx_RefNannyFinishContext();
10670   return __pyx_r;
10671 }
10672 
10673 /* "rasterio/_base.pyx":615
10674  *             self._set_crs(value)
10675  *
10676  *     def _set_all_descriptions(self, value):             # <<<<<<<<<<<<<<
10677  *         raise DatasetAttributeError("read-only attribute")
10678  *
10679  */
10680 
10681 /* Python wrapper */
10682 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_37_set_all_descriptions(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_37_set_all_descriptions(PyObject * __pyx_v_self,PyObject * __pyx_v_value)10683 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_37_set_all_descriptions(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
10684   PyObject *__pyx_r = 0;
10685   __Pyx_RefNannyDeclarations
10686   __Pyx_RefNannySetupContext("_set_all_descriptions (wrapper)", 0);
10687   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_36_set_all_descriptions(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
10688 
10689   /* function exit code */
10690   __Pyx_RefNannyFinishContext();
10691   return __pyx_r;
10692 }
10693 
__pyx_pf_8rasterio_5_base_11DatasetBase_36_set_all_descriptions(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_value)10694 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_36_set_all_descriptions(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value) {
10695   PyObject *__pyx_r = NULL;
10696   __Pyx_RefNannyDeclarations
10697   PyObject *__pyx_t_1 = NULL;
10698   PyObject *__pyx_t_2 = NULL;
10699   PyObject *__pyx_t_3 = NULL;
10700   int __pyx_lineno = 0;
10701   const char *__pyx_filename = NULL;
10702   int __pyx_clineno = 0;
10703   __Pyx_RefNannySetupContext("_set_all_descriptions", 0);
10704 
10705   /* "rasterio/_base.pyx":616
10706  *
10707  *     def _set_all_descriptions(self, value):
10708  *         raise DatasetAttributeError("read-only attribute")             # <<<<<<<<<<<<<<
10709  *
10710  *     def _set_all_scales(self, value):
10711  */
10712   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DatasetAttributeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 616, __pyx_L1_error)
10713   __Pyx_GOTREF(__pyx_t_2);
10714   __pyx_t_3 = NULL;
10715   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
10716     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
10717     if (likely(__pyx_t_3)) {
10718       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10719       __Pyx_INCREF(__pyx_t_3);
10720       __Pyx_INCREF(function);
10721       __Pyx_DECREF_SET(__pyx_t_2, function);
10722     }
10723   }
10724   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_read_only_attribute) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_read_only_attribute);
10725   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10726   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 616, __pyx_L1_error)
10727   __Pyx_GOTREF(__pyx_t_1);
10728   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10729   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10730   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10731   __PYX_ERR(0, 616, __pyx_L1_error)
10732 
10733   /* "rasterio/_base.pyx":615
10734  *             self._set_crs(value)
10735  *
10736  *     def _set_all_descriptions(self, value):             # <<<<<<<<<<<<<<
10737  *         raise DatasetAttributeError("read-only attribute")
10738  *
10739  */
10740 
10741   /* function exit code */
10742   __pyx_L1_error:;
10743   __Pyx_XDECREF(__pyx_t_1);
10744   __Pyx_XDECREF(__pyx_t_2);
10745   __Pyx_XDECREF(__pyx_t_3);
10746   __Pyx_AddTraceback("rasterio._base.DatasetBase._set_all_descriptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
10747   __pyx_r = NULL;
10748   __Pyx_XGIVEREF(__pyx_r);
10749   __Pyx_RefNannyFinishContext();
10750   return __pyx_r;
10751 }
10752 
10753 /* "rasterio/_base.pyx":618
10754  *         raise DatasetAttributeError("read-only attribute")
10755  *
10756  *     def _set_all_scales(self, value):             # <<<<<<<<<<<<<<
10757  *         raise DatasetAttributeError("read-only attribute")
10758  *
10759  */
10760 
10761 /* Python wrapper */
10762 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_39_set_all_scales(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_39_set_all_scales(PyObject * __pyx_v_self,PyObject * __pyx_v_value)10763 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_39_set_all_scales(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
10764   PyObject *__pyx_r = 0;
10765   __Pyx_RefNannyDeclarations
10766   __Pyx_RefNannySetupContext("_set_all_scales (wrapper)", 0);
10767   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_38_set_all_scales(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
10768 
10769   /* function exit code */
10770   __Pyx_RefNannyFinishContext();
10771   return __pyx_r;
10772 }
10773 
__pyx_pf_8rasterio_5_base_11DatasetBase_38_set_all_scales(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_value)10774 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_38_set_all_scales(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value) {
10775   PyObject *__pyx_r = NULL;
10776   __Pyx_RefNannyDeclarations
10777   PyObject *__pyx_t_1 = NULL;
10778   PyObject *__pyx_t_2 = NULL;
10779   PyObject *__pyx_t_3 = NULL;
10780   int __pyx_lineno = 0;
10781   const char *__pyx_filename = NULL;
10782   int __pyx_clineno = 0;
10783   __Pyx_RefNannySetupContext("_set_all_scales", 0);
10784 
10785   /* "rasterio/_base.pyx":619
10786  *
10787  *     def _set_all_scales(self, value):
10788  *         raise DatasetAttributeError("read-only attribute")             # <<<<<<<<<<<<<<
10789  *
10790  *     def _set_all_offsets(self, value):
10791  */
10792   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DatasetAttributeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 619, __pyx_L1_error)
10793   __Pyx_GOTREF(__pyx_t_2);
10794   __pyx_t_3 = NULL;
10795   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
10796     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
10797     if (likely(__pyx_t_3)) {
10798       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10799       __Pyx_INCREF(__pyx_t_3);
10800       __Pyx_INCREF(function);
10801       __Pyx_DECREF_SET(__pyx_t_2, function);
10802     }
10803   }
10804   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_read_only_attribute) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_read_only_attribute);
10805   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10806   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error)
10807   __Pyx_GOTREF(__pyx_t_1);
10808   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10809   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10810   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10811   __PYX_ERR(0, 619, __pyx_L1_error)
10812 
10813   /* "rasterio/_base.pyx":618
10814  *         raise DatasetAttributeError("read-only attribute")
10815  *
10816  *     def _set_all_scales(self, value):             # <<<<<<<<<<<<<<
10817  *         raise DatasetAttributeError("read-only attribute")
10818  *
10819  */
10820 
10821   /* function exit code */
10822   __pyx_L1_error:;
10823   __Pyx_XDECREF(__pyx_t_1);
10824   __Pyx_XDECREF(__pyx_t_2);
10825   __Pyx_XDECREF(__pyx_t_3);
10826   __Pyx_AddTraceback("rasterio._base.DatasetBase._set_all_scales", __pyx_clineno, __pyx_lineno, __pyx_filename);
10827   __pyx_r = NULL;
10828   __Pyx_XGIVEREF(__pyx_r);
10829   __Pyx_RefNannyFinishContext();
10830   return __pyx_r;
10831 }
10832 
10833 /* "rasterio/_base.pyx":621
10834  *         raise DatasetAttributeError("read-only attribute")
10835  *
10836  *     def _set_all_offsets(self, value):             # <<<<<<<<<<<<<<
10837  *         raise DatasetAttributeError("read-only attribute")
10838  *
10839  */
10840 
10841 /* Python wrapper */
10842 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_41_set_all_offsets(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_41_set_all_offsets(PyObject * __pyx_v_self,PyObject * __pyx_v_value)10843 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_41_set_all_offsets(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
10844   PyObject *__pyx_r = 0;
10845   __Pyx_RefNannyDeclarations
10846   __Pyx_RefNannySetupContext("_set_all_offsets (wrapper)", 0);
10847   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_40_set_all_offsets(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
10848 
10849   /* function exit code */
10850   __Pyx_RefNannyFinishContext();
10851   return __pyx_r;
10852 }
10853 
__pyx_pf_8rasterio_5_base_11DatasetBase_40_set_all_offsets(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_value)10854 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_40_set_all_offsets(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value) {
10855   PyObject *__pyx_r = NULL;
10856   __Pyx_RefNannyDeclarations
10857   PyObject *__pyx_t_1 = NULL;
10858   PyObject *__pyx_t_2 = NULL;
10859   PyObject *__pyx_t_3 = NULL;
10860   int __pyx_lineno = 0;
10861   const char *__pyx_filename = NULL;
10862   int __pyx_clineno = 0;
10863   __Pyx_RefNannySetupContext("_set_all_offsets", 0);
10864 
10865   /* "rasterio/_base.pyx":622
10866  *
10867  *     def _set_all_offsets(self, value):
10868  *         raise DatasetAttributeError("read-only attribute")             # <<<<<<<<<<<<<<
10869  *
10870  *     def _set_all_units(self, value):
10871  */
10872   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DatasetAttributeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 622, __pyx_L1_error)
10873   __Pyx_GOTREF(__pyx_t_2);
10874   __pyx_t_3 = NULL;
10875   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
10876     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
10877     if (likely(__pyx_t_3)) {
10878       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10879       __Pyx_INCREF(__pyx_t_3);
10880       __Pyx_INCREF(function);
10881       __Pyx_DECREF_SET(__pyx_t_2, function);
10882     }
10883   }
10884   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_read_only_attribute) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_read_only_attribute);
10885   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10886   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 622, __pyx_L1_error)
10887   __Pyx_GOTREF(__pyx_t_1);
10888   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10889   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10890   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10891   __PYX_ERR(0, 622, __pyx_L1_error)
10892 
10893   /* "rasterio/_base.pyx":621
10894  *         raise DatasetAttributeError("read-only attribute")
10895  *
10896  *     def _set_all_offsets(self, value):             # <<<<<<<<<<<<<<
10897  *         raise DatasetAttributeError("read-only attribute")
10898  *
10899  */
10900 
10901   /* function exit code */
10902   __pyx_L1_error:;
10903   __Pyx_XDECREF(__pyx_t_1);
10904   __Pyx_XDECREF(__pyx_t_2);
10905   __Pyx_XDECREF(__pyx_t_3);
10906   __Pyx_AddTraceback("rasterio._base.DatasetBase._set_all_offsets", __pyx_clineno, __pyx_lineno, __pyx_filename);
10907   __pyx_r = NULL;
10908   __Pyx_XGIVEREF(__pyx_r);
10909   __Pyx_RefNannyFinishContext();
10910   return __pyx_r;
10911 }
10912 
10913 /* "rasterio/_base.pyx":624
10914  *         raise DatasetAttributeError("read-only attribute")
10915  *
10916  *     def _set_all_units(self, value):             # <<<<<<<<<<<<<<
10917  *         raise DatasetAttributeError("read-only attribute")
10918  *
10919  */
10920 
10921 /* Python wrapper */
10922 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_43_set_all_units(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_43_set_all_units(PyObject * __pyx_v_self,PyObject * __pyx_v_value)10923 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_43_set_all_units(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
10924   PyObject *__pyx_r = 0;
10925   __Pyx_RefNannyDeclarations
10926   __Pyx_RefNannySetupContext("_set_all_units (wrapper)", 0);
10927   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_42_set_all_units(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
10928 
10929   /* function exit code */
10930   __Pyx_RefNannyFinishContext();
10931   return __pyx_r;
10932 }
10933 
__pyx_pf_8rasterio_5_base_11DatasetBase_42_set_all_units(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_value)10934 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_42_set_all_units(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value) {
10935   PyObject *__pyx_r = NULL;
10936   __Pyx_RefNannyDeclarations
10937   PyObject *__pyx_t_1 = NULL;
10938   PyObject *__pyx_t_2 = NULL;
10939   PyObject *__pyx_t_3 = NULL;
10940   int __pyx_lineno = 0;
10941   const char *__pyx_filename = NULL;
10942   int __pyx_clineno = 0;
10943   __Pyx_RefNannySetupContext("_set_all_units", 0);
10944 
10945   /* "rasterio/_base.pyx":625
10946  *
10947  *     def _set_all_units(self, value):
10948  *         raise DatasetAttributeError("read-only attribute")             # <<<<<<<<<<<<<<
10949  *
10950  *     property descriptions:
10951  */
10952   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DatasetAttributeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 625, __pyx_L1_error)
10953   __Pyx_GOTREF(__pyx_t_2);
10954   __pyx_t_3 = NULL;
10955   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
10956     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
10957     if (likely(__pyx_t_3)) {
10958       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10959       __Pyx_INCREF(__pyx_t_3);
10960       __Pyx_INCREF(function);
10961       __Pyx_DECREF_SET(__pyx_t_2, function);
10962     }
10963   }
10964   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_read_only_attribute) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_read_only_attribute);
10965   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10966   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error)
10967   __Pyx_GOTREF(__pyx_t_1);
10968   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10969   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10970   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10971   __PYX_ERR(0, 625, __pyx_L1_error)
10972 
10973   /* "rasterio/_base.pyx":624
10974  *         raise DatasetAttributeError("read-only attribute")
10975  *
10976  *     def _set_all_units(self, value):             # <<<<<<<<<<<<<<
10977  *         raise DatasetAttributeError("read-only attribute")
10978  *
10979  */
10980 
10981   /* function exit code */
10982   __pyx_L1_error:;
10983   __Pyx_XDECREF(__pyx_t_1);
10984   __Pyx_XDECREF(__pyx_t_2);
10985   __Pyx_XDECREF(__pyx_t_3);
10986   __Pyx_AddTraceback("rasterio._base.DatasetBase._set_all_units", __pyx_clineno, __pyx_lineno, __pyx_filename);
10987   __pyx_r = NULL;
10988   __Pyx_XGIVEREF(__pyx_r);
10989   __Pyx_RefNannyFinishContext();
10990   return __pyx_r;
10991 }
10992 
10993 /* "rasterio/_base.pyx":636
10994  *         list of str
10995  *         """
10996  *         def __get__(self):             # <<<<<<<<<<<<<<
10997  *             if not self._descriptions:
10998  *                 descr = [GDALGetDescription(self.band(j)) for j in self.indexes]
10999  */
11000 
11001 /* Python wrapper */
11002 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_12descriptions_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_12descriptions_1__get__(PyObject * __pyx_v_self)11003 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_12descriptions_1__get__(PyObject *__pyx_v_self) {
11004   PyObject *__pyx_r = 0;
11005   __Pyx_RefNannyDeclarations
11006   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11007   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_12descriptions___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
11008 
11009   /* function exit code */
11010   __Pyx_RefNannyFinishContext();
11011   return __pyx_r;
11012 }
11013 static PyObject *__pyx_gb_8rasterio_5_base_11DatasetBase_12descriptions_7__get___2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
11014 
11015 /* "rasterio/_base.pyx":639
11016  *             if not self._descriptions:
11017  *                 descr = [GDALGetDescription(self.band(j)) for j in self.indexes]
11018  *                 self._descriptions = tuple((d or None) for d in descr)             # <<<<<<<<<<<<<<
11019  *             return self._descriptions
11020  *
11021  */
11022 
__pyx_pf_8rasterio_5_base_11DatasetBase_12descriptions_7__get___genexpr(PyObject * __pyx_self)11023 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_12descriptions_7__get___genexpr(PyObject *__pyx_self) {
11024   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr *__pyx_cur_scope;
11025   PyObject *__pyx_r = NULL;
11026   __Pyx_RefNannyDeclarations
11027   int __pyx_lineno = 0;
11028   const char *__pyx_filename = NULL;
11029   int __pyx_clineno = 0;
11030   __Pyx_RefNannySetupContext("genexpr", 0);
11031   __pyx_cur_scope = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr *)__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_5_genexpr(__pyx_ptype_8rasterio_5_base___pyx_scope_struct_5_genexpr, __pyx_empty_tuple, NULL);
11032   if (unlikely(!__pyx_cur_scope)) {
11033     __pyx_cur_scope = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr *)Py_None);
11034     __Pyx_INCREF(Py_None);
11035     __PYX_ERR(0, 639, __pyx_L1_error)
11036   } else {
11037     __Pyx_GOTREF(__pyx_cur_scope);
11038   }
11039   __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__ *) __pyx_self;
11040   __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
11041   __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
11042   {
11043     __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_8rasterio_5_base_11DatasetBase_12descriptions_7__get___2generator3, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_DatasetBase___get___locals_genex, __pyx_n_s_rasterio__base); if (unlikely(!gen)) __PYX_ERR(0, 639, __pyx_L1_error)
11044     __Pyx_DECREF(__pyx_cur_scope);
11045     __Pyx_RefNannyFinishContext();
11046     return (PyObject *) gen;
11047   }
11048 
11049   /* function exit code */
11050   __pyx_L1_error:;
11051   __Pyx_AddTraceback("rasterio._base.DatasetBase.descriptions.__get__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
11052   __pyx_r = NULL;
11053   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
11054   __Pyx_XGIVEREF(__pyx_r);
11055   __Pyx_RefNannyFinishContext();
11056   return __pyx_r;
11057 }
11058 
__pyx_gb_8rasterio_5_base_11DatasetBase_12descriptions_7__get___2generator3(__pyx_CoroutineObject * __pyx_generator,CYTHON_UNUSED PyThreadState * __pyx_tstate,PyObject * __pyx_sent_value)11059 static PyObject *__pyx_gb_8rasterio_5_base_11DatasetBase_12descriptions_7__get___2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
11060 {
11061   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr *)__pyx_generator->closure);
11062   PyObject *__pyx_r = NULL;
11063   PyObject *__pyx_t_1 = NULL;
11064   Py_ssize_t __pyx_t_2;
11065   PyObject *__pyx_t_3 = NULL;
11066   int __pyx_t_4;
11067   int __pyx_lineno = 0;
11068   const char *__pyx_filename = NULL;
11069   int __pyx_clineno = 0;
11070   __Pyx_RefNannyDeclarations
11071   __Pyx_RefNannySetupContext("genexpr", 0);
11072   switch (__pyx_generator->resume_label) {
11073     case 0: goto __pyx_L3_first_run;
11074     case 1: goto __pyx_L8_resume_from_yield;
11075     default: /* CPython raises the right error here */
11076     __Pyx_RefNannyFinishContext();
11077     return NULL;
11078   }
11079   __pyx_L3_first_run:;
11080   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 639, __pyx_L1_error)
11081   if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_descr)) { __Pyx_RaiseClosureNameError("descr"); __PYX_ERR(0, 639, __pyx_L1_error) }
11082   if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_descr == Py_None)) {
11083     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
11084     __PYX_ERR(0, 639, __pyx_L1_error)
11085   }
11086   __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_descr; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
11087   for (;;) {
11088     if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
11089     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11090     __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 639, __pyx_L1_error)
11091     #else
11092     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 639, __pyx_L1_error)
11093     __Pyx_GOTREF(__pyx_t_3);
11094     #endif
11095     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_d);
11096     __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_d, __pyx_t_3);
11097     __Pyx_GIVEREF(__pyx_t_3);
11098     __pyx_t_3 = 0;
11099     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_d); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 639, __pyx_L1_error)
11100     if (!__pyx_t_4) {
11101     } else {
11102       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_d);
11103       __pyx_t_3 = __pyx_cur_scope->__pyx_v_d;
11104       goto __pyx_L6_bool_binop_done;
11105     }
11106     __Pyx_INCREF(Py_None);
11107     __pyx_t_3 = Py_None;
11108     __pyx_L6_bool_binop_done:;
11109     __pyx_r = __pyx_t_3;
11110     __pyx_t_3 = 0;
11111     __Pyx_XGIVEREF(__pyx_t_1);
11112     __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
11113     __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
11114     __Pyx_XGIVEREF(__pyx_r);
11115     __Pyx_RefNannyFinishContext();
11116     __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
11117     /* return from generator, yielding value */
11118     __pyx_generator->resume_label = 1;
11119     return __pyx_r;
11120     __pyx_L8_resume_from_yield:;
11121     __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
11122     __pyx_cur_scope->__pyx_t_0 = 0;
11123     __Pyx_XGOTREF(__pyx_t_1);
11124     __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
11125     if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 639, __pyx_L1_error)
11126   }
11127   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11128   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
11129 
11130   /* function exit code */
11131   PyErr_SetNone(PyExc_StopIteration);
11132   goto __pyx_L0;
11133   __pyx_L1_error:;
11134   __Pyx_XDECREF(__pyx_t_1);
11135   __Pyx_XDECREF(__pyx_t_3);
11136   __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
11137   __pyx_L0:;
11138   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
11139   #if !CYTHON_USE_EXC_INFO_STACK
11140   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
11141   #endif
11142   __pyx_generator->resume_label = -1;
11143   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
11144   __Pyx_RefNannyFinishContext();
11145   return __pyx_r;
11146 }
11147 
11148 /* "rasterio/_base.pyx":636
11149  *         list of str
11150  *         """
11151  *         def __get__(self):             # <<<<<<<<<<<<<<
11152  *             if not self._descriptions:
11153  *                 descr = [GDALGetDescription(self.band(j)) for j in self.indexes]
11154  */
11155 
__pyx_pf_8rasterio_5_base_11DatasetBase_12descriptions___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)11156 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_12descriptions___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
11157   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__ *__pyx_cur_scope;
11158   PyObject *__pyx_8genexpr5__pyx_v_j = NULL;
11159   PyObject *__pyx_r = NULL;
11160   __Pyx_RefNannyDeclarations
11161   int __pyx_t_1;
11162   int __pyx_t_2;
11163   PyObject *__pyx_t_3 = NULL;
11164   PyObject *__pyx_t_4 = NULL;
11165   PyObject *__pyx_t_5 = NULL;
11166   Py_ssize_t __pyx_t_6;
11167   PyObject *(*__pyx_t_7)(PyObject *);
11168   int __pyx_t_8;
11169   GDALRasterBandH __pyx_t_9;
11170   int __pyx_lineno = 0;
11171   const char *__pyx_filename = NULL;
11172   int __pyx_clineno = 0;
11173   __Pyx_RefNannySetupContext("__get__", 0);
11174   __pyx_cur_scope = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__ *)__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_4___get__(__pyx_ptype_8rasterio_5_base___pyx_scope_struct_4___get__, __pyx_empty_tuple, NULL);
11175   if (unlikely(!__pyx_cur_scope)) {
11176     __pyx_cur_scope = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__ *)Py_None);
11177     __Pyx_INCREF(Py_None);
11178     __PYX_ERR(0, 636, __pyx_L1_error)
11179   } else {
11180     __Pyx_GOTREF(__pyx_cur_scope);
11181   }
11182 
11183   /* "rasterio/_base.pyx":637
11184  *         """
11185  *         def __get__(self):
11186  *             if not self._descriptions:             # <<<<<<<<<<<<<<
11187  *                 descr = [GDALGetDescription(self.band(j)) for j in self.indexes]
11188  *                 self._descriptions = tuple((d or None) for d in descr)
11189  */
11190   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_descriptions); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 637, __pyx_L1_error)
11191   __pyx_t_2 = ((!__pyx_t_1) != 0);
11192   if (__pyx_t_2) {
11193 
11194     /* "rasterio/_base.pyx":638
11195  *         def __get__(self):
11196  *             if not self._descriptions:
11197  *                 descr = [GDALGetDescription(self.band(j)) for j in self.indexes]             # <<<<<<<<<<<<<<
11198  *                 self._descriptions = tuple((d or None) for d in descr)
11199  *             return self._descriptions
11200  */
11201     { /* enter inner scope */
11202       __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 638, __pyx_L6_error)
11203       __Pyx_GOTREF(__pyx_t_3);
11204       __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_indexes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 638, __pyx_L6_error)
11205       __Pyx_GOTREF(__pyx_t_4);
11206       if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
11207         __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
11208         __pyx_t_7 = NULL;
11209       } else {
11210         __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 638, __pyx_L6_error)
11211         __Pyx_GOTREF(__pyx_t_5);
11212         __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 638, __pyx_L6_error)
11213       }
11214       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11215       for (;;) {
11216         if (likely(!__pyx_t_7)) {
11217           if (likely(PyList_CheckExact(__pyx_t_5))) {
11218             if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
11219             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11220             __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 638, __pyx_L6_error)
11221             #else
11222             __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 638, __pyx_L6_error)
11223             __Pyx_GOTREF(__pyx_t_4);
11224             #endif
11225           } else {
11226             if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
11227             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11228             __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 638, __pyx_L6_error)
11229             #else
11230             __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 638, __pyx_L6_error)
11231             __Pyx_GOTREF(__pyx_t_4);
11232             #endif
11233           }
11234         } else {
11235           __pyx_t_4 = __pyx_t_7(__pyx_t_5);
11236           if (unlikely(!__pyx_t_4)) {
11237             PyObject* exc_type = PyErr_Occurred();
11238             if (exc_type) {
11239               if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
11240               else __PYX_ERR(0, 638, __pyx_L6_error)
11241             }
11242             break;
11243           }
11244           __Pyx_GOTREF(__pyx_t_4);
11245         }
11246         __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_j, __pyx_t_4);
11247         __pyx_t_4 = 0;
11248         __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_8genexpr5__pyx_v_j); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 638, __pyx_L6_error)
11249         __pyx_t_9 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_8); if (unlikely(__pyx_t_9 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 638, __pyx_L6_error)
11250         __pyx_t_4 = __Pyx_PyUnicode_FromString(GDALGetDescription(__pyx_t_9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 638, __pyx_L6_error)
11251         __Pyx_GOTREF(__pyx_t_4);
11252         if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 638, __pyx_L6_error)
11253         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11254       }
11255       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11256       __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_j); __pyx_8genexpr5__pyx_v_j = 0;
11257       goto __pyx_L9_exit_scope;
11258       __pyx_L6_error:;
11259       __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_j); __pyx_8genexpr5__pyx_v_j = 0;
11260       goto __pyx_L1_error;
11261       __pyx_L9_exit_scope:;
11262     } /* exit inner scope */
11263     __Pyx_GIVEREF(__pyx_t_3);
11264     __pyx_cur_scope->__pyx_v_descr = ((PyObject*)__pyx_t_3);
11265     __pyx_t_3 = 0;
11266 
11267     /* "rasterio/_base.pyx":639
11268  *             if not self._descriptions:
11269  *                 descr = [GDALGetDescription(self.band(j)) for j in self.indexes]
11270  *                 self._descriptions = tuple((d or None) for d in descr)             # <<<<<<<<<<<<<<
11271  *             return self._descriptions
11272  *
11273  */
11274     __pyx_t_3 = __pyx_pf_8rasterio_5_base_11DatasetBase_12descriptions_7__get___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 639, __pyx_L1_error)
11275     __Pyx_GOTREF(__pyx_t_3);
11276     __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 639, __pyx_L1_error)
11277     __Pyx_GOTREF(__pyx_t_5);
11278     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11279     __Pyx_GIVEREF(__pyx_t_5);
11280     __Pyx_GOTREF(__pyx_v_self->_descriptions);
11281     __Pyx_DECREF(__pyx_v_self->_descriptions);
11282     __pyx_v_self->_descriptions = __pyx_t_5;
11283     __pyx_t_5 = 0;
11284 
11285     /* "rasterio/_base.pyx":637
11286  *         """
11287  *         def __get__(self):
11288  *             if not self._descriptions:             # <<<<<<<<<<<<<<
11289  *                 descr = [GDALGetDescription(self.band(j)) for j in self.indexes]
11290  *                 self._descriptions = tuple((d or None) for d in descr)
11291  */
11292   }
11293 
11294   /* "rasterio/_base.pyx":640
11295  *                 descr = [GDALGetDescription(self.band(j)) for j in self.indexes]
11296  *                 self._descriptions = tuple((d or None) for d in descr)
11297  *             return self._descriptions             # <<<<<<<<<<<<<<
11298  *
11299  *         def __set__(self, value):
11300  */
11301   __Pyx_XDECREF(__pyx_r);
11302   __Pyx_INCREF(__pyx_v_self->_descriptions);
11303   __pyx_r = __pyx_v_self->_descriptions;
11304   goto __pyx_L0;
11305 
11306   /* "rasterio/_base.pyx":636
11307  *         list of str
11308  *         """
11309  *         def __get__(self):             # <<<<<<<<<<<<<<
11310  *             if not self._descriptions:
11311  *                 descr = [GDALGetDescription(self.band(j)) for j in self.indexes]
11312  */
11313 
11314   /* function exit code */
11315   __pyx_L1_error:;
11316   __Pyx_XDECREF(__pyx_t_3);
11317   __Pyx_XDECREF(__pyx_t_4);
11318   __Pyx_XDECREF(__pyx_t_5);
11319   __Pyx_AddTraceback("rasterio._base.DatasetBase.descriptions.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11320   __pyx_r = NULL;
11321   __pyx_L0:;
11322   __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_j);
11323   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
11324   __Pyx_XGIVEREF(__pyx_r);
11325   __Pyx_RefNannyFinishContext();
11326   return __pyx_r;
11327 }
11328 
11329 /* "rasterio/_base.pyx":642
11330  *             return self._descriptions
11331  *
11332  *         def __set__(self, value):             # <<<<<<<<<<<<<<
11333  *             self._set_all_descriptions(value)
11334  *
11335  */
11336 
11337 /* Python wrapper */
11338 static int __pyx_pw_8rasterio_5_base_11DatasetBase_12descriptions_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_12descriptions_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)11339 static int __pyx_pw_8rasterio_5_base_11DatasetBase_12descriptions_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
11340   int __pyx_r;
11341   __Pyx_RefNannyDeclarations
11342   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
11343   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_12descriptions_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
11344 
11345   /* function exit code */
11346   __Pyx_RefNannyFinishContext();
11347   return __pyx_r;
11348 }
11349 
__pyx_pf_8rasterio_5_base_11DatasetBase_12descriptions_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)11350 static int __pyx_pf_8rasterio_5_base_11DatasetBase_12descriptions_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
11351   int __pyx_r;
11352   __Pyx_RefNannyDeclarations
11353   PyObject *__pyx_t_1 = NULL;
11354   PyObject *__pyx_t_2 = NULL;
11355   PyObject *__pyx_t_3 = NULL;
11356   int __pyx_lineno = 0;
11357   const char *__pyx_filename = NULL;
11358   int __pyx_clineno = 0;
11359   __Pyx_RefNannySetupContext("__set__", 0);
11360 
11361   /* "rasterio/_base.pyx":643
11362  *
11363  *         def __set__(self, value):
11364  *             self._set_all_descriptions(value)             # <<<<<<<<<<<<<<
11365  *
11366  *     def write_transform(self, value):
11367  */
11368   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_all_descriptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 643, __pyx_L1_error)
11369   __Pyx_GOTREF(__pyx_t_2);
11370   __pyx_t_3 = NULL;
11371   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
11372     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
11373     if (likely(__pyx_t_3)) {
11374       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
11375       __Pyx_INCREF(__pyx_t_3);
11376       __Pyx_INCREF(function);
11377       __Pyx_DECREF_SET(__pyx_t_2, function);
11378     }
11379   }
11380   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_value) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_value);
11381   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11382   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error)
11383   __Pyx_GOTREF(__pyx_t_1);
11384   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11385   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11386 
11387   /* "rasterio/_base.pyx":642
11388  *             return self._descriptions
11389  *
11390  *         def __set__(self, value):             # <<<<<<<<<<<<<<
11391  *             self._set_all_descriptions(value)
11392  *
11393  */
11394 
11395   /* function exit code */
11396   __pyx_r = 0;
11397   goto __pyx_L0;
11398   __pyx_L1_error:;
11399   __Pyx_XDECREF(__pyx_t_1);
11400   __Pyx_XDECREF(__pyx_t_2);
11401   __Pyx_XDECREF(__pyx_t_3);
11402   __Pyx_AddTraceback("rasterio._base.DatasetBase.descriptions.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11403   __pyx_r = -1;
11404   __pyx_L0:;
11405   __Pyx_RefNannyFinishContext();
11406   return __pyx_r;
11407 }
11408 
11409 /* "rasterio/_base.pyx":645
11410  *             self._set_all_descriptions(value)
11411  *
11412  *     def write_transform(self, value):             # <<<<<<<<<<<<<<
11413  *         raise DatasetAttributeError("read-only attribute")
11414  *
11415  */
11416 
11417 /* Python wrapper */
11418 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_45write_transform(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_45write_transform(PyObject * __pyx_v_self,PyObject * __pyx_v_value)11419 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_45write_transform(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
11420   PyObject *__pyx_r = 0;
11421   __Pyx_RefNannyDeclarations
11422   __Pyx_RefNannySetupContext("write_transform (wrapper)", 0);
11423   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_44write_transform(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
11424 
11425   /* function exit code */
11426   __Pyx_RefNannyFinishContext();
11427   return __pyx_r;
11428 }
11429 
__pyx_pf_8rasterio_5_base_11DatasetBase_44write_transform(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_value)11430 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_44write_transform(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value) {
11431   PyObject *__pyx_r = NULL;
11432   __Pyx_RefNannyDeclarations
11433   PyObject *__pyx_t_1 = NULL;
11434   PyObject *__pyx_t_2 = NULL;
11435   PyObject *__pyx_t_3 = NULL;
11436   int __pyx_lineno = 0;
11437   const char *__pyx_filename = NULL;
11438   int __pyx_clineno = 0;
11439   __Pyx_RefNannySetupContext("write_transform", 0);
11440 
11441   /* "rasterio/_base.pyx":646
11442  *
11443  *     def write_transform(self, value):
11444  *         raise DatasetAttributeError("read-only attribute")             # <<<<<<<<<<<<<<
11445  *
11446  *     property transform:
11447  */
11448   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DatasetAttributeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L1_error)
11449   __Pyx_GOTREF(__pyx_t_2);
11450   __pyx_t_3 = NULL;
11451   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
11452     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
11453     if (likely(__pyx_t_3)) {
11454       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
11455       __Pyx_INCREF(__pyx_t_3);
11456       __Pyx_INCREF(function);
11457       __Pyx_DECREF_SET(__pyx_t_2, function);
11458     }
11459   }
11460   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_read_only_attribute) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_read_only_attribute);
11461   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11462   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 646, __pyx_L1_error)
11463   __Pyx_GOTREF(__pyx_t_1);
11464   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11465   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11466   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11467   __PYX_ERR(0, 646, __pyx_L1_error)
11468 
11469   /* "rasterio/_base.pyx":645
11470  *             self._set_all_descriptions(value)
11471  *
11472  *     def write_transform(self, value):             # <<<<<<<<<<<<<<
11473  *         raise DatasetAttributeError("read-only attribute")
11474  *
11475  */
11476 
11477   /* function exit code */
11478   __pyx_L1_error:;
11479   __Pyx_XDECREF(__pyx_t_1);
11480   __Pyx_XDECREF(__pyx_t_2);
11481   __Pyx_XDECREF(__pyx_t_3);
11482   __Pyx_AddTraceback("rasterio._base.DatasetBase.write_transform", __pyx_clineno, __pyx_lineno, __pyx_filename);
11483   __pyx_r = NULL;
11484   __Pyx_XGIVEREF(__pyx_r);
11485   __Pyx_RefNannyFinishContext();
11486   return __pyx_r;
11487 }
11488 
11489 /* "rasterio/_base.pyx":659
11490  *         """
11491  *
11492  *         def __get__(self):             # <<<<<<<<<<<<<<
11493  *             return Affine.from_gdal(*self.get_transform())
11494  *
11495  */
11496 
11497 /* Python wrapper */
11498 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_9transform_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_9transform_1__get__(PyObject * __pyx_v_self)11499 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_9transform_1__get__(PyObject *__pyx_v_self) {
11500   PyObject *__pyx_r = 0;
11501   __Pyx_RefNannyDeclarations
11502   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11503   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_9transform___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
11504 
11505   /* function exit code */
11506   __Pyx_RefNannyFinishContext();
11507   return __pyx_r;
11508 }
11509 
__pyx_pf_8rasterio_5_base_11DatasetBase_9transform___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)11510 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_9transform___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
11511   PyObject *__pyx_r = NULL;
11512   __Pyx_RefNannyDeclarations
11513   PyObject *__pyx_t_1 = NULL;
11514   PyObject *__pyx_t_2 = NULL;
11515   PyObject *__pyx_t_3 = NULL;
11516   PyObject *__pyx_t_4 = NULL;
11517   int __pyx_lineno = 0;
11518   const char *__pyx_filename = NULL;
11519   int __pyx_clineno = 0;
11520   __Pyx_RefNannySetupContext("__get__", 0);
11521 
11522   /* "rasterio/_base.pyx":660
11523  *
11524  *         def __get__(self):
11525  *             return Affine.from_gdal(*self.get_transform())             # <<<<<<<<<<<<<<
11526  *
11527  *         def __set__(self, value):
11528  */
11529   __Pyx_XDECREF(__pyx_r);
11530   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Affine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error)
11531   __Pyx_GOTREF(__pyx_t_1);
11532   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_from_gdal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 660, __pyx_L1_error)
11533   __Pyx_GOTREF(__pyx_t_2);
11534   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11535   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_transform); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 660, __pyx_L1_error)
11536   __Pyx_GOTREF(__pyx_t_3);
11537   __pyx_t_4 = NULL;
11538   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
11539     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
11540     if (likely(__pyx_t_4)) {
11541       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
11542       __Pyx_INCREF(__pyx_t_4);
11543       __Pyx_INCREF(function);
11544       __Pyx_DECREF_SET(__pyx_t_3, function);
11545     }
11546   }
11547   __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
11548   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11549   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error)
11550   __Pyx_GOTREF(__pyx_t_1);
11551   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11552   __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 660, __pyx_L1_error)
11553   __Pyx_GOTREF(__pyx_t_3);
11554   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11555   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error)
11556   __Pyx_GOTREF(__pyx_t_1);
11557   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11558   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11559   __pyx_r = __pyx_t_1;
11560   __pyx_t_1 = 0;
11561   goto __pyx_L0;
11562 
11563   /* "rasterio/_base.pyx":659
11564  *         """
11565  *
11566  *         def __get__(self):             # <<<<<<<<<<<<<<
11567  *             return Affine.from_gdal(*self.get_transform())
11568  *
11569  */
11570 
11571   /* function exit code */
11572   __pyx_L1_error:;
11573   __Pyx_XDECREF(__pyx_t_1);
11574   __Pyx_XDECREF(__pyx_t_2);
11575   __Pyx_XDECREF(__pyx_t_3);
11576   __Pyx_XDECREF(__pyx_t_4);
11577   __Pyx_AddTraceback("rasterio._base.DatasetBase.transform.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11578   __pyx_r = NULL;
11579   __pyx_L0:;
11580   __Pyx_XGIVEREF(__pyx_r);
11581   __Pyx_RefNannyFinishContext();
11582   return __pyx_r;
11583 }
11584 
11585 /* "rasterio/_base.pyx":662
11586  *             return Affine.from_gdal(*self.get_transform())
11587  *
11588  *         def __set__(self, value):             # <<<<<<<<<<<<<<
11589  *             self.write_transform(value.to_gdal())
11590  *
11591  */
11592 
11593 /* Python wrapper */
11594 static int __pyx_pw_8rasterio_5_base_11DatasetBase_9transform_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_9transform_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)11595 static int __pyx_pw_8rasterio_5_base_11DatasetBase_9transform_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
11596   int __pyx_r;
11597   __Pyx_RefNannyDeclarations
11598   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
11599   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_9transform_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
11600 
11601   /* function exit code */
11602   __Pyx_RefNannyFinishContext();
11603   return __pyx_r;
11604 }
11605 
__pyx_pf_8rasterio_5_base_11DatasetBase_9transform_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)11606 static int __pyx_pf_8rasterio_5_base_11DatasetBase_9transform_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
11607   int __pyx_r;
11608   __Pyx_RefNannyDeclarations
11609   PyObject *__pyx_t_1 = NULL;
11610   PyObject *__pyx_t_2 = NULL;
11611   PyObject *__pyx_t_3 = NULL;
11612   PyObject *__pyx_t_4 = NULL;
11613   PyObject *__pyx_t_5 = NULL;
11614   int __pyx_lineno = 0;
11615   const char *__pyx_filename = NULL;
11616   int __pyx_clineno = 0;
11617   __Pyx_RefNannySetupContext("__set__", 0);
11618 
11619   /* "rasterio/_base.pyx":663
11620  *
11621  *         def __set__(self, value):
11622  *             self.write_transform(value.to_gdal())             # <<<<<<<<<<<<<<
11623  *
11624  *     property offsets:
11625  */
11626   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write_transform); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 663, __pyx_L1_error)
11627   __Pyx_GOTREF(__pyx_t_2);
11628   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_to_gdal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 663, __pyx_L1_error)
11629   __Pyx_GOTREF(__pyx_t_4);
11630   __pyx_t_5 = NULL;
11631   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
11632     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
11633     if (likely(__pyx_t_5)) {
11634       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11635       __Pyx_INCREF(__pyx_t_5);
11636       __Pyx_INCREF(function);
11637       __Pyx_DECREF_SET(__pyx_t_4, function);
11638     }
11639   }
11640   __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
11641   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11642   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L1_error)
11643   __Pyx_GOTREF(__pyx_t_3);
11644   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11645   __pyx_t_4 = NULL;
11646   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
11647     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
11648     if (likely(__pyx_t_4)) {
11649       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
11650       __Pyx_INCREF(__pyx_t_4);
11651       __Pyx_INCREF(function);
11652       __Pyx_DECREF_SET(__pyx_t_2, function);
11653     }
11654   }
11655   __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
11656   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11657   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11658   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error)
11659   __Pyx_GOTREF(__pyx_t_1);
11660   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11661   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11662 
11663   /* "rasterio/_base.pyx":662
11664  *             return Affine.from_gdal(*self.get_transform())
11665  *
11666  *         def __set__(self, value):             # <<<<<<<<<<<<<<
11667  *             self.write_transform(value.to_gdal())
11668  *
11669  */
11670 
11671   /* function exit code */
11672   __pyx_r = 0;
11673   goto __pyx_L0;
11674   __pyx_L1_error:;
11675   __Pyx_XDECREF(__pyx_t_1);
11676   __Pyx_XDECREF(__pyx_t_2);
11677   __Pyx_XDECREF(__pyx_t_3);
11678   __Pyx_XDECREF(__pyx_t_4);
11679   __Pyx_XDECREF(__pyx_t_5);
11680   __Pyx_AddTraceback("rasterio._base.DatasetBase.transform.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11681   __pyx_r = -1;
11682   __pyx_L0:;
11683   __Pyx_RefNannyFinishContext();
11684   return __pyx_r;
11685 }
11686 
11687 /* "rasterio/_base.pyx":674
11688  *         list of float
11689  *         """
11690  *         def __get__(self):             # <<<<<<<<<<<<<<
11691  *             cdef int success = 0
11692  *             if not self._offsets:
11693  */
11694 
11695 /* Python wrapper */
11696 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7offsets_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7offsets_1__get__(PyObject * __pyx_v_self)11697 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7offsets_1__get__(PyObject *__pyx_v_self) {
11698   PyObject *__pyx_r = 0;
11699   __Pyx_RefNannyDeclarations
11700   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11701   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_7offsets___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
11702 
11703   /* function exit code */
11704   __Pyx_RefNannyFinishContext();
11705   return __pyx_r;
11706 }
11707 
__pyx_pf_8rasterio_5_base_11DatasetBase_7offsets___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)11708 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_7offsets___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
11709   int __pyx_v_success;
11710   PyObject *__pyx_v_offsets = NULL;
11711   PyObject *__pyx_8genexpr7__pyx_v_j = NULL;
11712   PyObject *__pyx_r = NULL;
11713   __Pyx_RefNannyDeclarations
11714   int __pyx_t_1;
11715   int __pyx_t_2;
11716   PyObject *__pyx_t_3 = NULL;
11717   PyObject *__pyx_t_4 = NULL;
11718   PyObject *__pyx_t_5 = NULL;
11719   Py_ssize_t __pyx_t_6;
11720   PyObject *(*__pyx_t_7)(PyObject *);
11721   int __pyx_t_8;
11722   GDALRasterBandH __pyx_t_9;
11723   int __pyx_lineno = 0;
11724   const char *__pyx_filename = NULL;
11725   int __pyx_clineno = 0;
11726   __Pyx_RefNannySetupContext("__get__", 0);
11727 
11728   /* "rasterio/_base.pyx":675
11729  *         """
11730  *         def __get__(self):
11731  *             cdef int success = 0             # <<<<<<<<<<<<<<
11732  *             if not self._offsets:
11733  *                 offsets = [GDALGetRasterOffset(self.band(j), &success) for j in self.indexes]
11734  */
11735   __pyx_v_success = 0;
11736 
11737   /* "rasterio/_base.pyx":676
11738  *         def __get__(self):
11739  *             cdef int success = 0
11740  *             if not self._offsets:             # <<<<<<<<<<<<<<
11741  *                 offsets = [GDALGetRasterOffset(self.band(j), &success) for j in self.indexes]
11742  *                 self._offsets = tuple(offsets)
11743  */
11744   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_offsets); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 676, __pyx_L1_error)
11745   __pyx_t_2 = ((!__pyx_t_1) != 0);
11746   if (__pyx_t_2) {
11747 
11748     /* "rasterio/_base.pyx":677
11749  *             cdef int success = 0
11750  *             if not self._offsets:
11751  *                 offsets = [GDALGetRasterOffset(self.band(j), &success) for j in self.indexes]             # <<<<<<<<<<<<<<
11752  *                 self._offsets = tuple(offsets)
11753  *             return self._offsets
11754  */
11755     { /* enter inner scope */
11756       __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 677, __pyx_L6_error)
11757       __Pyx_GOTREF(__pyx_t_3);
11758       __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_indexes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 677, __pyx_L6_error)
11759       __Pyx_GOTREF(__pyx_t_4);
11760       if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
11761         __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
11762         __pyx_t_7 = NULL;
11763       } else {
11764         __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 677, __pyx_L6_error)
11765         __Pyx_GOTREF(__pyx_t_5);
11766         __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 677, __pyx_L6_error)
11767       }
11768       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11769       for (;;) {
11770         if (likely(!__pyx_t_7)) {
11771           if (likely(PyList_CheckExact(__pyx_t_5))) {
11772             if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
11773             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11774             __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 677, __pyx_L6_error)
11775             #else
11776             __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 677, __pyx_L6_error)
11777             __Pyx_GOTREF(__pyx_t_4);
11778             #endif
11779           } else {
11780             if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
11781             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11782             __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 677, __pyx_L6_error)
11783             #else
11784             __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 677, __pyx_L6_error)
11785             __Pyx_GOTREF(__pyx_t_4);
11786             #endif
11787           }
11788         } else {
11789           __pyx_t_4 = __pyx_t_7(__pyx_t_5);
11790           if (unlikely(!__pyx_t_4)) {
11791             PyObject* exc_type = PyErr_Occurred();
11792             if (exc_type) {
11793               if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
11794               else __PYX_ERR(0, 677, __pyx_L6_error)
11795             }
11796             break;
11797           }
11798           __Pyx_GOTREF(__pyx_t_4);
11799         }
11800         __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_j, __pyx_t_4);
11801         __pyx_t_4 = 0;
11802         __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_8genexpr7__pyx_v_j); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 677, __pyx_L6_error)
11803         __pyx_t_9 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_8); if (unlikely(__pyx_t_9 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 677, __pyx_L6_error)
11804         __pyx_t_4 = PyFloat_FromDouble(GDALGetRasterOffset(__pyx_t_9, (&__pyx_v_success))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 677, __pyx_L6_error)
11805         __Pyx_GOTREF(__pyx_t_4);
11806         if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 677, __pyx_L6_error)
11807         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11808       }
11809       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11810       __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_j); __pyx_8genexpr7__pyx_v_j = 0;
11811       goto __pyx_L9_exit_scope;
11812       __pyx_L6_error:;
11813       __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_j); __pyx_8genexpr7__pyx_v_j = 0;
11814       goto __pyx_L1_error;
11815       __pyx_L9_exit_scope:;
11816     } /* exit inner scope */
11817     __pyx_v_offsets = ((PyObject*)__pyx_t_3);
11818     __pyx_t_3 = 0;
11819 
11820     /* "rasterio/_base.pyx":678
11821  *             if not self._offsets:
11822  *                 offsets = [GDALGetRasterOffset(self.band(j), &success) for j in self.indexes]
11823  *                 self._offsets = tuple(offsets)             # <<<<<<<<<<<<<<
11824  *             return self._offsets
11825  *
11826  */
11827     __pyx_t_3 = PyList_AsTuple(__pyx_v_offsets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 678, __pyx_L1_error)
11828     __Pyx_GOTREF(__pyx_t_3);
11829     __Pyx_GIVEREF(__pyx_t_3);
11830     __Pyx_GOTREF(__pyx_v_self->_offsets);
11831     __Pyx_DECREF(__pyx_v_self->_offsets);
11832     __pyx_v_self->_offsets = __pyx_t_3;
11833     __pyx_t_3 = 0;
11834 
11835     /* "rasterio/_base.pyx":676
11836  *         def __get__(self):
11837  *             cdef int success = 0
11838  *             if not self._offsets:             # <<<<<<<<<<<<<<
11839  *                 offsets = [GDALGetRasterOffset(self.band(j), &success) for j in self.indexes]
11840  *                 self._offsets = tuple(offsets)
11841  */
11842   }
11843 
11844   /* "rasterio/_base.pyx":679
11845  *                 offsets = [GDALGetRasterOffset(self.band(j), &success) for j in self.indexes]
11846  *                 self._offsets = tuple(offsets)
11847  *             return self._offsets             # <<<<<<<<<<<<<<
11848  *
11849  *         def __set__(self, value):
11850  */
11851   __Pyx_XDECREF(__pyx_r);
11852   __Pyx_INCREF(__pyx_v_self->_offsets);
11853   __pyx_r = __pyx_v_self->_offsets;
11854   goto __pyx_L0;
11855 
11856   /* "rasterio/_base.pyx":674
11857  *         list of float
11858  *         """
11859  *         def __get__(self):             # <<<<<<<<<<<<<<
11860  *             cdef int success = 0
11861  *             if not self._offsets:
11862  */
11863 
11864   /* function exit code */
11865   __pyx_L1_error:;
11866   __Pyx_XDECREF(__pyx_t_3);
11867   __Pyx_XDECREF(__pyx_t_4);
11868   __Pyx_XDECREF(__pyx_t_5);
11869   __Pyx_AddTraceback("rasterio._base.DatasetBase.offsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11870   __pyx_r = NULL;
11871   __pyx_L0:;
11872   __Pyx_XDECREF(__pyx_v_offsets);
11873   __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_j);
11874   __Pyx_XGIVEREF(__pyx_r);
11875   __Pyx_RefNannyFinishContext();
11876   return __pyx_r;
11877 }
11878 
11879 /* "rasterio/_base.pyx":681
11880  *             return self._offsets
11881  *
11882  *         def __set__(self, value):             # <<<<<<<<<<<<<<
11883  *             self._set_all_offsets(value)
11884  *
11885  */
11886 
11887 /* Python wrapper */
11888 static int __pyx_pw_8rasterio_5_base_11DatasetBase_7offsets_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7offsets_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)11889 static int __pyx_pw_8rasterio_5_base_11DatasetBase_7offsets_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
11890   int __pyx_r;
11891   __Pyx_RefNannyDeclarations
11892   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
11893   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_7offsets_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
11894 
11895   /* function exit code */
11896   __Pyx_RefNannyFinishContext();
11897   return __pyx_r;
11898 }
11899 
__pyx_pf_8rasterio_5_base_11DatasetBase_7offsets_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)11900 static int __pyx_pf_8rasterio_5_base_11DatasetBase_7offsets_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
11901   int __pyx_r;
11902   __Pyx_RefNannyDeclarations
11903   PyObject *__pyx_t_1 = NULL;
11904   PyObject *__pyx_t_2 = NULL;
11905   PyObject *__pyx_t_3 = NULL;
11906   int __pyx_lineno = 0;
11907   const char *__pyx_filename = NULL;
11908   int __pyx_clineno = 0;
11909   __Pyx_RefNannySetupContext("__set__", 0);
11910 
11911   /* "rasterio/_base.pyx":682
11912  *
11913  *         def __set__(self, value):
11914  *             self._set_all_offsets(value)             # <<<<<<<<<<<<<<
11915  *
11916  *     property scales:
11917  */
11918   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_all_offsets); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 682, __pyx_L1_error)
11919   __Pyx_GOTREF(__pyx_t_2);
11920   __pyx_t_3 = NULL;
11921   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
11922     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
11923     if (likely(__pyx_t_3)) {
11924       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
11925       __Pyx_INCREF(__pyx_t_3);
11926       __Pyx_INCREF(function);
11927       __Pyx_DECREF_SET(__pyx_t_2, function);
11928     }
11929   }
11930   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_value) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_value);
11931   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11932   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error)
11933   __Pyx_GOTREF(__pyx_t_1);
11934   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11935   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11936 
11937   /* "rasterio/_base.pyx":681
11938  *             return self._offsets
11939  *
11940  *         def __set__(self, value):             # <<<<<<<<<<<<<<
11941  *             self._set_all_offsets(value)
11942  *
11943  */
11944 
11945   /* function exit code */
11946   __pyx_r = 0;
11947   goto __pyx_L0;
11948   __pyx_L1_error:;
11949   __Pyx_XDECREF(__pyx_t_1);
11950   __Pyx_XDECREF(__pyx_t_2);
11951   __Pyx_XDECREF(__pyx_t_3);
11952   __Pyx_AddTraceback("rasterio._base.DatasetBase.offsets.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11953   __pyx_r = -1;
11954   __pyx_L0:;
11955   __Pyx_RefNannyFinishContext();
11956   return __pyx_r;
11957 }
11958 
11959 /* "rasterio/_base.pyx":693
11960  *         list of float
11961  *         """
11962  *         def __get__(self):             # <<<<<<<<<<<<<<
11963  *             cdef int success = 0
11964  *             if not self._scales:
11965  */
11966 
11967 /* Python wrapper */
11968 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6scales_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6scales_1__get__(PyObject * __pyx_v_self)11969 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6scales_1__get__(PyObject *__pyx_v_self) {
11970   PyObject *__pyx_r = 0;
11971   __Pyx_RefNannyDeclarations
11972   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11973   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6scales___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
11974 
11975   /* function exit code */
11976   __Pyx_RefNannyFinishContext();
11977   return __pyx_r;
11978 }
11979 
__pyx_pf_8rasterio_5_base_11DatasetBase_6scales___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)11980 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6scales___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
11981   int __pyx_v_success;
11982   PyObject *__pyx_v_scales = NULL;
11983   PyObject *__pyx_8genexpr8__pyx_v_j = NULL;
11984   PyObject *__pyx_r = NULL;
11985   __Pyx_RefNannyDeclarations
11986   int __pyx_t_1;
11987   int __pyx_t_2;
11988   PyObject *__pyx_t_3 = NULL;
11989   PyObject *__pyx_t_4 = NULL;
11990   PyObject *__pyx_t_5 = NULL;
11991   Py_ssize_t __pyx_t_6;
11992   PyObject *(*__pyx_t_7)(PyObject *);
11993   int __pyx_t_8;
11994   GDALRasterBandH __pyx_t_9;
11995   int __pyx_lineno = 0;
11996   const char *__pyx_filename = NULL;
11997   int __pyx_clineno = 0;
11998   __Pyx_RefNannySetupContext("__get__", 0);
11999 
12000   /* "rasterio/_base.pyx":694
12001  *         """
12002  *         def __get__(self):
12003  *             cdef int success = 0             # <<<<<<<<<<<<<<
12004  *             if not self._scales:
12005  *                 scales = [GDALGetRasterScale(self.band(j), &success) for j in self.indexes]
12006  */
12007   __pyx_v_success = 0;
12008 
12009   /* "rasterio/_base.pyx":695
12010  *         def __get__(self):
12011  *             cdef int success = 0
12012  *             if not self._scales:             # <<<<<<<<<<<<<<
12013  *                 scales = [GDALGetRasterScale(self.band(j), &success) for j in self.indexes]
12014  *                 self._scales = tuple(scales)
12015  */
12016   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_scales); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 695, __pyx_L1_error)
12017   __pyx_t_2 = ((!__pyx_t_1) != 0);
12018   if (__pyx_t_2) {
12019 
12020     /* "rasterio/_base.pyx":696
12021  *             cdef int success = 0
12022  *             if not self._scales:
12023  *                 scales = [GDALGetRasterScale(self.band(j), &success) for j in self.indexes]             # <<<<<<<<<<<<<<
12024  *                 self._scales = tuple(scales)
12025  *             return self._scales
12026  */
12027     { /* enter inner scope */
12028       __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 696, __pyx_L6_error)
12029       __Pyx_GOTREF(__pyx_t_3);
12030       __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_indexes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L6_error)
12031       __Pyx_GOTREF(__pyx_t_4);
12032       if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
12033         __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
12034         __pyx_t_7 = NULL;
12035       } else {
12036         __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 696, __pyx_L6_error)
12037         __Pyx_GOTREF(__pyx_t_5);
12038         __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 696, __pyx_L6_error)
12039       }
12040       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12041       for (;;) {
12042         if (likely(!__pyx_t_7)) {
12043           if (likely(PyList_CheckExact(__pyx_t_5))) {
12044             if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
12045             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12046             __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 696, __pyx_L6_error)
12047             #else
12048             __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L6_error)
12049             __Pyx_GOTREF(__pyx_t_4);
12050             #endif
12051           } else {
12052             if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
12053             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12054             __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 696, __pyx_L6_error)
12055             #else
12056             __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L6_error)
12057             __Pyx_GOTREF(__pyx_t_4);
12058             #endif
12059           }
12060         } else {
12061           __pyx_t_4 = __pyx_t_7(__pyx_t_5);
12062           if (unlikely(!__pyx_t_4)) {
12063             PyObject* exc_type = PyErr_Occurred();
12064             if (exc_type) {
12065               if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12066               else __PYX_ERR(0, 696, __pyx_L6_error)
12067             }
12068             break;
12069           }
12070           __Pyx_GOTREF(__pyx_t_4);
12071         }
12072         __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_j, __pyx_t_4);
12073         __pyx_t_4 = 0;
12074         __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_8genexpr8__pyx_v_j); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 696, __pyx_L6_error)
12075         __pyx_t_9 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_8); if (unlikely(__pyx_t_9 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 696, __pyx_L6_error)
12076         __pyx_t_4 = PyFloat_FromDouble(GDALGetRasterScale(__pyx_t_9, (&__pyx_v_success))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L6_error)
12077         __Pyx_GOTREF(__pyx_t_4);
12078         if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 696, __pyx_L6_error)
12079         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12080       }
12081       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12082       __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_j); __pyx_8genexpr8__pyx_v_j = 0;
12083       goto __pyx_L9_exit_scope;
12084       __pyx_L6_error:;
12085       __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_j); __pyx_8genexpr8__pyx_v_j = 0;
12086       goto __pyx_L1_error;
12087       __pyx_L9_exit_scope:;
12088     } /* exit inner scope */
12089     __pyx_v_scales = ((PyObject*)__pyx_t_3);
12090     __pyx_t_3 = 0;
12091 
12092     /* "rasterio/_base.pyx":697
12093  *             if not self._scales:
12094  *                 scales = [GDALGetRasterScale(self.band(j), &success) for j in self.indexes]
12095  *                 self._scales = tuple(scales)             # <<<<<<<<<<<<<<
12096  *             return self._scales
12097  *
12098  */
12099     __pyx_t_3 = PyList_AsTuple(__pyx_v_scales); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 697, __pyx_L1_error)
12100     __Pyx_GOTREF(__pyx_t_3);
12101     __Pyx_GIVEREF(__pyx_t_3);
12102     __Pyx_GOTREF(__pyx_v_self->_scales);
12103     __Pyx_DECREF(__pyx_v_self->_scales);
12104     __pyx_v_self->_scales = __pyx_t_3;
12105     __pyx_t_3 = 0;
12106 
12107     /* "rasterio/_base.pyx":695
12108  *         def __get__(self):
12109  *             cdef int success = 0
12110  *             if not self._scales:             # <<<<<<<<<<<<<<
12111  *                 scales = [GDALGetRasterScale(self.band(j), &success) for j in self.indexes]
12112  *                 self._scales = tuple(scales)
12113  */
12114   }
12115 
12116   /* "rasterio/_base.pyx":698
12117  *                 scales = [GDALGetRasterScale(self.band(j), &success) for j in self.indexes]
12118  *                 self._scales = tuple(scales)
12119  *             return self._scales             # <<<<<<<<<<<<<<
12120  *
12121  *         def __set__(self, value):
12122  */
12123   __Pyx_XDECREF(__pyx_r);
12124   __Pyx_INCREF(__pyx_v_self->_scales);
12125   __pyx_r = __pyx_v_self->_scales;
12126   goto __pyx_L0;
12127 
12128   /* "rasterio/_base.pyx":693
12129  *         list of float
12130  *         """
12131  *         def __get__(self):             # <<<<<<<<<<<<<<
12132  *             cdef int success = 0
12133  *             if not self._scales:
12134  */
12135 
12136   /* function exit code */
12137   __pyx_L1_error:;
12138   __Pyx_XDECREF(__pyx_t_3);
12139   __Pyx_XDECREF(__pyx_t_4);
12140   __Pyx_XDECREF(__pyx_t_5);
12141   __Pyx_AddTraceback("rasterio._base.DatasetBase.scales.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12142   __pyx_r = NULL;
12143   __pyx_L0:;
12144   __Pyx_XDECREF(__pyx_v_scales);
12145   __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_j);
12146   __Pyx_XGIVEREF(__pyx_r);
12147   __Pyx_RefNannyFinishContext();
12148   return __pyx_r;
12149 }
12150 
12151 /* "rasterio/_base.pyx":700
12152  *             return self._scales
12153  *
12154  *         def __set__(self, value):             # <<<<<<<<<<<<<<
12155  *             self._set_all_scales(value)
12156  *
12157  */
12158 
12159 /* Python wrapper */
12160 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6scales_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6scales_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)12161 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6scales_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
12162   int __pyx_r;
12163   __Pyx_RefNannyDeclarations
12164   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
12165   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6scales_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
12166 
12167   /* function exit code */
12168   __Pyx_RefNannyFinishContext();
12169   return __pyx_r;
12170 }
12171 
__pyx_pf_8rasterio_5_base_11DatasetBase_6scales_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)12172 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6scales_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
12173   int __pyx_r;
12174   __Pyx_RefNannyDeclarations
12175   PyObject *__pyx_t_1 = NULL;
12176   PyObject *__pyx_t_2 = NULL;
12177   PyObject *__pyx_t_3 = NULL;
12178   int __pyx_lineno = 0;
12179   const char *__pyx_filename = NULL;
12180   int __pyx_clineno = 0;
12181   __Pyx_RefNannySetupContext("__set__", 0);
12182 
12183   /* "rasterio/_base.pyx":701
12184  *
12185  *         def __set__(self, value):
12186  *             self._set_all_scales(value)             # <<<<<<<<<<<<<<
12187  *
12188  *     property units:
12189  */
12190   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_all_scales); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 701, __pyx_L1_error)
12191   __Pyx_GOTREF(__pyx_t_2);
12192   __pyx_t_3 = NULL;
12193   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12194     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
12195     if (likely(__pyx_t_3)) {
12196       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12197       __Pyx_INCREF(__pyx_t_3);
12198       __Pyx_INCREF(function);
12199       __Pyx_DECREF_SET(__pyx_t_2, function);
12200     }
12201   }
12202   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_value) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_value);
12203   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12204   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 701, __pyx_L1_error)
12205   __Pyx_GOTREF(__pyx_t_1);
12206   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12207   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12208 
12209   /* "rasterio/_base.pyx":700
12210  *             return self._scales
12211  *
12212  *         def __set__(self, value):             # <<<<<<<<<<<<<<
12213  *             self._set_all_scales(value)
12214  *
12215  */
12216 
12217   /* function exit code */
12218   __pyx_r = 0;
12219   goto __pyx_L0;
12220   __pyx_L1_error:;
12221   __Pyx_XDECREF(__pyx_t_1);
12222   __Pyx_XDECREF(__pyx_t_2);
12223   __Pyx_XDECREF(__pyx_t_3);
12224   __Pyx_AddTraceback("rasterio._base.DatasetBase.scales.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12225   __pyx_r = -1;
12226   __pyx_L0:;
12227   __Pyx_RefNannyFinishContext();
12228   return __pyx_r;
12229 }
12230 
12231 /* "rasterio/_base.pyx":715
12232  *         list of str
12233  *         """
12234  *         def __get__(self):             # <<<<<<<<<<<<<<
12235  *             if not self._units:
12236  *                 units = [GDALGetRasterUnitType(self.band(j)) for j in self.indexes]
12237  */
12238 
12239 /* Python wrapper */
12240 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5units_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5units_1__get__(PyObject * __pyx_v_self)12241 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5units_1__get__(PyObject *__pyx_v_self) {
12242   PyObject *__pyx_r = 0;
12243   __Pyx_RefNannyDeclarations
12244   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12245   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5units___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
12246 
12247   /* function exit code */
12248   __Pyx_RefNannyFinishContext();
12249   return __pyx_r;
12250 }
12251 static PyObject *__pyx_gb_8rasterio_5_base_11DatasetBase_5units_7__get___2generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
12252 
12253 /* "rasterio/_base.pyx":718
12254  *             if not self._units:
12255  *                 units = [GDALGetRasterUnitType(self.band(j)) for j in self.indexes]
12256  *                 self._units = tuple((u or None) for u in units)             # <<<<<<<<<<<<<<
12257  *             return self._units
12258  *
12259  */
12260 
__pyx_pf_8rasterio_5_base_11DatasetBase_5units_7__get___genexpr(PyObject * __pyx_self)12261 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5units_7__get___genexpr(PyObject *__pyx_self) {
12262   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr *__pyx_cur_scope;
12263   PyObject *__pyx_r = NULL;
12264   __Pyx_RefNannyDeclarations
12265   int __pyx_lineno = 0;
12266   const char *__pyx_filename = NULL;
12267   int __pyx_clineno = 0;
12268   __Pyx_RefNannySetupContext("genexpr", 0);
12269   __pyx_cur_scope = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr *)__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_7_genexpr(__pyx_ptype_8rasterio_5_base___pyx_scope_struct_7_genexpr, __pyx_empty_tuple, NULL);
12270   if (unlikely(!__pyx_cur_scope)) {
12271     __pyx_cur_scope = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr *)Py_None);
12272     __Pyx_INCREF(Py_None);
12273     __PYX_ERR(0, 718, __pyx_L1_error)
12274   } else {
12275     __Pyx_GOTREF(__pyx_cur_scope);
12276   }
12277   __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__ *) __pyx_self;
12278   __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
12279   __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
12280   {
12281     __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_8rasterio_5_base_11DatasetBase_5units_7__get___2generator4, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_DatasetBase___get___locals_genex, __pyx_n_s_rasterio__base); if (unlikely(!gen)) __PYX_ERR(0, 718, __pyx_L1_error)
12282     __Pyx_DECREF(__pyx_cur_scope);
12283     __Pyx_RefNannyFinishContext();
12284     return (PyObject *) gen;
12285   }
12286 
12287   /* function exit code */
12288   __pyx_L1_error:;
12289   __Pyx_AddTraceback("rasterio._base.DatasetBase.units.__get__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
12290   __pyx_r = NULL;
12291   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
12292   __Pyx_XGIVEREF(__pyx_r);
12293   __Pyx_RefNannyFinishContext();
12294   return __pyx_r;
12295 }
12296 
__pyx_gb_8rasterio_5_base_11DatasetBase_5units_7__get___2generator4(__pyx_CoroutineObject * __pyx_generator,CYTHON_UNUSED PyThreadState * __pyx_tstate,PyObject * __pyx_sent_value)12297 static PyObject *__pyx_gb_8rasterio_5_base_11DatasetBase_5units_7__get___2generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
12298 {
12299   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr *__pyx_cur_scope = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr *)__pyx_generator->closure);
12300   PyObject *__pyx_r = NULL;
12301   PyObject *__pyx_t_1 = NULL;
12302   Py_ssize_t __pyx_t_2;
12303   PyObject *__pyx_t_3 = NULL;
12304   int __pyx_t_4;
12305   int __pyx_lineno = 0;
12306   const char *__pyx_filename = NULL;
12307   int __pyx_clineno = 0;
12308   __Pyx_RefNannyDeclarations
12309   __Pyx_RefNannySetupContext("genexpr", 0);
12310   switch (__pyx_generator->resume_label) {
12311     case 0: goto __pyx_L3_first_run;
12312     case 1: goto __pyx_L8_resume_from_yield;
12313     default: /* CPython raises the right error here */
12314     __Pyx_RefNannyFinishContext();
12315     return NULL;
12316   }
12317   __pyx_L3_first_run:;
12318   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 718, __pyx_L1_error)
12319   if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_units)) { __Pyx_RaiseClosureNameError("units"); __PYX_ERR(0, 718, __pyx_L1_error) }
12320   if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_units == Py_None)) {
12321     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
12322     __PYX_ERR(0, 718, __pyx_L1_error)
12323   }
12324   __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_units; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
12325   for (;;) {
12326     if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
12327     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12328     __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 718, __pyx_L1_error)
12329     #else
12330     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 718, __pyx_L1_error)
12331     __Pyx_GOTREF(__pyx_t_3);
12332     #endif
12333     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_u);
12334     __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_u, __pyx_t_3);
12335     __Pyx_GIVEREF(__pyx_t_3);
12336     __pyx_t_3 = 0;
12337     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_u); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 718, __pyx_L1_error)
12338     if (!__pyx_t_4) {
12339     } else {
12340       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_u);
12341       __pyx_t_3 = __pyx_cur_scope->__pyx_v_u;
12342       goto __pyx_L6_bool_binop_done;
12343     }
12344     __Pyx_INCREF(Py_None);
12345     __pyx_t_3 = Py_None;
12346     __pyx_L6_bool_binop_done:;
12347     __pyx_r = __pyx_t_3;
12348     __pyx_t_3 = 0;
12349     __Pyx_XGIVEREF(__pyx_t_1);
12350     __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
12351     __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
12352     __Pyx_XGIVEREF(__pyx_r);
12353     __Pyx_RefNannyFinishContext();
12354     __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
12355     /* return from generator, yielding value */
12356     __pyx_generator->resume_label = 1;
12357     return __pyx_r;
12358     __pyx_L8_resume_from_yield:;
12359     __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
12360     __pyx_cur_scope->__pyx_t_0 = 0;
12361     __Pyx_XGOTREF(__pyx_t_1);
12362     __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
12363     if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 718, __pyx_L1_error)
12364   }
12365   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12366   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
12367 
12368   /* function exit code */
12369   PyErr_SetNone(PyExc_StopIteration);
12370   goto __pyx_L0;
12371   __pyx_L1_error:;
12372   __Pyx_XDECREF(__pyx_t_1);
12373   __Pyx_XDECREF(__pyx_t_3);
12374   __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
12375   __pyx_L0:;
12376   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
12377   #if !CYTHON_USE_EXC_INFO_STACK
12378   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
12379   #endif
12380   __pyx_generator->resume_label = -1;
12381   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
12382   __Pyx_RefNannyFinishContext();
12383   return __pyx_r;
12384 }
12385 
12386 /* "rasterio/_base.pyx":715
12387  *         list of str
12388  *         """
12389  *         def __get__(self):             # <<<<<<<<<<<<<<
12390  *             if not self._units:
12391  *                 units = [GDALGetRasterUnitType(self.band(j)) for j in self.indexes]
12392  */
12393 
__pyx_pf_8rasterio_5_base_11DatasetBase_5units___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)12394 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5units___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
12395   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__ *__pyx_cur_scope;
12396   PyObject *__pyx_8genexpr9__pyx_v_j = NULL;
12397   PyObject *__pyx_r = NULL;
12398   __Pyx_RefNannyDeclarations
12399   int __pyx_t_1;
12400   int __pyx_t_2;
12401   PyObject *__pyx_t_3 = NULL;
12402   PyObject *__pyx_t_4 = NULL;
12403   PyObject *__pyx_t_5 = NULL;
12404   Py_ssize_t __pyx_t_6;
12405   PyObject *(*__pyx_t_7)(PyObject *);
12406   int __pyx_t_8;
12407   GDALRasterBandH __pyx_t_9;
12408   int __pyx_lineno = 0;
12409   const char *__pyx_filename = NULL;
12410   int __pyx_clineno = 0;
12411   __Pyx_RefNannySetupContext("__get__", 0);
12412   __pyx_cur_scope = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__ *)__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_6___get__(__pyx_ptype_8rasterio_5_base___pyx_scope_struct_6___get__, __pyx_empty_tuple, NULL);
12413   if (unlikely(!__pyx_cur_scope)) {
12414     __pyx_cur_scope = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__ *)Py_None);
12415     __Pyx_INCREF(Py_None);
12416     __PYX_ERR(0, 715, __pyx_L1_error)
12417   } else {
12418     __Pyx_GOTREF(__pyx_cur_scope);
12419   }
12420 
12421   /* "rasterio/_base.pyx":716
12422  *         """
12423  *         def __get__(self):
12424  *             if not self._units:             # <<<<<<<<<<<<<<
12425  *                 units = [GDALGetRasterUnitType(self.band(j)) for j in self.indexes]
12426  *                 self._units = tuple((u or None) for u in units)
12427  */
12428   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_units); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 716, __pyx_L1_error)
12429   __pyx_t_2 = ((!__pyx_t_1) != 0);
12430   if (__pyx_t_2) {
12431 
12432     /* "rasterio/_base.pyx":717
12433  *         def __get__(self):
12434  *             if not self._units:
12435  *                 units = [GDALGetRasterUnitType(self.band(j)) for j in self.indexes]             # <<<<<<<<<<<<<<
12436  *                 self._units = tuple((u or None) for u in units)
12437  *             return self._units
12438  */
12439     { /* enter inner scope */
12440       __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 717, __pyx_L6_error)
12441       __Pyx_GOTREF(__pyx_t_3);
12442       __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_indexes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 717, __pyx_L6_error)
12443       __Pyx_GOTREF(__pyx_t_4);
12444       if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
12445         __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
12446         __pyx_t_7 = NULL;
12447       } else {
12448         __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 717, __pyx_L6_error)
12449         __Pyx_GOTREF(__pyx_t_5);
12450         __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 717, __pyx_L6_error)
12451       }
12452       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12453       for (;;) {
12454         if (likely(!__pyx_t_7)) {
12455           if (likely(PyList_CheckExact(__pyx_t_5))) {
12456             if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
12457             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12458             __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 717, __pyx_L6_error)
12459             #else
12460             __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 717, __pyx_L6_error)
12461             __Pyx_GOTREF(__pyx_t_4);
12462             #endif
12463           } else {
12464             if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
12465             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12466             __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 717, __pyx_L6_error)
12467             #else
12468             __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 717, __pyx_L6_error)
12469             __Pyx_GOTREF(__pyx_t_4);
12470             #endif
12471           }
12472         } else {
12473           __pyx_t_4 = __pyx_t_7(__pyx_t_5);
12474           if (unlikely(!__pyx_t_4)) {
12475             PyObject* exc_type = PyErr_Occurred();
12476             if (exc_type) {
12477               if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12478               else __PYX_ERR(0, 717, __pyx_L6_error)
12479             }
12480             break;
12481           }
12482           __Pyx_GOTREF(__pyx_t_4);
12483         }
12484         __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v_j, __pyx_t_4);
12485         __pyx_t_4 = 0;
12486         __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_8genexpr9__pyx_v_j); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 717, __pyx_L6_error)
12487         __pyx_t_9 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_8); if (unlikely(__pyx_t_9 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 717, __pyx_L6_error)
12488         __pyx_t_4 = __Pyx_PyUnicode_FromString(GDALGetRasterUnitType(__pyx_t_9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 717, __pyx_L6_error)
12489         __Pyx_GOTREF(__pyx_t_4);
12490         if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 717, __pyx_L6_error)
12491         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12492       }
12493       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12494       __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_j); __pyx_8genexpr9__pyx_v_j = 0;
12495       goto __pyx_L9_exit_scope;
12496       __pyx_L6_error:;
12497       __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_j); __pyx_8genexpr9__pyx_v_j = 0;
12498       goto __pyx_L1_error;
12499       __pyx_L9_exit_scope:;
12500     } /* exit inner scope */
12501     __Pyx_GIVEREF(__pyx_t_3);
12502     __pyx_cur_scope->__pyx_v_units = ((PyObject*)__pyx_t_3);
12503     __pyx_t_3 = 0;
12504 
12505     /* "rasterio/_base.pyx":718
12506  *             if not self._units:
12507  *                 units = [GDALGetRasterUnitType(self.band(j)) for j in self.indexes]
12508  *                 self._units = tuple((u or None) for u in units)             # <<<<<<<<<<<<<<
12509  *             return self._units
12510  *
12511  */
12512     __pyx_t_3 = __pyx_pf_8rasterio_5_base_11DatasetBase_5units_7__get___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 718, __pyx_L1_error)
12513     __Pyx_GOTREF(__pyx_t_3);
12514     __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 718, __pyx_L1_error)
12515     __Pyx_GOTREF(__pyx_t_5);
12516     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12517     __Pyx_GIVEREF(__pyx_t_5);
12518     __Pyx_GOTREF(__pyx_v_self->_units);
12519     __Pyx_DECREF(__pyx_v_self->_units);
12520     __pyx_v_self->_units = __pyx_t_5;
12521     __pyx_t_5 = 0;
12522 
12523     /* "rasterio/_base.pyx":716
12524  *         """
12525  *         def __get__(self):
12526  *             if not self._units:             # <<<<<<<<<<<<<<
12527  *                 units = [GDALGetRasterUnitType(self.band(j)) for j in self.indexes]
12528  *                 self._units = tuple((u or None) for u in units)
12529  */
12530   }
12531 
12532   /* "rasterio/_base.pyx":719
12533  *                 units = [GDALGetRasterUnitType(self.band(j)) for j in self.indexes]
12534  *                 self._units = tuple((u or None) for u in units)
12535  *             return self._units             # <<<<<<<<<<<<<<
12536  *
12537  *         def __set__(self, value):
12538  */
12539   __Pyx_XDECREF(__pyx_r);
12540   __Pyx_INCREF(__pyx_v_self->_units);
12541   __pyx_r = __pyx_v_self->_units;
12542   goto __pyx_L0;
12543 
12544   /* "rasterio/_base.pyx":715
12545  *         list of str
12546  *         """
12547  *         def __get__(self):             # <<<<<<<<<<<<<<
12548  *             if not self._units:
12549  *                 units = [GDALGetRasterUnitType(self.band(j)) for j in self.indexes]
12550  */
12551 
12552   /* function exit code */
12553   __pyx_L1_error:;
12554   __Pyx_XDECREF(__pyx_t_3);
12555   __Pyx_XDECREF(__pyx_t_4);
12556   __Pyx_XDECREF(__pyx_t_5);
12557   __Pyx_AddTraceback("rasterio._base.DatasetBase.units.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12558   __pyx_r = NULL;
12559   __pyx_L0:;
12560   __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_j);
12561   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
12562   __Pyx_XGIVEREF(__pyx_r);
12563   __Pyx_RefNannyFinishContext();
12564   return __pyx_r;
12565 }
12566 
12567 /* "rasterio/_base.pyx":721
12568  *             return self._units
12569  *
12570  *         def __set__(self, value):             # <<<<<<<<<<<<<<
12571  *             self._set_all_units(value)
12572  *
12573  */
12574 
12575 /* Python wrapper */
12576 static int __pyx_pw_8rasterio_5_base_11DatasetBase_5units_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5units_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)12577 static int __pyx_pw_8rasterio_5_base_11DatasetBase_5units_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
12578   int __pyx_r;
12579   __Pyx_RefNannyDeclarations
12580   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
12581   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5units_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
12582 
12583   /* function exit code */
12584   __Pyx_RefNannyFinishContext();
12585   return __pyx_r;
12586 }
12587 
__pyx_pf_8rasterio_5_base_11DatasetBase_5units_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)12588 static int __pyx_pf_8rasterio_5_base_11DatasetBase_5units_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
12589   int __pyx_r;
12590   __Pyx_RefNannyDeclarations
12591   PyObject *__pyx_t_1 = NULL;
12592   PyObject *__pyx_t_2 = NULL;
12593   PyObject *__pyx_t_3 = NULL;
12594   int __pyx_lineno = 0;
12595   const char *__pyx_filename = NULL;
12596   int __pyx_clineno = 0;
12597   __Pyx_RefNannySetupContext("__set__", 0);
12598 
12599   /* "rasterio/_base.pyx":722
12600  *
12601  *         def __set__(self, value):
12602  *             self._set_all_units(value)             # <<<<<<<<<<<<<<
12603  *
12604  *     def block_window(self, bidx, i, j):
12605  */
12606   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_all_units); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 722, __pyx_L1_error)
12607   __Pyx_GOTREF(__pyx_t_2);
12608   __pyx_t_3 = NULL;
12609   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12610     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
12611     if (likely(__pyx_t_3)) {
12612       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12613       __Pyx_INCREF(__pyx_t_3);
12614       __Pyx_INCREF(function);
12615       __Pyx_DECREF_SET(__pyx_t_2, function);
12616     }
12617   }
12618   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_value) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_value);
12619   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12620   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 722, __pyx_L1_error)
12621   __Pyx_GOTREF(__pyx_t_1);
12622   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12623   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12624 
12625   /* "rasterio/_base.pyx":721
12626  *             return self._units
12627  *
12628  *         def __set__(self, value):             # <<<<<<<<<<<<<<
12629  *             self._set_all_units(value)
12630  *
12631  */
12632 
12633   /* function exit code */
12634   __pyx_r = 0;
12635   goto __pyx_L0;
12636   __pyx_L1_error:;
12637   __Pyx_XDECREF(__pyx_t_1);
12638   __Pyx_XDECREF(__pyx_t_2);
12639   __Pyx_XDECREF(__pyx_t_3);
12640   __Pyx_AddTraceback("rasterio._base.DatasetBase.units.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12641   __pyx_r = -1;
12642   __pyx_L0:;
12643   __Pyx_RefNannyFinishContext();
12644   return __pyx_r;
12645 }
12646 
12647 /* "rasterio/_base.pyx":724
12648  *             self._set_all_units(value)
12649  *
12650  *     def block_window(self, bidx, i, j):             # <<<<<<<<<<<<<<
12651  *         """Returns the window for a particular block
12652  *
12653  */
12654 
12655 /* Python wrapper */
12656 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_47block_window(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
12657 static char __pyx_doc_8rasterio_5_base_11DatasetBase_46block_window[] = "Returns the window for a particular block\n\n        Parameters\n        ----------\n        bidx: int\n            Band index, starting with 1.\n        i: int\n            Row index of the block, starting with 0.\n        j: int\n            Column index of the block, starting with 0.\n\n        Returns\n        -------\n        Window\n        ";
__pyx_pw_8rasterio_5_base_11DatasetBase_47block_window(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)12658 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_47block_window(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
12659   PyObject *__pyx_v_bidx = 0;
12660   PyObject *__pyx_v_i = 0;
12661   PyObject *__pyx_v_j = 0;
12662   int __pyx_lineno = 0;
12663   const char *__pyx_filename = NULL;
12664   int __pyx_clineno = 0;
12665   PyObject *__pyx_r = 0;
12666   __Pyx_RefNannyDeclarations
12667   __Pyx_RefNannySetupContext("block_window (wrapper)", 0);
12668   {
12669     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bidx,&__pyx_n_s_i,&__pyx_n_s_j,0};
12670     PyObject* values[3] = {0,0,0};
12671     if (unlikely(__pyx_kwds)) {
12672       Py_ssize_t kw_args;
12673       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
12674       switch (pos_args) {
12675         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12676         CYTHON_FALLTHROUGH;
12677         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12678         CYTHON_FALLTHROUGH;
12679         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12680         CYTHON_FALLTHROUGH;
12681         case  0: break;
12682         default: goto __pyx_L5_argtuple_error;
12683       }
12684       kw_args = PyDict_Size(__pyx_kwds);
12685       switch (pos_args) {
12686         case  0:
12687         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bidx)) != 0)) kw_args--;
12688         else goto __pyx_L5_argtuple_error;
12689         CYTHON_FALLTHROUGH;
12690         case  1:
12691         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
12692         else {
12693           __Pyx_RaiseArgtupleInvalid("block_window", 1, 3, 3, 1); __PYX_ERR(0, 724, __pyx_L3_error)
12694         }
12695         CYTHON_FALLTHROUGH;
12696         case  2:
12697         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_j)) != 0)) kw_args--;
12698         else {
12699           __Pyx_RaiseArgtupleInvalid("block_window", 1, 3, 3, 2); __PYX_ERR(0, 724, __pyx_L3_error)
12700         }
12701       }
12702       if (unlikely(kw_args > 0)) {
12703         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "block_window") < 0)) __PYX_ERR(0, 724, __pyx_L3_error)
12704       }
12705     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
12706       goto __pyx_L5_argtuple_error;
12707     } else {
12708       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12709       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12710       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12711     }
12712     __pyx_v_bidx = values[0];
12713     __pyx_v_i = values[1];
12714     __pyx_v_j = values[2];
12715   }
12716   goto __pyx_L4_argument_unpacking_done;
12717   __pyx_L5_argtuple_error:;
12718   __Pyx_RaiseArgtupleInvalid("block_window", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 724, __pyx_L3_error)
12719   __pyx_L3_error:;
12720   __Pyx_AddTraceback("rasterio._base.DatasetBase.block_window", __pyx_clineno, __pyx_lineno, __pyx_filename);
12721   __Pyx_RefNannyFinishContext();
12722   return NULL;
12723   __pyx_L4_argument_unpacking_done:;
12724   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_46block_window(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), __pyx_v_bidx, __pyx_v_i, __pyx_v_j);
12725 
12726   /* function exit code */
12727   __Pyx_RefNannyFinishContext();
12728   return __pyx_r;
12729 }
12730 
__pyx_pf_8rasterio_5_base_11DatasetBase_46block_window(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_bidx,PyObject * __pyx_v_i,PyObject * __pyx_v_j)12731 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_46block_window(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx, PyObject *__pyx_v_i, PyObject *__pyx_v_j) {
12732   PyObject *__pyx_v_h = NULL;
12733   PyObject *__pyx_v_w = NULL;
12734   PyObject *__pyx_v_row = NULL;
12735   PyObject *__pyx_v_height = NULL;
12736   PyObject *__pyx_v_col = NULL;
12737   PyObject *__pyx_v_width = NULL;
12738   PyObject *__pyx_r = NULL;
12739   __Pyx_RefNannyDeclarations
12740   PyObject *__pyx_t_1 = NULL;
12741   PyObject *__pyx_t_2 = NULL;
12742   PyObject *__pyx_t_3 = NULL;
12743   PyObject *__pyx_t_4 = NULL;
12744   PyObject *(*__pyx_t_5)(PyObject *);
12745   int __pyx_t_6;
12746   int __pyx_t_7;
12747   int __pyx_lineno = 0;
12748   const char *__pyx_filename = NULL;
12749   int __pyx_clineno = 0;
12750   __Pyx_RefNannySetupContext("block_window", 0);
12751 
12752   /* "rasterio/_base.pyx":740
12753  *         Window
12754  *         """
12755  *         h, w = self.block_shapes[bidx-1]             # <<<<<<<<<<<<<<
12756  *         row = i * h
12757  *         height = min(h, self.height - row)
12758  */
12759   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_block_shapes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
12760   __Pyx_GOTREF(__pyx_t_1);
12761   __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_v_bidx, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error)
12762   __Pyx_GOTREF(__pyx_t_2);
12763   __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 740, __pyx_L1_error)
12764   __Pyx_GOTREF(__pyx_t_3);
12765   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12766   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12767   if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
12768     PyObject* sequence = __pyx_t_3;
12769     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
12770     if (unlikely(size != 2)) {
12771       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
12772       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
12773       __PYX_ERR(0, 740, __pyx_L1_error)
12774     }
12775     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12776     if (likely(PyTuple_CheckExact(sequence))) {
12777       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
12778       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
12779     } else {
12780       __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
12781       __pyx_t_1 = PyList_GET_ITEM(sequence, 1);
12782     }
12783     __Pyx_INCREF(__pyx_t_2);
12784     __Pyx_INCREF(__pyx_t_1);
12785     #else
12786     __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error)
12787     __Pyx_GOTREF(__pyx_t_2);
12788     __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
12789     __Pyx_GOTREF(__pyx_t_1);
12790     #endif
12791     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12792   } else {
12793     Py_ssize_t index = -1;
12794     __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 740, __pyx_L1_error)
12795     __Pyx_GOTREF(__pyx_t_4);
12796     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12797     __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
12798     index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
12799     __Pyx_GOTREF(__pyx_t_2);
12800     index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
12801     __Pyx_GOTREF(__pyx_t_1);
12802     if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 740, __pyx_L1_error)
12803     __pyx_t_5 = NULL;
12804     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12805     goto __pyx_L4_unpacking_done;
12806     __pyx_L3_unpacking_failed:;
12807     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12808     __pyx_t_5 = NULL;
12809     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
12810     __PYX_ERR(0, 740, __pyx_L1_error)
12811     __pyx_L4_unpacking_done:;
12812   }
12813   __pyx_v_h = __pyx_t_2;
12814   __pyx_t_2 = 0;
12815   __pyx_v_w = __pyx_t_1;
12816   __pyx_t_1 = 0;
12817 
12818   /* "rasterio/_base.pyx":741
12819  *         """
12820  *         h, w = self.block_shapes[bidx-1]
12821  *         row = i * h             # <<<<<<<<<<<<<<
12822  *         height = min(h, self.height - row)
12823  *         col = j * w
12824  */
12825   __pyx_t_3 = PyNumber_Multiply(__pyx_v_i, __pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 741, __pyx_L1_error)
12826   __Pyx_GOTREF(__pyx_t_3);
12827   __pyx_v_row = __pyx_t_3;
12828   __pyx_t_3 = 0;
12829 
12830   /* "rasterio/_base.pyx":742
12831  *         h, w = self.block_shapes[bidx-1]
12832  *         row = i * h
12833  *         height = min(h, self.height - row)             # <<<<<<<<<<<<<<
12834  *         col = j * w
12835  *         width = min(w, self.width - col)
12836  */
12837   __pyx_t_3 = PyNumber_Subtract(__pyx_v_self->height, __pyx_v_row); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 742, __pyx_L1_error)
12838   __Pyx_GOTREF(__pyx_t_3);
12839   __Pyx_INCREF(__pyx_v_h);
12840   __pyx_t_1 = __pyx_v_h;
12841   __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 742, __pyx_L1_error)
12842   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 742, __pyx_L1_error)
12843   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12844   if (__pyx_t_6) {
12845     __Pyx_INCREF(__pyx_t_3);
12846     __pyx_t_2 = __pyx_t_3;
12847   } else {
12848     __Pyx_INCREF(__pyx_t_1);
12849     __pyx_t_2 = __pyx_t_1;
12850   }
12851   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12852   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12853   __pyx_t_3 = __pyx_t_2;
12854   __Pyx_INCREF(__pyx_t_3);
12855   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12856   __pyx_v_height = __pyx_t_3;
12857   __pyx_t_3 = 0;
12858 
12859   /* "rasterio/_base.pyx":743
12860  *         row = i * h
12861  *         height = min(h, self.height - row)
12862  *         col = j * w             # <<<<<<<<<<<<<<
12863  *         width = min(w, self.width - col)
12864  *         return windows.Window(col, row, width, height)
12865  */
12866   __pyx_t_3 = PyNumber_Multiply(__pyx_v_j, __pyx_v_w); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 743, __pyx_L1_error)
12867   __Pyx_GOTREF(__pyx_t_3);
12868   __pyx_v_col = __pyx_t_3;
12869   __pyx_t_3 = 0;
12870 
12871   /* "rasterio/_base.pyx":744
12872  *         height = min(h, self.height - row)
12873  *         col = j * w
12874  *         width = min(w, self.width - col)             # <<<<<<<<<<<<<<
12875  *         return windows.Window(col, row, width, height)
12876  *
12877  */
12878   __pyx_t_3 = PyNumber_Subtract(__pyx_v_self->width, __pyx_v_col); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 744, __pyx_L1_error)
12879   __Pyx_GOTREF(__pyx_t_3);
12880   __Pyx_INCREF(__pyx_v_w);
12881   __pyx_t_2 = __pyx_v_w;
12882   __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 744, __pyx_L1_error)
12883   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 744, __pyx_L1_error)
12884   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12885   if (__pyx_t_6) {
12886     __Pyx_INCREF(__pyx_t_3);
12887     __pyx_t_1 = __pyx_t_3;
12888   } else {
12889     __Pyx_INCREF(__pyx_t_2);
12890     __pyx_t_1 = __pyx_t_2;
12891   }
12892   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12893   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12894   __pyx_t_3 = __pyx_t_1;
12895   __Pyx_INCREF(__pyx_t_3);
12896   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12897   __pyx_v_width = __pyx_t_3;
12898   __pyx_t_3 = 0;
12899 
12900   /* "rasterio/_base.pyx":745
12901  *         col = j * w
12902  *         width = min(w, self.width - col)
12903  *         return windows.Window(col, row, width, height)             # <<<<<<<<<<<<<<
12904  *
12905  *     def block_size(self, bidx, i, j):
12906  */
12907   __Pyx_XDECREF(__pyx_r);
12908   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_windows); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 745, __pyx_L1_error)
12909   __Pyx_GOTREF(__pyx_t_1);
12910   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Window); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L1_error)
12911   __Pyx_GOTREF(__pyx_t_2);
12912   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12913   __pyx_t_1 = NULL;
12914   __pyx_t_7 = 0;
12915   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
12916     __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
12917     if (likely(__pyx_t_1)) {
12918       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12919       __Pyx_INCREF(__pyx_t_1);
12920       __Pyx_INCREF(function);
12921       __Pyx_DECREF_SET(__pyx_t_2, function);
12922       __pyx_t_7 = 1;
12923     }
12924   }
12925   #if CYTHON_FAST_PYCALL
12926   if (PyFunction_Check(__pyx_t_2)) {
12927     PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_v_col, __pyx_v_row, __pyx_v_width, __pyx_v_height};
12928     __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 745, __pyx_L1_error)
12929     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12930     __Pyx_GOTREF(__pyx_t_3);
12931   } else
12932   #endif
12933   #if CYTHON_FAST_PYCCALL
12934   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
12935     PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_v_col, __pyx_v_row, __pyx_v_width, __pyx_v_height};
12936     __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 745, __pyx_L1_error)
12937     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12938     __Pyx_GOTREF(__pyx_t_3);
12939   } else
12940   #endif
12941   {
12942     __pyx_t_4 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 745, __pyx_L1_error)
12943     __Pyx_GOTREF(__pyx_t_4);
12944     if (__pyx_t_1) {
12945       __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
12946     }
12947     __Pyx_INCREF(__pyx_v_col);
12948     __Pyx_GIVEREF(__pyx_v_col);
12949     PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_v_col);
12950     __Pyx_INCREF(__pyx_v_row);
12951     __Pyx_GIVEREF(__pyx_v_row);
12952     PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_v_row);
12953     __Pyx_INCREF(__pyx_v_width);
12954     __Pyx_GIVEREF(__pyx_v_width);
12955     PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_7, __pyx_v_width);
12956     __Pyx_INCREF(__pyx_v_height);
12957     __Pyx_GIVEREF(__pyx_v_height);
12958     PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_7, __pyx_v_height);
12959     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 745, __pyx_L1_error)
12960     __Pyx_GOTREF(__pyx_t_3);
12961     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12962   }
12963   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12964   __pyx_r = __pyx_t_3;
12965   __pyx_t_3 = 0;
12966   goto __pyx_L0;
12967 
12968   /* "rasterio/_base.pyx":724
12969  *             self._set_all_units(value)
12970  *
12971  *     def block_window(self, bidx, i, j):             # <<<<<<<<<<<<<<
12972  *         """Returns the window for a particular block
12973  *
12974  */
12975 
12976   /* function exit code */
12977   __pyx_L1_error:;
12978   __Pyx_XDECREF(__pyx_t_1);
12979   __Pyx_XDECREF(__pyx_t_2);
12980   __Pyx_XDECREF(__pyx_t_3);
12981   __Pyx_XDECREF(__pyx_t_4);
12982   __Pyx_AddTraceback("rasterio._base.DatasetBase.block_window", __pyx_clineno, __pyx_lineno, __pyx_filename);
12983   __pyx_r = NULL;
12984   __pyx_L0:;
12985   __Pyx_XDECREF(__pyx_v_h);
12986   __Pyx_XDECREF(__pyx_v_w);
12987   __Pyx_XDECREF(__pyx_v_row);
12988   __Pyx_XDECREF(__pyx_v_height);
12989   __Pyx_XDECREF(__pyx_v_col);
12990   __Pyx_XDECREF(__pyx_v_width);
12991   __Pyx_XGIVEREF(__pyx_r);
12992   __Pyx_RefNannyFinishContext();
12993   return __pyx_r;
12994 }
12995 
12996 /* "rasterio/_base.pyx":747
12997  *         return windows.Window(col, row, width, height)
12998  *
12999  *     def block_size(self, bidx, i, j):             # <<<<<<<<<<<<<<
13000  *         """Returns the size in bytes of a particular block
13001  *
13002  */
13003 
13004 /* Python wrapper */
13005 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_49block_size(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13006 static char __pyx_doc_8rasterio_5_base_11DatasetBase_48block_size[] = "Returns the size in bytes of a particular block\n\n        Only useful for TIFF formatted datasets.\n\n        Parameters\n        ----------\n        bidx: int\n            Band index, starting with 1.\n        i: int\n            Row index of the block, starting with 0.\n        j: int\n            Column index of the block, starting with 0.\n\n        Returns\n        -------\n        int\n        ";
__pyx_pw_8rasterio_5_base_11DatasetBase_49block_size(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)13007 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_49block_size(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13008   PyObject *__pyx_v_bidx = 0;
13009   PyObject *__pyx_v_i = 0;
13010   PyObject *__pyx_v_j = 0;
13011   int __pyx_lineno = 0;
13012   const char *__pyx_filename = NULL;
13013   int __pyx_clineno = 0;
13014   PyObject *__pyx_r = 0;
13015   __Pyx_RefNannyDeclarations
13016   __Pyx_RefNannySetupContext("block_size (wrapper)", 0);
13017   {
13018     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bidx,&__pyx_n_s_i,&__pyx_n_s_j,0};
13019     PyObject* values[3] = {0,0,0};
13020     if (unlikely(__pyx_kwds)) {
13021       Py_ssize_t kw_args;
13022       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13023       switch (pos_args) {
13024         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13025         CYTHON_FALLTHROUGH;
13026         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13027         CYTHON_FALLTHROUGH;
13028         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13029         CYTHON_FALLTHROUGH;
13030         case  0: break;
13031         default: goto __pyx_L5_argtuple_error;
13032       }
13033       kw_args = PyDict_Size(__pyx_kwds);
13034       switch (pos_args) {
13035         case  0:
13036         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bidx)) != 0)) kw_args--;
13037         else goto __pyx_L5_argtuple_error;
13038         CYTHON_FALLTHROUGH;
13039         case  1:
13040         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
13041         else {
13042           __Pyx_RaiseArgtupleInvalid("block_size", 1, 3, 3, 1); __PYX_ERR(0, 747, __pyx_L3_error)
13043         }
13044         CYTHON_FALLTHROUGH;
13045         case  2:
13046         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_j)) != 0)) kw_args--;
13047         else {
13048           __Pyx_RaiseArgtupleInvalid("block_size", 1, 3, 3, 2); __PYX_ERR(0, 747, __pyx_L3_error)
13049         }
13050       }
13051       if (unlikely(kw_args > 0)) {
13052         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "block_size") < 0)) __PYX_ERR(0, 747, __pyx_L3_error)
13053       }
13054     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
13055       goto __pyx_L5_argtuple_error;
13056     } else {
13057       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13058       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13059       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13060     }
13061     __pyx_v_bidx = values[0];
13062     __pyx_v_i = values[1];
13063     __pyx_v_j = values[2];
13064   }
13065   goto __pyx_L4_argument_unpacking_done;
13066   __pyx_L5_argtuple_error:;
13067   __Pyx_RaiseArgtupleInvalid("block_size", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 747, __pyx_L3_error)
13068   __pyx_L3_error:;
13069   __Pyx_AddTraceback("rasterio._base.DatasetBase.block_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
13070   __Pyx_RefNannyFinishContext();
13071   return NULL;
13072   __pyx_L4_argument_unpacking_done:;
13073   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_48block_size(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), __pyx_v_bidx, __pyx_v_i, __pyx_v_j);
13074 
13075   /* function exit code */
13076   __Pyx_RefNannyFinishContext();
13077   return __pyx_r;
13078 }
13079 
__pyx_pf_8rasterio_5_base_11DatasetBase_48block_size(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_bidx,PyObject * __pyx_v_i,PyObject * __pyx_v_j)13080 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_48block_size(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx, PyObject *__pyx_v_i, PyObject *__pyx_v_j) {
13081   GDALMajorObjectH __pyx_v_obj;
13082   char *__pyx_v_value;
13083   char const *__pyx_v_key_c;
13084   PyObject *__pyx_v_key_b = NULL;
13085   PyObject *__pyx_r = NULL;
13086   __Pyx_RefNannyDeclarations
13087   int __pyx_t_1;
13088   GDALRasterBandH __pyx_t_2;
13089   PyObject *__pyx_t_3 = NULL;
13090   PyObject *__pyx_t_4 = NULL;
13091   PyObject *__pyx_t_5 = NULL;
13092   PyObject *__pyx_t_6 = NULL;
13093   PyObject *__pyx_t_7 = NULL;
13094   char const *__pyx_t_8;
13095   int __pyx_t_9;
13096   PyObject *__pyx_t_10 = NULL;
13097   int __pyx_lineno = 0;
13098   const char *__pyx_filename = NULL;
13099   int __pyx_clineno = 0;
13100   __Pyx_RefNannySetupContext("block_size", 0);
13101 
13102   /* "rasterio/_base.pyx":765
13103  *         int
13104  *         """
13105  *         cdef GDALMajorObjectH obj = NULL             # <<<<<<<<<<<<<<
13106  *         cdef char *value = NULL
13107  *         cdef const char *key_c = NULL
13108  */
13109   __pyx_v_obj = NULL;
13110 
13111   /* "rasterio/_base.pyx":766
13112  *         """
13113  *         cdef GDALMajorObjectH obj = NULL
13114  *         cdef char *value = NULL             # <<<<<<<<<<<<<<
13115  *         cdef const char *key_c = NULL
13116  *
13117  */
13118   __pyx_v_value = NULL;
13119 
13120   /* "rasterio/_base.pyx":767
13121  *         cdef GDALMajorObjectH obj = NULL
13122  *         cdef char *value = NULL
13123  *         cdef const char *key_c = NULL             # <<<<<<<<<<<<<<
13124  *
13125  *         obj = self.band(bidx)
13126  */
13127   __pyx_v_key_c = NULL;
13128 
13129   /* "rasterio/_base.pyx":769
13130  *         cdef const char *key_c = NULL
13131  *
13132  *         obj = self.band(bidx)             # <<<<<<<<<<<<<<
13133  *
13134  *         key_b = 'BLOCK_SIZE_{0}_{1}'.format(j, i).encode('utf-8')
13135  */
13136   __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_bidx); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 769, __pyx_L1_error)
13137   __pyx_t_2 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_1); if (unlikely(__pyx_t_2 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 769, __pyx_L1_error)
13138   __pyx_v_obj = __pyx_t_2;
13139 
13140   /* "rasterio/_base.pyx":771
13141  *         obj = self.band(bidx)
13142  *
13143  *         key_b = 'BLOCK_SIZE_{0}_{1}'.format(j, i).encode('utf-8')             # <<<<<<<<<<<<<<
13144  *         key_c = key_b
13145  *         value = GDALGetMetadataItem(obj, key_c, 'TIFF')
13146  */
13147   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_BLOCK_SIZE__0___1, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 771, __pyx_L1_error)
13148   __Pyx_GOTREF(__pyx_t_5);
13149   __pyx_t_6 = NULL;
13150   __pyx_t_1 = 0;
13151   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
13152     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
13153     if (likely(__pyx_t_6)) {
13154       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
13155       __Pyx_INCREF(__pyx_t_6);
13156       __Pyx_INCREF(function);
13157       __Pyx_DECREF_SET(__pyx_t_5, function);
13158       __pyx_t_1 = 1;
13159     }
13160   }
13161   #if CYTHON_FAST_PYCALL
13162   if (PyFunction_Check(__pyx_t_5)) {
13163     PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_j, __pyx_v_i};
13164     __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 771, __pyx_L1_error)
13165     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
13166     __Pyx_GOTREF(__pyx_t_4);
13167   } else
13168   #endif
13169   #if CYTHON_FAST_PYCCALL
13170   if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
13171     PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_j, __pyx_v_i};
13172     __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 771, __pyx_L1_error)
13173     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
13174     __Pyx_GOTREF(__pyx_t_4);
13175   } else
13176   #endif
13177   {
13178     __pyx_t_7 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 771, __pyx_L1_error)
13179     __Pyx_GOTREF(__pyx_t_7);
13180     if (__pyx_t_6) {
13181       __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
13182     }
13183     __Pyx_INCREF(__pyx_v_j);
13184     __Pyx_GIVEREF(__pyx_v_j);
13185     PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_1, __pyx_v_j);
13186     __Pyx_INCREF(__pyx_v_i);
13187     __Pyx_GIVEREF(__pyx_v_i);
13188     PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_1, __pyx_v_i);
13189     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 771, __pyx_L1_error)
13190     __Pyx_GOTREF(__pyx_t_4);
13191     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13192   }
13193   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13194   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 771, __pyx_L1_error)
13195   __Pyx_GOTREF(__pyx_t_5);
13196   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13197   __pyx_t_4 = NULL;
13198   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
13199     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
13200     if (likely(__pyx_t_4)) {
13201       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
13202       __Pyx_INCREF(__pyx_t_4);
13203       __Pyx_INCREF(function);
13204       __Pyx_DECREF_SET(__pyx_t_5, function);
13205     }
13206   }
13207   __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_utf_8);
13208   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13209   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 771, __pyx_L1_error)
13210   __Pyx_GOTREF(__pyx_t_3);
13211   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13212   __pyx_v_key_b = __pyx_t_3;
13213   __pyx_t_3 = 0;
13214 
13215   /* "rasterio/_base.pyx":772
13216  *
13217  *         key_b = 'BLOCK_SIZE_{0}_{1}'.format(j, i).encode('utf-8')
13218  *         key_c = key_b             # <<<<<<<<<<<<<<
13219  *         value = GDALGetMetadataItem(obj, key_c, 'TIFF')
13220  *         if value == NULL:
13221  */
13222   __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_key_b); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L1_error)
13223   __pyx_v_key_c = __pyx_t_8;
13224 
13225   /* "rasterio/_base.pyx":773
13226  *         key_b = 'BLOCK_SIZE_{0}_{1}'.format(j, i).encode('utf-8')
13227  *         key_c = key_b
13228  *         value = GDALGetMetadataItem(obj, key_c, 'TIFF')             # <<<<<<<<<<<<<<
13229  *         if value == NULL:
13230  *             raise RasterBlockError(
13231  */
13232   __pyx_v_value = GDALGetMetadataItem(__pyx_v_obj, __pyx_v_key_c, ((char const *)"TIFF"));
13233 
13234   /* "rasterio/_base.pyx":774
13235  *         key_c = key_b
13236  *         value = GDALGetMetadataItem(obj, key_c, 'TIFF')
13237  *         if value == NULL:             # <<<<<<<<<<<<<<
13238  *             raise RasterBlockError(
13239  *                 "Block i={0}, j={1} size can't be determined".format(i, j))
13240  */
13241   __pyx_t_9 = ((__pyx_v_value == NULL) != 0);
13242   if (unlikely(__pyx_t_9)) {
13243 
13244     /* "rasterio/_base.pyx":775
13245  *         value = GDALGetMetadataItem(obj, key_c, 'TIFF')
13246  *         if value == NULL:
13247  *             raise RasterBlockError(             # <<<<<<<<<<<<<<
13248  *                 "Block i={0}, j={1} size can't be determined".format(i, j))
13249  *         else:
13250  */
13251     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_RasterBlockError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 775, __pyx_L1_error)
13252     __Pyx_GOTREF(__pyx_t_5);
13253 
13254     /* "rasterio/_base.pyx":776
13255  *         if value == NULL:
13256  *             raise RasterBlockError(
13257  *                 "Block i={0}, j={1} size can't be determined".format(i, j))             # <<<<<<<<<<<<<<
13258  *         else:
13259  *             return int(value)
13260  */
13261     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Block_i_0_j_1_size_can_t_be_dete, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 776, __pyx_L1_error)
13262     __Pyx_GOTREF(__pyx_t_7);
13263     __pyx_t_6 = NULL;
13264     __pyx_t_1 = 0;
13265     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
13266       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
13267       if (likely(__pyx_t_6)) {
13268         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
13269         __Pyx_INCREF(__pyx_t_6);
13270         __Pyx_INCREF(function);
13271         __Pyx_DECREF_SET(__pyx_t_7, function);
13272         __pyx_t_1 = 1;
13273       }
13274     }
13275     #if CYTHON_FAST_PYCALL
13276     if (PyFunction_Check(__pyx_t_7)) {
13277       PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_i, __pyx_v_j};
13278       __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 776, __pyx_L1_error)
13279       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
13280       __Pyx_GOTREF(__pyx_t_4);
13281     } else
13282     #endif
13283     #if CYTHON_FAST_PYCCALL
13284     if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
13285       PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_i, __pyx_v_j};
13286       __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 776, __pyx_L1_error)
13287       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
13288       __Pyx_GOTREF(__pyx_t_4);
13289     } else
13290     #endif
13291     {
13292       __pyx_t_10 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 776, __pyx_L1_error)
13293       __Pyx_GOTREF(__pyx_t_10);
13294       if (__pyx_t_6) {
13295         __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
13296       }
13297       __Pyx_INCREF(__pyx_v_i);
13298       __Pyx_GIVEREF(__pyx_v_i);
13299       PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_1, __pyx_v_i);
13300       __Pyx_INCREF(__pyx_v_j);
13301       __Pyx_GIVEREF(__pyx_v_j);
13302       PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_1, __pyx_v_j);
13303       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 776, __pyx_L1_error)
13304       __Pyx_GOTREF(__pyx_t_4);
13305       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13306     }
13307     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13308     __pyx_t_7 = NULL;
13309     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
13310       __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
13311       if (likely(__pyx_t_7)) {
13312         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
13313         __Pyx_INCREF(__pyx_t_7);
13314         __Pyx_INCREF(function);
13315         __Pyx_DECREF_SET(__pyx_t_5, function);
13316       }
13317     }
13318     __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
13319     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
13320     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13321     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L1_error)
13322     __Pyx_GOTREF(__pyx_t_3);
13323     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13324     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
13325     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13326     __PYX_ERR(0, 775, __pyx_L1_error)
13327 
13328     /* "rasterio/_base.pyx":774
13329  *         key_c = key_b
13330  *         value = GDALGetMetadataItem(obj, key_c, 'TIFF')
13331  *         if value == NULL:             # <<<<<<<<<<<<<<
13332  *             raise RasterBlockError(
13333  *                 "Block i={0}, j={1} size can't be determined".format(i, j))
13334  */
13335   }
13336 
13337   /* "rasterio/_base.pyx":778
13338  *                 "Block i={0}, j={1} size can't be determined".format(i, j))
13339  *         else:
13340  *             return int(value)             # <<<<<<<<<<<<<<
13341  *
13342  *     def block_windows(self, bidx=0):
13343  */
13344   /*else*/ {
13345     __Pyx_XDECREF(__pyx_r);
13346     __pyx_t_3 = __Pyx_PyUnicode_FromString(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 778, __pyx_L1_error)
13347     __Pyx_GOTREF(__pyx_t_3);
13348     __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 778, __pyx_L1_error)
13349     __Pyx_GOTREF(__pyx_t_5);
13350     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13351     __pyx_r = __pyx_t_5;
13352     __pyx_t_5 = 0;
13353     goto __pyx_L0;
13354   }
13355 
13356   /* "rasterio/_base.pyx":747
13357  *         return windows.Window(col, row, width, height)
13358  *
13359  *     def block_size(self, bidx, i, j):             # <<<<<<<<<<<<<<
13360  *         """Returns the size in bytes of a particular block
13361  *
13362  */
13363 
13364   /* function exit code */
13365   __pyx_L1_error:;
13366   __Pyx_XDECREF(__pyx_t_3);
13367   __Pyx_XDECREF(__pyx_t_4);
13368   __Pyx_XDECREF(__pyx_t_5);
13369   __Pyx_XDECREF(__pyx_t_6);
13370   __Pyx_XDECREF(__pyx_t_7);
13371   __Pyx_XDECREF(__pyx_t_10);
13372   __Pyx_AddTraceback("rasterio._base.DatasetBase.block_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
13373   __pyx_r = NULL;
13374   __pyx_L0:;
13375   __Pyx_XDECREF(__pyx_v_key_b);
13376   __Pyx_XGIVEREF(__pyx_r);
13377   __Pyx_RefNannyFinishContext();
13378   return __pyx_r;
13379 }
13380 static PyObject *__pyx_gb_8rasterio_5_base_11DatasetBase_52generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
13381 
13382 /* "rasterio/_base.pyx":780
13383  *             return int(value)
13384  *
13385  *     def block_windows(self, bidx=0):             # <<<<<<<<<<<<<<
13386  *         """Iterator over a band's blocks and their windows
13387  *
13388  */
13389 
13390 /* Python wrapper */
13391 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_51block_windows(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13392 static char __pyx_doc_8rasterio_5_base_11DatasetBase_50block_windows[] = "Iterator over a band's blocks and their windows\n\n\n        The primary use of this method is to obtain windows to pass to\n        `read()` for highly efficient access to raster block data.\n\n        The positional parameter `bidx` takes the index (starting at 1) of the\n        desired band.  This iterator yields blocks \"left to right\" and \"top to\n        bottom\" and is similar to Python's ``enumerate()`` in that the first\n        element is the block index and the second is the dataset window.\n\n        Blocks are built-in to a dataset and describe how pixels are grouped\n        within each band and provide a mechanism for efficient I/O.  A window\n        is a range of pixels within a single band defined by row start, row\n        stop, column start, and column stop.  For example, ``((0, 2), (0, 2))``\n        defines a ``2 x 2`` window at the upper left corner of a raster band.\n        Blocks are referenced by an ``(i, j)`` tuple where ``(0, 0)`` would be\n        a band's upper left block.\n\n        Raster I/O is performed at the block level, so accessing a window\n        spanning multiple rows in a striped raster requires reading each row.\n        Accessing a ``2 x 2`` window at the center of a ``1800 x 3600`` image\n        requires reading 2 rows, or 7200 pixels just to get the target 4.  The\n        same image with internal ``256 x 256`` blocks would require reading at\n        least 1 block (if the window entire window falls within a single block)\n        and at most 4 blocks, or at least 512 pixels and at most 2048.\n\n        Given an image that is ``512 x 512`` with blocks that are\n        ``256 x 256``, its blocks and windows would look like::\n\n            Blocks:\n\n                    0       256     512\n                  0 +--------+--------+\n                    |        |        |\n                    | (0, 0) | (0, 1) |\n                    |        |        |\n                256 +--------+--------+\n                    |   ""     |        |\n                    | (1, 0) | (1, 1) |\n                    |        |        |\n                512 +--------+--------+\n\n\n            Windows:\n\n                UL: ((0, 256), (0, 256))\n                UR: ((0, 256), (256, 512))\n                LL: ((256, 512), (0, 256))\n                LR: ((256, 512), (256, 512))\n\n\n        Parameters\n        ----------\n        bidx : int, optional\n            The band index (using 1-based indexing) from which to extract\n            windows. A value less than 1 uses the first band if all bands have\n            homogeneous windows and raises an exception otherwise.\n\n        Yields\n        ------\n        block, window\n        ";
__pyx_pw_8rasterio_5_base_11DatasetBase_51block_windows(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)13393 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_51block_windows(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13394   PyObject *__pyx_v_bidx = 0;
13395   int __pyx_lineno = 0;
13396   const char *__pyx_filename = NULL;
13397   int __pyx_clineno = 0;
13398   PyObject *__pyx_r = 0;
13399   __Pyx_RefNannyDeclarations
13400   __Pyx_RefNannySetupContext("block_windows (wrapper)", 0);
13401   {
13402     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bidx,0};
13403     PyObject* values[1] = {0};
13404     values[0] = ((PyObject *)__pyx_int_0);
13405     if (unlikely(__pyx_kwds)) {
13406       Py_ssize_t kw_args;
13407       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13408       switch (pos_args) {
13409         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13410         CYTHON_FALLTHROUGH;
13411         case  0: break;
13412         default: goto __pyx_L5_argtuple_error;
13413       }
13414       kw_args = PyDict_Size(__pyx_kwds);
13415       switch (pos_args) {
13416         case  0:
13417         if (kw_args > 0) {
13418           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bidx);
13419           if (value) { values[0] = value; kw_args--; }
13420         }
13421       }
13422       if (unlikely(kw_args > 0)) {
13423         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "block_windows") < 0)) __PYX_ERR(0, 780, __pyx_L3_error)
13424       }
13425     } else {
13426       switch (PyTuple_GET_SIZE(__pyx_args)) {
13427         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13428         CYTHON_FALLTHROUGH;
13429         case  0: break;
13430         default: goto __pyx_L5_argtuple_error;
13431       }
13432     }
13433     __pyx_v_bidx = values[0];
13434   }
13435   goto __pyx_L4_argument_unpacking_done;
13436   __pyx_L5_argtuple_error:;
13437   __Pyx_RaiseArgtupleInvalid("block_windows", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 780, __pyx_L3_error)
13438   __pyx_L3_error:;
13439   __Pyx_AddTraceback("rasterio._base.DatasetBase.block_windows", __pyx_clineno, __pyx_lineno, __pyx_filename);
13440   __Pyx_RefNannyFinishContext();
13441   return NULL;
13442   __pyx_L4_argument_unpacking_done:;
13443   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_50block_windows(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), __pyx_v_bidx);
13444 
13445   /* function exit code */
13446   __Pyx_RefNannyFinishContext();
13447   return __pyx_r;
13448 }
13449 
__pyx_pf_8rasterio_5_base_11DatasetBase_50block_windows(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_bidx)13450 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_50block_windows(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx) {
13451   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows *__pyx_cur_scope;
13452   PyObject *__pyx_r = NULL;
13453   __Pyx_RefNannyDeclarations
13454   int __pyx_lineno = 0;
13455   const char *__pyx_filename = NULL;
13456   int __pyx_clineno = 0;
13457   __Pyx_RefNannySetupContext("block_windows", 0);
13458   __pyx_cur_scope = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows *)__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_8_block_windows(__pyx_ptype_8rasterio_5_base___pyx_scope_struct_8_block_windows, __pyx_empty_tuple, NULL);
13459   if (unlikely(!__pyx_cur_scope)) {
13460     __pyx_cur_scope = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows *)Py_None);
13461     __Pyx_INCREF(Py_None);
13462     __PYX_ERR(0, 780, __pyx_L1_error)
13463   } else {
13464     __Pyx_GOTREF(__pyx_cur_scope);
13465   }
13466   __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
13467   __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
13468   __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
13469   __pyx_cur_scope->__pyx_v_bidx = __pyx_v_bidx;
13470   __Pyx_INCREF(__pyx_cur_scope->__pyx_v_bidx);
13471   __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_bidx);
13472   {
13473     __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_8rasterio_5_base_11DatasetBase_52generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_block_windows, __pyx_n_s_DatasetBase_block_windows, __pyx_n_s_rasterio__base); if (unlikely(!gen)) __PYX_ERR(0, 780, __pyx_L1_error)
13474     __Pyx_DECREF(__pyx_cur_scope);
13475     __Pyx_RefNannyFinishContext();
13476     return (PyObject *) gen;
13477   }
13478 
13479   /* function exit code */
13480   __pyx_L1_error:;
13481   __Pyx_AddTraceback("rasterio._base.DatasetBase.block_windows", __pyx_clineno, __pyx_lineno, __pyx_filename);
13482   __pyx_r = NULL;
13483   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
13484   __Pyx_XGIVEREF(__pyx_r);
13485   __Pyx_RefNannyFinishContext();
13486   return __pyx_r;
13487 }
13488 
__pyx_gb_8rasterio_5_base_11DatasetBase_52generator(__pyx_CoroutineObject * __pyx_generator,CYTHON_UNUSED PyThreadState * __pyx_tstate,PyObject * __pyx_sent_value)13489 static PyObject *__pyx_gb_8rasterio_5_base_11DatasetBase_52generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
13490 {
13491   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows *__pyx_cur_scope = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows *)__pyx_generator->closure);
13492   PyObject *__pyx_r = NULL;
13493   PyObject *__pyx_t_1 = NULL;
13494   int __pyx_t_2;
13495   Py_ssize_t __pyx_t_3;
13496   PyObject *__pyx_t_4 = NULL;
13497   PyObject *__pyx_t_5 = NULL;
13498   PyObject *__pyx_t_6 = NULL;
13499   PyObject *(*__pyx_t_7)(PyObject *);
13500   long __pyx_t_8;
13501   long __pyx_t_9;
13502   int __pyx_t_10;
13503   long __pyx_t_11;
13504   long __pyx_t_12;
13505   int __pyx_t_13;
13506   int __pyx_lineno = 0;
13507   const char *__pyx_filename = NULL;
13508   int __pyx_clineno = 0;
13509   __Pyx_RefNannyDeclarations
13510   __Pyx_RefNannySetupContext("block_windows", 0);
13511   switch (__pyx_generator->resume_label) {
13512     case 0: goto __pyx_L3_first_run;
13513     case 1: goto __pyx_L16_resume_from_yield;
13514     default: /* CPython raises the right error here */
13515     __Pyx_RefNannyFinishContext();
13516     return NULL;
13517   }
13518   __pyx_L3_first_run:;
13519   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 780, __pyx_L1_error)
13520 
13521   /* "rasterio/_base.pyx":846
13522  *         cdef int i, j
13523  *
13524  *         block_shapes = self.block_shapes             # <<<<<<<<<<<<<<
13525  *         if bidx < 1:
13526  *             if len(set(block_shapes)) > 1:
13527  */
13528   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_block_shapes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 846, __pyx_L1_error)
13529   __Pyx_GOTREF(__pyx_t_1);
13530   __Pyx_GIVEREF(__pyx_t_1);
13531   __pyx_cur_scope->__pyx_v_block_shapes = __pyx_t_1;
13532   __pyx_t_1 = 0;
13533 
13534   /* "rasterio/_base.pyx":847
13535  *
13536  *         block_shapes = self.block_shapes
13537  *         if bidx < 1:             # <<<<<<<<<<<<<<
13538  *             if len(set(block_shapes)) > 1:
13539  *                 raise ValueError(
13540  */
13541   __pyx_t_1 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_bidx, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 847, __pyx_L1_error)
13542   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 847, __pyx_L1_error)
13543   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13544   if (__pyx_t_2) {
13545 
13546     /* "rasterio/_base.pyx":848
13547  *         block_shapes = self.block_shapes
13548  *         if bidx < 1:
13549  *             if len(set(block_shapes)) > 1:             # <<<<<<<<<<<<<<
13550  *                 raise ValueError(
13551  *                     "A band index must be provided when band block shapes"
13552  */
13553     __pyx_t_1 = PySet_New(__pyx_cur_scope->__pyx_v_block_shapes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 848, __pyx_L1_error)
13554     __Pyx_GOTREF(__pyx_t_1);
13555     __pyx_t_3 = PySet_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 848, __pyx_L1_error)
13556     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13557     __pyx_t_2 = ((__pyx_t_3 > 1) != 0);
13558     if (unlikely(__pyx_t_2)) {
13559 
13560       /* "rasterio/_base.pyx":849
13561  *         if bidx < 1:
13562  *             if len(set(block_shapes)) > 1:
13563  *                 raise ValueError(             # <<<<<<<<<<<<<<
13564  *                     "A band index must be provided when band block shapes"
13565  *                     "are inhomogeneous")
13566  */
13567       __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 849, __pyx_L1_error)
13568       __Pyx_GOTREF(__pyx_t_1);
13569       __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13570       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13571       __PYX_ERR(0, 849, __pyx_L1_error)
13572 
13573       /* "rasterio/_base.pyx":848
13574  *         block_shapes = self.block_shapes
13575  *         if bidx < 1:
13576  *             if len(set(block_shapes)) > 1:             # <<<<<<<<<<<<<<
13577  *                 raise ValueError(
13578  *                     "A band index must be provided when band block shapes"
13579  */
13580     }
13581 
13582     /* "rasterio/_base.pyx":852
13583  *                     "A band index must be provided when band block shapes"
13584  *                     "are inhomogeneous")
13585  *             bidx = 1             # <<<<<<<<<<<<<<
13586  *         h, w = block_shapes[bidx-1]
13587  *         d, m = divmod(self.height, h)
13588  */
13589     __Pyx_INCREF(__pyx_int_1);
13590     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_bidx);
13591     __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_bidx, __pyx_int_1);
13592     __Pyx_GIVEREF(__pyx_int_1);
13593 
13594     /* "rasterio/_base.pyx":847
13595  *
13596  *         block_shapes = self.block_shapes
13597  *         if bidx < 1:             # <<<<<<<<<<<<<<
13598  *             if len(set(block_shapes)) > 1:
13599  *                 raise ValueError(
13600  */
13601   }
13602 
13603   /* "rasterio/_base.pyx":853
13604  *                     "are inhomogeneous")
13605  *             bidx = 1
13606  *         h, w = block_shapes[bidx-1]             # <<<<<<<<<<<<<<
13607  *         d, m = divmod(self.height, h)
13608  *         nrows = d + int(m>0)
13609  */
13610   __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_cur_scope->__pyx_v_bidx, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L1_error)
13611   __Pyx_GOTREF(__pyx_t_1);
13612   __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_block_shapes, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 853, __pyx_L1_error)
13613   __Pyx_GOTREF(__pyx_t_4);
13614   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13615   if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
13616     PyObject* sequence = __pyx_t_4;
13617     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
13618     if (unlikely(size != 2)) {
13619       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
13620       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
13621       __PYX_ERR(0, 853, __pyx_L1_error)
13622     }
13623     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13624     if (likely(PyTuple_CheckExact(sequence))) {
13625       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
13626       __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
13627     } else {
13628       __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
13629       __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
13630     }
13631     __Pyx_INCREF(__pyx_t_1);
13632     __Pyx_INCREF(__pyx_t_5);
13633     #else
13634     __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L1_error)
13635     __Pyx_GOTREF(__pyx_t_1);
13636     __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 853, __pyx_L1_error)
13637     __Pyx_GOTREF(__pyx_t_5);
13638     #endif
13639     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13640   } else {
13641     Py_ssize_t index = -1;
13642     __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 853, __pyx_L1_error)
13643     __Pyx_GOTREF(__pyx_t_6);
13644     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13645     __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
13646     index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L6_unpacking_failed;
13647     __Pyx_GOTREF(__pyx_t_1);
13648     index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
13649     __Pyx_GOTREF(__pyx_t_5);
13650     if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 853, __pyx_L1_error)
13651     __pyx_t_7 = NULL;
13652     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13653     goto __pyx_L7_unpacking_done;
13654     __pyx_L6_unpacking_failed:;
13655     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13656     __pyx_t_7 = NULL;
13657     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
13658     __PYX_ERR(0, 853, __pyx_L1_error)
13659     __pyx_L7_unpacking_done:;
13660   }
13661   __Pyx_GIVEREF(__pyx_t_1);
13662   __pyx_cur_scope->__pyx_v_h = __pyx_t_1;
13663   __pyx_t_1 = 0;
13664   __Pyx_GIVEREF(__pyx_t_5);
13665   __pyx_cur_scope->__pyx_v_w = __pyx_t_5;
13666   __pyx_t_5 = 0;
13667 
13668   /* "rasterio/_base.pyx":854
13669  *             bidx = 1
13670  *         h, w = block_shapes[bidx-1]
13671  *         d, m = divmod(self.height, h)             # <<<<<<<<<<<<<<
13672  *         nrows = d + int(m>0)
13673  *         d, m = divmod(self.width, w)
13674  */
13675   __pyx_t_4 = __pyx_cur_scope->__pyx_v_self->height;
13676   __Pyx_INCREF(__pyx_t_4);
13677   __pyx_t_5 = PyNumber_Divmod(__pyx_t_4, __pyx_cur_scope->__pyx_v_h); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 854, __pyx_L1_error)
13678   __Pyx_GOTREF(__pyx_t_5);
13679   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13680   if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
13681     PyObject* sequence = __pyx_t_5;
13682     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
13683     if (unlikely(size != 2)) {
13684       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
13685       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
13686       __PYX_ERR(0, 854, __pyx_L1_error)
13687     }
13688     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13689     if (likely(PyTuple_CheckExact(sequence))) {
13690       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
13691       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
13692     } else {
13693       __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
13694       __pyx_t_1 = PyList_GET_ITEM(sequence, 1);
13695     }
13696     __Pyx_INCREF(__pyx_t_4);
13697     __Pyx_INCREF(__pyx_t_1);
13698     #else
13699     __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 854, __pyx_L1_error)
13700     __Pyx_GOTREF(__pyx_t_4);
13701     __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L1_error)
13702     __Pyx_GOTREF(__pyx_t_1);
13703     #endif
13704     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13705   } else {
13706     Py_ssize_t index = -1;
13707     __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 854, __pyx_L1_error)
13708     __Pyx_GOTREF(__pyx_t_6);
13709     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13710     __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
13711     index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L8_unpacking_failed;
13712     __Pyx_GOTREF(__pyx_t_4);
13713     index = 1; __pyx_t_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
13714     __Pyx_GOTREF(__pyx_t_1);
13715     if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 854, __pyx_L1_error)
13716     __pyx_t_7 = NULL;
13717     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13718     goto __pyx_L9_unpacking_done;
13719     __pyx_L8_unpacking_failed:;
13720     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13721     __pyx_t_7 = NULL;
13722     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
13723     __PYX_ERR(0, 854, __pyx_L1_error)
13724     __pyx_L9_unpacking_done:;
13725   }
13726   __Pyx_GIVEREF(__pyx_t_4);
13727   __pyx_cur_scope->__pyx_v_d = __pyx_t_4;
13728   __pyx_t_4 = 0;
13729   __Pyx_GIVEREF(__pyx_t_1);
13730   __pyx_cur_scope->__pyx_v_m = __pyx_t_1;
13731   __pyx_t_1 = 0;
13732 
13733   /* "rasterio/_base.pyx":855
13734  *         h, w = block_shapes[bidx-1]
13735  *         d, m = divmod(self.height, h)
13736  *         nrows = d + int(m>0)             # <<<<<<<<<<<<<<
13737  *         d, m = divmod(self.width, w)
13738  *         ncols = d + int(m>0)
13739  */
13740   __pyx_t_5 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_m, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 855, __pyx_L1_error)
13741   __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 855, __pyx_L1_error)
13742   __Pyx_GOTREF(__pyx_t_1);
13743   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13744   __pyx_t_5 = PyNumber_Add(__pyx_cur_scope->__pyx_v_d, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 855, __pyx_L1_error)
13745   __Pyx_GOTREF(__pyx_t_5);
13746   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13747   __Pyx_GIVEREF(__pyx_t_5);
13748   __pyx_cur_scope->__pyx_v_nrows = __pyx_t_5;
13749   __pyx_t_5 = 0;
13750 
13751   /* "rasterio/_base.pyx":856
13752  *         d, m = divmod(self.height, h)
13753  *         nrows = d + int(m>0)
13754  *         d, m = divmod(self.width, w)             # <<<<<<<<<<<<<<
13755  *         ncols = d + int(m>0)
13756  *
13757  */
13758   __pyx_t_5 = __pyx_cur_scope->__pyx_v_self->width;
13759   __Pyx_INCREF(__pyx_t_5);
13760   __pyx_t_1 = PyNumber_Divmod(__pyx_t_5, __pyx_cur_scope->__pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 856, __pyx_L1_error)
13761   __Pyx_GOTREF(__pyx_t_1);
13762   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13763   if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
13764     PyObject* sequence = __pyx_t_1;
13765     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
13766     if (unlikely(size != 2)) {
13767       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
13768       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
13769       __PYX_ERR(0, 856, __pyx_L1_error)
13770     }
13771     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13772     if (likely(PyTuple_CheckExact(sequence))) {
13773       __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
13774       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
13775     } else {
13776       __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
13777       __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
13778     }
13779     __Pyx_INCREF(__pyx_t_5);
13780     __Pyx_INCREF(__pyx_t_4);
13781     #else
13782     __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 856, __pyx_L1_error)
13783     __Pyx_GOTREF(__pyx_t_5);
13784     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 856, __pyx_L1_error)
13785     __Pyx_GOTREF(__pyx_t_4);
13786     #endif
13787     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13788   } else {
13789     Py_ssize_t index = -1;
13790     __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 856, __pyx_L1_error)
13791     __Pyx_GOTREF(__pyx_t_6);
13792     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13793     __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
13794     index = 0; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L10_unpacking_failed;
13795     __Pyx_GOTREF(__pyx_t_5);
13796     index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L10_unpacking_failed;
13797     __Pyx_GOTREF(__pyx_t_4);
13798     if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 856, __pyx_L1_error)
13799     __pyx_t_7 = NULL;
13800     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13801     goto __pyx_L11_unpacking_done;
13802     __pyx_L10_unpacking_failed:;
13803     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13804     __pyx_t_7 = NULL;
13805     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
13806     __PYX_ERR(0, 856, __pyx_L1_error)
13807     __pyx_L11_unpacking_done:;
13808   }
13809   __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_d);
13810   __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_d, __pyx_t_5);
13811   __Pyx_GIVEREF(__pyx_t_5);
13812   __pyx_t_5 = 0;
13813   __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_m);
13814   __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_m, __pyx_t_4);
13815   __Pyx_GIVEREF(__pyx_t_4);
13816   __pyx_t_4 = 0;
13817 
13818   /* "rasterio/_base.pyx":857
13819  *         nrows = d + int(m>0)
13820  *         d, m = divmod(self.width, w)
13821  *         ncols = d + int(m>0)             # <<<<<<<<<<<<<<
13822  *
13823  *         # We could call self.block_window() inside the loops but this
13824  */
13825   __pyx_t_1 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_m, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 857, __pyx_L1_error)
13826   __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 857, __pyx_L1_error)
13827   __Pyx_GOTREF(__pyx_t_4);
13828   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13829   __pyx_t_1 = PyNumber_Add(__pyx_cur_scope->__pyx_v_d, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 857, __pyx_L1_error)
13830   __Pyx_GOTREF(__pyx_t_1);
13831   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13832   __Pyx_GIVEREF(__pyx_t_1);
13833   __pyx_cur_scope->__pyx_v_ncols = __pyx_t_1;
13834   __pyx_t_1 = 0;
13835 
13836   /* "rasterio/_base.pyx":861
13837  *         # We could call self.block_window() inside the loops but this
13838  *         # is faster and doesn't duplicate much code.
13839  *         for j in range(nrows):             # <<<<<<<<<<<<<<
13840  *             row = j * h
13841  *             height = min(h, self.height - row)
13842  */
13843   __pyx_t_8 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_nrows); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 861, __pyx_L1_error)
13844   __pyx_t_9 = __pyx_t_8;
13845   for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
13846     __pyx_cur_scope->__pyx_v_j = __pyx_t_10;
13847 
13848     /* "rasterio/_base.pyx":862
13849  *         # is faster and doesn't duplicate much code.
13850  *         for j in range(nrows):
13851  *             row = j * h             # <<<<<<<<<<<<<<
13852  *             height = min(h, self.height - row)
13853  *             for i in range(ncols):
13854  */
13855     __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 862, __pyx_L1_error)
13856     __Pyx_GOTREF(__pyx_t_1);
13857     __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_cur_scope->__pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 862, __pyx_L1_error)
13858     __Pyx_GOTREF(__pyx_t_4);
13859     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13860     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_row);
13861     __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_row, __pyx_t_4);
13862     __Pyx_GIVEREF(__pyx_t_4);
13863     __pyx_t_4 = 0;
13864 
13865     /* "rasterio/_base.pyx":863
13866  *         for j in range(nrows):
13867  *             row = j * h
13868  *             height = min(h, self.height - row)             # <<<<<<<<<<<<<<
13869  *             for i in range(ncols):
13870  *                 col = i * w
13871  */
13872     __pyx_t_4 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_self->height, __pyx_cur_scope->__pyx_v_row); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 863, __pyx_L1_error)
13873     __Pyx_GOTREF(__pyx_t_4);
13874     __Pyx_INCREF(__pyx_cur_scope->__pyx_v_h);
13875     __pyx_t_1 = __pyx_cur_scope->__pyx_v_h;
13876     __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 863, __pyx_L1_error)
13877     __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 863, __pyx_L1_error)
13878     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13879     if (__pyx_t_2) {
13880       __Pyx_INCREF(__pyx_t_4);
13881       __pyx_t_5 = __pyx_t_4;
13882     } else {
13883       __Pyx_INCREF(__pyx_t_1);
13884       __pyx_t_5 = __pyx_t_1;
13885     }
13886     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13887     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13888     __pyx_t_4 = __pyx_t_5;
13889     __Pyx_INCREF(__pyx_t_4);
13890     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13891     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_height);
13892     __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_height, __pyx_t_4);
13893     __Pyx_GIVEREF(__pyx_t_4);
13894     __pyx_t_4 = 0;
13895 
13896     /* "rasterio/_base.pyx":864
13897  *             row = j * h
13898  *             height = min(h, self.height - row)
13899  *             for i in range(ncols):             # <<<<<<<<<<<<<<
13900  *                 col = i * w
13901  *                 width = min(w, self.width - col)
13902  */
13903     __pyx_t_11 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_ncols); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L1_error)
13904     __pyx_t_12 = __pyx_t_11;
13905     for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
13906       __pyx_cur_scope->__pyx_v_i = __pyx_t_13;
13907 
13908       /* "rasterio/_base.pyx":865
13909  *             height = min(h, self.height - row)
13910  *             for i in range(ncols):
13911  *                 col = i * w             # <<<<<<<<<<<<<<
13912  *                 width = min(w, self.width - col)
13913  *                 yield (j, i), windows.Window(
13914  */
13915       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 865, __pyx_L1_error)
13916       __Pyx_GOTREF(__pyx_t_4);
13917       __pyx_t_5 = PyNumber_Multiply(__pyx_t_4, __pyx_cur_scope->__pyx_v_w); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 865, __pyx_L1_error)
13918       __Pyx_GOTREF(__pyx_t_5);
13919       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13920       __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_col);
13921       __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_col, __pyx_t_5);
13922       __Pyx_GIVEREF(__pyx_t_5);
13923       __pyx_t_5 = 0;
13924 
13925       /* "rasterio/_base.pyx":866
13926  *             for i in range(ncols):
13927  *                 col = i * w
13928  *                 width = min(w, self.width - col)             # <<<<<<<<<<<<<<
13929  *                 yield (j, i), windows.Window(
13930  *                     col_off=col, row_off=row, width=width, height=height)
13931  */
13932       __pyx_t_5 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_self->width, __pyx_cur_scope->__pyx_v_col); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 866, __pyx_L1_error)
13933       __Pyx_GOTREF(__pyx_t_5);
13934       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_w);
13935       __pyx_t_4 = __pyx_cur_scope->__pyx_v_w;
13936       __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 866, __pyx_L1_error)
13937       __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 866, __pyx_L1_error)
13938       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13939       if (__pyx_t_2) {
13940         __Pyx_INCREF(__pyx_t_5);
13941         __pyx_t_1 = __pyx_t_5;
13942       } else {
13943         __Pyx_INCREF(__pyx_t_4);
13944         __pyx_t_1 = __pyx_t_4;
13945       }
13946       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13947       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13948       __pyx_t_5 = __pyx_t_1;
13949       __Pyx_INCREF(__pyx_t_5);
13950       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13951       __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_width);
13952       __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_width, __pyx_t_5);
13953       __Pyx_GIVEREF(__pyx_t_5);
13954       __pyx_t_5 = 0;
13955 
13956       /* "rasterio/_base.pyx":867
13957  *                 col = i * w
13958  *                 width = min(w, self.width - col)
13959  *                 yield (j, i), windows.Window(             # <<<<<<<<<<<<<<
13960  *                     col_off=col, row_off=row, width=width, height=height)
13961  *
13962  */
13963       __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_j); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 867, __pyx_L1_error)
13964       __Pyx_GOTREF(__pyx_t_5);
13965       __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 867, __pyx_L1_error)
13966       __Pyx_GOTREF(__pyx_t_1);
13967       __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 867, __pyx_L1_error)
13968       __Pyx_GOTREF(__pyx_t_4);
13969       __Pyx_GIVEREF(__pyx_t_5);
13970       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
13971       __Pyx_GIVEREF(__pyx_t_1);
13972       PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
13973       __pyx_t_5 = 0;
13974       __pyx_t_1 = 0;
13975       __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_windows); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 867, __pyx_L1_error)
13976       __Pyx_GOTREF(__pyx_t_1);
13977       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Window); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 867, __pyx_L1_error)
13978       __Pyx_GOTREF(__pyx_t_5);
13979       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13980 
13981       /* "rasterio/_base.pyx":868
13982  *                 width = min(w, self.width - col)
13983  *                 yield (j, i), windows.Window(
13984  *                     col_off=col, row_off=row, width=width, height=height)             # <<<<<<<<<<<<<<
13985  *
13986  *     property bounds:
13987  */
13988       __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 868, __pyx_L1_error)
13989       __Pyx_GOTREF(__pyx_t_1);
13990       if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_col_off, __pyx_cur_scope->__pyx_v_col) < 0) __PYX_ERR(0, 868, __pyx_L1_error)
13991       if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_row_off, __pyx_cur_scope->__pyx_v_row) < 0) __PYX_ERR(0, 868, __pyx_L1_error)
13992       if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_width, __pyx_cur_scope->__pyx_v_width) < 0) __PYX_ERR(0, 868, __pyx_L1_error)
13993       if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_height, __pyx_cur_scope->__pyx_v_height) < 0) __PYX_ERR(0, 868, __pyx_L1_error)
13994 
13995       /* "rasterio/_base.pyx":867
13996  *                 col = i * w
13997  *                 width = min(w, self.width - col)
13998  *                 yield (j, i), windows.Window(             # <<<<<<<<<<<<<<
13999  *                     col_off=col, row_off=row, width=width, height=height)
14000  *
14001  */
14002       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 867, __pyx_L1_error)
14003       __Pyx_GOTREF(__pyx_t_6);
14004       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14005       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14006       __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 867, __pyx_L1_error)
14007       __Pyx_GOTREF(__pyx_t_1);
14008       __Pyx_GIVEREF(__pyx_t_4);
14009       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
14010       __Pyx_GIVEREF(__pyx_t_6);
14011       PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
14012       __pyx_t_4 = 0;
14013       __pyx_t_6 = 0;
14014       __pyx_r = __pyx_t_1;
14015       __pyx_t_1 = 0;
14016       __pyx_cur_scope->__pyx_t_0 = __pyx_t_8;
14017       __pyx_cur_scope->__pyx_t_1 = __pyx_t_9;
14018       __pyx_cur_scope->__pyx_t_2 = __pyx_t_10;
14019       __pyx_cur_scope->__pyx_t_3 = __pyx_t_11;
14020       __pyx_cur_scope->__pyx_t_4 = __pyx_t_12;
14021       __pyx_cur_scope->__pyx_t_5 = __pyx_t_13;
14022       __Pyx_XGIVEREF(__pyx_r);
14023       __Pyx_RefNannyFinishContext();
14024       __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
14025       /* return from generator, yielding value */
14026       __pyx_generator->resume_label = 1;
14027       return __pyx_r;
14028       __pyx_L16_resume_from_yield:;
14029       __pyx_t_8 = __pyx_cur_scope->__pyx_t_0;
14030       __pyx_t_9 = __pyx_cur_scope->__pyx_t_1;
14031       __pyx_t_10 = __pyx_cur_scope->__pyx_t_2;
14032       __pyx_t_11 = __pyx_cur_scope->__pyx_t_3;
14033       __pyx_t_12 = __pyx_cur_scope->__pyx_t_4;
14034       __pyx_t_13 = __pyx_cur_scope->__pyx_t_5;
14035       if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 867, __pyx_L1_error)
14036     }
14037   }
14038   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
14039 
14040   /* "rasterio/_base.pyx":780
14041  *             return int(value)
14042  *
14043  *     def block_windows(self, bidx=0):             # <<<<<<<<<<<<<<
14044  *         """Iterator over a band's blocks and their windows
14045  *
14046  */
14047 
14048   /* function exit code */
14049   PyErr_SetNone(PyExc_StopIteration);
14050   goto __pyx_L0;
14051   __pyx_L1_error:;
14052   __Pyx_XDECREF(__pyx_t_1);
14053   __Pyx_XDECREF(__pyx_t_4);
14054   __Pyx_XDECREF(__pyx_t_5);
14055   __Pyx_XDECREF(__pyx_t_6);
14056   __Pyx_AddTraceback("block_windows", __pyx_clineno, __pyx_lineno, __pyx_filename);
14057   __pyx_L0:;
14058   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
14059   #if !CYTHON_USE_EXC_INFO_STACK
14060   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
14061   #endif
14062   __pyx_generator->resume_label = -1;
14063   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
14064   __Pyx_RefNannyFinishContext();
14065   return __pyx_r;
14066 }
14067 
14068 /* "rasterio/_base.pyx":877
14069  *         (lower left x, lower left y, upper right x, upper right y)
14070  *         """
14071  *         def __get__(self):             # <<<<<<<<<<<<<<
14072  *             a, b, c, d, e, f, _, _, _ = self.transform
14073  *             width = self.width
14074  */
14075 
14076 /* Python wrapper */
14077 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6bounds_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6bounds_1__get__(PyObject * __pyx_v_self)14078 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6bounds_1__get__(PyObject *__pyx_v_self) {
14079   PyObject *__pyx_r = 0;
14080   __Pyx_RefNannyDeclarations
14081   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14082   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6bounds___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
14083 
14084   /* function exit code */
14085   __Pyx_RefNannyFinishContext();
14086   return __pyx_r;
14087 }
14088 
__pyx_pf_8rasterio_5_base_11DatasetBase_6bounds___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)14089 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6bounds___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
14090   PyObject *__pyx_v_a = NULL;
14091   PyObject *__pyx_v_b = NULL;
14092   PyObject *__pyx_v_c = NULL;
14093   PyObject *__pyx_v_d = NULL;
14094   PyObject *__pyx_v_e = NULL;
14095   PyObject *__pyx_v_f = NULL;
14096   CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
14097   PyObject *__pyx_v_width = NULL;
14098   PyObject *__pyx_v_height = NULL;
14099   PyObject *__pyx_v_c0x = NULL;
14100   PyObject *__pyx_v_c0y = NULL;
14101   PyObject *__pyx_v_c1x = NULL;
14102   PyObject *__pyx_v_c1y = NULL;
14103   PyObject *__pyx_v_c2x = NULL;
14104   PyObject *__pyx_v_c2y = NULL;
14105   PyObject *__pyx_v_c3x = NULL;
14106   PyObject *__pyx_v_c3y = NULL;
14107   PyObject *__pyx_v_xs = NULL;
14108   PyObject *__pyx_v_ys = NULL;
14109   PyObject *__pyx_r = NULL;
14110   __Pyx_RefNannyDeclarations
14111   PyObject *__pyx_t_1 = NULL;
14112   PyObject *__pyx_t_2 = NULL;
14113   PyObject *__pyx_t_3 = NULL;
14114   PyObject *__pyx_t_4 = NULL;
14115   PyObject *__pyx_t_5 = NULL;
14116   PyObject *__pyx_t_6 = NULL;
14117   PyObject *__pyx_t_7 = NULL;
14118   PyObject *__pyx_t_8 = NULL;
14119   PyObject *__pyx_t_9 = NULL;
14120   PyObject *__pyx_t_10 = NULL;
14121   PyObject *__pyx_t_11 = NULL;
14122   PyObject *(*__pyx_t_12)(PyObject *);
14123   int __pyx_t_13;
14124   int __pyx_t_14;
14125   int __pyx_lineno = 0;
14126   const char *__pyx_filename = NULL;
14127   int __pyx_clineno = 0;
14128   __Pyx_RefNannySetupContext("__get__", 0);
14129 
14130   /* "rasterio/_base.pyx":878
14131  *         """
14132  *         def __get__(self):
14133  *             a, b, c, d, e, f, _, _, _ = self.transform             # <<<<<<<<<<<<<<
14134  *             width = self.width
14135  *             height = self.height
14136  */
14137   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_transform); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 878, __pyx_L1_error)
14138   __Pyx_GOTREF(__pyx_t_1);
14139   if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
14140     PyObject* sequence = __pyx_t_1;
14141     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
14142     if (unlikely(size != 9)) {
14143       if (size > 9) __Pyx_RaiseTooManyValuesError(9);
14144       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
14145       __PYX_ERR(0, 878, __pyx_L1_error)
14146     }
14147     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14148     if (likely(PyTuple_CheckExact(sequence))) {
14149       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
14150       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
14151       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
14152       __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3);
14153       __pyx_t_6 = PyTuple_GET_ITEM(sequence, 4);
14154       __pyx_t_7 = PyTuple_GET_ITEM(sequence, 5);
14155       __pyx_t_8 = PyTuple_GET_ITEM(sequence, 6);
14156       __pyx_t_9 = PyTuple_GET_ITEM(sequence, 7);
14157       __pyx_t_10 = PyTuple_GET_ITEM(sequence, 8);
14158     } else {
14159       __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
14160       __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
14161       __pyx_t_4 = PyList_GET_ITEM(sequence, 2);
14162       __pyx_t_5 = PyList_GET_ITEM(sequence, 3);
14163       __pyx_t_6 = PyList_GET_ITEM(sequence, 4);
14164       __pyx_t_7 = PyList_GET_ITEM(sequence, 5);
14165       __pyx_t_8 = PyList_GET_ITEM(sequence, 6);
14166       __pyx_t_9 = PyList_GET_ITEM(sequence, 7);
14167       __pyx_t_10 = PyList_GET_ITEM(sequence, 8);
14168     }
14169     __Pyx_INCREF(__pyx_t_2);
14170     __Pyx_INCREF(__pyx_t_3);
14171     __Pyx_INCREF(__pyx_t_4);
14172     __Pyx_INCREF(__pyx_t_5);
14173     __Pyx_INCREF(__pyx_t_6);
14174     __Pyx_INCREF(__pyx_t_7);
14175     __Pyx_INCREF(__pyx_t_8);
14176     __Pyx_INCREF(__pyx_t_9);
14177     __Pyx_INCREF(__pyx_t_10);
14178     #else
14179     {
14180       Py_ssize_t i;
14181       PyObject** temps[9] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10};
14182       for (i=0; i < 9; i++) {
14183         PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 878, __pyx_L1_error)
14184         __Pyx_GOTREF(item);
14185         *(temps[i]) = item;
14186       }
14187     }
14188     #endif
14189     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14190   } else {
14191     Py_ssize_t index = -1;
14192     PyObject** temps[9] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10};
14193     __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 878, __pyx_L1_error)
14194     __Pyx_GOTREF(__pyx_t_11);
14195     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14196     __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
14197     for (index=0; index < 9; index++) {
14198       PyObject* item = __pyx_t_12(__pyx_t_11); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
14199       __Pyx_GOTREF(item);
14200       *(temps[index]) = item;
14201     }
14202     if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 9) < 0) __PYX_ERR(0, 878, __pyx_L1_error)
14203     __pyx_t_12 = NULL;
14204     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
14205     goto __pyx_L4_unpacking_done;
14206     __pyx_L3_unpacking_failed:;
14207     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
14208     __pyx_t_12 = NULL;
14209     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
14210     __PYX_ERR(0, 878, __pyx_L1_error)
14211     __pyx_L4_unpacking_done:;
14212   }
14213   __pyx_v_a = __pyx_t_2;
14214   __pyx_t_2 = 0;
14215   __pyx_v_b = __pyx_t_3;
14216   __pyx_t_3 = 0;
14217   __pyx_v_c = __pyx_t_4;
14218   __pyx_t_4 = 0;
14219   __pyx_v_d = __pyx_t_5;
14220   __pyx_t_5 = 0;
14221   __pyx_v_e = __pyx_t_6;
14222   __pyx_t_6 = 0;
14223   __pyx_v_f = __pyx_t_7;
14224   __pyx_t_7 = 0;
14225   __pyx_v__ = __pyx_t_8;
14226   __pyx_t_8 = 0;
14227   __Pyx_DECREF_SET(__pyx_v__, __pyx_t_9);
14228   __pyx_t_9 = 0;
14229   __Pyx_DECREF_SET(__pyx_v__, __pyx_t_10);
14230   __pyx_t_10 = 0;
14231 
14232   /* "rasterio/_base.pyx":879
14233  *         def __get__(self):
14234  *             a, b, c, d, e, f, _, _, _ = self.transform
14235  *             width = self.width             # <<<<<<<<<<<<<<
14236  *             height = self.height
14237  *             if b == d == 0:
14238  */
14239   __pyx_t_1 = __pyx_v_self->width;
14240   __Pyx_INCREF(__pyx_t_1);
14241   __pyx_v_width = __pyx_t_1;
14242   __pyx_t_1 = 0;
14243 
14244   /* "rasterio/_base.pyx":880
14245  *             a, b, c, d, e, f, _, _, _ = self.transform
14246  *             width = self.width
14247  *             height = self.height             # <<<<<<<<<<<<<<
14248  *             if b == d == 0:
14249  *                 return BoundingBox(c, f + e * height, c + a * width, f)
14250  */
14251   __pyx_t_1 = __pyx_v_self->height;
14252   __Pyx_INCREF(__pyx_t_1);
14253   __pyx_v_height = __pyx_t_1;
14254   __pyx_t_1 = 0;
14255 
14256   /* "rasterio/_base.pyx":881
14257  *             width = self.width
14258  *             height = self.height
14259  *             if b == d == 0:             # <<<<<<<<<<<<<<
14260  *                 return BoundingBox(c, f + e * height, c + a * width, f)
14261  *             else:
14262  */
14263   __pyx_t_1 = PyObject_RichCompare(__pyx_v_b, __pyx_v_d, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L1_error)
14264   if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
14265     __Pyx_DECREF(__pyx_t_1);
14266     __pyx_t_1 = PyObject_RichCompare(__pyx_v_d, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L1_error)
14267   }
14268   __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 881, __pyx_L1_error)
14269   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14270   if (__pyx_t_13) {
14271 
14272     /* "rasterio/_base.pyx":882
14273  *             height = self.height
14274  *             if b == d == 0:
14275  *                 return BoundingBox(c, f + e * height, c + a * width, f)             # <<<<<<<<<<<<<<
14276  *             else:
14277  *                 c0x, c0y = c, f
14278  */
14279     __Pyx_XDECREF(__pyx_r);
14280     __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_BoundingBox); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 882, __pyx_L1_error)
14281     __Pyx_GOTREF(__pyx_t_10);
14282     __pyx_t_9 = PyNumber_Multiply(__pyx_v_e, __pyx_v_height); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 882, __pyx_L1_error)
14283     __Pyx_GOTREF(__pyx_t_9);
14284     __pyx_t_8 = PyNumber_Add(__pyx_v_f, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 882, __pyx_L1_error)
14285     __Pyx_GOTREF(__pyx_t_8);
14286     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14287     __pyx_t_9 = PyNumber_Multiply(__pyx_v_a, __pyx_v_width); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 882, __pyx_L1_error)
14288     __Pyx_GOTREF(__pyx_t_9);
14289     __pyx_t_7 = PyNumber_Add(__pyx_v_c, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 882, __pyx_L1_error)
14290     __Pyx_GOTREF(__pyx_t_7);
14291     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14292     __pyx_t_9 = NULL;
14293     __pyx_t_14 = 0;
14294     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
14295       __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
14296       if (likely(__pyx_t_9)) {
14297         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
14298         __Pyx_INCREF(__pyx_t_9);
14299         __Pyx_INCREF(function);
14300         __Pyx_DECREF_SET(__pyx_t_10, function);
14301         __pyx_t_14 = 1;
14302       }
14303     }
14304     #if CYTHON_FAST_PYCALL
14305     if (PyFunction_Check(__pyx_t_10)) {
14306       PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_c, __pyx_t_8, __pyx_t_7, __pyx_v_f};
14307       __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error)
14308       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
14309       __Pyx_GOTREF(__pyx_t_1);
14310       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14311       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14312     } else
14313     #endif
14314     #if CYTHON_FAST_PYCCALL
14315     if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
14316       PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_c, __pyx_t_8, __pyx_t_7, __pyx_v_f};
14317       __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error)
14318       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
14319       __Pyx_GOTREF(__pyx_t_1);
14320       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14321       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14322     } else
14323     #endif
14324     {
14325       __pyx_t_6 = PyTuple_New(4+__pyx_t_14); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 882, __pyx_L1_error)
14326       __Pyx_GOTREF(__pyx_t_6);
14327       if (__pyx_t_9) {
14328         __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); __pyx_t_9 = NULL;
14329       }
14330       __Pyx_INCREF(__pyx_v_c);
14331       __Pyx_GIVEREF(__pyx_v_c);
14332       PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_14, __pyx_v_c);
14333       __Pyx_GIVEREF(__pyx_t_8);
14334       PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_14, __pyx_t_8);
14335       __Pyx_GIVEREF(__pyx_t_7);
14336       PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_14, __pyx_t_7);
14337       __Pyx_INCREF(__pyx_v_f);
14338       __Pyx_GIVEREF(__pyx_v_f);
14339       PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_14, __pyx_v_f);
14340       __pyx_t_8 = 0;
14341       __pyx_t_7 = 0;
14342       __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error)
14343       __Pyx_GOTREF(__pyx_t_1);
14344       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14345     }
14346     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14347     __pyx_r = __pyx_t_1;
14348     __pyx_t_1 = 0;
14349     goto __pyx_L0;
14350 
14351     /* "rasterio/_base.pyx":881
14352  *             width = self.width
14353  *             height = self.height
14354  *             if b == d == 0:             # <<<<<<<<<<<<<<
14355  *                 return BoundingBox(c, f + e * height, c + a * width, f)
14356  *             else:
14357  */
14358   }
14359 
14360   /* "rasterio/_base.pyx":884
14361  *                 return BoundingBox(c, f + e * height, c + a * width, f)
14362  *             else:
14363  *                 c0x, c0y = c, f             # <<<<<<<<<<<<<<
14364  *                 c1x, c1y = self.transform * (0, height)
14365  *                 c2x, c2y = self.transform * (width, height)
14366  */
14367   /*else*/ {
14368     __pyx_t_1 = __pyx_v_c;
14369     __Pyx_INCREF(__pyx_t_1);
14370     __pyx_t_10 = __pyx_v_f;
14371     __Pyx_INCREF(__pyx_t_10);
14372     __pyx_v_c0x = __pyx_t_1;
14373     __pyx_t_1 = 0;
14374     __pyx_v_c0y = __pyx_t_10;
14375     __pyx_t_10 = 0;
14376 
14377     /* "rasterio/_base.pyx":885
14378  *             else:
14379  *                 c0x, c0y = c, f
14380  *                 c1x, c1y = self.transform * (0, height)             # <<<<<<<<<<<<<<
14381  *                 c2x, c2y = self.transform * (width, height)
14382  *                 c3x, c3y = self.transform * (width, 0)
14383  */
14384     __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_transform); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 885, __pyx_L1_error)
14385     __Pyx_GOTREF(__pyx_t_10);
14386     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error)
14387     __Pyx_GOTREF(__pyx_t_1);
14388     __Pyx_INCREF(__pyx_int_0);
14389     __Pyx_GIVEREF(__pyx_int_0);
14390     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
14391     __Pyx_INCREF(__pyx_v_height);
14392     __Pyx_GIVEREF(__pyx_v_height);
14393     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_height);
14394     __pyx_t_6 = PyNumber_Multiply(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 885, __pyx_L1_error)
14395     __Pyx_GOTREF(__pyx_t_6);
14396     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14397     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14398     if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
14399       PyObject* sequence = __pyx_t_6;
14400       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
14401       if (unlikely(size != 2)) {
14402         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
14403         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
14404         __PYX_ERR(0, 885, __pyx_L1_error)
14405       }
14406       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14407       if (likely(PyTuple_CheckExact(sequence))) {
14408         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
14409         __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
14410       } else {
14411         __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
14412         __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
14413       }
14414       __Pyx_INCREF(__pyx_t_1);
14415       __Pyx_INCREF(__pyx_t_10);
14416       #else
14417       __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error)
14418       __Pyx_GOTREF(__pyx_t_1);
14419       __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 885, __pyx_L1_error)
14420       __Pyx_GOTREF(__pyx_t_10);
14421       #endif
14422       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14423     } else {
14424       Py_ssize_t index = -1;
14425       __pyx_t_7 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 885, __pyx_L1_error)
14426       __Pyx_GOTREF(__pyx_t_7);
14427       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14428       __pyx_t_12 = Py_TYPE(__pyx_t_7)->tp_iternext;
14429       index = 0; __pyx_t_1 = __pyx_t_12(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L6_unpacking_failed;
14430       __Pyx_GOTREF(__pyx_t_1);
14431       index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_7); if (unlikely(!__pyx_t_10)) goto __pyx_L6_unpacking_failed;
14432       __Pyx_GOTREF(__pyx_t_10);
14433       if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_7), 2) < 0) __PYX_ERR(0, 885, __pyx_L1_error)
14434       __pyx_t_12 = NULL;
14435       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14436       goto __pyx_L7_unpacking_done;
14437       __pyx_L6_unpacking_failed:;
14438       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14439       __pyx_t_12 = NULL;
14440       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
14441       __PYX_ERR(0, 885, __pyx_L1_error)
14442       __pyx_L7_unpacking_done:;
14443     }
14444     __pyx_v_c1x = __pyx_t_1;
14445     __pyx_t_1 = 0;
14446     __pyx_v_c1y = __pyx_t_10;
14447     __pyx_t_10 = 0;
14448 
14449     /* "rasterio/_base.pyx":886
14450  *                 c0x, c0y = c, f
14451  *                 c1x, c1y = self.transform * (0, height)
14452  *                 c2x, c2y = self.transform * (width, height)             # <<<<<<<<<<<<<<
14453  *                 c3x, c3y = self.transform * (width, 0)
14454  *                 xs = (c0x, c1x, c2x, c3x)
14455  */
14456     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_transform); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 886, __pyx_L1_error)
14457     __Pyx_GOTREF(__pyx_t_6);
14458     __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 886, __pyx_L1_error)
14459     __Pyx_GOTREF(__pyx_t_10);
14460     __Pyx_INCREF(__pyx_v_width);
14461     __Pyx_GIVEREF(__pyx_v_width);
14462     PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_width);
14463     __Pyx_INCREF(__pyx_v_height);
14464     __Pyx_GIVEREF(__pyx_v_height);
14465     PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_height);
14466     __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 886, __pyx_L1_error)
14467     __Pyx_GOTREF(__pyx_t_1);
14468     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14469     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14470     if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
14471       PyObject* sequence = __pyx_t_1;
14472       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
14473       if (unlikely(size != 2)) {
14474         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
14475         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
14476         __PYX_ERR(0, 886, __pyx_L1_error)
14477       }
14478       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14479       if (likely(PyTuple_CheckExact(sequence))) {
14480         __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
14481         __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
14482       } else {
14483         __pyx_t_10 = PyList_GET_ITEM(sequence, 0);
14484         __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
14485       }
14486       __Pyx_INCREF(__pyx_t_10);
14487       __Pyx_INCREF(__pyx_t_6);
14488       #else
14489       __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 886, __pyx_L1_error)
14490       __Pyx_GOTREF(__pyx_t_10);
14491       __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 886, __pyx_L1_error)
14492       __Pyx_GOTREF(__pyx_t_6);
14493       #endif
14494       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14495     } else {
14496       Py_ssize_t index = -1;
14497       __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 886, __pyx_L1_error)
14498       __Pyx_GOTREF(__pyx_t_7);
14499       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14500       __pyx_t_12 = Py_TYPE(__pyx_t_7)->tp_iternext;
14501       index = 0; __pyx_t_10 = __pyx_t_12(__pyx_t_7); if (unlikely(!__pyx_t_10)) goto __pyx_L8_unpacking_failed;
14502       __Pyx_GOTREF(__pyx_t_10);
14503       index = 1; __pyx_t_6 = __pyx_t_12(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
14504       __Pyx_GOTREF(__pyx_t_6);
14505       if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_7), 2) < 0) __PYX_ERR(0, 886, __pyx_L1_error)
14506       __pyx_t_12 = NULL;
14507       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14508       goto __pyx_L9_unpacking_done;
14509       __pyx_L8_unpacking_failed:;
14510       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14511       __pyx_t_12 = NULL;
14512       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
14513       __PYX_ERR(0, 886, __pyx_L1_error)
14514       __pyx_L9_unpacking_done:;
14515     }
14516     __pyx_v_c2x = __pyx_t_10;
14517     __pyx_t_10 = 0;
14518     __pyx_v_c2y = __pyx_t_6;
14519     __pyx_t_6 = 0;
14520 
14521     /* "rasterio/_base.pyx":887
14522  *                 c1x, c1y = self.transform * (0, height)
14523  *                 c2x, c2y = self.transform * (width, height)
14524  *                 c3x, c3y = self.transform * (width, 0)             # <<<<<<<<<<<<<<
14525  *                 xs = (c0x, c1x, c2x, c3x)
14526  *                 ys = (c0y, c1y, c2y, c3y)
14527  */
14528     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_transform); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error)
14529     __Pyx_GOTREF(__pyx_t_1);
14530     __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 887, __pyx_L1_error)
14531     __Pyx_GOTREF(__pyx_t_6);
14532     __Pyx_INCREF(__pyx_v_width);
14533     __Pyx_GIVEREF(__pyx_v_width);
14534     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_width);
14535     __Pyx_INCREF(__pyx_int_0);
14536     __Pyx_GIVEREF(__pyx_int_0);
14537     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_0);
14538     __pyx_t_10 = PyNumber_Multiply(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 887, __pyx_L1_error)
14539     __Pyx_GOTREF(__pyx_t_10);
14540     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14541     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14542     if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
14543       PyObject* sequence = __pyx_t_10;
14544       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
14545       if (unlikely(size != 2)) {
14546         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
14547         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
14548         __PYX_ERR(0, 887, __pyx_L1_error)
14549       }
14550       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14551       if (likely(PyTuple_CheckExact(sequence))) {
14552         __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
14553         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
14554       } else {
14555         __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
14556         __pyx_t_1 = PyList_GET_ITEM(sequence, 1);
14557       }
14558       __Pyx_INCREF(__pyx_t_6);
14559       __Pyx_INCREF(__pyx_t_1);
14560       #else
14561       __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 887, __pyx_L1_error)
14562       __Pyx_GOTREF(__pyx_t_6);
14563       __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error)
14564       __Pyx_GOTREF(__pyx_t_1);
14565       #endif
14566       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14567     } else {
14568       Py_ssize_t index = -1;
14569       __pyx_t_7 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 887, __pyx_L1_error)
14570       __Pyx_GOTREF(__pyx_t_7);
14571       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14572       __pyx_t_12 = Py_TYPE(__pyx_t_7)->tp_iternext;
14573       index = 0; __pyx_t_6 = __pyx_t_12(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L10_unpacking_failed;
14574       __Pyx_GOTREF(__pyx_t_6);
14575       index = 1; __pyx_t_1 = __pyx_t_12(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L10_unpacking_failed;
14576       __Pyx_GOTREF(__pyx_t_1);
14577       if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_7), 2) < 0) __PYX_ERR(0, 887, __pyx_L1_error)
14578       __pyx_t_12 = NULL;
14579       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14580       goto __pyx_L11_unpacking_done;
14581       __pyx_L10_unpacking_failed:;
14582       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14583       __pyx_t_12 = NULL;
14584       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
14585       __PYX_ERR(0, 887, __pyx_L1_error)
14586       __pyx_L11_unpacking_done:;
14587     }
14588     __pyx_v_c3x = __pyx_t_6;
14589     __pyx_t_6 = 0;
14590     __pyx_v_c3y = __pyx_t_1;
14591     __pyx_t_1 = 0;
14592 
14593     /* "rasterio/_base.pyx":888
14594  *                 c2x, c2y = self.transform * (width, height)
14595  *                 c3x, c3y = self.transform * (width, 0)
14596  *                 xs = (c0x, c1x, c2x, c3x)             # <<<<<<<<<<<<<<
14597  *                 ys = (c0y, c1y, c2y, c3y)
14598  *                 return BoundingBox(min(xs), min(ys), max(xs), max(ys))
14599  */
14600     __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 888, __pyx_L1_error)
14601     __Pyx_GOTREF(__pyx_t_10);
14602     __Pyx_INCREF(__pyx_v_c0x);
14603     __Pyx_GIVEREF(__pyx_v_c0x);
14604     PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_c0x);
14605     __Pyx_INCREF(__pyx_v_c1x);
14606     __Pyx_GIVEREF(__pyx_v_c1x);
14607     PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c1x);
14608     __Pyx_INCREF(__pyx_v_c2x);
14609     __Pyx_GIVEREF(__pyx_v_c2x);
14610     PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_c2x);
14611     __Pyx_INCREF(__pyx_v_c3x);
14612     __Pyx_GIVEREF(__pyx_v_c3x);
14613     PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_v_c3x);
14614     __pyx_v_xs = ((PyObject*)__pyx_t_10);
14615     __pyx_t_10 = 0;
14616 
14617     /* "rasterio/_base.pyx":889
14618  *                 c3x, c3y = self.transform * (width, 0)
14619  *                 xs = (c0x, c1x, c2x, c3x)
14620  *                 ys = (c0y, c1y, c2y, c3y)             # <<<<<<<<<<<<<<
14621  *                 return BoundingBox(min(xs), min(ys), max(xs), max(ys))
14622  *
14623  */
14624     __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 889, __pyx_L1_error)
14625     __Pyx_GOTREF(__pyx_t_10);
14626     __Pyx_INCREF(__pyx_v_c0y);
14627     __Pyx_GIVEREF(__pyx_v_c0y);
14628     PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_c0y);
14629     __Pyx_INCREF(__pyx_v_c1y);
14630     __Pyx_GIVEREF(__pyx_v_c1y);
14631     PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c1y);
14632     __Pyx_INCREF(__pyx_v_c2y);
14633     __Pyx_GIVEREF(__pyx_v_c2y);
14634     PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_c2y);
14635     __Pyx_INCREF(__pyx_v_c3y);
14636     __Pyx_GIVEREF(__pyx_v_c3y);
14637     PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_v_c3y);
14638     __pyx_v_ys = ((PyObject*)__pyx_t_10);
14639     __pyx_t_10 = 0;
14640 
14641     /* "rasterio/_base.pyx":890
14642  *                 xs = (c0x, c1x, c2x, c3x)
14643  *                 ys = (c0y, c1y, c2y, c3y)
14644  *                 return BoundingBox(min(xs), min(ys), max(xs), max(ys))             # <<<<<<<<<<<<<<
14645  *
14646  *     property res:
14647  */
14648     __Pyx_XDECREF(__pyx_r);
14649     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BoundingBox); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error)
14650     __Pyx_GOTREF(__pyx_t_1);
14651     __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_v_xs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 890, __pyx_L1_error)
14652     __Pyx_GOTREF(__pyx_t_6);
14653     __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_v_ys); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 890, __pyx_L1_error)
14654     __Pyx_GOTREF(__pyx_t_7);
14655     __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_v_xs); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 890, __pyx_L1_error)
14656     __Pyx_GOTREF(__pyx_t_8);
14657     __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_v_ys); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 890, __pyx_L1_error)
14658     __Pyx_GOTREF(__pyx_t_9);
14659     __pyx_t_5 = NULL;
14660     __pyx_t_14 = 0;
14661     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
14662       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
14663       if (likely(__pyx_t_5)) {
14664         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
14665         __Pyx_INCREF(__pyx_t_5);
14666         __Pyx_INCREF(function);
14667         __Pyx_DECREF_SET(__pyx_t_1, function);
14668         __pyx_t_14 = 1;
14669       }
14670     }
14671     #if CYTHON_FAST_PYCALL
14672     if (PyFunction_Check(__pyx_t_1)) {
14673       PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9};
14674       __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 890, __pyx_L1_error)
14675       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14676       __Pyx_GOTREF(__pyx_t_10);
14677       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14678       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14679       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14680       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14681     } else
14682     #endif
14683     #if CYTHON_FAST_PYCCALL
14684     if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
14685       PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9};
14686       __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 890, __pyx_L1_error)
14687       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14688       __Pyx_GOTREF(__pyx_t_10);
14689       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14690       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14691       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14692       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14693     } else
14694     #endif
14695     {
14696       __pyx_t_4 = PyTuple_New(4+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 890, __pyx_L1_error)
14697       __Pyx_GOTREF(__pyx_t_4);
14698       if (__pyx_t_5) {
14699         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
14700       }
14701       __Pyx_GIVEREF(__pyx_t_6);
14702       PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_14, __pyx_t_6);
14703       __Pyx_GIVEREF(__pyx_t_7);
14704       PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_14, __pyx_t_7);
14705       __Pyx_GIVEREF(__pyx_t_8);
14706       PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_14, __pyx_t_8);
14707       __Pyx_GIVEREF(__pyx_t_9);
14708       PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_14, __pyx_t_9);
14709       __pyx_t_6 = 0;
14710       __pyx_t_7 = 0;
14711       __pyx_t_8 = 0;
14712       __pyx_t_9 = 0;
14713       __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 890, __pyx_L1_error)
14714       __Pyx_GOTREF(__pyx_t_10);
14715       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14716     }
14717     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14718     __pyx_r = __pyx_t_10;
14719     __pyx_t_10 = 0;
14720     goto __pyx_L0;
14721   }
14722 
14723   /* "rasterio/_base.pyx":877
14724  *         (lower left x, lower left y, upper right x, upper right y)
14725  *         """
14726  *         def __get__(self):             # <<<<<<<<<<<<<<
14727  *             a, b, c, d, e, f, _, _, _ = self.transform
14728  *             width = self.width
14729  */
14730 
14731   /* function exit code */
14732   __pyx_L1_error:;
14733   __Pyx_XDECREF(__pyx_t_1);
14734   __Pyx_XDECREF(__pyx_t_2);
14735   __Pyx_XDECREF(__pyx_t_3);
14736   __Pyx_XDECREF(__pyx_t_4);
14737   __Pyx_XDECREF(__pyx_t_5);
14738   __Pyx_XDECREF(__pyx_t_6);
14739   __Pyx_XDECREF(__pyx_t_7);
14740   __Pyx_XDECREF(__pyx_t_8);
14741   __Pyx_XDECREF(__pyx_t_9);
14742   __Pyx_XDECREF(__pyx_t_10);
14743   __Pyx_XDECREF(__pyx_t_11);
14744   __Pyx_AddTraceback("rasterio._base.DatasetBase.bounds.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14745   __pyx_r = NULL;
14746   __pyx_L0:;
14747   __Pyx_XDECREF(__pyx_v_a);
14748   __Pyx_XDECREF(__pyx_v_b);
14749   __Pyx_XDECREF(__pyx_v_c);
14750   __Pyx_XDECREF(__pyx_v_d);
14751   __Pyx_XDECREF(__pyx_v_e);
14752   __Pyx_XDECREF(__pyx_v_f);
14753   __Pyx_XDECREF(__pyx_v__);
14754   __Pyx_XDECREF(__pyx_v_width);
14755   __Pyx_XDECREF(__pyx_v_height);
14756   __Pyx_XDECREF(__pyx_v_c0x);
14757   __Pyx_XDECREF(__pyx_v_c0y);
14758   __Pyx_XDECREF(__pyx_v_c1x);
14759   __Pyx_XDECREF(__pyx_v_c1y);
14760   __Pyx_XDECREF(__pyx_v_c2x);
14761   __Pyx_XDECREF(__pyx_v_c2y);
14762   __Pyx_XDECREF(__pyx_v_c3x);
14763   __Pyx_XDECREF(__pyx_v_c3y);
14764   __Pyx_XDECREF(__pyx_v_xs);
14765   __Pyx_XDECREF(__pyx_v_ys);
14766   __Pyx_XGIVEREF(__pyx_r);
14767   __Pyx_RefNannyFinishContext();
14768   return __pyx_r;
14769 }
14770 
14771 /* "rasterio/_base.pyx":895
14772  *         """Returns the (width, height) of pixels in the units of its
14773  *         coordinate reference system."""
14774  *         def __get__(self):             # <<<<<<<<<<<<<<
14775  *             a, b, c, d, e, f, _, _, _ = self.transform
14776  *             if b == d == 0:
14777  */
14778 
14779 /* Python wrapper */
14780 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_3res_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_3res_1__get__(PyObject * __pyx_v_self)14781 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_3res_1__get__(PyObject *__pyx_v_self) {
14782   PyObject *__pyx_r = 0;
14783   __Pyx_RefNannyDeclarations
14784   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14785   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_3res___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
14786 
14787   /* function exit code */
14788   __Pyx_RefNannyFinishContext();
14789   return __pyx_r;
14790 }
14791 
__pyx_pf_8rasterio_5_base_11DatasetBase_3res___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)14792 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_3res___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
14793   PyObject *__pyx_v_a = NULL;
14794   PyObject *__pyx_v_b = NULL;
14795   CYTHON_UNUSED PyObject *__pyx_v_c = NULL;
14796   PyObject *__pyx_v_d = NULL;
14797   PyObject *__pyx_v_e = NULL;
14798   CYTHON_UNUSED PyObject *__pyx_v_f = NULL;
14799   CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
14800   PyObject *__pyx_r = NULL;
14801   __Pyx_RefNannyDeclarations
14802   PyObject *__pyx_t_1 = NULL;
14803   PyObject *__pyx_t_2 = NULL;
14804   PyObject *__pyx_t_3 = NULL;
14805   PyObject *__pyx_t_4 = NULL;
14806   PyObject *__pyx_t_5 = NULL;
14807   PyObject *__pyx_t_6 = NULL;
14808   PyObject *__pyx_t_7 = NULL;
14809   PyObject *__pyx_t_8 = NULL;
14810   PyObject *__pyx_t_9 = NULL;
14811   PyObject *__pyx_t_10 = NULL;
14812   PyObject *__pyx_t_11 = NULL;
14813   PyObject *(*__pyx_t_12)(PyObject *);
14814   int __pyx_t_13;
14815   int __pyx_lineno = 0;
14816   const char *__pyx_filename = NULL;
14817   int __pyx_clineno = 0;
14818   __Pyx_RefNannySetupContext("__get__", 0);
14819 
14820   /* "rasterio/_base.pyx":896
14821  *         coordinate reference system."""
14822  *         def __get__(self):
14823  *             a, b, c, d, e, f, _, _, _ = self.transform             # <<<<<<<<<<<<<<
14824  *             if b == d == 0:
14825  *                 return a, -e
14826  */
14827   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_transform); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 896, __pyx_L1_error)
14828   __Pyx_GOTREF(__pyx_t_1);
14829   if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
14830     PyObject* sequence = __pyx_t_1;
14831     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
14832     if (unlikely(size != 9)) {
14833       if (size > 9) __Pyx_RaiseTooManyValuesError(9);
14834       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
14835       __PYX_ERR(0, 896, __pyx_L1_error)
14836     }
14837     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14838     if (likely(PyTuple_CheckExact(sequence))) {
14839       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
14840       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
14841       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
14842       __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3);
14843       __pyx_t_6 = PyTuple_GET_ITEM(sequence, 4);
14844       __pyx_t_7 = PyTuple_GET_ITEM(sequence, 5);
14845       __pyx_t_8 = PyTuple_GET_ITEM(sequence, 6);
14846       __pyx_t_9 = PyTuple_GET_ITEM(sequence, 7);
14847       __pyx_t_10 = PyTuple_GET_ITEM(sequence, 8);
14848     } else {
14849       __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
14850       __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
14851       __pyx_t_4 = PyList_GET_ITEM(sequence, 2);
14852       __pyx_t_5 = PyList_GET_ITEM(sequence, 3);
14853       __pyx_t_6 = PyList_GET_ITEM(sequence, 4);
14854       __pyx_t_7 = PyList_GET_ITEM(sequence, 5);
14855       __pyx_t_8 = PyList_GET_ITEM(sequence, 6);
14856       __pyx_t_9 = PyList_GET_ITEM(sequence, 7);
14857       __pyx_t_10 = PyList_GET_ITEM(sequence, 8);
14858     }
14859     __Pyx_INCREF(__pyx_t_2);
14860     __Pyx_INCREF(__pyx_t_3);
14861     __Pyx_INCREF(__pyx_t_4);
14862     __Pyx_INCREF(__pyx_t_5);
14863     __Pyx_INCREF(__pyx_t_6);
14864     __Pyx_INCREF(__pyx_t_7);
14865     __Pyx_INCREF(__pyx_t_8);
14866     __Pyx_INCREF(__pyx_t_9);
14867     __Pyx_INCREF(__pyx_t_10);
14868     #else
14869     {
14870       Py_ssize_t i;
14871       PyObject** temps[9] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10};
14872       for (i=0; i < 9; i++) {
14873         PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 896, __pyx_L1_error)
14874         __Pyx_GOTREF(item);
14875         *(temps[i]) = item;
14876       }
14877     }
14878     #endif
14879     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14880   } else {
14881     Py_ssize_t index = -1;
14882     PyObject** temps[9] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10};
14883     __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 896, __pyx_L1_error)
14884     __Pyx_GOTREF(__pyx_t_11);
14885     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14886     __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
14887     for (index=0; index < 9; index++) {
14888       PyObject* item = __pyx_t_12(__pyx_t_11); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
14889       __Pyx_GOTREF(item);
14890       *(temps[index]) = item;
14891     }
14892     if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 9) < 0) __PYX_ERR(0, 896, __pyx_L1_error)
14893     __pyx_t_12 = NULL;
14894     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
14895     goto __pyx_L4_unpacking_done;
14896     __pyx_L3_unpacking_failed:;
14897     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
14898     __pyx_t_12 = NULL;
14899     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
14900     __PYX_ERR(0, 896, __pyx_L1_error)
14901     __pyx_L4_unpacking_done:;
14902   }
14903   __pyx_v_a = __pyx_t_2;
14904   __pyx_t_2 = 0;
14905   __pyx_v_b = __pyx_t_3;
14906   __pyx_t_3 = 0;
14907   __pyx_v_c = __pyx_t_4;
14908   __pyx_t_4 = 0;
14909   __pyx_v_d = __pyx_t_5;
14910   __pyx_t_5 = 0;
14911   __pyx_v_e = __pyx_t_6;
14912   __pyx_t_6 = 0;
14913   __pyx_v_f = __pyx_t_7;
14914   __pyx_t_7 = 0;
14915   __pyx_v__ = __pyx_t_8;
14916   __pyx_t_8 = 0;
14917   __Pyx_DECREF_SET(__pyx_v__, __pyx_t_9);
14918   __pyx_t_9 = 0;
14919   __Pyx_DECREF_SET(__pyx_v__, __pyx_t_10);
14920   __pyx_t_10 = 0;
14921 
14922   /* "rasterio/_base.pyx":897
14923  *         def __get__(self):
14924  *             a, b, c, d, e, f, _, _, _ = self.transform
14925  *             if b == d == 0:             # <<<<<<<<<<<<<<
14926  *                 return a, -e
14927  *             else:
14928  */
14929   __pyx_t_1 = PyObject_RichCompare(__pyx_v_b, __pyx_v_d, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 897, __pyx_L1_error)
14930   if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
14931     __Pyx_DECREF(__pyx_t_1);
14932     __pyx_t_1 = PyObject_RichCompare(__pyx_v_d, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 897, __pyx_L1_error)
14933   }
14934   __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 897, __pyx_L1_error)
14935   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14936   if (__pyx_t_13) {
14937 
14938     /* "rasterio/_base.pyx":898
14939  *             a, b, c, d, e, f, _, _, _ = self.transform
14940  *             if b == d == 0:
14941  *                 return a, -e             # <<<<<<<<<<<<<<
14942  *             else:
14943  *                 return math.sqrt(a * a+ d * d), math.sqrt(b * b + e * e)
14944  */
14945     __Pyx_XDECREF(__pyx_r);
14946     __pyx_t_1 = PyNumber_Negative(__pyx_v_e); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 898, __pyx_L1_error)
14947     __Pyx_GOTREF(__pyx_t_1);
14948     __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 898, __pyx_L1_error)
14949     __Pyx_GOTREF(__pyx_t_10);
14950     __Pyx_INCREF(__pyx_v_a);
14951     __Pyx_GIVEREF(__pyx_v_a);
14952     PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_a);
14953     __Pyx_GIVEREF(__pyx_t_1);
14954     PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1);
14955     __pyx_t_1 = 0;
14956     __pyx_r = __pyx_t_10;
14957     __pyx_t_10 = 0;
14958     goto __pyx_L0;
14959 
14960     /* "rasterio/_base.pyx":897
14961  *         def __get__(self):
14962  *             a, b, c, d, e, f, _, _, _ = self.transform
14963  *             if b == d == 0:             # <<<<<<<<<<<<<<
14964  *                 return a, -e
14965  *             else:
14966  */
14967   }
14968 
14969   /* "rasterio/_base.pyx":900
14970  *                 return a, -e
14971  *             else:
14972  *                 return math.sqrt(a * a+ d * d), math.sqrt(b * b + e * e)             # <<<<<<<<<<<<<<
14973  *
14974  *     @property
14975  */
14976   /*else*/ {
14977     __Pyx_XDECREF(__pyx_r);
14978     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_math); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 900, __pyx_L1_error)
14979     __Pyx_GOTREF(__pyx_t_1);
14980     __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 900, __pyx_L1_error)
14981     __Pyx_GOTREF(__pyx_t_9);
14982     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14983     __pyx_t_1 = PyNumber_Multiply(__pyx_v_a, __pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 900, __pyx_L1_error)
14984     __Pyx_GOTREF(__pyx_t_1);
14985     __pyx_t_8 = PyNumber_Multiply(__pyx_v_d, __pyx_v_d); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 900, __pyx_L1_error)
14986     __Pyx_GOTREF(__pyx_t_8);
14987     __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 900, __pyx_L1_error)
14988     __Pyx_GOTREF(__pyx_t_7);
14989     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14990     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14991     __pyx_t_8 = NULL;
14992     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
14993       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
14994       if (likely(__pyx_t_8)) {
14995         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
14996         __Pyx_INCREF(__pyx_t_8);
14997         __Pyx_INCREF(function);
14998         __Pyx_DECREF_SET(__pyx_t_9, function);
14999       }
15000     }
15001     __pyx_t_10 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_7);
15002     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
15003     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15004     if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 900, __pyx_L1_error)
15005     __Pyx_GOTREF(__pyx_t_10);
15006     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15007     __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_math); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 900, __pyx_L1_error)
15008     __Pyx_GOTREF(__pyx_t_7);
15009     __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 900, __pyx_L1_error)
15010     __Pyx_GOTREF(__pyx_t_8);
15011     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15012     __pyx_t_7 = PyNumber_Multiply(__pyx_v_b, __pyx_v_b); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 900, __pyx_L1_error)
15013     __Pyx_GOTREF(__pyx_t_7);
15014     __pyx_t_1 = PyNumber_Multiply(__pyx_v_e, __pyx_v_e); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 900, __pyx_L1_error)
15015     __Pyx_GOTREF(__pyx_t_1);
15016     __pyx_t_6 = PyNumber_Add(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 900, __pyx_L1_error)
15017     __Pyx_GOTREF(__pyx_t_6);
15018     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15019     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15020     __pyx_t_1 = NULL;
15021     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
15022       __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
15023       if (likely(__pyx_t_1)) {
15024         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
15025         __Pyx_INCREF(__pyx_t_1);
15026         __Pyx_INCREF(function);
15027         __Pyx_DECREF_SET(__pyx_t_8, function);
15028       }
15029     }
15030     __pyx_t_9 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_1, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6);
15031     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
15032     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15033     if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 900, __pyx_L1_error)
15034     __Pyx_GOTREF(__pyx_t_9);
15035     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
15036     __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 900, __pyx_L1_error)
15037     __Pyx_GOTREF(__pyx_t_8);
15038     __Pyx_GIVEREF(__pyx_t_10);
15039     PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10);
15040     __Pyx_GIVEREF(__pyx_t_9);
15041     PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
15042     __pyx_t_10 = 0;
15043     __pyx_t_9 = 0;
15044     __pyx_r = __pyx_t_8;
15045     __pyx_t_8 = 0;
15046     goto __pyx_L0;
15047   }
15048 
15049   /* "rasterio/_base.pyx":895
15050  *         """Returns the (width, height) of pixels in the units of its
15051  *         coordinate reference system."""
15052  *         def __get__(self):             # <<<<<<<<<<<<<<
15053  *             a, b, c, d, e, f, _, _, _ = self.transform
15054  *             if b == d == 0:
15055  */
15056 
15057   /* function exit code */
15058   __pyx_L1_error:;
15059   __Pyx_XDECREF(__pyx_t_1);
15060   __Pyx_XDECREF(__pyx_t_2);
15061   __Pyx_XDECREF(__pyx_t_3);
15062   __Pyx_XDECREF(__pyx_t_4);
15063   __Pyx_XDECREF(__pyx_t_5);
15064   __Pyx_XDECREF(__pyx_t_6);
15065   __Pyx_XDECREF(__pyx_t_7);
15066   __Pyx_XDECREF(__pyx_t_8);
15067   __Pyx_XDECREF(__pyx_t_9);
15068   __Pyx_XDECREF(__pyx_t_10);
15069   __Pyx_XDECREF(__pyx_t_11);
15070   __Pyx_AddTraceback("rasterio._base.DatasetBase.res.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15071   __pyx_r = NULL;
15072   __pyx_L0:;
15073   __Pyx_XDECREF(__pyx_v_a);
15074   __Pyx_XDECREF(__pyx_v_b);
15075   __Pyx_XDECREF(__pyx_v_c);
15076   __Pyx_XDECREF(__pyx_v_d);
15077   __Pyx_XDECREF(__pyx_v_e);
15078   __Pyx_XDECREF(__pyx_v_f);
15079   __Pyx_XDECREF(__pyx_v__);
15080   __Pyx_XGIVEREF(__pyx_r);
15081   __Pyx_RefNannyFinishContext();
15082   return __pyx_r;
15083 }
15084 
15085 /* "rasterio/_base.pyx":903
15086  *
15087  *     @property
15088  *     def meta(self):             # <<<<<<<<<<<<<<
15089  *         """The basic metadata of this dataset."""
15090  *         if self.count == 0:
15091  */
15092 
15093 /* Python wrapper */
15094 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_4meta_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_4meta_1__get__(PyObject * __pyx_v_self)15095 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_4meta_1__get__(PyObject *__pyx_v_self) {
15096   PyObject *__pyx_r = 0;
15097   __Pyx_RefNannyDeclarations
15098   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15099   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_4meta___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
15100 
15101   /* function exit code */
15102   __Pyx_RefNannyFinishContext();
15103   return __pyx_r;
15104 }
15105 
__pyx_pf_8rasterio_5_base_11DatasetBase_4meta___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)15106 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4meta___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
15107   PyObject *__pyx_v_dtype = NULL;
15108   PyObject *__pyx_v_m = NULL;
15109   PyObject *__pyx_r = NULL;
15110   __Pyx_RefNannyDeclarations
15111   PyObject *__pyx_t_1 = NULL;
15112   PyObject *__pyx_t_2 = NULL;
15113   int __pyx_t_3;
15114   int __pyx_lineno = 0;
15115   const char *__pyx_filename = NULL;
15116   int __pyx_clineno = 0;
15117   __Pyx_RefNannySetupContext("__get__", 0);
15118 
15119   /* "rasterio/_base.pyx":905
15120  *     def meta(self):
15121  *         """The basic metadata of this dataset."""
15122  *         if self.count == 0:             # <<<<<<<<<<<<<<
15123  *             dtype = 'float_'
15124  *         else:
15125  */
15126   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error)
15127   __Pyx_GOTREF(__pyx_t_1);
15128   __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 905, __pyx_L1_error)
15129   __Pyx_GOTREF(__pyx_t_2);
15130   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15131   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 905, __pyx_L1_error)
15132   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15133   if (__pyx_t_3) {
15134 
15135     /* "rasterio/_base.pyx":906
15136  *         """The basic metadata of this dataset."""
15137  *         if self.count == 0:
15138  *             dtype = 'float_'             # <<<<<<<<<<<<<<
15139  *         else:
15140  *             dtype = self.dtypes[0]
15141  */
15142     __Pyx_INCREF(__pyx_n_u_float);
15143     __pyx_v_dtype = __pyx_n_u_float;
15144 
15145     /* "rasterio/_base.pyx":905
15146  *     def meta(self):
15147  *         """The basic metadata of this dataset."""
15148  *         if self.count == 0:             # <<<<<<<<<<<<<<
15149  *             dtype = 'float_'
15150  *         else:
15151  */
15152     goto __pyx_L3;
15153   }
15154 
15155   /* "rasterio/_base.pyx":908
15156  *             dtype = 'float_'
15157  *         else:
15158  *             dtype = self.dtypes[0]             # <<<<<<<<<<<<<<
15159  *         m = {
15160  *             'driver': self.driver,
15161  */
15162   /*else*/ {
15163     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_dtypes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 908, __pyx_L1_error)
15164     __Pyx_GOTREF(__pyx_t_2);
15165     __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 908, __pyx_L1_error)
15166     __Pyx_GOTREF(__pyx_t_1);
15167     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15168     __pyx_v_dtype = __pyx_t_1;
15169     __pyx_t_1 = 0;
15170   }
15171   __pyx_L3:;
15172 
15173   /* "rasterio/_base.pyx":910
15174  *             dtype = self.dtypes[0]
15175  *         m = {
15176  *             'driver': self.driver,             # <<<<<<<<<<<<<<
15177  *             'dtype': dtype,
15178  *             'nodata': self.nodata,
15179  */
15180   __pyx_t_1 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 910, __pyx_L1_error)
15181   __Pyx_GOTREF(__pyx_t_1);
15182   if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_driver, __pyx_v_self->driver) < 0) __PYX_ERR(0, 910, __pyx_L1_error)
15183 
15184   /* "rasterio/_base.pyx":911
15185  *         m = {
15186  *             'driver': self.driver,
15187  *             'dtype': dtype,             # <<<<<<<<<<<<<<
15188  *             'nodata': self.nodata,
15189  *             'width': self.width,
15190  */
15191   if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_dtype, __pyx_v_dtype) < 0) __PYX_ERR(0, 910, __pyx_L1_error)
15192 
15193   /* "rasterio/_base.pyx":912
15194  *             'driver': self.driver,
15195  *             'dtype': dtype,
15196  *             'nodata': self.nodata,             # <<<<<<<<<<<<<<
15197  *             'width': self.width,
15198  *             'height': self.height,
15199  */
15200   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_nodata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 912, __pyx_L1_error)
15201   __Pyx_GOTREF(__pyx_t_2);
15202   if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_nodata, __pyx_t_2) < 0) __PYX_ERR(0, 910, __pyx_L1_error)
15203   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15204 
15205   /* "rasterio/_base.pyx":913
15206  *             'dtype': dtype,
15207  *             'nodata': self.nodata,
15208  *             'width': self.width,             # <<<<<<<<<<<<<<
15209  *             'height': self.height,
15210  *             'count': self.count,
15211  */
15212   if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_width, __pyx_v_self->width) < 0) __PYX_ERR(0, 910, __pyx_L1_error)
15213 
15214   /* "rasterio/_base.pyx":914
15215  *             'nodata': self.nodata,
15216  *             'width': self.width,
15217  *             'height': self.height,             # <<<<<<<<<<<<<<
15218  *             'count': self.count,
15219  *             'crs': self.crs,
15220  */
15221   if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_height, __pyx_v_self->height) < 0) __PYX_ERR(0, 910, __pyx_L1_error)
15222 
15223   /* "rasterio/_base.pyx":915
15224  *             'width': self.width,
15225  *             'height': self.height,
15226  *             'count': self.count,             # <<<<<<<<<<<<<<
15227  *             'crs': self.crs,
15228  *             'transform': self.transform,
15229  */
15230   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error)
15231   __Pyx_GOTREF(__pyx_t_2);
15232   if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_count, __pyx_t_2) < 0) __PYX_ERR(0, 910, __pyx_L1_error)
15233   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15234 
15235   /* "rasterio/_base.pyx":916
15236  *             'height': self.height,
15237  *             'count': self.count,
15238  *             'crs': self.crs,             # <<<<<<<<<<<<<<
15239  *             'transform': self.transform,
15240  *         }
15241  */
15242   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_crs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 916, __pyx_L1_error)
15243   __Pyx_GOTREF(__pyx_t_2);
15244   if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_crs, __pyx_t_2) < 0) __PYX_ERR(0, 910, __pyx_L1_error)
15245   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15246 
15247   /* "rasterio/_base.pyx":917
15248  *             'count': self.count,
15249  *             'crs': self.crs,
15250  *             'transform': self.transform,             # <<<<<<<<<<<<<<
15251  *         }
15252  *         self._read = True
15253  */
15254   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_transform); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 917, __pyx_L1_error)
15255   __Pyx_GOTREF(__pyx_t_2);
15256   if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_transform, __pyx_t_2) < 0) __PYX_ERR(0, 910, __pyx_L1_error)
15257   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15258   __pyx_v_m = ((PyObject*)__pyx_t_1);
15259   __pyx_t_1 = 0;
15260 
15261   /* "rasterio/_base.pyx":919
15262  *             'transform': self.transform,
15263  *         }
15264  *         self._read = True             # <<<<<<<<<<<<<<
15265  *         return m
15266  *
15267  */
15268   __Pyx_INCREF(Py_True);
15269   __Pyx_GIVEREF(Py_True);
15270   __Pyx_GOTREF(__pyx_v_self->_read);
15271   __Pyx_DECREF(__pyx_v_self->_read);
15272   __pyx_v_self->_read = Py_True;
15273 
15274   /* "rasterio/_base.pyx":920
15275  *         }
15276  *         self._read = True
15277  *         return m             # <<<<<<<<<<<<<<
15278  *
15279  *     @property
15280  */
15281   __Pyx_XDECREF(__pyx_r);
15282   __Pyx_INCREF(__pyx_v_m);
15283   __pyx_r = __pyx_v_m;
15284   goto __pyx_L0;
15285 
15286   /* "rasterio/_base.pyx":903
15287  *
15288  *     @property
15289  *     def meta(self):             # <<<<<<<<<<<<<<
15290  *         """The basic metadata of this dataset."""
15291  *         if self.count == 0:
15292  */
15293 
15294   /* function exit code */
15295   __pyx_L1_error:;
15296   __Pyx_XDECREF(__pyx_t_1);
15297   __Pyx_XDECREF(__pyx_t_2);
15298   __Pyx_AddTraceback("rasterio._base.DatasetBase.meta.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15299   __pyx_r = NULL;
15300   __pyx_L0:;
15301   __Pyx_XDECREF(__pyx_v_dtype);
15302   __Pyx_XDECREF(__pyx_v_m);
15303   __Pyx_XGIVEREF(__pyx_r);
15304   __Pyx_RefNannyFinishContext();
15305   return __pyx_r;
15306 }
15307 
15308 /* "rasterio/_base.pyx":923
15309  *
15310  *     @property
15311  *     def compression(self):             # <<<<<<<<<<<<<<
15312  *         val = self.tags(ns='IMAGE_STRUCTURE').get('COMPRESSION')
15313  *         if val:
15314  */
15315 
15316 /* Python wrapper */
15317 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_11compression_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_11compression_1__get__(PyObject * __pyx_v_self)15318 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_11compression_1__get__(PyObject *__pyx_v_self) {
15319   PyObject *__pyx_r = 0;
15320   __Pyx_RefNannyDeclarations
15321   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15322   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_11compression___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
15323 
15324   /* function exit code */
15325   __Pyx_RefNannyFinishContext();
15326   return __pyx_r;
15327 }
15328 
__pyx_pf_8rasterio_5_base_11DatasetBase_11compression___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)15329 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_11compression___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
15330   PyObject *__pyx_v_val = NULL;
15331   PyObject *__pyx_r = NULL;
15332   __Pyx_RefNannyDeclarations
15333   PyObject *__pyx_t_1 = NULL;
15334   PyObject *__pyx_t_2 = NULL;
15335   PyObject *__pyx_t_3 = NULL;
15336   PyObject *__pyx_t_4 = NULL;
15337   int __pyx_t_5;
15338   int __pyx_lineno = 0;
15339   const char *__pyx_filename = NULL;
15340   int __pyx_clineno = 0;
15341   __Pyx_RefNannySetupContext("__get__", 0);
15342 
15343   /* "rasterio/_base.pyx":924
15344  *     @property
15345  *     def compression(self):
15346  *         val = self.tags(ns='IMAGE_STRUCTURE').get('COMPRESSION')             # <<<<<<<<<<<<<<
15347  *         if val:
15348  *             # 'YCbCr JPEG' will be normalized to 'JPEG'
15349  */
15350   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 924, __pyx_L1_error)
15351   __Pyx_GOTREF(__pyx_t_2);
15352   __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 924, __pyx_L1_error)
15353   __Pyx_GOTREF(__pyx_t_3);
15354   if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_ns, __pyx_n_u_IMAGE_STRUCTURE) < 0) __PYX_ERR(0, 924, __pyx_L1_error)
15355   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 924, __pyx_L1_error)
15356   __Pyx_GOTREF(__pyx_t_4);
15357   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15358   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15359   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 924, __pyx_L1_error)
15360   __Pyx_GOTREF(__pyx_t_3);
15361   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15362   __pyx_t_4 = NULL;
15363   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
15364     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
15365     if (likely(__pyx_t_4)) {
15366       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15367       __Pyx_INCREF(__pyx_t_4);
15368       __Pyx_INCREF(function);
15369       __Pyx_DECREF_SET(__pyx_t_3, function);
15370     }
15371   }
15372   __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_n_u_COMPRESSION) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_COMPRESSION);
15373   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15374   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
15375   __Pyx_GOTREF(__pyx_t_1);
15376   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15377   __pyx_v_val = __pyx_t_1;
15378   __pyx_t_1 = 0;
15379 
15380   /* "rasterio/_base.pyx":925
15381  *     def compression(self):
15382  *         val = self.tags(ns='IMAGE_STRUCTURE').get('COMPRESSION')
15383  *         if val:             # <<<<<<<<<<<<<<
15384  *             # 'YCbCr JPEG' will be normalized to 'JPEG'
15385  *             val = val.split(' ')[-1]
15386  */
15387   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 925, __pyx_L1_error)
15388   if (__pyx_t_5) {
15389 
15390     /* "rasterio/_base.pyx":927
15391  *         if val:
15392  *             # 'YCbCr JPEG' will be normalized to 'JPEG'
15393  *             val = val.split(' ')[-1]             # <<<<<<<<<<<<<<
15394  *             return Compression(val)
15395  *         else:
15396  */
15397     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_val, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 927, __pyx_L1_error)
15398     __Pyx_GOTREF(__pyx_t_3);
15399     __pyx_t_4 = NULL;
15400     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
15401       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
15402       if (likely(__pyx_t_4)) {
15403         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15404         __Pyx_INCREF(__pyx_t_4);
15405         __Pyx_INCREF(function);
15406         __Pyx_DECREF_SET(__pyx_t_3, function);
15407       }
15408     }
15409     __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u__8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u__8);
15410     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15411     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 927, __pyx_L1_error)
15412     __Pyx_GOTREF(__pyx_t_1);
15413     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15414     __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 927, __pyx_L1_error)
15415     __Pyx_GOTREF(__pyx_t_3);
15416     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15417     __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_3);
15418     __pyx_t_3 = 0;
15419 
15420     /* "rasterio/_base.pyx":928
15421  *             # 'YCbCr JPEG' will be normalized to 'JPEG'
15422  *             val = val.split(' ')[-1]
15423  *             return Compression(val)             # <<<<<<<<<<<<<<
15424  *         else:
15425  *             return None
15426  */
15427     __Pyx_XDECREF(__pyx_r);
15428     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Compression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 928, __pyx_L1_error)
15429     __Pyx_GOTREF(__pyx_t_1);
15430     __pyx_t_4 = NULL;
15431     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
15432       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
15433       if (likely(__pyx_t_4)) {
15434         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
15435         __Pyx_INCREF(__pyx_t_4);
15436         __Pyx_INCREF(function);
15437         __Pyx_DECREF_SET(__pyx_t_1, function);
15438       }
15439     }
15440     __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_val) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_val);
15441     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15442     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 928, __pyx_L1_error)
15443     __Pyx_GOTREF(__pyx_t_3);
15444     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15445     __pyx_r = __pyx_t_3;
15446     __pyx_t_3 = 0;
15447     goto __pyx_L0;
15448 
15449     /* "rasterio/_base.pyx":925
15450  *     def compression(self):
15451  *         val = self.tags(ns='IMAGE_STRUCTURE').get('COMPRESSION')
15452  *         if val:             # <<<<<<<<<<<<<<
15453  *             # 'YCbCr JPEG' will be normalized to 'JPEG'
15454  *             val = val.split(' ')[-1]
15455  */
15456   }
15457 
15458   /* "rasterio/_base.pyx":930
15459  *             return Compression(val)
15460  *         else:
15461  *             return None             # <<<<<<<<<<<<<<
15462  *
15463  *     @property
15464  */
15465   /*else*/ {
15466     __Pyx_XDECREF(__pyx_r);
15467     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15468     goto __pyx_L0;
15469   }
15470 
15471   /* "rasterio/_base.pyx":923
15472  *
15473  *     @property
15474  *     def compression(self):             # <<<<<<<<<<<<<<
15475  *         val = self.tags(ns='IMAGE_STRUCTURE').get('COMPRESSION')
15476  *         if val:
15477  */
15478 
15479   /* function exit code */
15480   __pyx_L1_error:;
15481   __Pyx_XDECREF(__pyx_t_1);
15482   __Pyx_XDECREF(__pyx_t_2);
15483   __Pyx_XDECREF(__pyx_t_3);
15484   __Pyx_XDECREF(__pyx_t_4);
15485   __Pyx_AddTraceback("rasterio._base.DatasetBase.compression.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15486   __pyx_r = NULL;
15487   __pyx_L0:;
15488   __Pyx_XDECREF(__pyx_v_val);
15489   __Pyx_XGIVEREF(__pyx_r);
15490   __Pyx_RefNannyFinishContext();
15491   return __pyx_r;
15492 }
15493 
15494 /* "rasterio/_base.pyx":933
15495  *
15496  *     @property
15497  *     def interleaving(self):             # <<<<<<<<<<<<<<
15498  *         val = self.tags(ns='IMAGE_STRUCTURE').get('INTERLEAVE')
15499  *         if val:
15500  */
15501 
15502 /* Python wrapper */
15503 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_12interleaving_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_12interleaving_1__get__(PyObject * __pyx_v_self)15504 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_12interleaving_1__get__(PyObject *__pyx_v_self) {
15505   PyObject *__pyx_r = 0;
15506   __Pyx_RefNannyDeclarations
15507   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15508   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_12interleaving___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
15509 
15510   /* function exit code */
15511   __Pyx_RefNannyFinishContext();
15512   return __pyx_r;
15513 }
15514 
__pyx_pf_8rasterio_5_base_11DatasetBase_12interleaving___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)15515 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_12interleaving___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
15516   PyObject *__pyx_v_val = NULL;
15517   PyObject *__pyx_r = NULL;
15518   __Pyx_RefNannyDeclarations
15519   PyObject *__pyx_t_1 = NULL;
15520   PyObject *__pyx_t_2 = NULL;
15521   PyObject *__pyx_t_3 = NULL;
15522   PyObject *__pyx_t_4 = NULL;
15523   int __pyx_t_5;
15524   int __pyx_lineno = 0;
15525   const char *__pyx_filename = NULL;
15526   int __pyx_clineno = 0;
15527   __Pyx_RefNannySetupContext("__get__", 0);
15528 
15529   /* "rasterio/_base.pyx":934
15530  *     @property
15531  *     def interleaving(self):
15532  *         val = self.tags(ns='IMAGE_STRUCTURE').get('INTERLEAVE')             # <<<<<<<<<<<<<<
15533  *         if val:
15534  *             return Interleaving(val)
15535  */
15536   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 934, __pyx_L1_error)
15537   __Pyx_GOTREF(__pyx_t_2);
15538   __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 934, __pyx_L1_error)
15539   __Pyx_GOTREF(__pyx_t_3);
15540   if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_ns, __pyx_n_u_IMAGE_STRUCTURE) < 0) __PYX_ERR(0, 934, __pyx_L1_error)
15541   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 934, __pyx_L1_error)
15542   __Pyx_GOTREF(__pyx_t_4);
15543   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15544   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15545   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 934, __pyx_L1_error)
15546   __Pyx_GOTREF(__pyx_t_3);
15547   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15548   __pyx_t_4 = NULL;
15549   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
15550     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
15551     if (likely(__pyx_t_4)) {
15552       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15553       __Pyx_INCREF(__pyx_t_4);
15554       __Pyx_INCREF(function);
15555       __Pyx_DECREF_SET(__pyx_t_3, function);
15556     }
15557   }
15558   __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_n_u_INTERLEAVE) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_INTERLEAVE);
15559   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15560   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 934, __pyx_L1_error)
15561   __Pyx_GOTREF(__pyx_t_1);
15562   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15563   __pyx_v_val = __pyx_t_1;
15564   __pyx_t_1 = 0;
15565 
15566   /* "rasterio/_base.pyx":935
15567  *     def interleaving(self):
15568  *         val = self.tags(ns='IMAGE_STRUCTURE').get('INTERLEAVE')
15569  *         if val:             # <<<<<<<<<<<<<<
15570  *             return Interleaving(val)
15571  *         else:
15572  */
15573   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 935, __pyx_L1_error)
15574   if (__pyx_t_5) {
15575 
15576     /* "rasterio/_base.pyx":936
15577  *         val = self.tags(ns='IMAGE_STRUCTURE').get('INTERLEAVE')
15578  *         if val:
15579  *             return Interleaving(val)             # <<<<<<<<<<<<<<
15580  *         else:
15581  *             return None
15582  */
15583     __Pyx_XDECREF(__pyx_r);
15584     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Interleaving); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 936, __pyx_L1_error)
15585     __Pyx_GOTREF(__pyx_t_3);
15586     __pyx_t_4 = NULL;
15587     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
15588       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
15589       if (likely(__pyx_t_4)) {
15590         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15591         __Pyx_INCREF(__pyx_t_4);
15592         __Pyx_INCREF(function);
15593         __Pyx_DECREF_SET(__pyx_t_3, function);
15594       }
15595     }
15596     __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_val) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_val);
15597     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15598     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 936, __pyx_L1_error)
15599     __Pyx_GOTREF(__pyx_t_1);
15600     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15601     __pyx_r = __pyx_t_1;
15602     __pyx_t_1 = 0;
15603     goto __pyx_L0;
15604 
15605     /* "rasterio/_base.pyx":935
15606  *     def interleaving(self):
15607  *         val = self.tags(ns='IMAGE_STRUCTURE').get('INTERLEAVE')
15608  *         if val:             # <<<<<<<<<<<<<<
15609  *             return Interleaving(val)
15610  *         else:
15611  */
15612   }
15613 
15614   /* "rasterio/_base.pyx":938
15615  *             return Interleaving(val)
15616  *         else:
15617  *             return None             # <<<<<<<<<<<<<<
15618  *
15619  *     @property
15620  */
15621   /*else*/ {
15622     __Pyx_XDECREF(__pyx_r);
15623     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15624     goto __pyx_L0;
15625   }
15626 
15627   /* "rasterio/_base.pyx":933
15628  *
15629  *     @property
15630  *     def interleaving(self):             # <<<<<<<<<<<<<<
15631  *         val = self.tags(ns='IMAGE_STRUCTURE').get('INTERLEAVE')
15632  *         if val:
15633  */
15634 
15635   /* function exit code */
15636   __pyx_L1_error:;
15637   __Pyx_XDECREF(__pyx_t_1);
15638   __Pyx_XDECREF(__pyx_t_2);
15639   __Pyx_XDECREF(__pyx_t_3);
15640   __Pyx_XDECREF(__pyx_t_4);
15641   __Pyx_AddTraceback("rasterio._base.DatasetBase.interleaving.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15642   __pyx_r = NULL;
15643   __pyx_L0:;
15644   __Pyx_XDECREF(__pyx_v_val);
15645   __Pyx_XGIVEREF(__pyx_r);
15646   __Pyx_RefNannyFinishContext();
15647   return __pyx_r;
15648 }
15649 
15650 /* "rasterio/_base.pyx":941
15651  *
15652  *     @property
15653  *     def photometric(self):             # <<<<<<<<<<<<<<
15654  *         val = self.tags(ns='IMAGE_STRUCTURE').get('SOURCE_COLOR_SPACE')
15655  *         if val:
15656  */
15657 
15658 /* Python wrapper */
15659 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_11photometric_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_11photometric_1__get__(PyObject * __pyx_v_self)15660 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_11photometric_1__get__(PyObject *__pyx_v_self) {
15661   PyObject *__pyx_r = 0;
15662   __Pyx_RefNannyDeclarations
15663   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15664   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_11photometric___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
15665 
15666   /* function exit code */
15667   __Pyx_RefNannyFinishContext();
15668   return __pyx_r;
15669 }
15670 
__pyx_pf_8rasterio_5_base_11DatasetBase_11photometric___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)15671 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_11photometric___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
15672   PyObject *__pyx_v_val = NULL;
15673   PyObject *__pyx_r = NULL;
15674   __Pyx_RefNannyDeclarations
15675   PyObject *__pyx_t_1 = NULL;
15676   PyObject *__pyx_t_2 = NULL;
15677   PyObject *__pyx_t_3 = NULL;
15678   PyObject *__pyx_t_4 = NULL;
15679   int __pyx_t_5;
15680   int __pyx_lineno = 0;
15681   const char *__pyx_filename = NULL;
15682   int __pyx_clineno = 0;
15683   __Pyx_RefNannySetupContext("__get__", 0);
15684 
15685   /* "rasterio/_base.pyx":942
15686  *     @property
15687  *     def photometric(self):
15688  *         val = self.tags(ns='IMAGE_STRUCTURE').get('SOURCE_COLOR_SPACE')             # <<<<<<<<<<<<<<
15689  *         if val:
15690  *             return PhotometricInterp(val)
15691  */
15692   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 942, __pyx_L1_error)
15693   __Pyx_GOTREF(__pyx_t_2);
15694   __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 942, __pyx_L1_error)
15695   __Pyx_GOTREF(__pyx_t_3);
15696   if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_ns, __pyx_n_u_IMAGE_STRUCTURE) < 0) __PYX_ERR(0, 942, __pyx_L1_error)
15697   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 942, __pyx_L1_error)
15698   __Pyx_GOTREF(__pyx_t_4);
15699   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15700   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15701   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 942, __pyx_L1_error)
15702   __Pyx_GOTREF(__pyx_t_3);
15703   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15704   __pyx_t_4 = NULL;
15705   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
15706     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
15707     if (likely(__pyx_t_4)) {
15708       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15709       __Pyx_INCREF(__pyx_t_4);
15710       __Pyx_INCREF(function);
15711       __Pyx_DECREF_SET(__pyx_t_3, function);
15712     }
15713   }
15714   __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_n_u_SOURCE_COLOR_SPACE) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_SOURCE_COLOR_SPACE);
15715   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15716   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 942, __pyx_L1_error)
15717   __Pyx_GOTREF(__pyx_t_1);
15718   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15719   __pyx_v_val = __pyx_t_1;
15720   __pyx_t_1 = 0;
15721 
15722   /* "rasterio/_base.pyx":943
15723  *     def photometric(self):
15724  *         val = self.tags(ns='IMAGE_STRUCTURE').get('SOURCE_COLOR_SPACE')
15725  *         if val:             # <<<<<<<<<<<<<<
15726  *             return PhotometricInterp(val)
15727  *         else:
15728  */
15729   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 943, __pyx_L1_error)
15730   if (__pyx_t_5) {
15731 
15732     /* "rasterio/_base.pyx":944
15733  *         val = self.tags(ns='IMAGE_STRUCTURE').get('SOURCE_COLOR_SPACE')
15734  *         if val:
15735  *             return PhotometricInterp(val)             # <<<<<<<<<<<<<<
15736  *         else:
15737  *             return None
15738  */
15739     __Pyx_XDECREF(__pyx_r);
15740     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PhotometricInterp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 944, __pyx_L1_error)
15741     __Pyx_GOTREF(__pyx_t_3);
15742     __pyx_t_4 = NULL;
15743     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
15744       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
15745       if (likely(__pyx_t_4)) {
15746         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15747         __Pyx_INCREF(__pyx_t_4);
15748         __Pyx_INCREF(function);
15749         __Pyx_DECREF_SET(__pyx_t_3, function);
15750       }
15751     }
15752     __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_val) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_val);
15753     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15754     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 944, __pyx_L1_error)
15755     __Pyx_GOTREF(__pyx_t_1);
15756     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15757     __pyx_r = __pyx_t_1;
15758     __pyx_t_1 = 0;
15759     goto __pyx_L0;
15760 
15761     /* "rasterio/_base.pyx":943
15762  *     def photometric(self):
15763  *         val = self.tags(ns='IMAGE_STRUCTURE').get('SOURCE_COLOR_SPACE')
15764  *         if val:             # <<<<<<<<<<<<<<
15765  *             return PhotometricInterp(val)
15766  *         else:
15767  */
15768   }
15769 
15770   /* "rasterio/_base.pyx":946
15771  *             return PhotometricInterp(val)
15772  *         else:
15773  *             return None             # <<<<<<<<<<<<<<
15774  *
15775  *     @property
15776  */
15777   /*else*/ {
15778     __Pyx_XDECREF(__pyx_r);
15779     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15780     goto __pyx_L0;
15781   }
15782 
15783   /* "rasterio/_base.pyx":941
15784  *
15785  *     @property
15786  *     def photometric(self):             # <<<<<<<<<<<<<<
15787  *         val = self.tags(ns='IMAGE_STRUCTURE').get('SOURCE_COLOR_SPACE')
15788  *         if val:
15789  */
15790 
15791   /* function exit code */
15792   __pyx_L1_error:;
15793   __Pyx_XDECREF(__pyx_t_1);
15794   __Pyx_XDECREF(__pyx_t_2);
15795   __Pyx_XDECREF(__pyx_t_3);
15796   __Pyx_XDECREF(__pyx_t_4);
15797   __Pyx_AddTraceback("rasterio._base.DatasetBase.photometric.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15798   __pyx_r = NULL;
15799   __pyx_L0:;
15800   __Pyx_XDECREF(__pyx_v_val);
15801   __Pyx_XGIVEREF(__pyx_r);
15802   __Pyx_RefNannyFinishContext();
15803   return __pyx_r;
15804 }
15805 
15806 /* "rasterio/_base.pyx":949
15807  *
15808  *     @property
15809  *     def is_tiled(self):             # <<<<<<<<<<<<<<
15810  *         if len(self.block_shapes) == 0:
15811  *             return False
15812  */
15813 
15814 /* Python wrapper */
15815 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_8is_tiled_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_8is_tiled_1__get__(PyObject * __pyx_v_self)15816 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_8is_tiled_1__get__(PyObject *__pyx_v_self) {
15817   PyObject *__pyx_r = 0;
15818   __Pyx_RefNannyDeclarations
15819   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15820   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_8is_tiled___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
15821 
15822   /* function exit code */
15823   __Pyx_RefNannyFinishContext();
15824   return __pyx_r;
15825 }
15826 
__pyx_pf_8rasterio_5_base_11DatasetBase_8is_tiled___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)15827 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_8is_tiled___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
15828   PyObject *__pyx_v_blockysize = NULL;
15829   PyObject *__pyx_v_blockxsize = NULL;
15830   PyObject *__pyx_r = NULL;
15831   __Pyx_RefNannyDeclarations
15832   PyObject *__pyx_t_1 = NULL;
15833   Py_ssize_t __pyx_t_2;
15834   int __pyx_t_3;
15835   PyObject *__pyx_t_4 = NULL;
15836   PyObject *__pyx_t_5 = NULL;
15837   PyObject *__pyx_t_6 = NULL;
15838   PyObject *(*__pyx_t_7)(PyObject *);
15839   int __pyx_t_8;
15840   int __pyx_lineno = 0;
15841   const char *__pyx_filename = NULL;
15842   int __pyx_clineno = 0;
15843   __Pyx_RefNannySetupContext("__get__", 0);
15844 
15845   /* "rasterio/_base.pyx":950
15846  *     @property
15847  *     def is_tiled(self):
15848  *         if len(self.block_shapes) == 0:             # <<<<<<<<<<<<<<
15849  *             return False
15850  *         else:
15851  */
15852   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_block_shapes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 950, __pyx_L1_error)
15853   __Pyx_GOTREF(__pyx_t_1);
15854   __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 950, __pyx_L1_error)
15855   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15856   __pyx_t_3 = ((__pyx_t_2 == 0) != 0);
15857   if (__pyx_t_3) {
15858 
15859     /* "rasterio/_base.pyx":951
15860  *     def is_tiled(self):
15861  *         if len(self.block_shapes) == 0:
15862  *             return False             # <<<<<<<<<<<<<<
15863  *         else:
15864  *             blockysize, blockxsize = self.block_shapes[0]
15865  */
15866     __Pyx_XDECREF(__pyx_r);
15867     __Pyx_INCREF(Py_False);
15868     __pyx_r = Py_False;
15869     goto __pyx_L0;
15870 
15871     /* "rasterio/_base.pyx":950
15872  *     @property
15873  *     def is_tiled(self):
15874  *         if len(self.block_shapes) == 0:             # <<<<<<<<<<<<<<
15875  *             return False
15876  *         else:
15877  */
15878   }
15879 
15880   /* "rasterio/_base.pyx":953
15881  *             return False
15882  *         else:
15883  *             blockysize, blockxsize = self.block_shapes[0]             # <<<<<<<<<<<<<<
15884  *             if blockxsize % 16 or blockysize % 16:
15885  *                 return False
15886  */
15887   /*else*/ {
15888     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_block_shapes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 953, __pyx_L1_error)
15889     __Pyx_GOTREF(__pyx_t_1);
15890     __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 953, __pyx_L1_error)
15891     __Pyx_GOTREF(__pyx_t_4);
15892     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15893     if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
15894       PyObject* sequence = __pyx_t_4;
15895       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
15896       if (unlikely(size != 2)) {
15897         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
15898         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
15899         __PYX_ERR(0, 953, __pyx_L1_error)
15900       }
15901       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15902       if (likely(PyTuple_CheckExact(sequence))) {
15903         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
15904         __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
15905       } else {
15906         __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
15907         __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
15908       }
15909       __Pyx_INCREF(__pyx_t_1);
15910       __Pyx_INCREF(__pyx_t_5);
15911       #else
15912       __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 953, __pyx_L1_error)
15913       __Pyx_GOTREF(__pyx_t_1);
15914       __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 953, __pyx_L1_error)
15915       __Pyx_GOTREF(__pyx_t_5);
15916       #endif
15917       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15918     } else {
15919       Py_ssize_t index = -1;
15920       __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 953, __pyx_L1_error)
15921       __Pyx_GOTREF(__pyx_t_6);
15922       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15923       __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
15924       index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
15925       __Pyx_GOTREF(__pyx_t_1);
15926       index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
15927       __Pyx_GOTREF(__pyx_t_5);
15928       if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 953, __pyx_L1_error)
15929       __pyx_t_7 = NULL;
15930       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15931       goto __pyx_L5_unpacking_done;
15932       __pyx_L4_unpacking_failed:;
15933       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15934       __pyx_t_7 = NULL;
15935       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
15936       __PYX_ERR(0, 953, __pyx_L1_error)
15937       __pyx_L5_unpacking_done:;
15938     }
15939     __pyx_v_blockysize = __pyx_t_1;
15940     __pyx_t_1 = 0;
15941     __pyx_v_blockxsize = __pyx_t_5;
15942     __pyx_t_5 = 0;
15943 
15944     /* "rasterio/_base.pyx":954
15945  *         else:
15946  *             blockysize, blockxsize = self.block_shapes[0]
15947  *             if blockxsize % 16 or blockysize % 16:             # <<<<<<<<<<<<<<
15948  *                 return False
15949  *             # Perfectly square is a special case/
15950  */
15951     __pyx_t_4 = __Pyx_PyInt_RemainderObjC(__pyx_v_blockxsize, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 954, __pyx_L1_error)
15952     __Pyx_GOTREF(__pyx_t_4);
15953     __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 954, __pyx_L1_error)
15954     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15955     if (!__pyx_t_8) {
15956     } else {
15957       __pyx_t_3 = __pyx_t_8;
15958       goto __pyx_L7_bool_binop_done;
15959     }
15960     __pyx_t_4 = __Pyx_PyInt_RemainderObjC(__pyx_v_blockysize, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 954, __pyx_L1_error)
15961     __Pyx_GOTREF(__pyx_t_4);
15962     __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 954, __pyx_L1_error)
15963     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15964     __pyx_t_3 = __pyx_t_8;
15965     __pyx_L7_bool_binop_done:;
15966     if (__pyx_t_3) {
15967 
15968       /* "rasterio/_base.pyx":955
15969  *             blockysize, blockxsize = self.block_shapes[0]
15970  *             if blockxsize % 16 or blockysize % 16:
15971  *                 return False             # <<<<<<<<<<<<<<
15972  *             # Perfectly square is a special case/
15973  *             if blockxsize == blockysize == self.height == self.width:
15974  */
15975       __Pyx_XDECREF(__pyx_r);
15976       __Pyx_INCREF(Py_False);
15977       __pyx_r = Py_False;
15978       goto __pyx_L0;
15979 
15980       /* "rasterio/_base.pyx":954
15981  *         else:
15982  *             blockysize, blockxsize = self.block_shapes[0]
15983  *             if blockxsize % 16 or blockysize % 16:             # <<<<<<<<<<<<<<
15984  *                 return False
15985  *             # Perfectly square is a special case/
15986  */
15987     }
15988 
15989     /* "rasterio/_base.pyx":957
15990  *                 return False
15991  *             # Perfectly square is a special case/
15992  *             if blockxsize == blockysize == self.height == self.width:             # <<<<<<<<<<<<<<
15993  *                 return True
15994  *             else:
15995  */
15996     __pyx_t_4 = PyObject_RichCompare(__pyx_v_blockxsize, __pyx_v_blockysize, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 957, __pyx_L1_error)
15997     if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
15998       __Pyx_DECREF(__pyx_t_4);
15999       __pyx_t_4 = PyObject_RichCompare(__pyx_v_blockysize, __pyx_v_self->height, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 957, __pyx_L1_error)
16000       if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
16001         __Pyx_DECREF(__pyx_t_4);
16002         __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->height, __pyx_v_self->width, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 957, __pyx_L1_error)
16003       }
16004     }
16005     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 957, __pyx_L1_error)
16006     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16007     if (__pyx_t_3) {
16008 
16009       /* "rasterio/_base.pyx":958
16010  *             # Perfectly square is a special case/
16011  *             if blockxsize == blockysize == self.height == self.width:
16012  *                 return True             # <<<<<<<<<<<<<<
16013  *             else:
16014  *                 return blockxsize < self.width or blockxsize > self.width
16015  */
16016       __Pyx_XDECREF(__pyx_r);
16017       __Pyx_INCREF(Py_True);
16018       __pyx_r = Py_True;
16019       goto __pyx_L0;
16020 
16021       /* "rasterio/_base.pyx":957
16022  *                 return False
16023  *             # Perfectly square is a special case/
16024  *             if blockxsize == blockysize == self.height == self.width:             # <<<<<<<<<<<<<<
16025  *                 return True
16026  *             else:
16027  */
16028     }
16029 
16030     /* "rasterio/_base.pyx":960
16031  *                 return True
16032  *             else:
16033  *                 return blockxsize < self.width or blockxsize > self.width             # <<<<<<<<<<<<<<
16034  *
16035  *     property profile:
16036  */
16037     /*else*/ {
16038       __Pyx_XDECREF(__pyx_r);
16039       __pyx_t_5 = PyObject_RichCompare(__pyx_v_blockxsize, __pyx_v_self->width, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 960, __pyx_L1_error)
16040       __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 960, __pyx_L1_error)
16041       if (!__pyx_t_3) {
16042         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16043       } else {
16044         __Pyx_INCREF(__pyx_t_5);
16045         __pyx_t_4 = __pyx_t_5;
16046         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16047         goto __pyx_L10_bool_binop_done;
16048       }
16049       __pyx_t_5 = PyObject_RichCompare(__pyx_v_blockxsize, __pyx_v_self->width, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 960, __pyx_L1_error)
16050       __Pyx_INCREF(__pyx_t_5);
16051       __pyx_t_4 = __pyx_t_5;
16052       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16053       __pyx_L10_bool_binop_done:;
16054       __pyx_r = __pyx_t_4;
16055       __pyx_t_4 = 0;
16056       goto __pyx_L0;
16057     }
16058   }
16059 
16060   /* "rasterio/_base.pyx":949
16061  *
16062  *     @property
16063  *     def is_tiled(self):             # <<<<<<<<<<<<<<
16064  *         if len(self.block_shapes) == 0:
16065  *             return False
16066  */
16067 
16068   /* function exit code */
16069   __pyx_L1_error:;
16070   __Pyx_XDECREF(__pyx_t_1);
16071   __Pyx_XDECREF(__pyx_t_4);
16072   __Pyx_XDECREF(__pyx_t_5);
16073   __Pyx_XDECREF(__pyx_t_6);
16074   __Pyx_AddTraceback("rasterio._base.DatasetBase.is_tiled.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16075   __pyx_r = NULL;
16076   __pyx_L0:;
16077   __Pyx_XDECREF(__pyx_v_blockysize);
16078   __Pyx_XDECREF(__pyx_v_blockxsize);
16079   __Pyx_XGIVEREF(__pyx_r);
16080   __Pyx_RefNannyFinishContext();
16081   return __pyx_r;
16082 }
16083 
16084 /* "rasterio/_base.pyx":968
16085  *         create a clone of this dataset.
16086  *         """
16087  *         def __get__(self):             # <<<<<<<<<<<<<<
16088  *             m = Profile(**self.meta)
16089  *
16090  */
16091 
16092 /* Python wrapper */
16093 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7profile_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7profile_1__get__(PyObject * __pyx_v_self)16094 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7profile_1__get__(PyObject *__pyx_v_self) {
16095   PyObject *__pyx_r = 0;
16096   __Pyx_RefNannyDeclarations
16097   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
16098   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_7profile___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
16099 
16100   /* function exit code */
16101   __Pyx_RefNannyFinishContext();
16102   return __pyx_r;
16103 }
16104 
__pyx_pf_8rasterio_5_base_11DatasetBase_7profile___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)16105 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_7profile___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
16106   PyObject *__pyx_v_m = NULL;
16107   PyObject *__pyx_r = NULL;
16108   __Pyx_RefNannyDeclarations
16109   PyObject *__pyx_t_1 = NULL;
16110   PyObject *__pyx_t_2 = NULL;
16111   PyObject *__pyx_t_3 = NULL;
16112   int __pyx_t_4;
16113   PyObject *__pyx_t_5 = NULL;
16114   int __pyx_lineno = 0;
16115   const char *__pyx_filename = NULL;
16116   int __pyx_clineno = 0;
16117   __Pyx_RefNannySetupContext("__get__", 0);
16118 
16119   /* "rasterio/_base.pyx":969
16120  *         """
16121  *         def __get__(self):
16122  *             m = Profile(**self.meta)             # <<<<<<<<<<<<<<
16123  *
16124  *             if self.is_tiled:
16125  */
16126   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Profile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 969, __pyx_L1_error)
16127   __Pyx_GOTREF(__pyx_t_1);
16128   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_meta); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 969, __pyx_L1_error)
16129   __Pyx_GOTREF(__pyx_t_3);
16130   if (unlikely(__pyx_t_3 == Py_None)) {
16131     PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
16132     __PYX_ERR(0, 969, __pyx_L1_error)
16133   }
16134   if (likely(PyDict_CheckExact(__pyx_t_3))) {
16135     __pyx_t_2 = PyDict_Copy(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 969, __pyx_L1_error)
16136     __Pyx_GOTREF(__pyx_t_2);
16137     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16138   } else {
16139     __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 969, __pyx_L1_error)
16140     __Pyx_GOTREF(__pyx_t_2);
16141     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16142   }
16143   __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 969, __pyx_L1_error)
16144   __Pyx_GOTREF(__pyx_t_3);
16145   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16146   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16147   __pyx_v_m = __pyx_t_3;
16148   __pyx_t_3 = 0;
16149 
16150   /* "rasterio/_base.pyx":971
16151  *             m = Profile(**self.meta)
16152  *
16153  *             if self.is_tiled:             # <<<<<<<<<<<<<<
16154  *                 m.update(
16155  *                     blockxsize=self.block_shapes[0][1],
16156  */
16157   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_tiled); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 971, __pyx_L1_error)
16158   __Pyx_GOTREF(__pyx_t_3);
16159   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 971, __pyx_L1_error)
16160   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16161   if (__pyx_t_4) {
16162 
16163     /* "rasterio/_base.pyx":972
16164  *
16165  *             if self.is_tiled:
16166  *                 m.update(             # <<<<<<<<<<<<<<
16167  *                     blockxsize=self.block_shapes[0][1],
16168  *                     blockysize=self.block_shapes[0][0],
16169  */
16170     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_n_s_update); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 972, __pyx_L1_error)
16171     __Pyx_GOTREF(__pyx_t_3);
16172 
16173     /* "rasterio/_base.pyx":973
16174  *             if self.is_tiled:
16175  *                 m.update(
16176  *                     blockxsize=self.block_shapes[0][1],             # <<<<<<<<<<<<<<
16177  *                     blockysize=self.block_shapes[0][0],
16178  *                     tiled=True)
16179  */
16180     __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 973, __pyx_L1_error)
16181     __Pyx_GOTREF(__pyx_t_2);
16182     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_block_shapes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 973, __pyx_L1_error)
16183     __Pyx_GOTREF(__pyx_t_1);
16184     __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 973, __pyx_L1_error)
16185     __Pyx_GOTREF(__pyx_t_5);
16186     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16187     __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 973, __pyx_L1_error)
16188     __Pyx_GOTREF(__pyx_t_1);
16189     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16190     if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_blockxsize, __pyx_t_1) < 0) __PYX_ERR(0, 973, __pyx_L1_error)
16191     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16192 
16193     /* "rasterio/_base.pyx":974
16194  *                 m.update(
16195  *                     blockxsize=self.block_shapes[0][1],
16196  *                     blockysize=self.block_shapes[0][0],             # <<<<<<<<<<<<<<
16197  *                     tiled=True)
16198  *             else:
16199  */
16200     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_block_shapes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 974, __pyx_L1_error)
16201     __Pyx_GOTREF(__pyx_t_1);
16202     __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 974, __pyx_L1_error)
16203     __Pyx_GOTREF(__pyx_t_5);
16204     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16205     __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 974, __pyx_L1_error)
16206     __Pyx_GOTREF(__pyx_t_1);
16207     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16208     if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_blockysize, __pyx_t_1) < 0) __PYX_ERR(0, 973, __pyx_L1_error)
16209     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16210 
16211     /* "rasterio/_base.pyx":975
16212  *                     blockxsize=self.block_shapes[0][1],
16213  *                     blockysize=self.block_shapes[0][0],
16214  *                     tiled=True)             # <<<<<<<<<<<<<<
16215  *             else:
16216  *                 m.update(tiled=False)
16217  */
16218     if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_tiled, Py_True) < 0) __PYX_ERR(0, 973, __pyx_L1_error)
16219 
16220     /* "rasterio/_base.pyx":972
16221  *
16222  *             if self.is_tiled:
16223  *                 m.update(             # <<<<<<<<<<<<<<
16224  *                     blockxsize=self.block_shapes[0][1],
16225  *                     blockysize=self.block_shapes[0][0],
16226  */
16227     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 972, __pyx_L1_error)
16228     __Pyx_GOTREF(__pyx_t_1);
16229     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16230     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16231     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16232 
16233     /* "rasterio/_base.pyx":971
16234  *             m = Profile(**self.meta)
16235  *
16236  *             if self.is_tiled:             # <<<<<<<<<<<<<<
16237  *                 m.update(
16238  *                     blockxsize=self.block_shapes[0][1],
16239  */
16240     goto __pyx_L3;
16241   }
16242 
16243   /* "rasterio/_base.pyx":977
16244  *                     tiled=True)
16245  *             else:
16246  *                 m.update(tiled=False)             # <<<<<<<<<<<<<<
16247  *             if self.compression:
16248  *                 m['compress'] = self.compression.name
16249  */
16250   /*else*/ {
16251     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_n_s_update); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 977, __pyx_L1_error)
16252     __Pyx_GOTREF(__pyx_t_1);
16253     __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 977, __pyx_L1_error)
16254     __Pyx_GOTREF(__pyx_t_2);
16255     if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_tiled, Py_False) < 0) __PYX_ERR(0, 977, __pyx_L1_error)
16256     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 977, __pyx_L1_error)
16257     __Pyx_GOTREF(__pyx_t_3);
16258     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16259     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16260     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16261   }
16262   __pyx_L3:;
16263 
16264   /* "rasterio/_base.pyx":978
16265  *             else:
16266  *                 m.update(tiled=False)
16267  *             if self.compression:             # <<<<<<<<<<<<<<
16268  *                 m['compress'] = self.compression.name
16269  *             if self.interleaving:
16270  */
16271   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_compression); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 978, __pyx_L1_error)
16272   __Pyx_GOTREF(__pyx_t_3);
16273   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 978, __pyx_L1_error)
16274   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16275   if (__pyx_t_4) {
16276 
16277     /* "rasterio/_base.pyx":979
16278  *                 m.update(tiled=False)
16279  *             if self.compression:
16280  *                 m['compress'] = self.compression.name             # <<<<<<<<<<<<<<
16281  *             if self.interleaving:
16282  *                 m['interleave'] = self.interleaving.name
16283  */
16284     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_compression); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 979, __pyx_L1_error)
16285     __Pyx_GOTREF(__pyx_t_3);
16286     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 979, __pyx_L1_error)
16287     __Pyx_GOTREF(__pyx_t_2);
16288     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16289     if (unlikely(PyObject_SetItem(__pyx_v_m, __pyx_n_u_compress, __pyx_t_2) < 0)) __PYX_ERR(0, 979, __pyx_L1_error)
16290     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16291 
16292     /* "rasterio/_base.pyx":978
16293  *             else:
16294  *                 m.update(tiled=False)
16295  *             if self.compression:             # <<<<<<<<<<<<<<
16296  *                 m['compress'] = self.compression.name
16297  *             if self.interleaving:
16298  */
16299   }
16300 
16301   /* "rasterio/_base.pyx":980
16302  *             if self.compression:
16303  *                 m['compress'] = self.compression.name
16304  *             if self.interleaving:             # <<<<<<<<<<<<<<
16305  *                 m['interleave'] = self.interleaving.name
16306  *             if self.photometric:
16307  */
16308   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_interleaving); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 980, __pyx_L1_error)
16309   __Pyx_GOTREF(__pyx_t_2);
16310   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 980, __pyx_L1_error)
16311   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16312   if (__pyx_t_4) {
16313 
16314     /* "rasterio/_base.pyx":981
16315  *                 m['compress'] = self.compression.name
16316  *             if self.interleaving:
16317  *                 m['interleave'] = self.interleaving.name             # <<<<<<<<<<<<<<
16318  *             if self.photometric:
16319  *                 m['photometric'] = self.photometric.name
16320  */
16321     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_interleaving); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 981, __pyx_L1_error)
16322     __Pyx_GOTREF(__pyx_t_2);
16323     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 981, __pyx_L1_error)
16324     __Pyx_GOTREF(__pyx_t_3);
16325     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16326     if (unlikely(PyObject_SetItem(__pyx_v_m, __pyx_n_u_interleave, __pyx_t_3) < 0)) __PYX_ERR(0, 981, __pyx_L1_error)
16327     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16328 
16329     /* "rasterio/_base.pyx":980
16330  *             if self.compression:
16331  *                 m['compress'] = self.compression.name
16332  *             if self.interleaving:             # <<<<<<<<<<<<<<
16333  *                 m['interleave'] = self.interleaving.name
16334  *             if self.photometric:
16335  */
16336   }
16337 
16338   /* "rasterio/_base.pyx":982
16339  *             if self.interleaving:
16340  *                 m['interleave'] = self.interleaving.name
16341  *             if self.photometric:             # <<<<<<<<<<<<<<
16342  *                 m['photometric'] = self.photometric.name
16343  *             return m
16344  */
16345   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_photometric); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 982, __pyx_L1_error)
16346   __Pyx_GOTREF(__pyx_t_3);
16347   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 982, __pyx_L1_error)
16348   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16349   if (__pyx_t_4) {
16350 
16351     /* "rasterio/_base.pyx":983
16352  *                 m['interleave'] = self.interleaving.name
16353  *             if self.photometric:
16354  *                 m['photometric'] = self.photometric.name             # <<<<<<<<<<<<<<
16355  *             return m
16356  *
16357  */
16358     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_photometric); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 983, __pyx_L1_error)
16359     __Pyx_GOTREF(__pyx_t_3);
16360     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 983, __pyx_L1_error)
16361     __Pyx_GOTREF(__pyx_t_2);
16362     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16363     if (unlikely(PyObject_SetItem(__pyx_v_m, __pyx_n_u_photometric, __pyx_t_2) < 0)) __PYX_ERR(0, 983, __pyx_L1_error)
16364     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16365 
16366     /* "rasterio/_base.pyx":982
16367  *             if self.interleaving:
16368  *                 m['interleave'] = self.interleaving.name
16369  *             if self.photometric:             # <<<<<<<<<<<<<<
16370  *                 m['photometric'] = self.photometric.name
16371  *             return m
16372  */
16373   }
16374 
16375   /* "rasterio/_base.pyx":984
16376  *             if self.photometric:
16377  *                 m['photometric'] = self.photometric.name
16378  *             return m             # <<<<<<<<<<<<<<
16379  *
16380  *     def lnglat(self):
16381  */
16382   __Pyx_XDECREF(__pyx_r);
16383   __Pyx_INCREF(__pyx_v_m);
16384   __pyx_r = __pyx_v_m;
16385   goto __pyx_L0;
16386 
16387   /* "rasterio/_base.pyx":968
16388  *         create a clone of this dataset.
16389  *         """
16390  *         def __get__(self):             # <<<<<<<<<<<<<<
16391  *             m = Profile(**self.meta)
16392  *
16393  */
16394 
16395   /* function exit code */
16396   __pyx_L1_error:;
16397   __Pyx_XDECREF(__pyx_t_1);
16398   __Pyx_XDECREF(__pyx_t_2);
16399   __Pyx_XDECREF(__pyx_t_3);
16400   __Pyx_XDECREF(__pyx_t_5);
16401   __Pyx_AddTraceback("rasterio._base.DatasetBase.profile.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16402   __pyx_r = NULL;
16403   __pyx_L0:;
16404   __Pyx_XDECREF(__pyx_v_m);
16405   __Pyx_XGIVEREF(__pyx_r);
16406   __Pyx_RefNannyFinishContext();
16407   return __pyx_r;
16408 }
16409 
16410 /* "rasterio/_base.pyx":986
16411  *             return m
16412  *
16413  *     def lnglat(self):             # <<<<<<<<<<<<<<
16414  *         w, s, e, n = self.bounds
16415  *         cx = (w + e)/2.0
16416  */
16417 
16418 /* Python wrapper */
16419 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_54lnglat(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_54lnglat(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)16420 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_54lnglat(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16421   PyObject *__pyx_r = 0;
16422   __Pyx_RefNannyDeclarations
16423   __Pyx_RefNannySetupContext("lnglat (wrapper)", 0);
16424   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_53lnglat(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
16425 
16426   /* function exit code */
16427   __Pyx_RefNannyFinishContext();
16428   return __pyx_r;
16429 }
16430 
__pyx_pf_8rasterio_5_base_11DatasetBase_53lnglat(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)16431 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_53lnglat(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
16432   PyObject *__pyx_v_w = NULL;
16433   PyObject *__pyx_v_s = NULL;
16434   PyObject *__pyx_v_e = NULL;
16435   PyObject *__pyx_v_n = NULL;
16436   PyObject *__pyx_v_cx = NULL;
16437   PyObject *__pyx_v_cy = NULL;
16438   PyObject *__pyx_v_lng = NULL;
16439   PyObject *__pyx_v_lat = NULL;
16440   PyObject *__pyx_r = NULL;
16441   __Pyx_RefNannyDeclarations
16442   PyObject *__pyx_t_1 = NULL;
16443   PyObject *__pyx_t_2 = NULL;
16444   PyObject *__pyx_t_3 = NULL;
16445   PyObject *__pyx_t_4 = NULL;
16446   PyObject *__pyx_t_5 = NULL;
16447   PyObject *__pyx_t_6 = NULL;
16448   PyObject *(*__pyx_t_7)(PyObject *);
16449   PyObject *__pyx_t_8 = NULL;
16450   int __pyx_t_9;
16451   PyObject *__pyx_t_10 = NULL;
16452   int __pyx_lineno = 0;
16453   const char *__pyx_filename = NULL;
16454   int __pyx_clineno = 0;
16455   __Pyx_RefNannySetupContext("lnglat", 0);
16456 
16457   /* "rasterio/_base.pyx":987
16458  *
16459  *     def lnglat(self):
16460  *         w, s, e, n = self.bounds             # <<<<<<<<<<<<<<
16461  *         cx = (w + e)/2.0
16462  *         cy = (s + n)/2.0
16463  */
16464   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_bounds); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 987, __pyx_L1_error)
16465   __Pyx_GOTREF(__pyx_t_1);
16466   if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
16467     PyObject* sequence = __pyx_t_1;
16468     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
16469     if (unlikely(size != 4)) {
16470       if (size > 4) __Pyx_RaiseTooManyValuesError(4);
16471       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
16472       __PYX_ERR(0, 987, __pyx_L1_error)
16473     }
16474     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
16475     if (likely(PyTuple_CheckExact(sequence))) {
16476       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
16477       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
16478       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
16479       __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3);
16480     } else {
16481       __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
16482       __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
16483       __pyx_t_4 = PyList_GET_ITEM(sequence, 2);
16484       __pyx_t_5 = PyList_GET_ITEM(sequence, 3);
16485     }
16486     __Pyx_INCREF(__pyx_t_2);
16487     __Pyx_INCREF(__pyx_t_3);
16488     __Pyx_INCREF(__pyx_t_4);
16489     __Pyx_INCREF(__pyx_t_5);
16490     #else
16491     {
16492       Py_ssize_t i;
16493       PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5};
16494       for (i=0; i < 4; i++) {
16495         PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 987, __pyx_L1_error)
16496         __Pyx_GOTREF(item);
16497         *(temps[i]) = item;
16498       }
16499     }
16500     #endif
16501     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16502   } else {
16503     Py_ssize_t index = -1;
16504     PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5};
16505     __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 987, __pyx_L1_error)
16506     __Pyx_GOTREF(__pyx_t_6);
16507     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16508     __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
16509     for (index=0; index < 4; index++) {
16510       PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
16511       __Pyx_GOTREF(item);
16512       *(temps[index]) = item;
16513     }
16514     if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 987, __pyx_L1_error)
16515     __pyx_t_7 = NULL;
16516     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
16517     goto __pyx_L4_unpacking_done;
16518     __pyx_L3_unpacking_failed:;
16519     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
16520     __pyx_t_7 = NULL;
16521     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
16522     __PYX_ERR(0, 987, __pyx_L1_error)
16523     __pyx_L4_unpacking_done:;
16524   }
16525   __pyx_v_w = __pyx_t_2;
16526   __pyx_t_2 = 0;
16527   __pyx_v_s = __pyx_t_3;
16528   __pyx_t_3 = 0;
16529   __pyx_v_e = __pyx_t_4;
16530   __pyx_t_4 = 0;
16531   __pyx_v_n = __pyx_t_5;
16532   __pyx_t_5 = 0;
16533 
16534   /* "rasterio/_base.pyx":988
16535  *     def lnglat(self):
16536  *         w, s, e, n = self.bounds
16537  *         cx = (w + e)/2.0             # <<<<<<<<<<<<<<
16538  *         cy = (s + n)/2.0
16539  *         lng, lat = _transform(
16540  */
16541   __pyx_t_1 = PyNumber_Add(__pyx_v_w, __pyx_v_e); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 988, __pyx_L1_error)
16542   __Pyx_GOTREF(__pyx_t_1);
16543   __pyx_t_5 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_1, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 988, __pyx_L1_error)
16544   __Pyx_GOTREF(__pyx_t_5);
16545   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16546   __pyx_v_cx = __pyx_t_5;
16547   __pyx_t_5 = 0;
16548 
16549   /* "rasterio/_base.pyx":989
16550  *         w, s, e, n = self.bounds
16551  *         cx = (w + e)/2.0
16552  *         cy = (s + n)/2.0             # <<<<<<<<<<<<<<
16553  *         lng, lat = _transform(
16554  *                 self.crs, {'init': 'epsg:4326'}, [cx], [cy], None)
16555  */
16556   __pyx_t_5 = PyNumber_Add(__pyx_v_s, __pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 989, __pyx_L1_error)
16557   __Pyx_GOTREF(__pyx_t_5);
16558   __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_5, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 989, __pyx_L1_error)
16559   __Pyx_GOTREF(__pyx_t_1);
16560   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16561   __pyx_v_cy = __pyx_t_1;
16562   __pyx_t_1 = 0;
16563 
16564   /* "rasterio/_base.pyx":990
16565  *         cx = (w + e)/2.0
16566  *         cy = (s + n)/2.0
16567  *         lng, lat = _transform(             # <<<<<<<<<<<<<<
16568  *                 self.crs, {'init': 'epsg:4326'}, [cx], [cy], None)
16569  *         return lng.pop(), lat.pop()
16570  */
16571   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_transform_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 990, __pyx_L1_error)
16572   __Pyx_GOTREF(__pyx_t_5);
16573 
16574   /* "rasterio/_base.pyx":991
16575  *         cy = (s + n)/2.0
16576  *         lng, lat = _transform(
16577  *                 self.crs, {'init': 'epsg:4326'}, [cx], [cy], None)             # <<<<<<<<<<<<<<
16578  *         return lng.pop(), lat.pop()
16579  *
16580  */
16581   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_crs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 991, __pyx_L1_error)
16582   __Pyx_GOTREF(__pyx_t_4);
16583   __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 991, __pyx_L1_error)
16584   __Pyx_GOTREF(__pyx_t_3);
16585   if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_init, __pyx_kp_u_epsg_4326) < 0) __PYX_ERR(0, 991, __pyx_L1_error)
16586   __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 991, __pyx_L1_error)
16587   __Pyx_GOTREF(__pyx_t_2);
16588   __Pyx_INCREF(__pyx_v_cx);
16589   __Pyx_GIVEREF(__pyx_v_cx);
16590   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_cx);
16591   __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 991, __pyx_L1_error)
16592   __Pyx_GOTREF(__pyx_t_6);
16593   __Pyx_INCREF(__pyx_v_cy);
16594   __Pyx_GIVEREF(__pyx_v_cy);
16595   PyList_SET_ITEM(__pyx_t_6, 0, __pyx_v_cy);
16596   __pyx_t_8 = NULL;
16597   __pyx_t_9 = 0;
16598   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
16599     __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
16600     if (likely(__pyx_t_8)) {
16601       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
16602       __Pyx_INCREF(__pyx_t_8);
16603       __Pyx_INCREF(function);
16604       __Pyx_DECREF_SET(__pyx_t_5, function);
16605       __pyx_t_9 = 1;
16606     }
16607   }
16608   #if CYTHON_FAST_PYCALL
16609   if (PyFunction_Check(__pyx_t_5)) {
16610     PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_t_4, __pyx_t_3, __pyx_t_2, __pyx_t_6, Py_None};
16611     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 990, __pyx_L1_error)
16612     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
16613     __Pyx_GOTREF(__pyx_t_1);
16614     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16615     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16616     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16617     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
16618   } else
16619   #endif
16620   #if CYTHON_FAST_PYCCALL
16621   if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
16622     PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_t_4, __pyx_t_3, __pyx_t_2, __pyx_t_6, Py_None};
16623     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 990, __pyx_L1_error)
16624     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
16625     __Pyx_GOTREF(__pyx_t_1);
16626     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16627     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16628     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16629     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
16630   } else
16631   #endif
16632   {
16633     __pyx_t_10 = PyTuple_New(5+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 990, __pyx_L1_error)
16634     __Pyx_GOTREF(__pyx_t_10);
16635     if (__pyx_t_8) {
16636       __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
16637     }
16638     __Pyx_GIVEREF(__pyx_t_4);
16639     PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_4);
16640     __Pyx_GIVEREF(__pyx_t_3);
16641     PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_3);
16642     __Pyx_GIVEREF(__pyx_t_2);
16643     PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_2);
16644     __Pyx_GIVEREF(__pyx_t_6);
16645     PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_t_6);
16646     __Pyx_INCREF(Py_None);
16647     __Pyx_GIVEREF(Py_None);
16648     PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_9, Py_None);
16649     __pyx_t_4 = 0;
16650     __pyx_t_3 = 0;
16651     __pyx_t_2 = 0;
16652     __pyx_t_6 = 0;
16653     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 990, __pyx_L1_error)
16654     __Pyx_GOTREF(__pyx_t_1);
16655     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
16656   }
16657   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16658   if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
16659     PyObject* sequence = __pyx_t_1;
16660     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
16661     if (unlikely(size != 2)) {
16662       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
16663       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
16664       __PYX_ERR(0, 990, __pyx_L1_error)
16665     }
16666     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
16667     if (likely(PyTuple_CheckExact(sequence))) {
16668       __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
16669       __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
16670     } else {
16671       __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
16672       __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
16673     }
16674     __Pyx_INCREF(__pyx_t_5);
16675     __Pyx_INCREF(__pyx_t_10);
16676     #else
16677     __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 990, __pyx_L1_error)
16678     __Pyx_GOTREF(__pyx_t_5);
16679     __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 990, __pyx_L1_error)
16680     __Pyx_GOTREF(__pyx_t_10);
16681     #endif
16682     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16683   } else {
16684     Py_ssize_t index = -1;
16685     __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 990, __pyx_L1_error)
16686     __Pyx_GOTREF(__pyx_t_6);
16687     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16688     __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
16689     index = 0; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
16690     __Pyx_GOTREF(__pyx_t_5);
16691     index = 1; __pyx_t_10 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_10)) goto __pyx_L5_unpacking_failed;
16692     __Pyx_GOTREF(__pyx_t_10);
16693     if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 990, __pyx_L1_error)
16694     __pyx_t_7 = NULL;
16695     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
16696     goto __pyx_L6_unpacking_done;
16697     __pyx_L5_unpacking_failed:;
16698     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
16699     __pyx_t_7 = NULL;
16700     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
16701     __PYX_ERR(0, 990, __pyx_L1_error)
16702     __pyx_L6_unpacking_done:;
16703   }
16704 
16705   /* "rasterio/_base.pyx":990
16706  *         cx = (w + e)/2.0
16707  *         cy = (s + n)/2.0
16708  *         lng, lat = _transform(             # <<<<<<<<<<<<<<
16709  *                 self.crs, {'init': 'epsg:4326'}, [cx], [cy], None)
16710  *         return lng.pop(), lat.pop()
16711  */
16712   __pyx_v_lng = __pyx_t_5;
16713   __pyx_t_5 = 0;
16714   __pyx_v_lat = __pyx_t_10;
16715   __pyx_t_10 = 0;
16716 
16717   /* "rasterio/_base.pyx":992
16718  *         lng, lat = _transform(
16719  *                 self.crs, {'init': 'epsg:4326'}, [cx], [cy], None)
16720  *         return lng.pop(), lat.pop()             # <<<<<<<<<<<<<<
16721  *
16722  *     def _get_crs(self):
16723  */
16724   __Pyx_XDECREF(__pyx_r);
16725   __pyx_t_1 = __Pyx_PyObject_Pop(__pyx_v_lng); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 992, __pyx_L1_error)
16726   __Pyx_GOTREF(__pyx_t_1);
16727   __pyx_t_10 = __Pyx_PyObject_Pop(__pyx_v_lat); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 992, __pyx_L1_error)
16728   __Pyx_GOTREF(__pyx_t_10);
16729   __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 992, __pyx_L1_error)
16730   __Pyx_GOTREF(__pyx_t_5);
16731   __Pyx_GIVEREF(__pyx_t_1);
16732   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
16733   __Pyx_GIVEREF(__pyx_t_10);
16734   PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_10);
16735   __pyx_t_1 = 0;
16736   __pyx_t_10 = 0;
16737   __pyx_r = __pyx_t_5;
16738   __pyx_t_5 = 0;
16739   goto __pyx_L0;
16740 
16741   /* "rasterio/_base.pyx":986
16742  *             return m
16743  *
16744  *     def lnglat(self):             # <<<<<<<<<<<<<<
16745  *         w, s, e, n = self.bounds
16746  *         cx = (w + e)/2.0
16747  */
16748 
16749   /* function exit code */
16750   __pyx_L1_error:;
16751   __Pyx_XDECREF(__pyx_t_1);
16752   __Pyx_XDECREF(__pyx_t_2);
16753   __Pyx_XDECREF(__pyx_t_3);
16754   __Pyx_XDECREF(__pyx_t_4);
16755   __Pyx_XDECREF(__pyx_t_5);
16756   __Pyx_XDECREF(__pyx_t_6);
16757   __Pyx_XDECREF(__pyx_t_8);
16758   __Pyx_XDECREF(__pyx_t_10);
16759   __Pyx_AddTraceback("rasterio._base.DatasetBase.lnglat", __pyx_clineno, __pyx_lineno, __pyx_filename);
16760   __pyx_r = NULL;
16761   __pyx_L0:;
16762   __Pyx_XDECREF(__pyx_v_w);
16763   __Pyx_XDECREF(__pyx_v_s);
16764   __Pyx_XDECREF(__pyx_v_e);
16765   __Pyx_XDECREF(__pyx_v_n);
16766   __Pyx_XDECREF(__pyx_v_cx);
16767   __Pyx_XDECREF(__pyx_v_cy);
16768   __Pyx_XDECREF(__pyx_v_lng);
16769   __Pyx_XDECREF(__pyx_v_lat);
16770   __Pyx_XGIVEREF(__pyx_r);
16771   __Pyx_RefNannyFinishContext();
16772   return __pyx_r;
16773 }
16774 
16775 /* "rasterio/_base.pyx":994
16776  *         return lng.pop(), lat.pop()
16777  *
16778  *     def _get_crs(self):             # <<<<<<<<<<<<<<
16779  *         # _read tells us that the CRS was read before and really is
16780  *         # None.
16781  */
16782 
16783 /* Python wrapper */
16784 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_56_get_crs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_56_get_crs(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)16785 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_56_get_crs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16786   PyObject *__pyx_r = 0;
16787   __Pyx_RefNannyDeclarations
16788   __Pyx_RefNannySetupContext("_get_crs (wrapper)", 0);
16789   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_55_get_crs(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
16790 
16791   /* function exit code */
16792   __Pyx_RefNannyFinishContext();
16793   return __pyx_r;
16794 }
16795 
__pyx_pf_8rasterio_5_base_11DatasetBase_55_get_crs(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)16796 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_55_get_crs(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
16797   PyObject *__pyx_r = NULL;
16798   __Pyx_RefNannyDeclarations
16799   int __pyx_t_1;
16800   int __pyx_t_2;
16801   int __pyx_t_3;
16802   PyObject *__pyx_t_4 = NULL;
16803   PyObject *__pyx_t_5 = NULL;
16804   PyObject *__pyx_t_6 = NULL;
16805   int __pyx_lineno = 0;
16806   const char *__pyx_filename = NULL;
16807   int __pyx_clineno = 0;
16808   __Pyx_RefNannySetupContext("_get_crs", 0);
16809 
16810   /* "rasterio/_base.pyx":997
16811  *         # _read tells us that the CRS was read before and really is
16812  *         # None.
16813  *         if not self._read and self._crs is None:             # <<<<<<<<<<<<<<
16814  *             self._crs = self.read_crs()
16815  *         return self._crs
16816  */
16817   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->_read); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 997, __pyx_L1_error)
16818   __pyx_t_3 = ((!__pyx_t_2) != 0);
16819   if (__pyx_t_3) {
16820   } else {
16821     __pyx_t_1 = __pyx_t_3;
16822     goto __pyx_L4_bool_binop_done;
16823   }
16824   __pyx_t_3 = (__pyx_v_self->_crs == Py_None);
16825   __pyx_t_2 = (__pyx_t_3 != 0);
16826   __pyx_t_1 = __pyx_t_2;
16827   __pyx_L4_bool_binop_done:;
16828   if (__pyx_t_1) {
16829 
16830     /* "rasterio/_base.pyx":998
16831  *         # None.
16832  *         if not self._read and self._crs is None:
16833  *             self._crs = self.read_crs()             # <<<<<<<<<<<<<<
16834  *         return self._crs
16835  *
16836  */
16837     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_crs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 998, __pyx_L1_error)
16838     __Pyx_GOTREF(__pyx_t_5);
16839     __pyx_t_6 = NULL;
16840     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
16841       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
16842       if (likely(__pyx_t_6)) {
16843         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
16844         __Pyx_INCREF(__pyx_t_6);
16845         __Pyx_INCREF(function);
16846         __Pyx_DECREF_SET(__pyx_t_5, function);
16847       }
16848     }
16849     __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
16850     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
16851     if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 998, __pyx_L1_error)
16852     __Pyx_GOTREF(__pyx_t_4);
16853     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16854     __Pyx_GIVEREF(__pyx_t_4);
16855     __Pyx_GOTREF(__pyx_v_self->_crs);
16856     __Pyx_DECREF(__pyx_v_self->_crs);
16857     __pyx_v_self->_crs = __pyx_t_4;
16858     __pyx_t_4 = 0;
16859 
16860     /* "rasterio/_base.pyx":997
16861  *         # _read tells us that the CRS was read before and really is
16862  *         # None.
16863  *         if not self._read and self._crs is None:             # <<<<<<<<<<<<<<
16864  *             self._crs = self.read_crs()
16865  *         return self._crs
16866  */
16867   }
16868 
16869   /* "rasterio/_base.pyx":999
16870  *         if not self._read and self._crs is None:
16871  *             self._crs = self.read_crs()
16872  *         return self._crs             # <<<<<<<<<<<<<<
16873  *
16874  *     def get_transform(self):
16875  */
16876   __Pyx_XDECREF(__pyx_r);
16877   __Pyx_INCREF(__pyx_v_self->_crs);
16878   __pyx_r = __pyx_v_self->_crs;
16879   goto __pyx_L0;
16880 
16881   /* "rasterio/_base.pyx":994
16882  *         return lng.pop(), lat.pop()
16883  *
16884  *     def _get_crs(self):             # <<<<<<<<<<<<<<
16885  *         # _read tells us that the CRS was read before and really is
16886  *         # None.
16887  */
16888 
16889   /* function exit code */
16890   __pyx_L1_error:;
16891   __Pyx_XDECREF(__pyx_t_4);
16892   __Pyx_XDECREF(__pyx_t_5);
16893   __Pyx_XDECREF(__pyx_t_6);
16894   __Pyx_AddTraceback("rasterio._base.DatasetBase._get_crs", __pyx_clineno, __pyx_lineno, __pyx_filename);
16895   __pyx_r = NULL;
16896   __pyx_L0:;
16897   __Pyx_XGIVEREF(__pyx_r);
16898   __Pyx_RefNannyFinishContext();
16899   return __pyx_r;
16900 }
16901 
16902 /* "rasterio/_base.pyx":1001
16903  *         return self._crs
16904  *
16905  *     def get_transform(self):             # <<<<<<<<<<<<<<
16906  *         """Returns a GDAL geotransform in its native form."""
16907  *         if not self._read and self._transform is None:
16908  */
16909 
16910 /* Python wrapper */
16911 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_58get_transform(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
16912 static char __pyx_doc_8rasterio_5_base_11DatasetBase_57get_transform[] = "Returns a GDAL geotransform in its native form.";
__pyx_pw_8rasterio_5_base_11DatasetBase_58get_transform(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)16913 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_58get_transform(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16914   PyObject *__pyx_r = 0;
16915   __Pyx_RefNannyDeclarations
16916   __Pyx_RefNannySetupContext("get_transform (wrapper)", 0);
16917   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_57get_transform(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
16918 
16919   /* function exit code */
16920   __Pyx_RefNannyFinishContext();
16921   return __pyx_r;
16922 }
16923 
__pyx_pf_8rasterio_5_base_11DatasetBase_57get_transform(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)16924 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_57get_transform(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
16925   PyObject *__pyx_r = NULL;
16926   __Pyx_RefNannyDeclarations
16927   int __pyx_t_1;
16928   int __pyx_t_2;
16929   int __pyx_t_3;
16930   PyObject *__pyx_t_4 = NULL;
16931   PyObject *__pyx_t_5 = NULL;
16932   PyObject *__pyx_t_6 = NULL;
16933   int __pyx_lineno = 0;
16934   const char *__pyx_filename = NULL;
16935   int __pyx_clineno = 0;
16936   __Pyx_RefNannySetupContext("get_transform", 0);
16937 
16938   /* "rasterio/_base.pyx":1003
16939  *     def get_transform(self):
16940  *         """Returns a GDAL geotransform in its native form."""
16941  *         if not self._read and self._transform is None:             # <<<<<<<<<<<<<<
16942  *             self._transform = self.read_transform()
16943  *         return self._transform
16944  */
16945   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->_read); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1003, __pyx_L1_error)
16946   __pyx_t_3 = ((!__pyx_t_2) != 0);
16947   if (__pyx_t_3) {
16948   } else {
16949     __pyx_t_1 = __pyx_t_3;
16950     goto __pyx_L4_bool_binop_done;
16951   }
16952   __pyx_t_3 = (__pyx_v_self->_transform == Py_None);
16953   __pyx_t_2 = (__pyx_t_3 != 0);
16954   __pyx_t_1 = __pyx_t_2;
16955   __pyx_L4_bool_binop_done:;
16956   if (__pyx_t_1) {
16957 
16958     /* "rasterio/_base.pyx":1004
16959  *         """Returns a GDAL geotransform in its native form."""
16960  *         if not self._read and self._transform is None:
16961  *             self._transform = self.read_transform()             # <<<<<<<<<<<<<<
16962  *         return self._transform
16963  *
16964  */
16965     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_transform); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1004, __pyx_L1_error)
16966     __Pyx_GOTREF(__pyx_t_5);
16967     __pyx_t_6 = NULL;
16968     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
16969       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
16970       if (likely(__pyx_t_6)) {
16971         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
16972         __Pyx_INCREF(__pyx_t_6);
16973         __Pyx_INCREF(function);
16974         __Pyx_DECREF_SET(__pyx_t_5, function);
16975       }
16976     }
16977     __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
16978     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
16979     if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1004, __pyx_L1_error)
16980     __Pyx_GOTREF(__pyx_t_4);
16981     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16982     __Pyx_GIVEREF(__pyx_t_4);
16983     __Pyx_GOTREF(__pyx_v_self->_transform);
16984     __Pyx_DECREF(__pyx_v_self->_transform);
16985     __pyx_v_self->_transform = __pyx_t_4;
16986     __pyx_t_4 = 0;
16987 
16988     /* "rasterio/_base.pyx":1003
16989  *     def get_transform(self):
16990  *         """Returns a GDAL geotransform in its native form."""
16991  *         if not self._read and self._transform is None:             # <<<<<<<<<<<<<<
16992  *             self._transform = self.read_transform()
16993  *         return self._transform
16994  */
16995   }
16996 
16997   /* "rasterio/_base.pyx":1005
16998  *         if not self._read and self._transform is None:
16999  *             self._transform = self.read_transform()
17000  *         return self._transform             # <<<<<<<<<<<<<<
17001  *
17002  *     property subdatasets:
17003  */
17004   __Pyx_XDECREF(__pyx_r);
17005   __Pyx_INCREF(__pyx_v_self->_transform);
17006   __pyx_r = __pyx_v_self->_transform;
17007   goto __pyx_L0;
17008 
17009   /* "rasterio/_base.pyx":1001
17010  *         return self._crs
17011  *
17012  *     def get_transform(self):             # <<<<<<<<<<<<<<
17013  *         """Returns a GDAL geotransform in its native form."""
17014  *         if not self._read and self._transform is None:
17015  */
17016 
17017   /* function exit code */
17018   __pyx_L1_error:;
17019   __Pyx_XDECREF(__pyx_t_4);
17020   __Pyx_XDECREF(__pyx_t_5);
17021   __Pyx_XDECREF(__pyx_t_6);
17022   __Pyx_AddTraceback("rasterio._base.DatasetBase.get_transform", __pyx_clineno, __pyx_lineno, __pyx_filename);
17023   __pyx_r = NULL;
17024   __pyx_L0:;
17025   __Pyx_XGIVEREF(__pyx_r);
17026   __Pyx_RefNannyFinishContext();
17027   return __pyx_r;
17028 }
17029 
17030 /* "rasterio/_base.pyx":1010
17031  *         """Sequence of subdatasets"""
17032  *
17033  *         def __get__(self):             # <<<<<<<<<<<<<<
17034  *             tags = self.tags(ns='SUBDATASETS')
17035  *             subs = defaultdict(dict)
17036  */
17037 
17038 /* Python wrapper */
17039 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_11subdatasets_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_11subdatasets_1__get__(PyObject * __pyx_v_self)17040 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_11subdatasets_1__get__(PyObject *__pyx_v_self) {
17041   PyObject *__pyx_r = 0;
17042   __Pyx_RefNannyDeclarations
17043   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
17044   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_11subdatasets___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
17045 
17046   /* function exit code */
17047   __Pyx_RefNannyFinishContext();
17048   return __pyx_r;
17049 }
17050 
__pyx_pf_8rasterio_5_base_11DatasetBase_11subdatasets___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)17051 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_11subdatasets___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
17052   PyObject *__pyx_v_tags = NULL;
17053   PyObject *__pyx_v_subs = NULL;
17054   PyObject *__pyx_v_key = NULL;
17055   PyObject *__pyx_v_val = NULL;
17056   CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
17057   PyObject *__pyx_v_idx = NULL;
17058   PyObject *__pyx_v_fld = NULL;
17059   PyObject *__pyx_9genexpr11__pyx_v_idx = NULL;
17060   PyObject *__pyx_r = NULL;
17061   __Pyx_RefNannyDeclarations
17062   PyObject *__pyx_t_1 = NULL;
17063   PyObject *__pyx_t_2 = NULL;
17064   PyObject *__pyx_t_3 = NULL;
17065   Py_ssize_t __pyx_t_4;
17066   Py_ssize_t __pyx_t_5;
17067   int __pyx_t_6;
17068   int __pyx_t_7;
17069   PyObject *__pyx_t_8 = NULL;
17070   PyObject *__pyx_t_9 = NULL;
17071   PyObject *__pyx_t_10 = NULL;
17072   PyObject *(*__pyx_t_11)(PyObject *);
17073   int __pyx_t_12;
17074   int __pyx_t_13;
17075   int __pyx_lineno = 0;
17076   const char *__pyx_filename = NULL;
17077   int __pyx_clineno = 0;
17078   __Pyx_RefNannySetupContext("__get__", 0);
17079 
17080   /* "rasterio/_base.pyx":1011
17081  *
17082  *         def __get__(self):
17083  *             tags = self.tags(ns='SUBDATASETS')             # <<<<<<<<<<<<<<
17084  *             subs = defaultdict(dict)
17085  *             for key, val in tags.items():
17086  */
17087   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1011, __pyx_L1_error)
17088   __Pyx_GOTREF(__pyx_t_1);
17089   __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1011, __pyx_L1_error)
17090   __Pyx_GOTREF(__pyx_t_2);
17091   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_ns, __pyx_n_u_SUBDATASETS) < 0) __PYX_ERR(0, 1011, __pyx_L1_error)
17092   __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1011, __pyx_L1_error)
17093   __Pyx_GOTREF(__pyx_t_3);
17094   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17095   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17096   __pyx_v_tags = __pyx_t_3;
17097   __pyx_t_3 = 0;
17098 
17099   /* "rasterio/_base.pyx":1012
17100  *         def __get__(self):
17101  *             tags = self.tags(ns='SUBDATASETS')
17102  *             subs = defaultdict(dict)             # <<<<<<<<<<<<<<
17103  *             for key, val in tags.items():
17104  *                 _, idx, fld = key.split('_')
17105  */
17106   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1012, __pyx_L1_error)
17107   __Pyx_GOTREF(__pyx_t_2);
17108   __pyx_t_1 = NULL;
17109   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
17110     __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
17111     if (likely(__pyx_t_1)) {
17112       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
17113       __Pyx_INCREF(__pyx_t_1);
17114       __Pyx_INCREF(function);
17115       __Pyx_DECREF_SET(__pyx_t_2, function);
17116     }
17117   }
17118   __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, ((PyObject *)(&PyDict_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)(&PyDict_Type)));
17119   __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
17120   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1012, __pyx_L1_error)
17121   __Pyx_GOTREF(__pyx_t_3);
17122   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17123   __pyx_v_subs = __pyx_t_3;
17124   __pyx_t_3 = 0;
17125 
17126   /* "rasterio/_base.pyx":1013
17127  *             tags = self.tags(ns='SUBDATASETS')
17128  *             subs = defaultdict(dict)
17129  *             for key, val in tags.items():             # <<<<<<<<<<<<<<
17130  *                 _, idx, fld = key.split('_')
17131  *                 fld = fld.lower()
17132  */
17133   __pyx_t_4 = 0;
17134   if (unlikely(__pyx_v_tags == Py_None)) {
17135     PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
17136     __PYX_ERR(0, 1013, __pyx_L1_error)
17137   }
17138   __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_tags, 0, __pyx_n_s_items, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1013, __pyx_L1_error)
17139   __Pyx_GOTREF(__pyx_t_2);
17140   __Pyx_XDECREF(__pyx_t_3);
17141   __pyx_t_3 = __pyx_t_2;
17142   __pyx_t_2 = 0;
17143   while (1) {
17144     __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_5, &__pyx_t_4, &__pyx_t_2, &__pyx_t_1, NULL, __pyx_t_6);
17145     if (unlikely(__pyx_t_7 == 0)) break;
17146     if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 1013, __pyx_L1_error)
17147     __Pyx_GOTREF(__pyx_t_2);
17148     __Pyx_GOTREF(__pyx_t_1);
17149     __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_2);
17150     __pyx_t_2 = 0;
17151     __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_1);
17152     __pyx_t_1 = 0;
17153 
17154     /* "rasterio/_base.pyx":1014
17155  *             subs = defaultdict(dict)
17156  *             for key, val in tags.items():
17157  *                 _, idx, fld = key.split('_')             # <<<<<<<<<<<<<<
17158  *                 fld = fld.lower()
17159  *                 if fld == 'desc':
17160  */
17161     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1014, __pyx_L1_error)
17162     __Pyx_GOTREF(__pyx_t_2);
17163     __pyx_t_8 = NULL;
17164     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
17165       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
17166       if (likely(__pyx_t_8)) {
17167         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
17168         __Pyx_INCREF(__pyx_t_8);
17169         __Pyx_INCREF(function);
17170         __Pyx_DECREF_SET(__pyx_t_2, function);
17171       }
17172     }
17173     __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, __pyx_n_u__9) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u__9);
17174     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
17175     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1014, __pyx_L1_error)
17176     __Pyx_GOTREF(__pyx_t_1);
17177     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17178     if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
17179       PyObject* sequence = __pyx_t_1;
17180       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
17181       if (unlikely(size != 3)) {
17182         if (size > 3) __Pyx_RaiseTooManyValuesError(3);
17183         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
17184         __PYX_ERR(0, 1014, __pyx_L1_error)
17185       }
17186       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17187       if (likely(PyTuple_CheckExact(sequence))) {
17188         __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
17189         __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
17190         __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2);
17191       } else {
17192         __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
17193         __pyx_t_8 = PyList_GET_ITEM(sequence, 1);
17194         __pyx_t_9 = PyList_GET_ITEM(sequence, 2);
17195       }
17196       __Pyx_INCREF(__pyx_t_2);
17197       __Pyx_INCREF(__pyx_t_8);
17198       __Pyx_INCREF(__pyx_t_9);
17199       #else
17200       __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1014, __pyx_L1_error)
17201       __Pyx_GOTREF(__pyx_t_2);
17202       __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1014, __pyx_L1_error)
17203       __Pyx_GOTREF(__pyx_t_8);
17204       __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1014, __pyx_L1_error)
17205       __Pyx_GOTREF(__pyx_t_9);
17206       #endif
17207       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17208     } else {
17209       Py_ssize_t index = -1;
17210       __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1014, __pyx_L1_error)
17211       __Pyx_GOTREF(__pyx_t_10);
17212       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17213       __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
17214       index = 0; __pyx_t_2 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
17215       __Pyx_GOTREF(__pyx_t_2);
17216       index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed;
17217       __Pyx_GOTREF(__pyx_t_8);
17218       index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L5_unpacking_failed;
17219       __Pyx_GOTREF(__pyx_t_9);
17220       if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) __PYX_ERR(0, 1014, __pyx_L1_error)
17221       __pyx_t_11 = NULL;
17222       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
17223       goto __pyx_L6_unpacking_done;
17224       __pyx_L5_unpacking_failed:;
17225       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
17226       __pyx_t_11 = NULL;
17227       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
17228       __PYX_ERR(0, 1014, __pyx_L1_error)
17229       __pyx_L6_unpacking_done:;
17230     }
17231     __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_2);
17232     __pyx_t_2 = 0;
17233     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_8);
17234     __pyx_t_8 = 0;
17235     __Pyx_XDECREF_SET(__pyx_v_fld, __pyx_t_9);
17236     __pyx_t_9 = 0;
17237 
17238     /* "rasterio/_base.pyx":1015
17239  *             for key, val in tags.items():
17240  *                 _, idx, fld = key.split('_')
17241  *                 fld = fld.lower()             # <<<<<<<<<<<<<<
17242  *                 if fld == 'desc':
17243  *                     fld = 'description'
17244  */
17245     __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_fld, __pyx_n_s_lower); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1015, __pyx_L1_error)
17246     __Pyx_GOTREF(__pyx_t_9);
17247     __pyx_t_8 = NULL;
17248     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
17249       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
17250       if (likely(__pyx_t_8)) {
17251         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
17252         __Pyx_INCREF(__pyx_t_8);
17253         __Pyx_INCREF(function);
17254         __Pyx_DECREF_SET(__pyx_t_9, function);
17255       }
17256     }
17257     __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
17258     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
17259     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)
17260     __Pyx_GOTREF(__pyx_t_1);
17261     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
17262     __Pyx_DECREF_SET(__pyx_v_fld, __pyx_t_1);
17263     __pyx_t_1 = 0;
17264 
17265     /* "rasterio/_base.pyx":1016
17266  *                 _, idx, fld = key.split('_')
17267  *                 fld = fld.lower()
17268  *                 if fld == 'desc':             # <<<<<<<<<<<<<<
17269  *                     fld = 'description'
17270  *                 if fld == 'name':
17271  */
17272     __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_v_fld, __pyx_n_u_desc, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1016, __pyx_L1_error)
17273     if (__pyx_t_12) {
17274 
17275       /* "rasterio/_base.pyx":1017
17276  *                 fld = fld.lower()
17277  *                 if fld == 'desc':
17278  *                     fld = 'description'             # <<<<<<<<<<<<<<
17279  *                 if fld == 'name':
17280  *                     val = val.replace('NETCDF', 'netcdf')
17281  */
17282       __Pyx_INCREF(__pyx_n_u_description);
17283       __Pyx_DECREF_SET(__pyx_v_fld, __pyx_n_u_description);
17284 
17285       /* "rasterio/_base.pyx":1016
17286  *                 _, idx, fld = key.split('_')
17287  *                 fld = fld.lower()
17288  *                 if fld == 'desc':             # <<<<<<<<<<<<<<
17289  *                     fld = 'description'
17290  *                 if fld == 'name':
17291  */
17292     }
17293 
17294     /* "rasterio/_base.pyx":1018
17295  *                 if fld == 'desc':
17296  *                     fld = 'description'
17297  *                 if fld == 'name':             # <<<<<<<<<<<<<<
17298  *                     val = val.replace('NETCDF', 'netcdf')
17299  *                 subs[idx][fld] = val.replace('"', '')
17300  */
17301     __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_v_fld, __pyx_n_u_name, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1018, __pyx_L1_error)
17302     if (__pyx_t_12) {
17303 
17304       /* "rasterio/_base.pyx":1019
17305  *                     fld = 'description'
17306  *                 if fld == 'name':
17307  *                     val = val.replace('NETCDF', 'netcdf')             # <<<<<<<<<<<<<<
17308  *                 subs[idx][fld] = val.replace('"', '')
17309  *             return [subs[idx]['name'] for idx in sorted(subs.keys())]
17310  */
17311       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_val, __pyx_n_s_replace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1019, __pyx_L1_error)
17312       __Pyx_GOTREF(__pyx_t_1);
17313       __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1019, __pyx_L1_error)
17314       __Pyx_GOTREF(__pyx_t_9);
17315       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17316       __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_9);
17317       __pyx_t_9 = 0;
17318 
17319       /* "rasterio/_base.pyx":1018
17320  *                 if fld == 'desc':
17321  *                     fld = 'description'
17322  *                 if fld == 'name':             # <<<<<<<<<<<<<<
17323  *                     val = val.replace('NETCDF', 'netcdf')
17324  *                 subs[idx][fld] = val.replace('"', '')
17325  */
17326     }
17327 
17328     /* "rasterio/_base.pyx":1020
17329  *                 if fld == 'name':
17330  *                     val = val.replace('NETCDF', 'netcdf')
17331  *                 subs[idx][fld] = val.replace('"', '')             # <<<<<<<<<<<<<<
17332  *             return [subs[idx]['name'] for idx in sorted(subs.keys())]
17333  *
17334  */
17335     __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_val, __pyx_n_s_replace); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1020, __pyx_L1_error)
17336     __Pyx_GOTREF(__pyx_t_9);
17337     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1020, __pyx_L1_error)
17338     __Pyx_GOTREF(__pyx_t_1);
17339     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
17340     __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_subs, __pyx_v_idx); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1020, __pyx_L1_error)
17341     __Pyx_GOTREF(__pyx_t_9);
17342     if (unlikely(PyObject_SetItem(__pyx_t_9, __pyx_v_fld, __pyx_t_1) < 0)) __PYX_ERR(0, 1020, __pyx_L1_error)
17343     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
17344     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17345   }
17346   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17347 
17348   /* "rasterio/_base.pyx":1021
17349  *                     val = val.replace('NETCDF', 'netcdf')
17350  *                 subs[idx][fld] = val.replace('"', '')
17351  *             return [subs[idx]['name'] for idx in sorted(subs.keys())]             # <<<<<<<<<<<<<<
17352  *
17353  *
17354  */
17355   __Pyx_XDECREF(__pyx_r);
17356   { /* enter inner scope */
17357     __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1021, __pyx_L11_error)
17358     __Pyx_GOTREF(__pyx_t_3);
17359     __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_subs, __pyx_n_s_keys); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1021, __pyx_L11_error)
17360     __Pyx_GOTREF(__pyx_t_8);
17361     __pyx_t_2 = NULL;
17362     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
17363       __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
17364       if (likely(__pyx_t_2)) {
17365         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
17366         __Pyx_INCREF(__pyx_t_2);
17367         __Pyx_INCREF(function);
17368         __Pyx_DECREF_SET(__pyx_t_8, function);
17369       }
17370     }
17371     __pyx_t_9 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
17372     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
17373     if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1021, __pyx_L11_error)
17374     __Pyx_GOTREF(__pyx_t_9);
17375     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
17376     __pyx_t_8 = PySequence_List(__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1021, __pyx_L11_error)
17377     __Pyx_GOTREF(__pyx_t_8);
17378     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
17379     __pyx_t_1 = ((PyObject*)__pyx_t_8);
17380     __pyx_t_8 = 0;
17381     __pyx_t_13 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 1021, __pyx_L11_error)
17382     if (unlikely(__pyx_t_1 == Py_None)) {
17383       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
17384       __PYX_ERR(0, 1021, __pyx_L11_error)
17385     }
17386     __pyx_t_8 = __pyx_t_1; __Pyx_INCREF(__pyx_t_8); __pyx_t_5 = 0;
17387     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17388     for (;;) {
17389       if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_8)) break;
17390       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17391       __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1021, __pyx_L11_error)
17392       #else
17393       __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1021, __pyx_L11_error)
17394       __Pyx_GOTREF(__pyx_t_1);
17395       #endif
17396       __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_idx, __pyx_t_1);
17397       __pyx_t_1 = 0;
17398       __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_subs, __pyx_9genexpr11__pyx_v_idx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1021, __pyx_L11_error)
17399       __Pyx_GOTREF(__pyx_t_1);
17400       __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1021, __pyx_L11_error)
17401       __Pyx_GOTREF(__pyx_t_9);
17402       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17403       if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 1021, __pyx_L11_error)
17404       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
17405     }
17406     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
17407     __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_idx); __pyx_9genexpr11__pyx_v_idx = 0;
17408     goto __pyx_L14_exit_scope;
17409     __pyx_L11_error:;
17410     __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_idx); __pyx_9genexpr11__pyx_v_idx = 0;
17411     goto __pyx_L1_error;
17412     __pyx_L14_exit_scope:;
17413   } /* exit inner scope */
17414   __pyx_r = __pyx_t_3;
17415   __pyx_t_3 = 0;
17416   goto __pyx_L0;
17417 
17418   /* "rasterio/_base.pyx":1010
17419  *         """Sequence of subdatasets"""
17420  *
17421  *         def __get__(self):             # <<<<<<<<<<<<<<
17422  *             tags = self.tags(ns='SUBDATASETS')
17423  *             subs = defaultdict(dict)
17424  */
17425 
17426   /* function exit code */
17427   __pyx_L1_error:;
17428   __Pyx_XDECREF(__pyx_t_1);
17429   __Pyx_XDECREF(__pyx_t_2);
17430   __Pyx_XDECREF(__pyx_t_3);
17431   __Pyx_XDECREF(__pyx_t_8);
17432   __Pyx_XDECREF(__pyx_t_9);
17433   __Pyx_XDECREF(__pyx_t_10);
17434   __Pyx_AddTraceback("rasterio._base.DatasetBase.subdatasets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17435   __pyx_r = NULL;
17436   __pyx_L0:;
17437   __Pyx_XDECREF(__pyx_v_tags);
17438   __Pyx_XDECREF(__pyx_v_subs);
17439   __Pyx_XDECREF(__pyx_v_key);
17440   __Pyx_XDECREF(__pyx_v_val);
17441   __Pyx_XDECREF(__pyx_v__);
17442   __Pyx_XDECREF(__pyx_v_idx);
17443   __Pyx_XDECREF(__pyx_v_fld);
17444   __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_idx);
17445   __Pyx_XGIVEREF(__pyx_r);
17446   __Pyx_RefNannyFinishContext();
17447   return __pyx_r;
17448 }
17449 
17450 /* "rasterio/_base.pyx":1024
17451  *
17452  *
17453  *     def tag_namespaces(self, bidx=0):             # <<<<<<<<<<<<<<
17454  *         """Get a list of the dataset's metadata domains.
17455  *
17456  */
17457 
17458 /* Python wrapper */
17459 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_60tag_namespaces(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17460 static char __pyx_doc_8rasterio_5_base_11DatasetBase_59tag_namespaces[] = "Get a list of the dataset's metadata domains.\n\n        Returned items may be passed as `ns` to the tags method.\n\n        Parameters\n        ----------\n        bidx int, optional\n            Can be used to select a specific band, otherwise the\n            dataset's general metadata domains are returned.\n\n        Returns\n        -------\n        list of str\n\n        ";
__pyx_pw_8rasterio_5_base_11DatasetBase_60tag_namespaces(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)17461 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_60tag_namespaces(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17462   PyObject *__pyx_v_bidx = 0;
17463   int __pyx_lineno = 0;
17464   const char *__pyx_filename = NULL;
17465   int __pyx_clineno = 0;
17466   PyObject *__pyx_r = 0;
17467   __Pyx_RefNannyDeclarations
17468   __Pyx_RefNannySetupContext("tag_namespaces (wrapper)", 0);
17469   {
17470     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bidx,0};
17471     PyObject* values[1] = {0};
17472     values[0] = ((PyObject *)__pyx_int_0);
17473     if (unlikely(__pyx_kwds)) {
17474       Py_ssize_t kw_args;
17475       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17476       switch (pos_args) {
17477         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17478         CYTHON_FALLTHROUGH;
17479         case  0: break;
17480         default: goto __pyx_L5_argtuple_error;
17481       }
17482       kw_args = PyDict_Size(__pyx_kwds);
17483       switch (pos_args) {
17484         case  0:
17485         if (kw_args > 0) {
17486           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bidx);
17487           if (value) { values[0] = value; kw_args--; }
17488         }
17489       }
17490       if (unlikely(kw_args > 0)) {
17491         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tag_namespaces") < 0)) __PYX_ERR(0, 1024, __pyx_L3_error)
17492       }
17493     } else {
17494       switch (PyTuple_GET_SIZE(__pyx_args)) {
17495         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17496         CYTHON_FALLTHROUGH;
17497         case  0: break;
17498         default: goto __pyx_L5_argtuple_error;
17499       }
17500     }
17501     __pyx_v_bidx = values[0];
17502   }
17503   goto __pyx_L4_argument_unpacking_done;
17504   __pyx_L5_argtuple_error:;
17505   __Pyx_RaiseArgtupleInvalid("tag_namespaces", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1024, __pyx_L3_error)
17506   __pyx_L3_error:;
17507   __Pyx_AddTraceback("rasterio._base.DatasetBase.tag_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
17508   __Pyx_RefNannyFinishContext();
17509   return NULL;
17510   __pyx_L4_argument_unpacking_done:;
17511   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_59tag_namespaces(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), __pyx_v_bidx);
17512 
17513   /* function exit code */
17514   __Pyx_RefNannyFinishContext();
17515   return __pyx_r;
17516 }
17517 
__pyx_pf_8rasterio_5_base_11DatasetBase_59tag_namespaces(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_bidx)17518 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_59tag_namespaces(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx) {
17519   GDALMajorObjectH __pyx_v_obj;
17520   char **__pyx_v_namespaces;
17521   int __pyx_v_num_items;
17522   int __pyx_9genexpr12__pyx_v_i;
17523   PyObject *__pyx_r = NULL;
17524   __Pyx_RefNannyDeclarations
17525   PyObject *__pyx_t_1 = NULL;
17526   int __pyx_t_2;
17527   int __pyx_t_3;
17528   GDALRasterBandH __pyx_t_4;
17529   GDALDatasetH __pyx_t_5;
17530   int __pyx_t_6;
17531   int __pyx_t_7;
17532   PyObject *__pyx_t_8 = NULL;
17533   PyObject *__pyx_t_9 = NULL;
17534   char const *__pyx_t_10;
17535   PyObject *__pyx_t_11 = NULL;
17536   PyObject *__pyx_t_12 = NULL;
17537   PyObject *__pyx_t_13 = NULL;
17538   PyObject *__pyx_t_14 = NULL;
17539   PyObject *__pyx_t_15 = NULL;
17540   PyObject *__pyx_t_16 = NULL;
17541   int __pyx_lineno = 0;
17542   const char *__pyx_filename = NULL;
17543   int __pyx_clineno = 0;
17544   __Pyx_RefNannySetupContext("tag_namespaces", 0);
17545 
17546   /* "rasterio/_base.pyx":1040
17547  *
17548  *         """
17549  *         cdef GDALMajorObjectH obj = NULL             # <<<<<<<<<<<<<<
17550  *         if bidx > 0:
17551  *             obj = self.band(bidx)
17552  */
17553   __pyx_v_obj = NULL;
17554 
17555   /* "rasterio/_base.pyx":1041
17556  *         """
17557  *         cdef GDALMajorObjectH obj = NULL
17558  *         if bidx > 0:             # <<<<<<<<<<<<<<
17559  *             obj = self.band(bidx)
17560  *         else:
17561  */
17562   __pyx_t_1 = PyObject_RichCompare(__pyx_v_bidx, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1041, __pyx_L1_error)
17563   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1041, __pyx_L1_error)
17564   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17565   if (__pyx_t_2) {
17566 
17567     /* "rasterio/_base.pyx":1042
17568  *         cdef GDALMajorObjectH obj = NULL
17569  *         if bidx > 0:
17570  *             obj = self.band(bidx)             # <<<<<<<<<<<<<<
17571  *         else:
17572  *             obj = self._hds
17573  */
17574     __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_bidx); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1042, __pyx_L1_error)
17575     __pyx_t_4 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_3); if (unlikely(__pyx_t_4 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 1042, __pyx_L1_error)
17576     __pyx_v_obj = __pyx_t_4;
17577 
17578     /* "rasterio/_base.pyx":1041
17579  *         """
17580  *         cdef GDALMajorObjectH obj = NULL
17581  *         if bidx > 0:             # <<<<<<<<<<<<<<
17582  *             obj = self.band(bidx)
17583  *         else:
17584  */
17585     goto __pyx_L3;
17586   }
17587 
17588   /* "rasterio/_base.pyx":1044
17589  *             obj = self.band(bidx)
17590  *         else:
17591  *             obj = self._hds             # <<<<<<<<<<<<<<
17592  *
17593  *         namespaces = GDALGetMetadataDomainList(obj)
17594  */
17595   /*else*/ {
17596     __pyx_t_5 = __pyx_v_self->_hds;
17597     __pyx_v_obj = __pyx_t_5;
17598   }
17599   __pyx_L3:;
17600 
17601   /* "rasterio/_base.pyx":1046
17602  *             obj = self._hds
17603  *
17604  *         namespaces = GDALGetMetadataDomainList(obj)             # <<<<<<<<<<<<<<
17605  *         num_items = CSLCount(namespaces)
17606  *         try:
17607  */
17608   __pyx_v_namespaces = GDALGetMetadataDomainList(__pyx_v_obj);
17609 
17610   /* "rasterio/_base.pyx":1047
17611  *
17612  *         namespaces = GDALGetMetadataDomainList(obj)
17613  *         num_items = CSLCount(namespaces)             # <<<<<<<<<<<<<<
17614  *         try:
17615  *             return list([namespaces[i] for i in range(num_items) if str(namespaces[i])])
17616  */
17617   __pyx_v_num_items = CSLCount(__pyx_v_namespaces);
17618 
17619   /* "rasterio/_base.pyx":1048
17620  *         namespaces = GDALGetMetadataDomainList(obj)
17621  *         num_items = CSLCount(namespaces)
17622  *         try:             # <<<<<<<<<<<<<<
17623  *             return list([namespaces[i] for i in range(num_items) if str(namespaces[i])])
17624  *         finally:
17625  */
17626   /*try:*/ {
17627 
17628     /* "rasterio/_base.pyx":1049
17629  *         num_items = CSLCount(namespaces)
17630  *         try:
17631  *             return list([namespaces[i] for i in range(num_items) if str(namespaces[i])])             # <<<<<<<<<<<<<<
17632  *         finally:
17633  *             CSLDestroy(namespaces)
17634  */
17635     __Pyx_XDECREF(__pyx_r);
17636     { /* enter inner scope */
17637       __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1049, __pyx_L5_error)
17638       __Pyx_GOTREF(__pyx_t_1);
17639       __pyx_t_3 = __pyx_v_num_items;
17640       __pyx_t_6 = __pyx_t_3;
17641       for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17642         __pyx_9genexpr12__pyx_v_i = __pyx_t_7;
17643         __pyx_t_8 = __Pyx_PyUnicode_FromString((__pyx_v_namespaces[__pyx_9genexpr12__pyx_v_i])); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1049, __pyx_L5_error)
17644         __Pyx_GOTREF(__pyx_t_8);
17645         __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1049, __pyx_L5_error)
17646         __Pyx_GOTREF(__pyx_t_9);
17647         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
17648         __pyx_t_2 = (__Pyx_PyUnicode_IS_TRUE(__pyx_t_9) != 0);
17649         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
17650         if (__pyx_t_2) {
17651           __pyx_t_9 = __Pyx_PyUnicode_FromString((__pyx_v_namespaces[__pyx_9genexpr12__pyx_v_i])); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1049, __pyx_L5_error)
17652           __Pyx_GOTREF(__pyx_t_9);
17653           if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 1049, __pyx_L5_error)
17654           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
17655         }
17656       }
17657     } /* exit inner scope */
17658     __pyx_t_9 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1049, __pyx_L5_error)
17659     __Pyx_GOTREF(__pyx_t_9);
17660     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17661     __pyx_r = __pyx_t_9;
17662     __pyx_t_9 = 0;
17663     goto __pyx_L4_return;
17664   }
17665 
17666   /* "rasterio/_base.pyx":1051
17667  *             return list([namespaces[i] for i in range(num_items) if str(namespaces[i])])
17668  *         finally:
17669  *             CSLDestroy(namespaces)             # <<<<<<<<<<<<<<
17670  *
17671  *
17672  */
17673   /*finally:*/ {
17674     __pyx_L5_error:;
17675     /*exception exit:*/{
17676       __Pyx_PyThreadState_declare
17677       __Pyx_PyThreadState_assign
17678       __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
17679       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
17680       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
17681       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
17682       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
17683       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
17684       __Pyx_XGOTREF(__pyx_t_11);
17685       __Pyx_XGOTREF(__pyx_t_12);
17686       __Pyx_XGOTREF(__pyx_t_13);
17687       __Pyx_XGOTREF(__pyx_t_14);
17688       __Pyx_XGOTREF(__pyx_t_15);
17689       __Pyx_XGOTREF(__pyx_t_16);
17690       __pyx_t_3 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
17691       {
17692         CSLDestroy(__pyx_v_namespaces);
17693       }
17694       if (PY_MAJOR_VERSION >= 3) {
17695         __Pyx_XGIVEREF(__pyx_t_14);
17696         __Pyx_XGIVEREF(__pyx_t_15);
17697         __Pyx_XGIVEREF(__pyx_t_16);
17698         __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
17699       }
17700       __Pyx_XGIVEREF(__pyx_t_11);
17701       __Pyx_XGIVEREF(__pyx_t_12);
17702       __Pyx_XGIVEREF(__pyx_t_13);
17703       __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
17704       __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
17705       __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_10;
17706       goto __pyx_L1_error;
17707     }
17708     __pyx_L4_return: {
17709       __pyx_t_16 = __pyx_r;
17710       __pyx_r = 0;
17711       CSLDestroy(__pyx_v_namespaces);
17712       __pyx_r = __pyx_t_16;
17713       __pyx_t_16 = 0;
17714       goto __pyx_L0;
17715     }
17716   }
17717 
17718   /* "rasterio/_base.pyx":1024
17719  *
17720  *
17721  *     def tag_namespaces(self, bidx=0):             # <<<<<<<<<<<<<<
17722  *         """Get a list of the dataset's metadata domains.
17723  *
17724  */
17725 
17726   /* function exit code */
17727   __pyx_L1_error:;
17728   __Pyx_XDECREF(__pyx_t_1);
17729   __Pyx_XDECREF(__pyx_t_8);
17730   __Pyx_XDECREF(__pyx_t_9);
17731   __Pyx_AddTraceback("rasterio._base.DatasetBase.tag_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
17732   __pyx_r = NULL;
17733   __pyx_L0:;
17734   __Pyx_XGIVEREF(__pyx_r);
17735   __Pyx_RefNannyFinishContext();
17736   return __pyx_r;
17737 }
17738 
17739 /* "rasterio/_base.pyx":1054
17740  *
17741  *
17742  *     def tags(self, bidx=0, ns=None):             # <<<<<<<<<<<<<<
17743  *         """Returns a dict containing copies of the dataset or band's
17744  *         tags.
17745  */
17746 
17747 /* Python wrapper */
17748 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_62tags(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17749 static char __pyx_doc_8rasterio_5_base_11DatasetBase_61tags[] = "Returns a dict containing copies of the dataset or band's\n        tags.\n\n        Tags are pairs of key and value strings. Tags belong to\n        namespaces.  The standard namespaces are: default (None) and\n        'IMAGE_STRUCTURE'.  Applications can create their own additional\n        namespaces.\n\n        The optional bidx argument can be used to select the tags of\n        a specific band. The optional ns argument can be used to select\n        a namespace other than the default.\n        ";
__pyx_pw_8rasterio_5_base_11DatasetBase_62tags(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)17750 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_62tags(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17751   PyObject *__pyx_v_bidx = 0;
17752   PyObject *__pyx_v_ns = 0;
17753   int __pyx_lineno = 0;
17754   const char *__pyx_filename = NULL;
17755   int __pyx_clineno = 0;
17756   PyObject *__pyx_r = 0;
17757   __Pyx_RefNannyDeclarations
17758   __Pyx_RefNannySetupContext("tags (wrapper)", 0);
17759   {
17760     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bidx,&__pyx_n_s_ns,0};
17761     PyObject* values[2] = {0,0};
17762     values[0] = ((PyObject *)__pyx_int_0);
17763     values[1] = ((PyObject *)Py_None);
17764     if (unlikely(__pyx_kwds)) {
17765       Py_ssize_t kw_args;
17766       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17767       switch (pos_args) {
17768         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17769         CYTHON_FALLTHROUGH;
17770         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17771         CYTHON_FALLTHROUGH;
17772         case  0: break;
17773         default: goto __pyx_L5_argtuple_error;
17774       }
17775       kw_args = PyDict_Size(__pyx_kwds);
17776       switch (pos_args) {
17777         case  0:
17778         if (kw_args > 0) {
17779           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bidx);
17780           if (value) { values[0] = value; kw_args--; }
17781         }
17782         CYTHON_FALLTHROUGH;
17783         case  1:
17784         if (kw_args > 0) {
17785           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns);
17786           if (value) { values[1] = value; kw_args--; }
17787         }
17788       }
17789       if (unlikely(kw_args > 0)) {
17790         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tags") < 0)) __PYX_ERR(0, 1054, __pyx_L3_error)
17791       }
17792     } else {
17793       switch (PyTuple_GET_SIZE(__pyx_args)) {
17794         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17795         CYTHON_FALLTHROUGH;
17796         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17797         CYTHON_FALLTHROUGH;
17798         case  0: break;
17799         default: goto __pyx_L5_argtuple_error;
17800       }
17801     }
17802     __pyx_v_bidx = values[0];
17803     __pyx_v_ns = values[1];
17804   }
17805   goto __pyx_L4_argument_unpacking_done;
17806   __pyx_L5_argtuple_error:;
17807   __Pyx_RaiseArgtupleInvalid("tags", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1054, __pyx_L3_error)
17808   __pyx_L3_error:;
17809   __Pyx_AddTraceback("rasterio._base.DatasetBase.tags", __pyx_clineno, __pyx_lineno, __pyx_filename);
17810   __Pyx_RefNannyFinishContext();
17811   return NULL;
17812   __pyx_L4_argument_unpacking_done:;
17813   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_61tags(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), __pyx_v_bidx, __pyx_v_ns);
17814 
17815   /* function exit code */
17816   __Pyx_RefNannyFinishContext();
17817   return __pyx_r;
17818 }
17819 
__pyx_pf_8rasterio_5_base_11DatasetBase_61tags(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_bidx,PyObject * __pyx_v_ns)17820 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_61tags(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx, PyObject *__pyx_v_ns) {
17821   GDALMajorObjectH __pyx_v_obj;
17822   char **__pyx_v_metadata;
17823   char *__pyx_v_item;
17824   char const *__pyx_v_domain;
17825   char *__pyx_v_key;
17826   char *__pyx_v_val;
17827   int __pyx_v_num_items;
17828   PyObject *__pyx_v_tag_items = NULL;
17829   int __pyx_v_i;
17830   PyObject *__pyx_v_item_bytes = NULL;
17831   PyObject *__pyx_r = NULL;
17832   __Pyx_RefNannyDeclarations
17833   PyObject *__pyx_t_1 = NULL;
17834   int __pyx_t_2;
17835   int __pyx_t_3;
17836   GDALRasterBandH __pyx_t_4;
17837   GDALDatasetH __pyx_t_5;
17838   PyObject *__pyx_t_6 = NULL;
17839   PyObject *__pyx_t_7 = NULL;
17840   char const *__pyx_t_8;
17841   int __pyx_t_9;
17842   int __pyx_t_10;
17843   PyObject *__pyx_t_11 = NULL;
17844   PyObject *__pyx_t_12 = NULL;
17845   PyObject *__pyx_t_13 = NULL;
17846   int __pyx_t_14;
17847   int __pyx_t_15;
17848   PyObject *__pyx_t_16 = NULL;
17849   PyObject *__pyx_t_17 = NULL;
17850   PyObject *__pyx_t_18 = NULL;
17851   PyObject *__pyx_t_19 = NULL;
17852   PyObject *__pyx_t_20 = NULL;
17853   int __pyx_t_21;
17854   char const *__pyx_t_22;
17855   PyObject *__pyx_t_23 = NULL;
17856   PyObject *__pyx_t_24 = NULL;
17857   PyObject *__pyx_t_25 = NULL;
17858   int __pyx_lineno = 0;
17859   const char *__pyx_filename = NULL;
17860   int __pyx_clineno = 0;
17861   __Pyx_RefNannySetupContext("tags", 0);
17862   __Pyx_INCREF(__pyx_v_ns);
17863 
17864   /* "rasterio/_base.pyx":1067
17865  *         a namespace other than the default.
17866  *         """
17867  *         cdef GDALMajorObjectH obj = NULL             # <<<<<<<<<<<<<<
17868  *         cdef char **metadata = NULL
17869  *         cdef char *item = NULL
17870  */
17871   __pyx_v_obj = NULL;
17872 
17873   /* "rasterio/_base.pyx":1068
17874  *         """
17875  *         cdef GDALMajorObjectH obj = NULL
17876  *         cdef char **metadata = NULL             # <<<<<<<<<<<<<<
17877  *         cdef char *item = NULL
17878  *         cdef const char *domain = NULL
17879  */
17880   __pyx_v_metadata = NULL;
17881 
17882   /* "rasterio/_base.pyx":1069
17883  *         cdef GDALMajorObjectH obj = NULL
17884  *         cdef char **metadata = NULL
17885  *         cdef char *item = NULL             # <<<<<<<<<<<<<<
17886  *         cdef const char *domain = NULL
17887  *         cdef char *key = NULL
17888  */
17889   __pyx_v_item = NULL;
17890 
17891   /* "rasterio/_base.pyx":1070
17892  *         cdef char **metadata = NULL
17893  *         cdef char *item = NULL
17894  *         cdef const char *domain = NULL             # <<<<<<<<<<<<<<
17895  *         cdef char *key = NULL
17896  *         cdef char *val = NULL
17897  */
17898   __pyx_v_domain = NULL;
17899 
17900   /* "rasterio/_base.pyx":1071
17901  *         cdef char *item = NULL
17902  *         cdef const char *domain = NULL
17903  *         cdef char *key = NULL             # <<<<<<<<<<<<<<
17904  *         cdef char *val = NULL
17905  *
17906  */
17907   __pyx_v_key = NULL;
17908 
17909   /* "rasterio/_base.pyx":1072
17910  *         cdef const char *domain = NULL
17911  *         cdef char *key = NULL
17912  *         cdef char *val = NULL             # <<<<<<<<<<<<<<
17913  *
17914  *         if bidx > 0:
17915  */
17916   __pyx_v_val = NULL;
17917 
17918   /* "rasterio/_base.pyx":1074
17919  *         cdef char *val = NULL
17920  *
17921  *         if bidx > 0:             # <<<<<<<<<<<<<<
17922  *             obj = self.band(bidx)
17923  *         else:
17924  */
17925   __pyx_t_1 = PyObject_RichCompare(__pyx_v_bidx, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1074, __pyx_L1_error)
17926   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1074, __pyx_L1_error)
17927   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17928   if (__pyx_t_2) {
17929 
17930     /* "rasterio/_base.pyx":1075
17931  *
17932  *         if bidx > 0:
17933  *             obj = self.band(bidx)             # <<<<<<<<<<<<<<
17934  *         else:
17935  *             obj = self._hds
17936  */
17937     __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_bidx); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1075, __pyx_L1_error)
17938     __pyx_t_4 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_3); if (unlikely(__pyx_t_4 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 1075, __pyx_L1_error)
17939     __pyx_v_obj = __pyx_t_4;
17940 
17941     /* "rasterio/_base.pyx":1074
17942  *         cdef char *val = NULL
17943  *
17944  *         if bidx > 0:             # <<<<<<<<<<<<<<
17945  *             obj = self.band(bidx)
17946  *         else:
17947  */
17948     goto __pyx_L3;
17949   }
17950 
17951   /* "rasterio/_base.pyx":1077
17952  *             obj = self.band(bidx)
17953  *         else:
17954  *             obj = self._hds             # <<<<<<<<<<<<<<
17955  *         if ns:
17956  *             ns = ns.encode('utf-8')
17957  */
17958   /*else*/ {
17959     __pyx_t_5 = __pyx_v_self->_hds;
17960     __pyx_v_obj = __pyx_t_5;
17961   }
17962   __pyx_L3:;
17963 
17964   /* "rasterio/_base.pyx":1078
17965  *         else:
17966  *             obj = self._hds
17967  *         if ns:             # <<<<<<<<<<<<<<
17968  *             ns = ns.encode('utf-8')
17969  *             domain = ns
17970  */
17971   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ns); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1078, __pyx_L1_error)
17972   if (__pyx_t_2) {
17973 
17974     /* "rasterio/_base.pyx":1079
17975  *             obj = self._hds
17976  *         if ns:
17977  *             ns = ns.encode('utf-8')             # <<<<<<<<<<<<<<
17978  *             domain = ns
17979  *
17980  */
17981     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_ns, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1079, __pyx_L1_error)
17982     __Pyx_GOTREF(__pyx_t_6);
17983     __pyx_t_7 = NULL;
17984     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
17985       __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
17986       if (likely(__pyx_t_7)) {
17987         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
17988         __Pyx_INCREF(__pyx_t_7);
17989         __Pyx_INCREF(function);
17990         __Pyx_DECREF_SET(__pyx_t_6, function);
17991       }
17992     }
17993     __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_utf_8);
17994     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
17995     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1079, __pyx_L1_error)
17996     __Pyx_GOTREF(__pyx_t_1);
17997     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17998     __Pyx_DECREF_SET(__pyx_v_ns, __pyx_t_1);
17999     __pyx_t_1 = 0;
18000 
18001     /* "rasterio/_base.pyx":1080
18002  *         if ns:
18003  *             ns = ns.encode('utf-8')
18004  *             domain = ns             # <<<<<<<<<<<<<<
18005  *
18006  *         metadata = GDALGetMetadata(obj, domain)
18007  */
18008     __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_ns); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 1080, __pyx_L1_error)
18009     __pyx_v_domain = __pyx_t_8;
18010 
18011     /* "rasterio/_base.pyx":1078
18012  *         else:
18013  *             obj = self._hds
18014  *         if ns:             # <<<<<<<<<<<<<<
18015  *             ns = ns.encode('utf-8')
18016  *             domain = ns
18017  */
18018   }
18019 
18020   /* "rasterio/_base.pyx":1082
18021  *             domain = ns
18022  *
18023  *         metadata = GDALGetMetadata(obj, domain)             # <<<<<<<<<<<<<<
18024  *         num_items = CSLCount(metadata)
18025  *
18026  */
18027   __pyx_v_metadata = GDALGetMetadata(__pyx_v_obj, __pyx_v_domain);
18028 
18029   /* "rasterio/_base.pyx":1083
18030  *
18031  *         metadata = GDALGetMetadata(obj, domain)
18032  *         num_items = CSLCount(metadata)             # <<<<<<<<<<<<<<
18033  *
18034  *         tag_items = []
18035  */
18036   __pyx_v_num_items = CSLCount(__pyx_v_metadata);
18037 
18038   /* "rasterio/_base.pyx":1085
18039  *         num_items = CSLCount(metadata)
18040  *
18041  *         tag_items = []             # <<<<<<<<<<<<<<
18042  *         for i in range(num_items):
18043  *             item = <char *>metadata[i]
18044  */
18045   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1085, __pyx_L1_error)
18046   __Pyx_GOTREF(__pyx_t_1);
18047   __pyx_v_tag_items = ((PyObject*)__pyx_t_1);
18048   __pyx_t_1 = 0;
18049 
18050   /* "rasterio/_base.pyx":1086
18051  *
18052  *         tag_items = []
18053  *         for i in range(num_items):             # <<<<<<<<<<<<<<
18054  *             item = <char *>metadata[i]
18055  *             try:
18056  */
18057   __pyx_t_3 = __pyx_v_num_items;
18058   __pyx_t_9 = __pyx_t_3;
18059   for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18060     __pyx_v_i = __pyx_t_10;
18061 
18062     /* "rasterio/_base.pyx":1087
18063  *         tag_items = []
18064  *         for i in range(num_items):
18065  *             item = <char *>metadata[i]             # <<<<<<<<<<<<<<
18066  *             try:
18067  *                 val = CPLParseNameValue(metadata[i], &key)
18068  */
18069     __pyx_v_item = ((char *)(__pyx_v_metadata[__pyx_v_i]));
18070 
18071     /* "rasterio/_base.pyx":1088
18072  *         for i in range(num_items):
18073  *             item = <char *>metadata[i]
18074  *             try:             # <<<<<<<<<<<<<<
18075  *                 val = CPLParseNameValue(metadata[i], &key)
18076  *                 tag_items.append((key[:], val[:]))
18077  */
18078     /*try:*/ {
18079       {
18080         __Pyx_PyThreadState_declare
18081         __Pyx_PyThreadState_assign
18082         __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
18083         __Pyx_XGOTREF(__pyx_t_11);
18084         __Pyx_XGOTREF(__pyx_t_12);
18085         __Pyx_XGOTREF(__pyx_t_13);
18086         /*try:*/ {
18087 
18088           /* "rasterio/_base.pyx":1089
18089  *             item = <char *>metadata[i]
18090  *             try:
18091  *                 val = CPLParseNameValue(metadata[i], &key)             # <<<<<<<<<<<<<<
18092  *                 tag_items.append((key[:], val[:]))
18093  *             except UnicodeDecodeError:
18094  */
18095           __pyx_v_val = CPLParseNameValue((__pyx_v_metadata[__pyx_v_i]), (&__pyx_v_key));
18096 
18097           /* "rasterio/_base.pyx":1090
18098  *             try:
18099  *                 val = CPLParseNameValue(metadata[i], &key)
18100  *                 tag_items.append((key[:], val[:]))             # <<<<<<<<<<<<<<
18101  *             except UnicodeDecodeError:
18102  *                 item_bytes = <bytes>item
18103  */
18104           __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_key + 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L12_error)
18105           __Pyx_GOTREF(__pyx_t_1);
18106           __pyx_t_6 = __Pyx_PyUnicode_FromString(__pyx_v_val + 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L12_error)
18107           __Pyx_GOTREF(__pyx_t_6);
18108           __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1090, __pyx_L12_error)
18109           __Pyx_GOTREF(__pyx_t_7);
18110           __Pyx_GIVEREF(__pyx_t_1);
18111           PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
18112           __Pyx_GIVEREF(__pyx_t_6);
18113           PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
18114           __pyx_t_1 = 0;
18115           __pyx_t_6 = 0;
18116           __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_tag_items, __pyx_t_7); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1090, __pyx_L12_error)
18117           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
18118 
18119           /* "rasterio/_base.pyx":1088
18120  *         for i in range(num_items):
18121  *             item = <char *>metadata[i]
18122  *             try:             # <<<<<<<<<<<<<<
18123  *                 val = CPLParseNameValue(metadata[i], &key)
18124  *                 tag_items.append((key[:], val[:]))
18125  */
18126         }
18127         __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
18128         __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
18129         __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
18130         goto __pyx_L19_try_end;
18131         __pyx_L12_error:;
18132         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
18133         __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
18134         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
18135 
18136         /* "rasterio/_base.pyx":1091
18137  *                 val = CPLParseNameValue(metadata[i], &key)
18138  *                 tag_items.append((key[:], val[:]))
18139  *             except UnicodeDecodeError:             # <<<<<<<<<<<<<<
18140  *                 item_bytes = <bytes>item
18141  *                 log.warning("Failed to decode metadata item: i=%r, item=%r", i, item_bytes)
18142  */
18143         __pyx_t_15 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
18144         if (__pyx_t_15) {
18145           __Pyx_AddTraceback("rasterio._base.DatasetBase.tags", __pyx_clineno, __pyx_lineno, __pyx_filename);
18146           if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(0, 1091, __pyx_L14_except_error)
18147           __Pyx_GOTREF(__pyx_t_7);
18148           __Pyx_GOTREF(__pyx_t_6);
18149           __Pyx_GOTREF(__pyx_t_1);
18150 
18151           /* "rasterio/_base.pyx":1092
18152  *                 tag_items.append((key[:], val[:]))
18153  *             except UnicodeDecodeError:
18154  *                 item_bytes = <bytes>item             # <<<<<<<<<<<<<<
18155  *                 log.warning("Failed to decode metadata item: i=%r, item=%r", i, item_bytes)
18156  *             finally:
18157  */
18158           __pyx_t_16 = __Pyx_PyBytes_FromString(__pyx_v_item); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1092, __pyx_L14_except_error)
18159           __Pyx_GOTREF(__pyx_t_16);
18160           __pyx_t_17 = __pyx_t_16;
18161           __Pyx_INCREF(__pyx_t_17);
18162           __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
18163           __Pyx_XDECREF_SET(__pyx_v_item_bytes, ((PyObject*)__pyx_t_17));
18164           __pyx_t_17 = 0;
18165 
18166           /* "rasterio/_base.pyx":1093
18167  *             except UnicodeDecodeError:
18168  *                 item_bytes = <bytes>item
18169  *                 log.warning("Failed to decode metadata item: i=%r, item=%r", i, item_bytes)             # <<<<<<<<<<<<<<
18170  *             finally:
18171  *                 CPLFree(key)
18172  */
18173           __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_log); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1093, __pyx_L14_except_error)
18174           __Pyx_GOTREF(__pyx_t_16);
18175           __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_warning); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1093, __pyx_L14_except_error)
18176           __Pyx_GOTREF(__pyx_t_18);
18177           __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
18178           __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1093, __pyx_L14_except_error)
18179           __Pyx_GOTREF(__pyx_t_16);
18180           __pyx_t_19 = NULL;
18181           __pyx_t_15 = 0;
18182           if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
18183             __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_18);
18184             if (likely(__pyx_t_19)) {
18185               PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
18186               __Pyx_INCREF(__pyx_t_19);
18187               __Pyx_INCREF(function);
18188               __Pyx_DECREF_SET(__pyx_t_18, function);
18189               __pyx_t_15 = 1;
18190             }
18191           }
18192           #if CYTHON_FAST_PYCALL
18193           if (PyFunction_Check(__pyx_t_18)) {
18194             PyObject *__pyx_temp[4] = {__pyx_t_19, __pyx_kp_u_Failed_to_decode_metadata_item_i, __pyx_t_16, __pyx_v_item_bytes};
18195             __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_18, __pyx_temp+1-__pyx_t_15, 3+__pyx_t_15); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1093, __pyx_L14_except_error)
18196             __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
18197             __Pyx_GOTREF(__pyx_t_17);
18198             __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
18199           } else
18200           #endif
18201           #if CYTHON_FAST_PYCCALL
18202           if (__Pyx_PyFastCFunction_Check(__pyx_t_18)) {
18203             PyObject *__pyx_temp[4] = {__pyx_t_19, __pyx_kp_u_Failed_to_decode_metadata_item_i, __pyx_t_16, __pyx_v_item_bytes};
18204             __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_18, __pyx_temp+1-__pyx_t_15, 3+__pyx_t_15); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1093, __pyx_L14_except_error)
18205             __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
18206             __Pyx_GOTREF(__pyx_t_17);
18207             __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
18208           } else
18209           #endif
18210           {
18211             __pyx_t_20 = PyTuple_New(3+__pyx_t_15); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1093, __pyx_L14_except_error)
18212             __Pyx_GOTREF(__pyx_t_20);
18213             if (__pyx_t_19) {
18214               __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19); __pyx_t_19 = NULL;
18215             }
18216             __Pyx_INCREF(__pyx_kp_u_Failed_to_decode_metadata_item_i);
18217             __Pyx_GIVEREF(__pyx_kp_u_Failed_to_decode_metadata_item_i);
18218             PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_15, __pyx_kp_u_Failed_to_decode_metadata_item_i);
18219             __Pyx_GIVEREF(__pyx_t_16);
18220             PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_15, __pyx_t_16);
18221             __Pyx_INCREF(__pyx_v_item_bytes);
18222             __Pyx_GIVEREF(__pyx_v_item_bytes);
18223             PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_15, __pyx_v_item_bytes);
18224             __pyx_t_16 = 0;
18225             __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_20, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1093, __pyx_L14_except_error)
18226             __Pyx_GOTREF(__pyx_t_17);
18227             __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
18228           }
18229           __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
18230           __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
18231           __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
18232           __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
18233           __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
18234           goto __pyx_L13_exception_handled;
18235         }
18236         goto __pyx_L14_except_error;
18237         __pyx_L14_except_error:;
18238 
18239         /* "rasterio/_base.pyx":1088
18240  *         for i in range(num_items):
18241  *             item = <char *>metadata[i]
18242  *             try:             # <<<<<<<<<<<<<<
18243  *                 val = CPLParseNameValue(metadata[i], &key)
18244  *                 tag_items.append((key[:], val[:]))
18245  */
18246         __Pyx_XGIVEREF(__pyx_t_11);
18247         __Pyx_XGIVEREF(__pyx_t_12);
18248         __Pyx_XGIVEREF(__pyx_t_13);
18249         __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
18250         goto __pyx_L10_error;
18251         __pyx_L13_exception_handled:;
18252         __Pyx_XGIVEREF(__pyx_t_11);
18253         __Pyx_XGIVEREF(__pyx_t_12);
18254         __Pyx_XGIVEREF(__pyx_t_13);
18255         __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
18256         __pyx_L19_try_end:;
18257       }
18258     }
18259 
18260     /* "rasterio/_base.pyx":1095
18261  *                 log.warning("Failed to decode metadata item: i=%r, item=%r", i, item_bytes)
18262  *             finally:
18263  *                 CPLFree(key)             # <<<<<<<<<<<<<<
18264  *
18265  *         return dict(tag_items)
18266  */
18267     /*finally:*/ {
18268       /*normal exit:*/{
18269         CPLFree(__pyx_v_key);
18270         goto __pyx_L11;
18271       }
18272       __pyx_L10_error:;
18273       /*exception exit:*/{
18274         __Pyx_PyThreadState_declare
18275         __Pyx_PyThreadState_assign
18276         __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0;
18277         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
18278         __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
18279         __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
18280         __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
18281         __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
18282         __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
18283         __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
18284         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
18285         if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25);
18286         if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
18287         __Pyx_XGOTREF(__pyx_t_13);
18288         __Pyx_XGOTREF(__pyx_t_12);
18289         __Pyx_XGOTREF(__pyx_t_11);
18290         __Pyx_XGOTREF(__pyx_t_23);
18291         __Pyx_XGOTREF(__pyx_t_24);
18292         __Pyx_XGOTREF(__pyx_t_25);
18293         __pyx_t_15 = __pyx_lineno; __pyx_t_21 = __pyx_clineno; __pyx_t_22 = __pyx_filename;
18294         {
18295           CPLFree(__pyx_v_key);
18296         }
18297         if (PY_MAJOR_VERSION >= 3) {
18298           __Pyx_XGIVEREF(__pyx_t_23);
18299           __Pyx_XGIVEREF(__pyx_t_24);
18300           __Pyx_XGIVEREF(__pyx_t_25);
18301           __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_24, __pyx_t_25);
18302         }
18303         __Pyx_XGIVEREF(__pyx_t_13);
18304         __Pyx_XGIVEREF(__pyx_t_12);
18305         __Pyx_XGIVEREF(__pyx_t_11);
18306         __Pyx_ErrRestore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
18307         __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0;
18308         __pyx_lineno = __pyx_t_15; __pyx_clineno = __pyx_t_21; __pyx_filename = __pyx_t_22;
18309         goto __pyx_L1_error;
18310       }
18311       __pyx_L11:;
18312     }
18313   }
18314 
18315   /* "rasterio/_base.pyx":1097
18316  *                 CPLFree(key)
18317  *
18318  *         return dict(tag_items)             # <<<<<<<<<<<<<<
18319  *
18320  *
18321  */
18322   __Pyx_XDECREF(__pyx_r);
18323   __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_v_tag_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1097, __pyx_L1_error)
18324   __Pyx_GOTREF(__pyx_t_1);
18325   __pyx_r = __pyx_t_1;
18326   __pyx_t_1 = 0;
18327   goto __pyx_L0;
18328 
18329   /* "rasterio/_base.pyx":1054
18330  *
18331  *
18332  *     def tags(self, bidx=0, ns=None):             # <<<<<<<<<<<<<<
18333  *         """Returns a dict containing copies of the dataset or band's
18334  *         tags.
18335  */
18336 
18337   /* function exit code */
18338   __pyx_L1_error:;
18339   __Pyx_XDECREF(__pyx_t_1);
18340   __Pyx_XDECREF(__pyx_t_6);
18341   __Pyx_XDECREF(__pyx_t_7);
18342   __Pyx_XDECREF(__pyx_t_16);
18343   __Pyx_XDECREF(__pyx_t_17);
18344   __Pyx_XDECREF(__pyx_t_18);
18345   __Pyx_XDECREF(__pyx_t_19);
18346   __Pyx_XDECREF(__pyx_t_20);
18347   __Pyx_AddTraceback("rasterio._base.DatasetBase.tags", __pyx_clineno, __pyx_lineno, __pyx_filename);
18348   __pyx_r = NULL;
18349   __pyx_L0:;
18350   __Pyx_XDECREF(__pyx_v_tag_items);
18351   __Pyx_XDECREF(__pyx_v_item_bytes);
18352   __Pyx_XDECREF(__pyx_v_ns);
18353   __Pyx_XGIVEREF(__pyx_r);
18354   __Pyx_RefNannyFinishContext();
18355   return __pyx_r;
18356 }
18357 
18358 /* "rasterio/_base.pyx":1100
18359  *
18360  *
18361  *     def get_tag_item(self, ns, dm=None, bidx=0, ovr=None):             # <<<<<<<<<<<<<<
18362  *         """Returns tag item value
18363  *
18364  */
18365 
18366 /* Python wrapper */
18367 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_64get_tag_item(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
18368 static char __pyx_doc_8rasterio_5_base_11DatasetBase_63get_tag_item[] = "Returns tag item value\n\n        Parameters\n        ----------\n        ns: str\n            The key for the metadata item to fetch.\n        dm: str\n            The domain to fetch for.\n        bidx: int\n            Band index, starting with 1.\n        ovr: int\n            Overview level\n\n        Returns\n        -------\n        str\n        ";
__pyx_pw_8rasterio_5_base_11DatasetBase_64get_tag_item(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)18369 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_64get_tag_item(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18370   PyObject *__pyx_v_ns = 0;
18371   PyObject *__pyx_v_dm = 0;
18372   PyObject *__pyx_v_bidx = 0;
18373   PyObject *__pyx_v_ovr = 0;
18374   int __pyx_lineno = 0;
18375   const char *__pyx_filename = NULL;
18376   int __pyx_clineno = 0;
18377   PyObject *__pyx_r = 0;
18378   __Pyx_RefNannyDeclarations
18379   __Pyx_RefNannySetupContext("get_tag_item (wrapper)", 0);
18380   {
18381     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ns,&__pyx_n_s_dm,&__pyx_n_s_bidx,&__pyx_n_s_ovr,0};
18382     PyObject* values[4] = {0,0,0,0};
18383     values[1] = ((PyObject *)Py_None);
18384     values[2] = ((PyObject *)__pyx_int_0);
18385     values[3] = ((PyObject *)Py_None);
18386     if (unlikely(__pyx_kwds)) {
18387       Py_ssize_t kw_args;
18388       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
18389       switch (pos_args) {
18390         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
18391         CYTHON_FALLTHROUGH;
18392         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18393         CYTHON_FALLTHROUGH;
18394         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18395         CYTHON_FALLTHROUGH;
18396         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18397         CYTHON_FALLTHROUGH;
18398         case  0: break;
18399         default: goto __pyx_L5_argtuple_error;
18400       }
18401       kw_args = PyDict_Size(__pyx_kwds);
18402       switch (pos_args) {
18403         case  0:
18404         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns)) != 0)) kw_args--;
18405         else goto __pyx_L5_argtuple_error;
18406         CYTHON_FALLTHROUGH;
18407         case  1:
18408         if (kw_args > 0) {
18409           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dm);
18410           if (value) { values[1] = value; kw_args--; }
18411         }
18412         CYTHON_FALLTHROUGH;
18413         case  2:
18414         if (kw_args > 0) {
18415           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bidx);
18416           if (value) { values[2] = value; kw_args--; }
18417         }
18418         CYTHON_FALLTHROUGH;
18419         case  3:
18420         if (kw_args > 0) {
18421           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ovr);
18422           if (value) { values[3] = value; kw_args--; }
18423         }
18424       }
18425       if (unlikely(kw_args > 0)) {
18426         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_tag_item") < 0)) __PYX_ERR(0, 1100, __pyx_L3_error)
18427       }
18428     } else {
18429       switch (PyTuple_GET_SIZE(__pyx_args)) {
18430         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
18431         CYTHON_FALLTHROUGH;
18432         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18433         CYTHON_FALLTHROUGH;
18434         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18435         CYTHON_FALLTHROUGH;
18436         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18437         break;
18438         default: goto __pyx_L5_argtuple_error;
18439       }
18440     }
18441     __pyx_v_ns = values[0];
18442     __pyx_v_dm = values[1];
18443     __pyx_v_bidx = values[2];
18444     __pyx_v_ovr = values[3];
18445   }
18446   goto __pyx_L4_argument_unpacking_done;
18447   __pyx_L5_argtuple_error:;
18448   __Pyx_RaiseArgtupleInvalid("get_tag_item", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1100, __pyx_L3_error)
18449   __pyx_L3_error:;
18450   __Pyx_AddTraceback("rasterio._base.DatasetBase.get_tag_item", __pyx_clineno, __pyx_lineno, __pyx_filename);
18451   __Pyx_RefNannyFinishContext();
18452   return NULL;
18453   __pyx_L4_argument_unpacking_done:;
18454   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_63get_tag_item(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), __pyx_v_ns, __pyx_v_dm, __pyx_v_bidx, __pyx_v_ovr);
18455 
18456   /* function exit code */
18457   __Pyx_RefNannyFinishContext();
18458   return __pyx_r;
18459 }
18460 
__pyx_pf_8rasterio_5_base_11DatasetBase_63get_tag_item(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_ns,PyObject * __pyx_v_dm,PyObject * __pyx_v_bidx,PyObject * __pyx_v_ovr)18461 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_63get_tag_item(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_ns, PyObject *__pyx_v_dm, PyObject *__pyx_v_bidx, PyObject *__pyx_v_ovr) {
18462   GDALMajorObjectH __pyx_v_band;
18463   GDALMajorObjectH __pyx_v_obj;
18464   char *__pyx_v_value;
18465   char const *__pyx_v_name;
18466   char const *__pyx_v_domain;
18467   PyObject *__pyx_r = NULL;
18468   __Pyx_RefNannyDeclarations
18469   PyObject *__pyx_t_1 = NULL;
18470   PyObject *__pyx_t_2 = NULL;
18471   PyObject *__pyx_t_3 = NULL;
18472   char const *__pyx_t_4;
18473   int __pyx_t_5;
18474   char const *__pyx_t_6;
18475   int __pyx_t_7;
18476   int __pyx_t_8;
18477   int __pyx_t_9;
18478   GDALRasterBandH __pyx_t_10;
18479   GDALDatasetH __pyx_t_11;
18480   PyObject *__pyx_t_12 = NULL;
18481   PyObject *__pyx_t_13 = NULL;
18482   int __pyx_lineno = 0;
18483   const char *__pyx_filename = NULL;
18484   int __pyx_clineno = 0;
18485   __Pyx_RefNannySetupContext("get_tag_item", 0);
18486   __Pyx_INCREF(__pyx_v_ns);
18487   __Pyx_INCREF(__pyx_v_dm);
18488 
18489   /* "rasterio/_base.pyx":1118
18490  *         str
18491  *         """
18492  *         cdef GDALMajorObjectH band = NULL             # <<<<<<<<<<<<<<
18493  *         cdef GDALMajorObjectH obj = NULL
18494  *         cdef char *value = NULL
18495  */
18496   __pyx_v_band = NULL;
18497 
18498   /* "rasterio/_base.pyx":1119
18499  *         """
18500  *         cdef GDALMajorObjectH band = NULL
18501  *         cdef GDALMajorObjectH obj = NULL             # <<<<<<<<<<<<<<
18502  *         cdef char *value = NULL
18503  *         cdef const char *name = NULL
18504  */
18505   __pyx_v_obj = NULL;
18506 
18507   /* "rasterio/_base.pyx":1120
18508  *         cdef GDALMajorObjectH band = NULL
18509  *         cdef GDALMajorObjectH obj = NULL
18510  *         cdef char *value = NULL             # <<<<<<<<<<<<<<
18511  *         cdef const char *name = NULL
18512  *         cdef const char *domain = NULL
18513  */
18514   __pyx_v_value = NULL;
18515 
18516   /* "rasterio/_base.pyx":1121
18517  *         cdef GDALMajorObjectH obj = NULL
18518  *         cdef char *value = NULL
18519  *         cdef const char *name = NULL             # <<<<<<<<<<<<<<
18520  *         cdef const char *domain = NULL
18521  *
18522  */
18523   __pyx_v_name = NULL;
18524 
18525   /* "rasterio/_base.pyx":1122
18526  *         cdef char *value = NULL
18527  *         cdef const char *name = NULL
18528  *         cdef const char *domain = NULL             # <<<<<<<<<<<<<<
18529  *
18530  *         ns = ns.encode('utf-8')
18531  */
18532   __pyx_v_domain = NULL;
18533 
18534   /* "rasterio/_base.pyx":1124
18535  *         cdef const char *domain = NULL
18536  *
18537  *         ns = ns.encode('utf-8')             # <<<<<<<<<<<<<<
18538  *         name = ns
18539  *
18540  */
18541   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ns, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1124, __pyx_L1_error)
18542   __Pyx_GOTREF(__pyx_t_2);
18543   __pyx_t_3 = NULL;
18544   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
18545     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
18546     if (likely(__pyx_t_3)) {
18547       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
18548       __Pyx_INCREF(__pyx_t_3);
18549       __Pyx_INCREF(function);
18550       __Pyx_DECREF_SET(__pyx_t_2, function);
18551     }
18552   }
18553   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_utf_8);
18554   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
18555   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1124, __pyx_L1_error)
18556   __Pyx_GOTREF(__pyx_t_1);
18557   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18558   __Pyx_DECREF_SET(__pyx_v_ns, __pyx_t_1);
18559   __pyx_t_1 = 0;
18560 
18561   /* "rasterio/_base.pyx":1125
18562  *
18563  *         ns = ns.encode('utf-8')
18564  *         name = ns             # <<<<<<<<<<<<<<
18565  *
18566  *         if dm:
18567  */
18568   __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_ns); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 1125, __pyx_L1_error)
18569   __pyx_v_name = __pyx_t_4;
18570 
18571   /* "rasterio/_base.pyx":1127
18572  *         name = ns
18573  *
18574  *         if dm:             # <<<<<<<<<<<<<<
18575  *             dm = dm.encode('utf-8')
18576  *             domain = dm
18577  */
18578   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_dm); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1127, __pyx_L1_error)
18579   if (__pyx_t_5) {
18580 
18581     /* "rasterio/_base.pyx":1128
18582  *
18583  *         if dm:
18584  *             dm = dm.encode('utf-8')             # <<<<<<<<<<<<<<
18585  *             domain = dm
18586  *
18587  */
18588     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dm, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1128, __pyx_L1_error)
18589     __Pyx_GOTREF(__pyx_t_2);
18590     __pyx_t_3 = NULL;
18591     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
18592       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
18593       if (likely(__pyx_t_3)) {
18594         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
18595         __Pyx_INCREF(__pyx_t_3);
18596         __Pyx_INCREF(function);
18597         __Pyx_DECREF_SET(__pyx_t_2, function);
18598       }
18599     }
18600     __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_utf_8);
18601     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
18602     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1128, __pyx_L1_error)
18603     __Pyx_GOTREF(__pyx_t_1);
18604     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18605     __Pyx_DECREF_SET(__pyx_v_dm, __pyx_t_1);
18606     __pyx_t_1 = 0;
18607 
18608     /* "rasterio/_base.pyx":1129
18609  *         if dm:
18610  *             dm = dm.encode('utf-8')
18611  *             domain = dm             # <<<<<<<<<<<<<<
18612  *
18613  *         if not bidx > 0 and ovr:
18614  */
18615     __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_dm); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 1129, __pyx_L1_error)
18616     __pyx_v_domain = __pyx_t_6;
18617 
18618     /* "rasterio/_base.pyx":1127
18619  *         name = ns
18620  *
18621  *         if dm:             # <<<<<<<<<<<<<<
18622  *             dm = dm.encode('utf-8')
18623  *             domain = dm
18624  */
18625   }
18626 
18627   /* "rasterio/_base.pyx":1131
18628  *             domain = dm
18629  *
18630  *         if not bidx > 0 and ovr:             # <<<<<<<<<<<<<<
18631  *             raise Exception("Band index (bidx) option needed for overview level")
18632  *
18633  */
18634   __pyx_t_1 = PyObject_RichCompare(__pyx_v_bidx, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1131, __pyx_L1_error)
18635   __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1131, __pyx_L1_error)
18636   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18637   __pyx_t_8 = ((!__pyx_t_7) != 0);
18638   if (__pyx_t_8) {
18639   } else {
18640     __pyx_t_5 = __pyx_t_8;
18641     goto __pyx_L5_bool_binop_done;
18642   }
18643   __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_ovr); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1131, __pyx_L1_error)
18644   __pyx_t_5 = __pyx_t_8;
18645   __pyx_L5_bool_binop_done:;
18646   if (unlikely(__pyx_t_5)) {
18647 
18648     /* "rasterio/_base.pyx":1132
18649  *
18650  *         if not bidx > 0 and ovr:
18651  *             raise Exception("Band index (bidx) option needed for overview level")             # <<<<<<<<<<<<<<
18652  *
18653  *         if bidx > 0:
18654  */
18655     __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1132, __pyx_L1_error)
18656     __Pyx_GOTREF(__pyx_t_1);
18657     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18658     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18659     __PYX_ERR(0, 1132, __pyx_L1_error)
18660 
18661     /* "rasterio/_base.pyx":1131
18662  *             domain = dm
18663  *
18664  *         if not bidx > 0 and ovr:             # <<<<<<<<<<<<<<
18665  *             raise Exception("Band index (bidx) option needed for overview level")
18666  *
18667  */
18668   }
18669 
18670   /* "rasterio/_base.pyx":1134
18671  *             raise Exception("Band index (bidx) option needed for overview level")
18672  *
18673  *         if bidx > 0:             # <<<<<<<<<<<<<<
18674  *             band = self.band(bidx)
18675  *         else:
18676  */
18677   __pyx_t_1 = PyObject_RichCompare(__pyx_v_bidx, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1134, __pyx_L1_error)
18678   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1134, __pyx_L1_error)
18679   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18680   if (__pyx_t_5) {
18681 
18682     /* "rasterio/_base.pyx":1135
18683  *
18684  *         if bidx > 0:
18685  *             band = self.band(bidx)             # <<<<<<<<<<<<<<
18686  *         else:
18687  *             band = self._hds
18688  */
18689     __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_bidx); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1135, __pyx_L1_error)
18690     __pyx_t_10 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_9); if (unlikely(__pyx_t_10 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 1135, __pyx_L1_error)
18691     __pyx_v_band = __pyx_t_10;
18692 
18693     /* "rasterio/_base.pyx":1134
18694  *             raise Exception("Band index (bidx) option needed for overview level")
18695  *
18696  *         if bidx > 0:             # <<<<<<<<<<<<<<
18697  *             band = self.band(bidx)
18698  *         else:
18699  */
18700     goto __pyx_L7;
18701   }
18702 
18703   /* "rasterio/_base.pyx":1137
18704  *             band = self.band(bidx)
18705  *         else:
18706  *             band = self._hds             # <<<<<<<<<<<<<<
18707  *
18708  *         if ovr is not None:
18709  */
18710   /*else*/ {
18711     __pyx_t_11 = __pyx_v_self->_hds;
18712     __pyx_v_band = __pyx_t_11;
18713   }
18714   __pyx_L7:;
18715 
18716   /* "rasterio/_base.pyx":1139
18717  *             band = self._hds
18718  *
18719  *         if ovr is not None:             # <<<<<<<<<<<<<<
18720  *             obj = GDALGetOverview(band, ovr)
18721  *             if obj == NULL:
18722  */
18723   __pyx_t_5 = (__pyx_v_ovr != Py_None);
18724   __pyx_t_8 = (__pyx_t_5 != 0);
18725   if (__pyx_t_8) {
18726 
18727     /* "rasterio/_base.pyx":1140
18728  *
18729  *         if ovr is not None:
18730  *             obj = GDALGetOverview(band, ovr)             # <<<<<<<<<<<<<<
18731  *             if obj == NULL:
18732  *               raise BandOverviewError(
18733  */
18734     __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_ovr); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1140, __pyx_L1_error)
18735     __pyx_v_obj = GDALGetOverview(__pyx_v_band, __pyx_t_9);
18736 
18737     /* "rasterio/_base.pyx":1141
18738  *         if ovr is not None:
18739  *             obj = GDALGetOverview(band, ovr)
18740  *             if obj == NULL:             # <<<<<<<<<<<<<<
18741  *               raise BandOverviewError(
18742  *                   "Failed to retrieve overview {}".format(ovr))
18743  */
18744     __pyx_t_8 = ((__pyx_v_obj == NULL) != 0);
18745     if (unlikely(__pyx_t_8)) {
18746 
18747       /* "rasterio/_base.pyx":1142
18748  *             obj = GDALGetOverview(band, ovr)
18749  *             if obj == NULL:
18750  *               raise BandOverviewError(             # <<<<<<<<<<<<<<
18751  *                   "Failed to retrieve overview {}".format(ovr))
18752  *         else:
18753  */
18754       __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BandOverviewError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1142, __pyx_L1_error)
18755       __Pyx_GOTREF(__pyx_t_2);
18756 
18757       /* "rasterio/_base.pyx":1143
18758  *             if obj == NULL:
18759  *               raise BandOverviewError(
18760  *                   "Failed to retrieve overview {}".format(ovr))             # <<<<<<<<<<<<<<
18761  *         else:
18762  *             obj = band
18763  */
18764       __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Failed_to_retrieve_overview, __pyx_n_s_format); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1143, __pyx_L1_error)
18765       __Pyx_GOTREF(__pyx_t_12);
18766       __pyx_t_13 = NULL;
18767       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
18768         __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
18769         if (likely(__pyx_t_13)) {
18770           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
18771           __Pyx_INCREF(__pyx_t_13);
18772           __Pyx_INCREF(function);
18773           __Pyx_DECREF_SET(__pyx_t_12, function);
18774         }
18775       }
18776       __pyx_t_3 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_13, __pyx_v_ovr) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_ovr);
18777       __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
18778       if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1143, __pyx_L1_error)
18779       __Pyx_GOTREF(__pyx_t_3);
18780       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
18781       __pyx_t_12 = NULL;
18782       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
18783         __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
18784         if (likely(__pyx_t_12)) {
18785           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
18786           __Pyx_INCREF(__pyx_t_12);
18787           __Pyx_INCREF(function);
18788           __Pyx_DECREF_SET(__pyx_t_2, function);
18789         }
18790       }
18791       __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_12, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
18792       __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
18793       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18794       if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
18795       __Pyx_GOTREF(__pyx_t_1);
18796       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18797       __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18798       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18799       __PYX_ERR(0, 1142, __pyx_L1_error)
18800 
18801       /* "rasterio/_base.pyx":1141
18802  *         if ovr is not None:
18803  *             obj = GDALGetOverview(band, ovr)
18804  *             if obj == NULL:             # <<<<<<<<<<<<<<
18805  *               raise BandOverviewError(
18806  *                   "Failed to retrieve overview {}".format(ovr))
18807  */
18808     }
18809 
18810     /* "rasterio/_base.pyx":1139
18811  *             band = self._hds
18812  *
18813  *         if ovr is not None:             # <<<<<<<<<<<<<<
18814  *             obj = GDALGetOverview(band, ovr)
18815  *             if obj == NULL:
18816  */
18817     goto __pyx_L8;
18818   }
18819 
18820   /* "rasterio/_base.pyx":1145
18821  *                   "Failed to retrieve overview {}".format(ovr))
18822  *         else:
18823  *             obj = band             # <<<<<<<<<<<<<<
18824  *
18825  *         value = GDALGetMetadataItem(obj, name, domain)
18826  */
18827   /*else*/ {
18828     __pyx_v_obj = __pyx_v_band;
18829   }
18830   __pyx_L8:;
18831 
18832   /* "rasterio/_base.pyx":1147
18833  *             obj = band
18834  *
18835  *         value = GDALGetMetadataItem(obj, name, domain)             # <<<<<<<<<<<<<<
18836  *         if value == NULL:
18837  *             return None
18838  */
18839   __pyx_v_value = GDALGetMetadataItem(__pyx_v_obj, __pyx_v_name, __pyx_v_domain);
18840 
18841   /* "rasterio/_base.pyx":1148
18842  *
18843  *         value = GDALGetMetadataItem(obj, name, domain)
18844  *         if value == NULL:             # <<<<<<<<<<<<<<
18845  *             return None
18846  *         else:
18847  */
18848   __pyx_t_8 = ((__pyx_v_value == NULL) != 0);
18849   if (__pyx_t_8) {
18850 
18851     /* "rasterio/_base.pyx":1149
18852  *         value = GDALGetMetadataItem(obj, name, domain)
18853  *         if value == NULL:
18854  *             return None             # <<<<<<<<<<<<<<
18855  *         else:
18856  *             return value
18857  */
18858     __Pyx_XDECREF(__pyx_r);
18859     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18860     goto __pyx_L0;
18861 
18862     /* "rasterio/_base.pyx":1148
18863  *
18864  *         value = GDALGetMetadataItem(obj, name, domain)
18865  *         if value == NULL:             # <<<<<<<<<<<<<<
18866  *             return None
18867  *         else:
18868  */
18869   }
18870 
18871   /* "rasterio/_base.pyx":1151
18872  *             return None
18873  *         else:
18874  *             return value             # <<<<<<<<<<<<<<
18875  *
18876  *
18877  */
18878   /*else*/ {
18879     __Pyx_XDECREF(__pyx_r);
18880     __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1151, __pyx_L1_error)
18881     __Pyx_GOTREF(__pyx_t_1);
18882     __pyx_r = __pyx_t_1;
18883     __pyx_t_1 = 0;
18884     goto __pyx_L0;
18885   }
18886 
18887   /* "rasterio/_base.pyx":1100
18888  *
18889  *
18890  *     def get_tag_item(self, ns, dm=None, bidx=0, ovr=None):             # <<<<<<<<<<<<<<
18891  *         """Returns tag item value
18892  *
18893  */
18894 
18895   /* function exit code */
18896   __pyx_L1_error:;
18897   __Pyx_XDECREF(__pyx_t_1);
18898   __Pyx_XDECREF(__pyx_t_2);
18899   __Pyx_XDECREF(__pyx_t_3);
18900   __Pyx_XDECREF(__pyx_t_12);
18901   __Pyx_XDECREF(__pyx_t_13);
18902   __Pyx_AddTraceback("rasterio._base.DatasetBase.get_tag_item", __pyx_clineno, __pyx_lineno, __pyx_filename);
18903   __pyx_r = NULL;
18904   __pyx_L0:;
18905   __Pyx_XDECREF(__pyx_v_ns);
18906   __Pyx_XDECREF(__pyx_v_dm);
18907   __Pyx_XGIVEREF(__pyx_r);
18908   __Pyx_RefNannyFinishContext();
18909   return __pyx_r;
18910 }
18911 
18912 /* "rasterio/_base.pyx":1177
18913  *         """
18914  *
18915  *         def __get__(self):             # <<<<<<<<<<<<<<
18916  *
18917  *             """A sequence of ``ColorInterp.<enum>`` in band order.
18918  */
18919 
18920 /* Python wrapper */
18921 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_11colorinterp_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_11colorinterp_1__get__(PyObject * __pyx_v_self)18922 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_11colorinterp_1__get__(PyObject *__pyx_v_self) {
18923   PyObject *__pyx_r = 0;
18924   __Pyx_RefNannyDeclarations
18925   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
18926   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_11colorinterp___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
18927 
18928   /* function exit code */
18929   __Pyx_RefNannyFinishContext();
18930   return __pyx_r;
18931 }
18932 
__pyx_pf_8rasterio_5_base_11DatasetBase_11colorinterp___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)18933 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_11colorinterp___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
18934   CYTHON_UNUSED GDALRasterBandH __pyx_v_band;
18935   PyObject *__pyx_v_out = NULL;
18936   PyObject *__pyx_v_bidx = NULL;
18937   int __pyx_v_value;
18938   PyObject *__pyx_r = NULL;
18939   __Pyx_RefNannyDeclarations
18940   PyObject *__pyx_t_1 = NULL;
18941   PyObject *__pyx_t_2 = NULL;
18942   Py_ssize_t __pyx_t_3;
18943   PyObject *(*__pyx_t_4)(PyObject *);
18944   int __pyx_t_5;
18945   GDALRasterBandH __pyx_t_6;
18946   PyObject *__pyx_t_7 = NULL;
18947   PyObject *__pyx_t_8 = NULL;
18948   PyObject *__pyx_t_9 = NULL;
18949   int __pyx_t_10;
18950   int __pyx_lineno = 0;
18951   const char *__pyx_filename = NULL;
18952   int __pyx_clineno = 0;
18953   __Pyx_RefNannySetupContext("__get__", 0);
18954 
18955   /* "rasterio/_base.pyx":1186
18956  *             """
18957  *
18958  *             cdef GDALRasterBandH band = NULL             # <<<<<<<<<<<<<<
18959  *
18960  *             out = []
18961  */
18962   __pyx_v_band = NULL;
18963 
18964   /* "rasterio/_base.pyx":1188
18965  *             cdef GDALRasterBandH band = NULL
18966  *
18967  *             out = []             # <<<<<<<<<<<<<<
18968  *             for bidx in self.indexes:
18969  *                 value = exc_wrap_int(
18970  */
18971   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1188, __pyx_L1_error)
18972   __Pyx_GOTREF(__pyx_t_1);
18973   __pyx_v_out = ((PyObject*)__pyx_t_1);
18974   __pyx_t_1 = 0;
18975 
18976   /* "rasterio/_base.pyx":1189
18977  *
18978  *             out = []
18979  *             for bidx in self.indexes:             # <<<<<<<<<<<<<<
18980  *                 value = exc_wrap_int(
18981  *                     GDALGetRasterColorInterpretation(self.band(bidx)))
18982  */
18983   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_indexes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
18984   __Pyx_GOTREF(__pyx_t_1);
18985   if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
18986     __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
18987     __pyx_t_4 = NULL;
18988   } else {
18989     __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1189, __pyx_L1_error)
18990     __Pyx_GOTREF(__pyx_t_2);
18991     __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1189, __pyx_L1_error)
18992   }
18993   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18994   for (;;) {
18995     if (likely(!__pyx_t_4)) {
18996       if (likely(PyList_CheckExact(__pyx_t_2))) {
18997         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
18998         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
18999         __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1189, __pyx_L1_error)
19000         #else
19001         __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
19002         __Pyx_GOTREF(__pyx_t_1);
19003         #endif
19004       } else {
19005         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
19006         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
19007         __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1189, __pyx_L1_error)
19008         #else
19009         __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
19010         __Pyx_GOTREF(__pyx_t_1);
19011         #endif
19012       }
19013     } else {
19014       __pyx_t_1 = __pyx_t_4(__pyx_t_2);
19015       if (unlikely(!__pyx_t_1)) {
19016         PyObject* exc_type = PyErr_Occurred();
19017         if (exc_type) {
19018           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
19019           else __PYX_ERR(0, 1189, __pyx_L1_error)
19020         }
19021         break;
19022       }
19023       __Pyx_GOTREF(__pyx_t_1);
19024     }
19025     __Pyx_XDECREF_SET(__pyx_v_bidx, __pyx_t_1);
19026     __pyx_t_1 = 0;
19027 
19028     /* "rasterio/_base.pyx":1191
19029  *             for bidx in self.indexes:
19030  *                 value = exc_wrap_int(
19031  *                     GDALGetRasterColorInterpretation(self.band(bidx)))             # <<<<<<<<<<<<<<
19032  *                 out.append(ColorInterp(value))
19033  *             return tuple(out)
19034  */
19035     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_bidx); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1191, __pyx_L1_error)
19036     __pyx_t_6 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_5); if (unlikely(__pyx_t_6 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 1191, __pyx_L1_error)
19037 
19038     /* "rasterio/_base.pyx":1190
19039  *             out = []
19040  *             for bidx in self.indexes:
19041  *                 value = exc_wrap_int(             # <<<<<<<<<<<<<<
19042  *                     GDALGetRasterColorInterpretation(self.band(bidx)))
19043  *                 out.append(ColorInterp(value))
19044  */
19045     __pyx_t_5 = __pyx_f_8rasterio_4_err_exc_wrap_int(GDALGetRasterColorInterpretation(__pyx_t_6)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1190, __pyx_L1_error)
19046     __pyx_v_value = __pyx_t_5;
19047 
19048     /* "rasterio/_base.pyx":1192
19049  *                 value = exc_wrap_int(
19050  *                     GDALGetRasterColorInterpretation(self.band(bidx)))
19051  *                 out.append(ColorInterp(value))             # <<<<<<<<<<<<<<
19052  *             return tuple(out)
19053  *
19054  */
19055     __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_ColorInterp); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1192, __pyx_L1_error)
19056     __Pyx_GOTREF(__pyx_t_7);
19057     __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1192, __pyx_L1_error)
19058     __Pyx_GOTREF(__pyx_t_8);
19059     __pyx_t_9 = NULL;
19060     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
19061       __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
19062       if (likely(__pyx_t_9)) {
19063         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
19064         __Pyx_INCREF(__pyx_t_9);
19065         __Pyx_INCREF(function);
19066         __Pyx_DECREF_SET(__pyx_t_7, function);
19067       }
19068     }
19069     __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8);
19070     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
19071     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
19072     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1192, __pyx_L1_error)
19073     __Pyx_GOTREF(__pyx_t_1);
19074     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
19075     __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_out, __pyx_t_1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 1192, __pyx_L1_error)
19076     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19077 
19078     /* "rasterio/_base.pyx":1189
19079  *
19080  *             out = []
19081  *             for bidx in self.indexes:             # <<<<<<<<<<<<<<
19082  *                 value = exc_wrap_int(
19083  *                     GDALGetRasterColorInterpretation(self.band(bidx)))
19084  */
19085   }
19086   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19087 
19088   /* "rasterio/_base.pyx":1193
19089  *                     GDALGetRasterColorInterpretation(self.band(bidx)))
19090  *                 out.append(ColorInterp(value))
19091  *             return tuple(out)             # <<<<<<<<<<<<<<
19092  *
19093  *         def __set__(self, value):
19094  */
19095   __Pyx_XDECREF(__pyx_r);
19096   __pyx_t_2 = PyList_AsTuple(__pyx_v_out); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1193, __pyx_L1_error)
19097   __Pyx_GOTREF(__pyx_t_2);
19098   __pyx_r = __pyx_t_2;
19099   __pyx_t_2 = 0;
19100   goto __pyx_L0;
19101 
19102   /* "rasterio/_base.pyx":1177
19103  *         """
19104  *
19105  *         def __get__(self):             # <<<<<<<<<<<<<<
19106  *
19107  *             """A sequence of ``ColorInterp.<enum>`` in band order.
19108  */
19109 
19110   /* function exit code */
19111   __pyx_L1_error:;
19112   __Pyx_XDECREF(__pyx_t_1);
19113   __Pyx_XDECREF(__pyx_t_2);
19114   __Pyx_XDECREF(__pyx_t_7);
19115   __Pyx_XDECREF(__pyx_t_8);
19116   __Pyx_XDECREF(__pyx_t_9);
19117   __Pyx_AddTraceback("rasterio._base.DatasetBase.colorinterp.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19118   __pyx_r = NULL;
19119   __pyx_L0:;
19120   __Pyx_XDECREF(__pyx_v_out);
19121   __Pyx_XDECREF(__pyx_v_bidx);
19122   __Pyx_XGIVEREF(__pyx_r);
19123   __Pyx_RefNannyFinishContext();
19124   return __pyx_r;
19125 }
19126 
19127 /* "rasterio/_base.pyx":1195
19128  *             return tuple(out)
19129  *
19130  *         def __set__(self, value):             # <<<<<<<<<<<<<<
19131  *
19132  *             """Set band color interpretation with a sequence of
19133  */
19134 
19135 /* Python wrapper */
19136 static int __pyx_pw_8rasterio_5_base_11DatasetBase_11colorinterp_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_11colorinterp_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)19137 static int __pyx_pw_8rasterio_5_base_11DatasetBase_11colorinterp_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
19138   int __pyx_r;
19139   __Pyx_RefNannyDeclarations
19140   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
19141   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_11colorinterp_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
19142 
19143   /* function exit code */
19144   __Pyx_RefNannyFinishContext();
19145   return __pyx_r;
19146 }
19147 
__pyx_pf_8rasterio_5_base_11DatasetBase_11colorinterp_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)19148 static int __pyx_pf_8rasterio_5_base_11DatasetBase_11colorinterp_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
19149   PyObject *__pyx_v_bidx = NULL;
19150   PyObject *__pyx_v_ci = NULL;
19151   int __pyx_r;
19152   __Pyx_RefNannyDeclarations
19153   int __pyx_t_1;
19154   PyObject *__pyx_t_2 = NULL;
19155   PyObject *__pyx_t_3 = NULL;
19156   PyObject *__pyx_t_4 = NULL;
19157   PyObject *__pyx_t_5 = NULL;
19158   PyObject *__pyx_t_6 = NULL;
19159   Py_ssize_t __pyx_t_7;
19160   Py_ssize_t __pyx_t_8;
19161   int __pyx_t_9;
19162   PyObject *(*__pyx_t_10)(PyObject *);
19163   PyObject *(*__pyx_t_11)(PyObject *);
19164   GDALRasterBandH __pyx_t_12;
19165   GDALColorInterp __pyx_t_13;
19166   int __pyx_lineno = 0;
19167   const char *__pyx_filename = NULL;
19168   int __pyx_clineno = 0;
19169   __Pyx_RefNannySetupContext("__set__", 0);
19170 
19171   /* "rasterio/_base.pyx":1205
19172  *                 A sequence of ``ColorInterp.<enum>``.
19173  *             """
19174  *             if self.mode == 'r':             # <<<<<<<<<<<<<<
19175  *                 raise RasterioIOError(
19176  *                     "Can only set color interpretation when dataset is "
19177  */
19178   __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_r, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1205, __pyx_L1_error)
19179   if (unlikely(__pyx_t_1)) {
19180 
19181     /* "rasterio/_base.pyx":1206
19182  *             """
19183  *             if self.mode == 'r':
19184  *                 raise RasterioIOError(             # <<<<<<<<<<<<<<
19185  *                     "Can only set color interpretation when dataset is "
19186  *                     "opened in 'r+' or 'w' mode, not '{}'.".format(self.mode))
19187  */
19188     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RasterioIOError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1206, __pyx_L1_error)
19189     __Pyx_GOTREF(__pyx_t_3);
19190 
19191     /* "rasterio/_base.pyx":1208
19192  *                 raise RasterioIOError(
19193  *                     "Can only set color interpretation when dataset is "
19194  *                     "opened in 'r+' or 'w' mode, not '{}'.".format(self.mode))             # <<<<<<<<<<<<<<
19195  *             if len(value) != len(self.indexes):
19196  *                 raise ValueError(
19197  */
19198     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Can_only_set_color_interpretatio, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1208, __pyx_L1_error)
19199     __Pyx_GOTREF(__pyx_t_5);
19200     __pyx_t_6 = NULL;
19201     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
19202       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
19203       if (likely(__pyx_t_6)) {
19204         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
19205         __Pyx_INCREF(__pyx_t_6);
19206         __Pyx_INCREF(function);
19207         __Pyx_DECREF_SET(__pyx_t_5, function);
19208       }
19209     }
19210     __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_self->mode) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_self->mode);
19211     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
19212     if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1208, __pyx_L1_error)
19213     __Pyx_GOTREF(__pyx_t_4);
19214     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
19215     __pyx_t_5 = NULL;
19216     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
19217       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
19218       if (likely(__pyx_t_5)) {
19219         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
19220         __Pyx_INCREF(__pyx_t_5);
19221         __Pyx_INCREF(function);
19222         __Pyx_DECREF_SET(__pyx_t_3, function);
19223       }
19224     }
19225     __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
19226     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19227     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19228     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1206, __pyx_L1_error)
19229     __Pyx_GOTREF(__pyx_t_2);
19230     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19231     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
19232     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19233     __PYX_ERR(0, 1206, __pyx_L1_error)
19234 
19235     /* "rasterio/_base.pyx":1205
19236  *                 A sequence of ``ColorInterp.<enum>``.
19237  *             """
19238  *             if self.mode == 'r':             # <<<<<<<<<<<<<<
19239  *                 raise RasterioIOError(
19240  *                     "Can only set color interpretation when dataset is "
19241  */
19242   }
19243 
19244   /* "rasterio/_base.pyx":1209
19245  *                     "Can only set color interpretation when dataset is "
19246  *                     "opened in 'r+' or 'w' mode, not '{}'.".format(self.mode))
19247  *             if len(value) != len(self.indexes):             # <<<<<<<<<<<<<<
19248  *                 raise ValueError(
19249  *                     "Must set color interpretation for all bands.  Found "
19250  */
19251   __pyx_t_7 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1209, __pyx_L1_error)
19252   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_indexes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1209, __pyx_L1_error)
19253   __Pyx_GOTREF(__pyx_t_2);
19254   __pyx_t_8 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1209, __pyx_L1_error)
19255   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19256   __pyx_t_1 = ((__pyx_t_7 != __pyx_t_8) != 0);
19257   if (unlikely(__pyx_t_1)) {
19258 
19259     /* "rasterio/_base.pyx":1213
19260  *                     "Must set color interpretation for all bands.  Found "
19261  *                     "{} bands but attempting to set color interpretation to: "
19262  *                     "{}".format(len(self.indexes), value))             # <<<<<<<<<<<<<<
19263  *
19264  *             for bidx, ci in zip(self.indexes, value):
19265  */
19266     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Must_set_color_interpretation_fo, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1213, __pyx_L1_error)
19267     __Pyx_GOTREF(__pyx_t_3);
19268     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_indexes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1213, __pyx_L1_error)
19269     __Pyx_GOTREF(__pyx_t_4);
19270     __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1213, __pyx_L1_error)
19271     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19272     __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1213, __pyx_L1_error)
19273     __Pyx_GOTREF(__pyx_t_4);
19274     __pyx_t_5 = NULL;
19275     __pyx_t_9 = 0;
19276     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
19277       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
19278       if (likely(__pyx_t_5)) {
19279         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
19280         __Pyx_INCREF(__pyx_t_5);
19281         __Pyx_INCREF(function);
19282         __Pyx_DECREF_SET(__pyx_t_3, function);
19283         __pyx_t_9 = 1;
19284       }
19285     }
19286     #if CYTHON_FAST_PYCALL
19287     if (PyFunction_Check(__pyx_t_3)) {
19288       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_v_value};
19289       __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1213, __pyx_L1_error)
19290       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19291       __Pyx_GOTREF(__pyx_t_2);
19292       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19293     } else
19294     #endif
19295     #if CYTHON_FAST_PYCCALL
19296     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
19297       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_v_value};
19298       __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1213, __pyx_L1_error)
19299       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19300       __Pyx_GOTREF(__pyx_t_2);
19301       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19302     } else
19303     #endif
19304     {
19305       __pyx_t_6 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1213, __pyx_L1_error)
19306       __Pyx_GOTREF(__pyx_t_6);
19307       if (__pyx_t_5) {
19308         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
19309       }
19310       __Pyx_GIVEREF(__pyx_t_4);
19311       PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_t_4);
19312       __Pyx_INCREF(__pyx_v_value);
19313       __Pyx_GIVEREF(__pyx_v_value);
19314       PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_v_value);
19315       __pyx_t_4 = 0;
19316       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1213, __pyx_L1_error)
19317       __Pyx_GOTREF(__pyx_t_2);
19318       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19319     }
19320     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19321 
19322     /* "rasterio/_base.pyx":1210
19323  *                     "opened in 'r+' or 'w' mode, not '{}'.".format(self.mode))
19324  *             if len(value) != len(self.indexes):
19325  *                 raise ValueError(             # <<<<<<<<<<<<<<
19326  *                     "Must set color interpretation for all bands.  Found "
19327  *                     "{} bands but attempting to set color interpretation to: "
19328  */
19329     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1210, __pyx_L1_error)
19330     __Pyx_GOTREF(__pyx_t_3);
19331     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19332     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
19333     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19334     __PYX_ERR(0, 1210, __pyx_L1_error)
19335 
19336     /* "rasterio/_base.pyx":1209
19337  *                     "Can only set color interpretation when dataset is "
19338  *                     "opened in 'r+' or 'w' mode, not '{}'.".format(self.mode))
19339  *             if len(value) != len(self.indexes):             # <<<<<<<<<<<<<<
19340  *                 raise ValueError(
19341  *                     "Must set color interpretation for all bands.  Found "
19342  */
19343   }
19344 
19345   /* "rasterio/_base.pyx":1215
19346  *                     "{}".format(len(self.indexes), value))
19347  *
19348  *             for bidx, ci in zip(self.indexes, value):             # <<<<<<<<<<<<<<
19349  *                 exc_wrap_int(
19350  *                     GDALSetRasterColorInterpretation(self.band(bidx), <GDALColorInterp>ci.value))
19351  */
19352   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_indexes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1215, __pyx_L1_error)
19353   __Pyx_GOTREF(__pyx_t_3);
19354   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1215, __pyx_L1_error)
19355   __Pyx_GOTREF(__pyx_t_2);
19356   __Pyx_GIVEREF(__pyx_t_3);
19357   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
19358   __Pyx_INCREF(__pyx_v_value);
19359   __Pyx_GIVEREF(__pyx_v_value);
19360   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value);
19361   __pyx_t_3 = 0;
19362   __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1215, __pyx_L1_error)
19363   __Pyx_GOTREF(__pyx_t_3);
19364   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19365   if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
19366     __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
19367     __pyx_t_10 = NULL;
19368   } else {
19369     __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1215, __pyx_L1_error)
19370     __Pyx_GOTREF(__pyx_t_2);
19371     __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1215, __pyx_L1_error)
19372   }
19373   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19374   for (;;) {
19375     if (likely(!__pyx_t_10)) {
19376       if (likely(PyList_CheckExact(__pyx_t_2))) {
19377         if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
19378         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
19379         __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1215, __pyx_L1_error)
19380         #else
19381         __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1215, __pyx_L1_error)
19382         __Pyx_GOTREF(__pyx_t_3);
19383         #endif
19384       } else {
19385         if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
19386         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
19387         __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1215, __pyx_L1_error)
19388         #else
19389         __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1215, __pyx_L1_error)
19390         __Pyx_GOTREF(__pyx_t_3);
19391         #endif
19392       }
19393     } else {
19394       __pyx_t_3 = __pyx_t_10(__pyx_t_2);
19395       if (unlikely(!__pyx_t_3)) {
19396         PyObject* exc_type = PyErr_Occurred();
19397         if (exc_type) {
19398           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
19399           else __PYX_ERR(0, 1215, __pyx_L1_error)
19400         }
19401         break;
19402       }
19403       __Pyx_GOTREF(__pyx_t_3);
19404     }
19405     if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
19406       PyObject* sequence = __pyx_t_3;
19407       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
19408       if (unlikely(size != 2)) {
19409         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
19410         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
19411         __PYX_ERR(0, 1215, __pyx_L1_error)
19412       }
19413       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
19414       if (likely(PyTuple_CheckExact(sequence))) {
19415         __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
19416         __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
19417       } else {
19418         __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
19419         __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
19420       }
19421       __Pyx_INCREF(__pyx_t_6);
19422       __Pyx_INCREF(__pyx_t_4);
19423       #else
19424       __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1215, __pyx_L1_error)
19425       __Pyx_GOTREF(__pyx_t_6);
19426       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1215, __pyx_L1_error)
19427       __Pyx_GOTREF(__pyx_t_4);
19428       #endif
19429       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19430     } else {
19431       Py_ssize_t index = -1;
19432       __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1215, __pyx_L1_error)
19433       __Pyx_GOTREF(__pyx_t_5);
19434       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19435       __pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext;
19436       index = 0; __pyx_t_6 = __pyx_t_11(__pyx_t_5); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed;
19437       __Pyx_GOTREF(__pyx_t_6);
19438       index = 1; __pyx_t_4 = __pyx_t_11(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
19439       __Pyx_GOTREF(__pyx_t_4);
19440       if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1215, __pyx_L1_error)
19441       __pyx_t_11 = NULL;
19442       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
19443       goto __pyx_L8_unpacking_done;
19444       __pyx_L7_unpacking_failed:;
19445       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
19446       __pyx_t_11 = NULL;
19447       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
19448       __PYX_ERR(0, 1215, __pyx_L1_error)
19449       __pyx_L8_unpacking_done:;
19450     }
19451     __Pyx_XDECREF_SET(__pyx_v_bidx, __pyx_t_6);
19452     __pyx_t_6 = 0;
19453     __Pyx_XDECREF_SET(__pyx_v_ci, __pyx_t_4);
19454     __pyx_t_4 = 0;
19455 
19456     /* "rasterio/_base.pyx":1217
19457  *             for bidx, ci in zip(self.indexes, value):
19458  *                 exc_wrap_int(
19459  *                     GDALSetRasterColorInterpretation(self.band(bidx), <GDALColorInterp>ci.value))             # <<<<<<<<<<<<<<
19460  *
19461  *     def colormap(self, bidx):
19462  */
19463     __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_bidx); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1217, __pyx_L1_error)
19464     __pyx_t_12 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_9); if (unlikely(__pyx_t_12 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 1217, __pyx_L1_error)
19465     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ci, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1217, __pyx_L1_error)
19466     __Pyx_GOTREF(__pyx_t_3);
19467     __pyx_t_13 = ((GDALColorInterp)__Pyx_PyInt_As_GDALColorInterp(__pyx_t_3)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1217, __pyx_L1_error)
19468     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19469 
19470     /* "rasterio/_base.pyx":1216
19471  *
19472  *             for bidx, ci in zip(self.indexes, value):
19473  *                 exc_wrap_int(             # <<<<<<<<<<<<<<
19474  *                     GDALSetRasterColorInterpretation(self.band(bidx), <GDALColorInterp>ci.value))
19475  *
19476  */
19477     __pyx_t_9 = __pyx_f_8rasterio_4_err_exc_wrap_int(GDALSetRasterColorInterpretation(__pyx_t_12, ((GDALColorInterp)__pyx_t_13))); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1216, __pyx_L1_error)
19478 
19479     /* "rasterio/_base.pyx":1215
19480  *                     "{}".format(len(self.indexes), value))
19481  *
19482  *             for bidx, ci in zip(self.indexes, value):             # <<<<<<<<<<<<<<
19483  *                 exc_wrap_int(
19484  *                     GDALSetRasterColorInterpretation(self.band(bidx), <GDALColorInterp>ci.value))
19485  */
19486   }
19487   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19488 
19489   /* "rasterio/_base.pyx":1195
19490  *             return tuple(out)
19491  *
19492  *         def __set__(self, value):             # <<<<<<<<<<<<<<
19493  *
19494  *             """Set band color interpretation with a sequence of
19495  */
19496 
19497   /* function exit code */
19498   __pyx_r = 0;
19499   goto __pyx_L0;
19500   __pyx_L1_error:;
19501   __Pyx_XDECREF(__pyx_t_2);
19502   __Pyx_XDECREF(__pyx_t_3);
19503   __Pyx_XDECREF(__pyx_t_4);
19504   __Pyx_XDECREF(__pyx_t_5);
19505   __Pyx_XDECREF(__pyx_t_6);
19506   __Pyx_AddTraceback("rasterio._base.DatasetBase.colorinterp.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19507   __pyx_r = -1;
19508   __pyx_L0:;
19509   __Pyx_XDECREF(__pyx_v_bidx);
19510   __Pyx_XDECREF(__pyx_v_ci);
19511   __Pyx_RefNannyFinishContext();
19512   return __pyx_r;
19513 }
19514 
19515 /* "rasterio/_base.pyx":1219
19516  *                     GDALSetRasterColorInterpretation(self.band(bidx), <GDALColorInterp>ci.value))
19517  *
19518  *     def colormap(self, bidx):             # <<<<<<<<<<<<<<
19519  *         """Returns a dict containing the colormap for a band or None."""
19520  *         cdef GDALRasterBandH band = NULL
19521  */
19522 
19523 /* Python wrapper */
19524 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_66colormap(PyObject *__pyx_v_self, PyObject *__pyx_v_bidx); /*proto*/
19525 static char __pyx_doc_8rasterio_5_base_11DatasetBase_65colormap[] = "Returns a dict containing the colormap for a band or None.";
__pyx_pw_8rasterio_5_base_11DatasetBase_66colormap(PyObject * __pyx_v_self,PyObject * __pyx_v_bidx)19526 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_66colormap(PyObject *__pyx_v_self, PyObject *__pyx_v_bidx) {
19527   PyObject *__pyx_r = 0;
19528   __Pyx_RefNannyDeclarations
19529   __Pyx_RefNannySetupContext("colormap (wrapper)", 0);
19530   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_65colormap(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_bidx));
19531 
19532   /* function exit code */
19533   __Pyx_RefNannyFinishContext();
19534   return __pyx_r;
19535 }
19536 
__pyx_pf_8rasterio_5_base_11DatasetBase_65colormap(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_bidx)19537 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_65colormap(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx) {
19538   GDALRasterBandH __pyx_v_band;
19539   GDALColorTableH __pyx_v_colortable;
19540   GDALColorEntry *__pyx_v_color;
19541   int __pyx_v_i;
19542   PyObject *__pyx_v_retval = NULL;
19543   PyObject *__pyx_r = NULL;
19544   __Pyx_RefNannyDeclarations
19545   int __pyx_t_1;
19546   GDALRasterBandH __pyx_t_2;
19547   int __pyx_t_3;
19548   PyObject *__pyx_t_4 = NULL;
19549   int __pyx_t_5;
19550   int __pyx_t_6;
19551   PyObject *__pyx_t_7 = NULL;
19552   PyObject *__pyx_t_8 = NULL;
19553   PyObject *__pyx_t_9 = NULL;
19554   int __pyx_t_10;
19555   PyObject *__pyx_t_11 = NULL;
19556   PyObject *__pyx_t_12 = NULL;
19557   PyObject *__pyx_t_13 = NULL;
19558   PyObject *__pyx_t_14 = NULL;
19559   int __pyx_lineno = 0;
19560   const char *__pyx_filename = NULL;
19561   int __pyx_clineno = 0;
19562   __Pyx_RefNannySetupContext("colormap", 0);
19563 
19564   /* "rasterio/_base.pyx":1221
19565  *     def colormap(self, bidx):
19566  *         """Returns a dict containing the colormap for a band or None."""
19567  *         cdef GDALRasterBandH band = NULL             # <<<<<<<<<<<<<<
19568  *         cdef GDALColorTableH colortable = NULL
19569  *         cdef GDALColorEntry *color = NULL
19570  */
19571   __pyx_v_band = NULL;
19572 
19573   /* "rasterio/_base.pyx":1222
19574  *         """Returns a dict containing the colormap for a band or None."""
19575  *         cdef GDALRasterBandH band = NULL
19576  *         cdef GDALColorTableH colortable = NULL             # <<<<<<<<<<<<<<
19577  *         cdef GDALColorEntry *color = NULL
19578  *         cdef int i
19579  */
19580   __pyx_v_colortable = NULL;
19581 
19582   /* "rasterio/_base.pyx":1223
19583  *         cdef GDALRasterBandH band = NULL
19584  *         cdef GDALColorTableH colortable = NULL
19585  *         cdef GDALColorEntry *color = NULL             # <<<<<<<<<<<<<<
19586  *         cdef int i
19587  *
19588  */
19589   __pyx_v_color = NULL;
19590 
19591   /* "rasterio/_base.pyx":1226
19592  *         cdef int i
19593  *
19594  *         band = self.band(bidx)             # <<<<<<<<<<<<<<
19595  *         colortable = GDALGetRasterColorTable(band)
19596  *         if colortable == NULL:
19597  */
19598   __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_bidx); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1226, __pyx_L1_error)
19599   __pyx_t_2 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_1); if (unlikely(__pyx_t_2 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 1226, __pyx_L1_error)
19600   __pyx_v_band = __pyx_t_2;
19601 
19602   /* "rasterio/_base.pyx":1227
19603  *
19604  *         band = self.band(bidx)
19605  *         colortable = GDALGetRasterColorTable(band)             # <<<<<<<<<<<<<<
19606  *         if colortable == NULL:
19607  *             raise ValueError("NULL color table")
19608  */
19609   __pyx_v_colortable = GDALGetRasterColorTable(__pyx_v_band);
19610 
19611   /* "rasterio/_base.pyx":1228
19612  *         band = self.band(bidx)
19613  *         colortable = GDALGetRasterColorTable(band)
19614  *         if colortable == NULL:             # <<<<<<<<<<<<<<
19615  *             raise ValueError("NULL color table")
19616  *         retval = {}
19617  */
19618   __pyx_t_3 = ((__pyx_v_colortable == NULL) != 0);
19619   if (unlikely(__pyx_t_3)) {
19620 
19621     /* "rasterio/_base.pyx":1229
19622  *         colortable = GDALGetRasterColorTable(band)
19623  *         if colortable == NULL:
19624  *             raise ValueError("NULL color table")             # <<<<<<<<<<<<<<
19625  *         retval = {}
19626  *
19627  */
19628     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1229, __pyx_L1_error)
19629     __Pyx_GOTREF(__pyx_t_4);
19630     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
19631     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19632     __PYX_ERR(0, 1229, __pyx_L1_error)
19633 
19634     /* "rasterio/_base.pyx":1228
19635  *         band = self.band(bidx)
19636  *         colortable = GDALGetRasterColorTable(band)
19637  *         if colortable == NULL:             # <<<<<<<<<<<<<<
19638  *             raise ValueError("NULL color table")
19639  *         retval = {}
19640  */
19641   }
19642 
19643   /* "rasterio/_base.pyx":1230
19644  *         if colortable == NULL:
19645  *             raise ValueError("NULL color table")
19646  *         retval = {}             # <<<<<<<<<<<<<<
19647  *
19648  *         for i in range(GDALGetColorEntryCount(colortable)):
19649  */
19650   __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1230, __pyx_L1_error)
19651   __Pyx_GOTREF(__pyx_t_4);
19652   __pyx_v_retval = ((PyObject*)__pyx_t_4);
19653   __pyx_t_4 = 0;
19654 
19655   /* "rasterio/_base.pyx":1232
19656  *         retval = {}
19657  *
19658  *         for i in range(GDALGetColorEntryCount(colortable)):             # <<<<<<<<<<<<<<
19659  *             color = <GDALColorEntry*>GDALGetColorEntry(colortable, i)
19660  *             if color == NULL:
19661  */
19662   __pyx_t_1 = GDALGetColorEntryCount(__pyx_v_colortable);
19663   __pyx_t_5 = __pyx_t_1;
19664   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
19665     __pyx_v_i = __pyx_t_6;
19666 
19667     /* "rasterio/_base.pyx":1233
19668  *
19669  *         for i in range(GDALGetColorEntryCount(colortable)):
19670  *             color = <GDALColorEntry*>GDALGetColorEntry(colortable, i)             # <<<<<<<<<<<<<<
19671  *             if color == NULL:
19672  *                 log.warn("NULL color at %d, skipping", i)
19673  */
19674     __pyx_v_color = ((GDALColorEntry *)GDALGetColorEntry(__pyx_v_colortable, __pyx_v_i));
19675 
19676     /* "rasterio/_base.pyx":1234
19677  *         for i in range(GDALGetColorEntryCount(colortable)):
19678  *             color = <GDALColorEntry*>GDALGetColorEntry(colortable, i)
19679  *             if color == NULL:             # <<<<<<<<<<<<<<
19680  *                 log.warn("NULL color at %d, skipping", i)
19681  *                 continue
19682  */
19683     __pyx_t_3 = ((__pyx_v_color == NULL) != 0);
19684     if (__pyx_t_3) {
19685 
19686       /* "rasterio/_base.pyx":1235
19687  *             color = <GDALColorEntry*>GDALGetColorEntry(colortable, i)
19688  *             if color == NULL:
19689  *                 log.warn("NULL color at %d, skipping", i)             # <<<<<<<<<<<<<<
19690  *                 continue
19691  *             log.debug(
19692  */
19693       __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1235, __pyx_L1_error)
19694       __Pyx_GOTREF(__pyx_t_7);
19695       __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_warn); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1235, __pyx_L1_error)
19696       __Pyx_GOTREF(__pyx_t_8);
19697       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
19698       __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1235, __pyx_L1_error)
19699       __Pyx_GOTREF(__pyx_t_7);
19700       __pyx_t_9 = NULL;
19701       __pyx_t_10 = 0;
19702       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
19703         __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
19704         if (likely(__pyx_t_9)) {
19705           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
19706           __Pyx_INCREF(__pyx_t_9);
19707           __Pyx_INCREF(function);
19708           __Pyx_DECREF_SET(__pyx_t_8, function);
19709           __pyx_t_10 = 1;
19710         }
19711       }
19712       #if CYTHON_FAST_PYCALL
19713       if (PyFunction_Check(__pyx_t_8)) {
19714         PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_kp_u_NULL_color_at_d_skipping, __pyx_t_7};
19715         __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1235, __pyx_L1_error)
19716         __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
19717         __Pyx_GOTREF(__pyx_t_4);
19718         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
19719       } else
19720       #endif
19721       #if CYTHON_FAST_PYCCALL
19722       if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
19723         PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_kp_u_NULL_color_at_d_skipping, __pyx_t_7};
19724         __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1235, __pyx_L1_error)
19725         __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
19726         __Pyx_GOTREF(__pyx_t_4);
19727         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
19728       } else
19729       #endif
19730       {
19731         __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1235, __pyx_L1_error)
19732         __Pyx_GOTREF(__pyx_t_11);
19733         if (__pyx_t_9) {
19734           __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
19735         }
19736         __Pyx_INCREF(__pyx_kp_u_NULL_color_at_d_skipping);
19737         __Pyx_GIVEREF(__pyx_kp_u_NULL_color_at_d_skipping);
19738         PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_kp_u_NULL_color_at_d_skipping);
19739         __Pyx_GIVEREF(__pyx_t_7);
19740         PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_7);
19741         __pyx_t_7 = 0;
19742         __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1235, __pyx_L1_error)
19743         __Pyx_GOTREF(__pyx_t_4);
19744         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
19745       }
19746       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
19747       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19748 
19749       /* "rasterio/_base.pyx":1236
19750  *             if color == NULL:
19751  *                 log.warn("NULL color at %d, skipping", i)
19752  *                 continue             # <<<<<<<<<<<<<<
19753  *             log.debug(
19754  *                 "Color: (%d, %d, %d, %d)",
19755  */
19756       goto __pyx_L4_continue;
19757 
19758       /* "rasterio/_base.pyx":1234
19759  *         for i in range(GDALGetColorEntryCount(colortable)):
19760  *             color = <GDALColorEntry*>GDALGetColorEntry(colortable, i)
19761  *             if color == NULL:             # <<<<<<<<<<<<<<
19762  *                 log.warn("NULL color at %d, skipping", i)
19763  *                 continue
19764  */
19765     }
19766 
19767     /* "rasterio/_base.pyx":1237
19768  *                 log.warn("NULL color at %d, skipping", i)
19769  *                 continue
19770  *             log.debug(             # <<<<<<<<<<<<<<
19771  *                 "Color: (%d, %d, %d, %d)",
19772  *                 color.c1, color.c2, color.c3, color.c4)
19773  */
19774     __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_log); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1237, __pyx_L1_error)
19775     __Pyx_GOTREF(__pyx_t_8);
19776     __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_debug); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1237, __pyx_L1_error)
19777     __Pyx_GOTREF(__pyx_t_11);
19778     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
19779 
19780     /* "rasterio/_base.pyx":1239
19781  *             log.debug(
19782  *                 "Color: (%d, %d, %d, %d)",
19783  *                 color.c1, color.c2, color.c3, color.c4)             # <<<<<<<<<<<<<<
19784  *             retval[i] = (color.c1, color.c2, color.c3, color.c4)
19785  *
19786  */
19787     __pyx_t_8 = __Pyx_PyInt_From_short(__pyx_v_color->c1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1239, __pyx_L1_error)
19788     __Pyx_GOTREF(__pyx_t_8);
19789     __pyx_t_7 = __Pyx_PyInt_From_short(__pyx_v_color->c2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1239, __pyx_L1_error)
19790     __Pyx_GOTREF(__pyx_t_7);
19791     __pyx_t_9 = __Pyx_PyInt_From_short(__pyx_v_color->c3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1239, __pyx_L1_error)
19792     __Pyx_GOTREF(__pyx_t_9);
19793     __pyx_t_12 = __Pyx_PyInt_From_short(__pyx_v_color->c4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1239, __pyx_L1_error)
19794     __Pyx_GOTREF(__pyx_t_12);
19795     __pyx_t_13 = NULL;
19796     __pyx_t_10 = 0;
19797     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
19798       __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
19799       if (likely(__pyx_t_13)) {
19800         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
19801         __Pyx_INCREF(__pyx_t_13);
19802         __Pyx_INCREF(function);
19803         __Pyx_DECREF_SET(__pyx_t_11, function);
19804         __pyx_t_10 = 1;
19805       }
19806     }
19807     #if CYTHON_FAST_PYCALL
19808     if (PyFunction_Check(__pyx_t_11)) {
19809       PyObject *__pyx_temp[6] = {__pyx_t_13, __pyx_kp_u_Color_d_d_d_d, __pyx_t_8, __pyx_t_7, __pyx_t_9, __pyx_t_12};
19810       __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_10, 5+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1237, __pyx_L1_error)
19811       __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
19812       __Pyx_GOTREF(__pyx_t_4);
19813       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
19814       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
19815       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
19816       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
19817     } else
19818     #endif
19819     #if CYTHON_FAST_PYCCALL
19820     if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
19821       PyObject *__pyx_temp[6] = {__pyx_t_13, __pyx_kp_u_Color_d_d_d_d, __pyx_t_8, __pyx_t_7, __pyx_t_9, __pyx_t_12};
19822       __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_10, 5+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1237, __pyx_L1_error)
19823       __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
19824       __Pyx_GOTREF(__pyx_t_4);
19825       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
19826       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
19827       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
19828       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
19829     } else
19830     #endif
19831     {
19832       __pyx_t_14 = PyTuple_New(5+__pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1237, __pyx_L1_error)
19833       __Pyx_GOTREF(__pyx_t_14);
19834       if (__pyx_t_13) {
19835         __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
19836       }
19837       __Pyx_INCREF(__pyx_kp_u_Color_d_d_d_d);
19838       __Pyx_GIVEREF(__pyx_kp_u_Color_d_d_d_d);
19839       PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_10, __pyx_kp_u_Color_d_d_d_d);
19840       __Pyx_GIVEREF(__pyx_t_8);
19841       PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_10, __pyx_t_8);
19842       __Pyx_GIVEREF(__pyx_t_7);
19843       PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_10, __pyx_t_7);
19844       __Pyx_GIVEREF(__pyx_t_9);
19845       PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_10, __pyx_t_9);
19846       __Pyx_GIVEREF(__pyx_t_12);
19847       PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_10, __pyx_t_12);
19848       __pyx_t_8 = 0;
19849       __pyx_t_7 = 0;
19850       __pyx_t_9 = 0;
19851       __pyx_t_12 = 0;
19852       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1237, __pyx_L1_error)
19853       __Pyx_GOTREF(__pyx_t_4);
19854       __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
19855     }
19856     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
19857     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19858 
19859     /* "rasterio/_base.pyx":1240
19860  *                 "Color: (%d, %d, %d, %d)",
19861  *                 color.c1, color.c2, color.c3, color.c4)
19862  *             retval[i] = (color.c1, color.c2, color.c3, color.c4)             # <<<<<<<<<<<<<<
19863  *
19864  *         return retval
19865  */
19866     __pyx_t_4 = __Pyx_PyInt_From_short(__pyx_v_color->c1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1240, __pyx_L1_error)
19867     __Pyx_GOTREF(__pyx_t_4);
19868     __pyx_t_11 = __Pyx_PyInt_From_short(__pyx_v_color->c2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1240, __pyx_L1_error)
19869     __Pyx_GOTREF(__pyx_t_11);
19870     __pyx_t_14 = __Pyx_PyInt_From_short(__pyx_v_color->c3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1240, __pyx_L1_error)
19871     __Pyx_GOTREF(__pyx_t_14);
19872     __pyx_t_12 = __Pyx_PyInt_From_short(__pyx_v_color->c4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1240, __pyx_L1_error)
19873     __Pyx_GOTREF(__pyx_t_12);
19874     __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1240, __pyx_L1_error)
19875     __Pyx_GOTREF(__pyx_t_9);
19876     __Pyx_GIVEREF(__pyx_t_4);
19877     PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
19878     __Pyx_GIVEREF(__pyx_t_11);
19879     PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_11);
19880     __Pyx_GIVEREF(__pyx_t_14);
19881     PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_14);
19882     __Pyx_GIVEREF(__pyx_t_12);
19883     PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_12);
19884     __pyx_t_4 = 0;
19885     __pyx_t_11 = 0;
19886     __pyx_t_14 = 0;
19887     __pyx_t_12 = 0;
19888     __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1240, __pyx_L1_error)
19889     __Pyx_GOTREF(__pyx_t_12);
19890     if (unlikely(PyDict_SetItem(__pyx_v_retval, __pyx_t_12, __pyx_t_9) < 0)) __PYX_ERR(0, 1240, __pyx_L1_error)
19891     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
19892     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
19893     __pyx_L4_continue:;
19894   }
19895 
19896   /* "rasterio/_base.pyx":1242
19897  *             retval[i] = (color.c1, color.c2, color.c3, color.c4)
19898  *
19899  *         return retval             # <<<<<<<<<<<<<<
19900  *
19901  *     def overviews(self, bidx):
19902  */
19903   __Pyx_XDECREF(__pyx_r);
19904   __Pyx_INCREF(__pyx_v_retval);
19905   __pyx_r = __pyx_v_retval;
19906   goto __pyx_L0;
19907 
19908   /* "rasterio/_base.pyx":1219
19909  *                     GDALSetRasterColorInterpretation(self.band(bidx), <GDALColorInterp>ci.value))
19910  *
19911  *     def colormap(self, bidx):             # <<<<<<<<<<<<<<
19912  *         """Returns a dict containing the colormap for a band or None."""
19913  *         cdef GDALRasterBandH band = NULL
19914  */
19915 
19916   /* function exit code */
19917   __pyx_L1_error:;
19918   __Pyx_XDECREF(__pyx_t_4);
19919   __Pyx_XDECREF(__pyx_t_7);
19920   __Pyx_XDECREF(__pyx_t_8);
19921   __Pyx_XDECREF(__pyx_t_9);
19922   __Pyx_XDECREF(__pyx_t_11);
19923   __Pyx_XDECREF(__pyx_t_12);
19924   __Pyx_XDECREF(__pyx_t_13);
19925   __Pyx_XDECREF(__pyx_t_14);
19926   __Pyx_AddTraceback("rasterio._base.DatasetBase.colormap", __pyx_clineno, __pyx_lineno, __pyx_filename);
19927   __pyx_r = NULL;
19928   __pyx_L0:;
19929   __Pyx_XDECREF(__pyx_v_retval);
19930   __Pyx_XGIVEREF(__pyx_r);
19931   __Pyx_RefNannyFinishContext();
19932   return __pyx_r;
19933 }
19934 
19935 /* "rasterio/_base.pyx":1244
19936  *         return retval
19937  *
19938  *     def overviews(self, bidx):             # <<<<<<<<<<<<<<
19939  *         cdef GDALRasterBandH ovrband = NULL
19940  *         cdef GDALRasterBandH band = NULL
19941  */
19942 
19943 /* Python wrapper */
19944 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_68overviews(PyObject *__pyx_v_self, PyObject *__pyx_v_bidx); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_68overviews(PyObject * __pyx_v_self,PyObject * __pyx_v_bidx)19945 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_68overviews(PyObject *__pyx_v_self, PyObject *__pyx_v_bidx) {
19946   PyObject *__pyx_r = 0;
19947   __Pyx_RefNannyDeclarations
19948   __Pyx_RefNannySetupContext("overviews (wrapper)", 0);
19949   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_67overviews(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_bidx));
19950 
19951   /* function exit code */
19952   __Pyx_RefNannyFinishContext();
19953   return __pyx_r;
19954 }
19955 
__pyx_pf_8rasterio_5_base_11DatasetBase_67overviews(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_bidx)19956 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_67overviews(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx) {
19957   GDALRasterBandH __pyx_v_ovrband;
19958   GDALRasterBandH __pyx_v_band;
19959   int __pyx_v_num_overviews;
19960   PyObject *__pyx_v_factors = NULL;
19961   int __pyx_v_i;
19962   PyObject *__pyx_v_xsize = NULL;
19963   PyObject *__pyx_r = NULL;
19964   __Pyx_RefNannyDeclarations
19965   int __pyx_t_1;
19966   GDALRasterBandH __pyx_t_2;
19967   PyObject *__pyx_t_3 = NULL;
19968   int __pyx_t_4;
19969   int __pyx_t_5;
19970   double __pyx_t_6;
19971   double __pyx_t_7;
19972   PyObject *__pyx_t_8 = NULL;
19973   int __pyx_t_9;
19974   int __pyx_lineno = 0;
19975   const char *__pyx_filename = NULL;
19976   int __pyx_clineno = 0;
19977   __Pyx_RefNannySetupContext("overviews", 0);
19978 
19979   /* "rasterio/_base.pyx":1245
19980  *
19981  *     def overviews(self, bidx):
19982  *         cdef GDALRasterBandH ovrband = NULL             # <<<<<<<<<<<<<<
19983  *         cdef GDALRasterBandH band = NULL
19984  *
19985  */
19986   __pyx_v_ovrband = NULL;
19987 
19988   /* "rasterio/_base.pyx":1246
19989  *     def overviews(self, bidx):
19990  *         cdef GDALRasterBandH ovrband = NULL
19991  *         cdef GDALRasterBandH band = NULL             # <<<<<<<<<<<<<<
19992  *
19993  *         band = self.band(bidx)
19994  */
19995   __pyx_v_band = NULL;
19996 
19997   /* "rasterio/_base.pyx":1248
19998  *         cdef GDALRasterBandH band = NULL
19999  *
20000  *         band = self.band(bidx)             # <<<<<<<<<<<<<<
20001  *         num_overviews = GDALGetOverviewCount(band)
20002  *         factors = []
20003  */
20004   __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_bidx); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1248, __pyx_L1_error)
20005   __pyx_t_2 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_1); if (unlikely(__pyx_t_2 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 1248, __pyx_L1_error)
20006   __pyx_v_band = __pyx_t_2;
20007 
20008   /* "rasterio/_base.pyx":1249
20009  *
20010  *         band = self.band(bidx)
20011  *         num_overviews = GDALGetOverviewCount(band)             # <<<<<<<<<<<<<<
20012  *         factors = []
20013  *
20014  */
20015   __pyx_v_num_overviews = GDALGetOverviewCount(__pyx_v_band);
20016 
20017   /* "rasterio/_base.pyx":1250
20018  *         band = self.band(bidx)
20019  *         num_overviews = GDALGetOverviewCount(band)
20020  *         factors = []             # <<<<<<<<<<<<<<
20021  *
20022  *         for i in range(num_overviews):
20023  */
20024   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1250, __pyx_L1_error)
20025   __Pyx_GOTREF(__pyx_t_3);
20026   __pyx_v_factors = ((PyObject*)__pyx_t_3);
20027   __pyx_t_3 = 0;
20028 
20029   /* "rasterio/_base.pyx":1252
20030  *         factors = []
20031  *
20032  *         for i in range(num_overviews):             # <<<<<<<<<<<<<<
20033  *             ovrband = GDALGetOverview(band, i)
20034  *             # Compute the overview factor only from the xsize (width).
20035  */
20036   __pyx_t_1 = __pyx_v_num_overviews;
20037   __pyx_t_4 = __pyx_t_1;
20038   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
20039     __pyx_v_i = __pyx_t_5;
20040 
20041     /* "rasterio/_base.pyx":1253
20042  *
20043  *         for i in range(num_overviews):
20044  *             ovrband = GDALGetOverview(band, i)             # <<<<<<<<<<<<<<
20045  *             # Compute the overview factor only from the xsize (width).
20046  *             xsize = GDALGetRasterBandXSize(ovrband)
20047  */
20048     __pyx_v_ovrband = GDALGetOverview(__pyx_v_band, __pyx_v_i);
20049 
20050     /* "rasterio/_base.pyx":1255
20051  *             ovrband = GDALGetOverview(band, i)
20052  *             # Compute the overview factor only from the xsize (width).
20053  *             xsize = GDALGetRasterBandXSize(ovrband)             # <<<<<<<<<<<<<<
20054  *             factors.append(int(round(float(self.width)/float(xsize))))
20055  *
20056  */
20057     __pyx_t_3 = __Pyx_PyInt_From_int(GDALGetRasterBandXSize(__pyx_v_ovrband)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1255, __pyx_L1_error)
20058     __Pyx_GOTREF(__pyx_t_3);
20059     __Pyx_XDECREF_SET(__pyx_v_xsize, __pyx_t_3);
20060     __pyx_t_3 = 0;
20061 
20062     /* "rasterio/_base.pyx":1256
20063  *             # Compute the overview factor only from the xsize (width).
20064  *             xsize = GDALGetRasterBandXSize(ovrband)
20065  *             factors.append(int(round(float(self.width)/float(xsize))))             # <<<<<<<<<<<<<<
20066  *
20067  *         return factors
20068  */
20069     __pyx_t_6 = __Pyx_PyObject_AsDouble(__pyx_v_self->width); if (unlikely(__pyx_t_6 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1256, __pyx_L1_error)
20070     __pyx_t_7 = __Pyx_PyObject_AsDouble(__pyx_v_xsize); if (unlikely(__pyx_t_7 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1256, __pyx_L1_error)
20071     if (unlikely(__pyx_t_7 == 0)) {
20072       PyErr_SetString(PyExc_ZeroDivisionError, "float division");
20073       __PYX_ERR(0, 1256, __pyx_L1_error)
20074     }
20075     __pyx_t_3 = PyFloat_FromDouble((__pyx_t_6 / __pyx_t_7)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1256, __pyx_L1_error)
20076     __Pyx_GOTREF(__pyx_t_3);
20077     __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_round, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1256, __pyx_L1_error)
20078     __Pyx_GOTREF(__pyx_t_8);
20079     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20080     __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1256, __pyx_L1_error)
20081     __Pyx_GOTREF(__pyx_t_3);
20082     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
20083     __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_factors, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1256, __pyx_L1_error)
20084     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20085   }
20086 
20087   /* "rasterio/_base.pyx":1258
20088  *             factors.append(int(round(float(self.width)/float(xsize))))
20089  *
20090  *         return factors             # <<<<<<<<<<<<<<
20091  *
20092  *     def checksum(self, bidx, window=None):
20093  */
20094   __Pyx_XDECREF(__pyx_r);
20095   __Pyx_INCREF(__pyx_v_factors);
20096   __pyx_r = __pyx_v_factors;
20097   goto __pyx_L0;
20098 
20099   /* "rasterio/_base.pyx":1244
20100  *         return retval
20101  *
20102  *     def overviews(self, bidx):             # <<<<<<<<<<<<<<
20103  *         cdef GDALRasterBandH ovrband = NULL
20104  *         cdef GDALRasterBandH band = NULL
20105  */
20106 
20107   /* function exit code */
20108   __pyx_L1_error:;
20109   __Pyx_XDECREF(__pyx_t_3);
20110   __Pyx_XDECREF(__pyx_t_8);
20111   __Pyx_AddTraceback("rasterio._base.DatasetBase.overviews", __pyx_clineno, __pyx_lineno, __pyx_filename);
20112   __pyx_r = NULL;
20113   __pyx_L0:;
20114   __Pyx_XDECREF(__pyx_v_factors);
20115   __Pyx_XDECREF(__pyx_v_xsize);
20116   __Pyx_XGIVEREF(__pyx_r);
20117   __Pyx_RefNannyFinishContext();
20118   return __pyx_r;
20119 }
20120 
20121 /* "rasterio/_base.pyx":1260
20122  *         return factors
20123  *
20124  *     def checksum(self, bidx, window=None):             # <<<<<<<<<<<<<<
20125  *         """Compute an integer checksum for the stored band
20126  *
20127  */
20128 
20129 /* Python wrapper */
20130 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_70checksum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20131 static char __pyx_doc_8rasterio_5_base_11DatasetBase_69checksum[] = "Compute an integer checksum for the stored band\n\n        Parameters\n        ----------\n        bidx : int\n            The band's index (1-indexed).\n        window: tuple, optional\n            A window of the band. Default is the entire extent of the band.\n\n        Returns\n        -------\n        An int.\n        ";
__pyx_pw_8rasterio_5_base_11DatasetBase_70checksum(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)20132 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_70checksum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20133   PyObject *__pyx_v_bidx = 0;
20134   PyObject *__pyx_v_window = 0;
20135   int __pyx_lineno = 0;
20136   const char *__pyx_filename = NULL;
20137   int __pyx_clineno = 0;
20138   PyObject *__pyx_r = 0;
20139   __Pyx_RefNannyDeclarations
20140   __Pyx_RefNannySetupContext("checksum (wrapper)", 0);
20141   {
20142     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bidx,&__pyx_n_s_window,0};
20143     PyObject* values[2] = {0,0};
20144     values[1] = ((PyObject *)Py_None);
20145     if (unlikely(__pyx_kwds)) {
20146       Py_ssize_t kw_args;
20147       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20148       switch (pos_args) {
20149         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20150         CYTHON_FALLTHROUGH;
20151         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20152         CYTHON_FALLTHROUGH;
20153         case  0: break;
20154         default: goto __pyx_L5_argtuple_error;
20155       }
20156       kw_args = PyDict_Size(__pyx_kwds);
20157       switch (pos_args) {
20158         case  0:
20159         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bidx)) != 0)) kw_args--;
20160         else goto __pyx_L5_argtuple_error;
20161         CYTHON_FALLTHROUGH;
20162         case  1:
20163         if (kw_args > 0) {
20164           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_window);
20165           if (value) { values[1] = value; kw_args--; }
20166         }
20167       }
20168       if (unlikely(kw_args > 0)) {
20169         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "checksum") < 0)) __PYX_ERR(0, 1260, __pyx_L3_error)
20170       }
20171     } else {
20172       switch (PyTuple_GET_SIZE(__pyx_args)) {
20173         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20174         CYTHON_FALLTHROUGH;
20175         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20176         break;
20177         default: goto __pyx_L5_argtuple_error;
20178       }
20179     }
20180     __pyx_v_bidx = values[0];
20181     __pyx_v_window = values[1];
20182   }
20183   goto __pyx_L4_argument_unpacking_done;
20184   __pyx_L5_argtuple_error:;
20185   __Pyx_RaiseArgtupleInvalid("checksum", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1260, __pyx_L3_error)
20186   __pyx_L3_error:;
20187   __Pyx_AddTraceback("rasterio._base.DatasetBase.checksum", __pyx_clineno, __pyx_lineno, __pyx_filename);
20188   __Pyx_RefNannyFinishContext();
20189   return NULL;
20190   __pyx_L4_argument_unpacking_done:;
20191   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_69checksum(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), __pyx_v_bidx, __pyx_v_window);
20192 
20193   /* function exit code */
20194   __Pyx_RefNannyFinishContext();
20195   return __pyx_r;
20196 }
20197 
__pyx_pf_8rasterio_5_base_11DatasetBase_69checksum(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_bidx,PyObject * __pyx_v_window)20198 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_69checksum(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_bidx, PyObject *__pyx_v_window) {
20199   GDALRasterBandH __pyx_v_band;
20200   int __pyx_v_xoff;
20201   int __pyx_v_yoff;
20202   int __pyx_v_width;
20203   int __pyx_v_height;
20204   PyObject *__pyx_v_err = NULL;
20205   PyObject *__pyx_r = NULL;
20206   __Pyx_RefNannyDeclarations
20207   int __pyx_t_1;
20208   GDALRasterBandH __pyx_t_2;
20209   int __pyx_t_3;
20210   int __pyx_t_4;
20211   int __pyx_t_5;
20212   PyObject *__pyx_t_6 = NULL;
20213   PyObject *__pyx_t_7 = NULL;
20214   PyObject *__pyx_t_8 = NULL;
20215   PyObject *__pyx_t_9 = NULL;
20216   PyObject *__pyx_t_10 = NULL;
20217   PyObject *__pyx_t_11 = NULL;
20218   PyObject *__pyx_t_12 = NULL;
20219   PyObject *__pyx_t_13 = NULL;
20220   PyObject *__pyx_t_14 = NULL;
20221   PyObject *__pyx_t_15 = NULL;
20222   char const *__pyx_t_16;
20223   PyObject *__pyx_t_17 = NULL;
20224   PyObject *__pyx_t_18 = NULL;
20225   PyObject *__pyx_t_19 = NULL;
20226   PyObject *__pyx_t_20 = NULL;
20227   PyObject *__pyx_t_21 = NULL;
20228   PyObject *__pyx_t_22 = NULL;
20229   int __pyx_lineno = 0;
20230   const char *__pyx_filename = NULL;
20231   int __pyx_clineno = 0;
20232   __Pyx_RefNannySetupContext("checksum", 0);
20233   __Pyx_INCREF(__pyx_v_window);
20234 
20235   /* "rasterio/_base.pyx":1274
20236  *         An int.
20237  *         """
20238  *         cdef GDALRasterBandH band = NULL             # <<<<<<<<<<<<<<
20239  *         cdef int xoff, yoff, width, height
20240  *
20241  */
20242   __pyx_v_band = NULL;
20243 
20244   /* "rasterio/_base.pyx":1277
20245  *         cdef int xoff, yoff, width, height
20246  *
20247  *         band = self.band(bidx)             # <<<<<<<<<<<<<<
20248  *         if not window:
20249  *             xoff = yoff = 0
20250  */
20251   __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_bidx); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1277, __pyx_L1_error)
20252   __pyx_t_2 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->band(__pyx_v_self, __pyx_t_1); if (unlikely(__pyx_t_2 == ((GDALRasterBandH)NULL))) __PYX_ERR(0, 1277, __pyx_L1_error)
20253   __pyx_v_band = __pyx_t_2;
20254 
20255   /* "rasterio/_base.pyx":1278
20256  *
20257  *         band = self.band(bidx)
20258  *         if not window:             # <<<<<<<<<<<<<<
20259  *             xoff = yoff = 0
20260  *             width, height = self.width, self.height
20261  */
20262   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_window); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1278, __pyx_L1_error)
20263   __pyx_t_4 = ((!__pyx_t_3) != 0);
20264   if (__pyx_t_4) {
20265 
20266     /* "rasterio/_base.pyx":1279
20267  *         band = self.band(bidx)
20268  *         if not window:
20269  *             xoff = yoff = 0             # <<<<<<<<<<<<<<
20270  *             width, height = self.width, self.height
20271  *         else:
20272  */
20273     __pyx_v_xoff = 0;
20274     __pyx_v_yoff = 0;
20275 
20276     /* "rasterio/_base.pyx":1280
20277  *         if not window:
20278  *             xoff = yoff = 0
20279  *             width, height = self.width, self.height             # <<<<<<<<<<<<<<
20280  *         else:
20281  *             window = windows.evaluate(window, self.height, self.width)
20282  */
20283     __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_self->width); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1280, __pyx_L1_error)
20284     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_self->height); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1280, __pyx_L1_error)
20285     __pyx_v_width = __pyx_t_1;
20286     __pyx_v_height = __pyx_t_5;
20287 
20288     /* "rasterio/_base.pyx":1278
20289  *
20290  *         band = self.band(bidx)
20291  *         if not window:             # <<<<<<<<<<<<<<
20292  *             xoff = yoff = 0
20293  *             width, height = self.width, self.height
20294  */
20295     goto __pyx_L3;
20296   }
20297 
20298   /* "rasterio/_base.pyx":1282
20299  *             width, height = self.width, self.height
20300  *         else:
20301  *             window = windows.evaluate(window, self.height, self.width)             # <<<<<<<<<<<<<<
20302  *             window = windows.crop(window, self.height, self.width)
20303  *             xoff = window.col_off
20304  */
20305   /*else*/ {
20306     __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_windows); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1282, __pyx_L1_error)
20307     __Pyx_GOTREF(__pyx_t_7);
20308     __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1282, __pyx_L1_error)
20309     __Pyx_GOTREF(__pyx_t_8);
20310     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20311     __pyx_t_7 = NULL;
20312     __pyx_t_5 = 0;
20313     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
20314       __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
20315       if (likely(__pyx_t_7)) {
20316         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
20317         __Pyx_INCREF(__pyx_t_7);
20318         __Pyx_INCREF(function);
20319         __Pyx_DECREF_SET(__pyx_t_8, function);
20320         __pyx_t_5 = 1;
20321       }
20322     }
20323     #if CYTHON_FAST_PYCALL
20324     if (PyFunction_Check(__pyx_t_8)) {
20325       PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_window, __pyx_v_self->height, __pyx_v_self->width};
20326       __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1282, __pyx_L1_error)
20327       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
20328       __Pyx_GOTREF(__pyx_t_6);
20329     } else
20330     #endif
20331     #if CYTHON_FAST_PYCCALL
20332     if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
20333       PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_window, __pyx_v_self->height, __pyx_v_self->width};
20334       __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1282, __pyx_L1_error)
20335       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
20336       __Pyx_GOTREF(__pyx_t_6);
20337     } else
20338     #endif
20339     {
20340       __pyx_t_9 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1282, __pyx_L1_error)
20341       __Pyx_GOTREF(__pyx_t_9);
20342       if (__pyx_t_7) {
20343         __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
20344       }
20345       __Pyx_INCREF(__pyx_v_window);
20346       __Pyx_GIVEREF(__pyx_v_window);
20347       PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_5, __pyx_v_window);
20348       __Pyx_INCREF(__pyx_v_self->height);
20349       __Pyx_GIVEREF(__pyx_v_self->height);
20350       PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_5, __pyx_v_self->height);
20351       __Pyx_INCREF(__pyx_v_self->width);
20352       __Pyx_GIVEREF(__pyx_v_self->width);
20353       PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_5, __pyx_v_self->width);
20354       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1282, __pyx_L1_error)
20355       __Pyx_GOTREF(__pyx_t_6);
20356       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20357     }
20358     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
20359     __Pyx_DECREF_SET(__pyx_v_window, __pyx_t_6);
20360     __pyx_t_6 = 0;
20361 
20362     /* "rasterio/_base.pyx":1283
20363  *         else:
20364  *             window = windows.evaluate(window, self.height, self.width)
20365  *             window = windows.crop(window, self.height, self.width)             # <<<<<<<<<<<<<<
20366  *             xoff = window.col_off
20367  *             width = window.width
20368  */
20369     __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_windows); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1283, __pyx_L1_error)
20370     __Pyx_GOTREF(__pyx_t_8);
20371     __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_crop); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1283, __pyx_L1_error)
20372     __Pyx_GOTREF(__pyx_t_9);
20373     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
20374     __pyx_t_8 = NULL;
20375     __pyx_t_5 = 0;
20376     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
20377       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
20378       if (likely(__pyx_t_8)) {
20379         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
20380         __Pyx_INCREF(__pyx_t_8);
20381         __Pyx_INCREF(function);
20382         __Pyx_DECREF_SET(__pyx_t_9, function);
20383         __pyx_t_5 = 1;
20384       }
20385     }
20386     #if CYTHON_FAST_PYCALL
20387     if (PyFunction_Check(__pyx_t_9)) {
20388       PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_window, __pyx_v_self->height, __pyx_v_self->width};
20389       __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1283, __pyx_L1_error)
20390       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
20391       __Pyx_GOTREF(__pyx_t_6);
20392     } else
20393     #endif
20394     #if CYTHON_FAST_PYCCALL
20395     if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
20396       PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_window, __pyx_v_self->height, __pyx_v_self->width};
20397       __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1283, __pyx_L1_error)
20398       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
20399       __Pyx_GOTREF(__pyx_t_6);
20400     } else
20401     #endif
20402     {
20403       __pyx_t_7 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1283, __pyx_L1_error)
20404       __Pyx_GOTREF(__pyx_t_7);
20405       if (__pyx_t_8) {
20406         __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL;
20407       }
20408       __Pyx_INCREF(__pyx_v_window);
20409       __Pyx_GIVEREF(__pyx_v_window);
20410       PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_5, __pyx_v_window);
20411       __Pyx_INCREF(__pyx_v_self->height);
20412       __Pyx_GIVEREF(__pyx_v_self->height);
20413       PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_5, __pyx_v_self->height);
20414       __Pyx_INCREF(__pyx_v_self->width);
20415       __Pyx_GIVEREF(__pyx_v_self->width);
20416       PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_5, __pyx_v_self->width);
20417       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1283, __pyx_L1_error)
20418       __Pyx_GOTREF(__pyx_t_6);
20419       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20420     }
20421     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20422     __Pyx_DECREF_SET(__pyx_v_window, __pyx_t_6);
20423     __pyx_t_6 = 0;
20424 
20425     /* "rasterio/_base.pyx":1284
20426  *             window = windows.evaluate(window, self.height, self.width)
20427  *             window = windows.crop(window, self.height, self.width)
20428  *             xoff = window.col_off             # <<<<<<<<<<<<<<
20429  *             width = window.width
20430  *             yoff = window.row_off
20431  */
20432     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_window, __pyx_n_s_col_off); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1284, __pyx_L1_error)
20433     __Pyx_GOTREF(__pyx_t_6);
20434     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1284, __pyx_L1_error)
20435     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20436     __pyx_v_xoff = __pyx_t_5;
20437 
20438     /* "rasterio/_base.pyx":1285
20439  *             window = windows.crop(window, self.height, self.width)
20440  *             xoff = window.col_off
20441  *             width = window.width             # <<<<<<<<<<<<<<
20442  *             yoff = window.row_off
20443  *             height = window.height
20444  */
20445     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_window, __pyx_n_s_width); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1285, __pyx_L1_error)
20446     __Pyx_GOTREF(__pyx_t_6);
20447     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1285, __pyx_L1_error)
20448     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20449     __pyx_v_width = __pyx_t_5;
20450 
20451     /* "rasterio/_base.pyx":1286
20452  *             xoff = window.col_off
20453  *             width = window.width
20454  *             yoff = window.row_off             # <<<<<<<<<<<<<<
20455  *             height = window.height
20456  *
20457  */
20458     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_window, __pyx_n_s_row_off); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1286, __pyx_L1_error)
20459     __Pyx_GOTREF(__pyx_t_6);
20460     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1286, __pyx_L1_error)
20461     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20462     __pyx_v_yoff = __pyx_t_5;
20463 
20464     /* "rasterio/_base.pyx":1287
20465  *             width = window.width
20466  *             yoff = window.row_off
20467  *             height = window.height             # <<<<<<<<<<<<<<
20468  *
20469  *         try:
20470  */
20471     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_window, __pyx_n_s_height); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1287, __pyx_L1_error)
20472     __Pyx_GOTREF(__pyx_t_6);
20473     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1287, __pyx_L1_error)
20474     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20475     __pyx_v_height = __pyx_t_5;
20476   }
20477   __pyx_L3:;
20478 
20479   /* "rasterio/_base.pyx":1289
20480  *             height = window.height
20481  *
20482  *         try:             # <<<<<<<<<<<<<<
20483  *             return exc_wrap(GDALChecksumImage(band, xoff, yoff, width, height))
20484  *         except CPLE_BaseError as err:
20485  */
20486   {
20487     __Pyx_PyThreadState_declare
20488     __Pyx_PyThreadState_assign
20489     __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
20490     __Pyx_XGOTREF(__pyx_t_10);
20491     __Pyx_XGOTREF(__pyx_t_11);
20492     __Pyx_XGOTREF(__pyx_t_12);
20493     /*try:*/ {
20494 
20495       /* "rasterio/_base.pyx":1290
20496  *
20497  *         try:
20498  *             return exc_wrap(GDALChecksumImage(band, xoff, yoff, width, height))             # <<<<<<<<<<<<<<
20499  *         except CPLE_BaseError as err:
20500  *             raise RasterioIOError(str(err))
20501  */
20502       __Pyx_XDECREF(__pyx_r);
20503       __pyx_t_5 = __pyx_f_8rasterio_4_err_exc_wrap(GDALChecksumImage(__pyx_v_band, __pyx_v_xoff, __pyx_v_yoff, __pyx_v_width, __pyx_v_height)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1290, __pyx_L4_error)
20504       __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1290, __pyx_L4_error)
20505       __Pyx_GOTREF(__pyx_t_6);
20506       __pyx_r = __pyx_t_6;
20507       __pyx_t_6 = 0;
20508       goto __pyx_L8_try_return;
20509 
20510       /* "rasterio/_base.pyx":1289
20511  *             height = window.height
20512  *
20513  *         try:             # <<<<<<<<<<<<<<
20514  *             return exc_wrap(GDALChecksumImage(band, xoff, yoff, width, height))
20515  *         except CPLE_BaseError as err:
20516  */
20517     }
20518     __pyx_L4_error:;
20519     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
20520     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
20521     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
20522     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
20523 
20524     /* "rasterio/_base.pyx":1291
20525  *         try:
20526  *             return exc_wrap(GDALChecksumImage(band, xoff, yoff, width, height))
20527  *         except CPLE_BaseError as err:             # <<<<<<<<<<<<<<
20528  *             raise RasterioIOError(str(err))
20529  *
20530  */
20531     __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_9, &__pyx_t_7);
20532     __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_CPLE_BaseError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1291, __pyx_L6_except_error)
20533     __Pyx_GOTREF(__pyx_t_8);
20534     __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_6, __pyx_t_8);
20535     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
20536     __Pyx_ErrRestore(__pyx_t_6, __pyx_t_9, __pyx_t_7);
20537     __pyx_t_6 = 0; __pyx_t_9 = 0; __pyx_t_7 = 0;
20538     if (__pyx_t_5) {
20539       __Pyx_AddTraceback("rasterio._base.DatasetBase.checksum", __pyx_clineno, __pyx_lineno, __pyx_filename);
20540       if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_9, &__pyx_t_6) < 0) __PYX_ERR(0, 1291, __pyx_L6_except_error)
20541       __Pyx_GOTREF(__pyx_t_7);
20542       __Pyx_GOTREF(__pyx_t_9);
20543       __Pyx_GOTREF(__pyx_t_6);
20544       __Pyx_INCREF(__pyx_t_9);
20545       __pyx_v_err = __pyx_t_9;
20546       /*try:*/ {
20547 
20548         /* "rasterio/_base.pyx":1292
20549  *             return exc_wrap(GDALChecksumImage(band, xoff, yoff, width, height))
20550  *         except CPLE_BaseError as err:
20551  *             raise RasterioIOError(str(err))             # <<<<<<<<<<<<<<
20552  *
20553  *
20554  */
20555         __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_RasterioIOError); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1292, __pyx_L15_error)
20556         __Pyx_GOTREF(__pyx_t_13);
20557         __pyx_t_14 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_err); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1292, __pyx_L15_error)
20558         __Pyx_GOTREF(__pyx_t_14);
20559         __pyx_t_15 = NULL;
20560         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
20561           __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_13);
20562           if (likely(__pyx_t_15)) {
20563             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
20564             __Pyx_INCREF(__pyx_t_15);
20565             __Pyx_INCREF(function);
20566             __Pyx_DECREF_SET(__pyx_t_13, function);
20567           }
20568         }
20569         __pyx_t_8 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_15, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_14);
20570         __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
20571         __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
20572         if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1292, __pyx_L15_error)
20573         __Pyx_GOTREF(__pyx_t_8);
20574         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
20575         __Pyx_Raise(__pyx_t_8, 0, 0, 0);
20576         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
20577         __PYX_ERR(0, 1292, __pyx_L15_error)
20578       }
20579 
20580       /* "rasterio/_base.pyx":1291
20581  *         try:
20582  *             return exc_wrap(GDALChecksumImage(band, xoff, yoff, width, height))
20583  *         except CPLE_BaseError as err:             # <<<<<<<<<<<<<<
20584  *             raise RasterioIOError(str(err))
20585  *
20586  */
20587       /*finally:*/ {
20588         __pyx_L15_error:;
20589         /*exception exit:*/{
20590           __Pyx_PyThreadState_declare
20591           __Pyx_PyThreadState_assign
20592           __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
20593           __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
20594           __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
20595           __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
20596           __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
20597           if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
20598           if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
20599           __Pyx_XGOTREF(__pyx_t_17);
20600           __Pyx_XGOTREF(__pyx_t_18);
20601           __Pyx_XGOTREF(__pyx_t_19);
20602           __Pyx_XGOTREF(__pyx_t_20);
20603           __Pyx_XGOTREF(__pyx_t_21);
20604           __Pyx_XGOTREF(__pyx_t_22);
20605           __pyx_t_5 = __pyx_lineno; __pyx_t_1 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
20606           {
20607             __Pyx_DECREF(__pyx_v_err);
20608             __pyx_v_err = NULL;
20609           }
20610           if (PY_MAJOR_VERSION >= 3) {
20611             __Pyx_XGIVEREF(__pyx_t_20);
20612             __Pyx_XGIVEREF(__pyx_t_21);
20613             __Pyx_XGIVEREF(__pyx_t_22);
20614             __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
20615           }
20616           __Pyx_XGIVEREF(__pyx_t_17);
20617           __Pyx_XGIVEREF(__pyx_t_18);
20618           __Pyx_XGIVEREF(__pyx_t_19);
20619           __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19);
20620           __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
20621           __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_1; __pyx_filename = __pyx_t_16;
20622           goto __pyx_L6_except_error;
20623         }
20624       }
20625     }
20626     goto __pyx_L6_except_error;
20627     __pyx_L6_except_error:;
20628 
20629     /* "rasterio/_base.pyx":1289
20630  *             height = window.height
20631  *
20632  *         try:             # <<<<<<<<<<<<<<
20633  *             return exc_wrap(GDALChecksumImage(band, xoff, yoff, width, height))
20634  *         except CPLE_BaseError as err:
20635  */
20636     __Pyx_XGIVEREF(__pyx_t_10);
20637     __Pyx_XGIVEREF(__pyx_t_11);
20638     __Pyx_XGIVEREF(__pyx_t_12);
20639     __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
20640     goto __pyx_L1_error;
20641     __pyx_L8_try_return:;
20642     __Pyx_XGIVEREF(__pyx_t_10);
20643     __Pyx_XGIVEREF(__pyx_t_11);
20644     __Pyx_XGIVEREF(__pyx_t_12);
20645     __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
20646     goto __pyx_L0;
20647   }
20648 
20649   /* "rasterio/_base.pyx":1260
20650  *         return factors
20651  *
20652  *     def checksum(self, bidx, window=None):             # <<<<<<<<<<<<<<
20653  *         """Compute an integer checksum for the stored band
20654  *
20655  */
20656 
20657   /* function exit code */
20658   __pyx_L1_error:;
20659   __Pyx_XDECREF(__pyx_t_6);
20660   __Pyx_XDECREF(__pyx_t_7);
20661   __Pyx_XDECREF(__pyx_t_8);
20662   __Pyx_XDECREF(__pyx_t_9);
20663   __Pyx_XDECREF(__pyx_t_13);
20664   __Pyx_XDECREF(__pyx_t_14);
20665   __Pyx_XDECREF(__pyx_t_15);
20666   __Pyx_AddTraceback("rasterio._base.DatasetBase.checksum", __pyx_clineno, __pyx_lineno, __pyx_filename);
20667   __pyx_r = NULL;
20668   __pyx_L0:;
20669   __Pyx_XDECREF(__pyx_v_err);
20670   __Pyx_XDECREF(__pyx_v_window);
20671   __Pyx_XGIVEREF(__pyx_r);
20672   __Pyx_RefNannyFinishContext();
20673   return __pyx_r;
20674 }
20675 
20676 /* "rasterio/_base.pyx":1295
20677  *
20678  *
20679  *     def get_gcps(self):             # <<<<<<<<<<<<<<
20680  *         """Get GCPs and their associated CRS."""
20681  *         cdef const char *wkt_b = GDALGetGCPProjection(self.handle())
20682  */
20683 
20684 /* Python wrapper */
20685 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_72get_gcps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
20686 static char __pyx_doc_8rasterio_5_base_11DatasetBase_71get_gcps[] = "Get GCPs and their associated CRS.";
__pyx_pw_8rasterio_5_base_11DatasetBase_72get_gcps(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)20687 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_72get_gcps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
20688   PyObject *__pyx_r = 0;
20689   __Pyx_RefNannyDeclarations
20690   __Pyx_RefNannySetupContext("get_gcps (wrapper)", 0);
20691   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_71get_gcps(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
20692 
20693   /* function exit code */
20694   __Pyx_RefNannyFinishContext();
20695   return __pyx_r;
20696 }
20697 
__pyx_pf_8rasterio_5_base_11DatasetBase_71get_gcps(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)20698 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_71get_gcps(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
20699   char const *__pyx_v_wkt_b;
20700   char const *__pyx_v_wkt;
20701   PyObject *__pyx_v_crs = NULL;
20702   GDAL_GCP const *__pyx_v_gcplist;
20703   int __pyx_v_num_gcps;
20704   int __pyx_9genexpr13__pyx_v_i;
20705   PyObject *__pyx_r = NULL;
20706   __Pyx_RefNannyDeclarations
20707   GDALDatasetH __pyx_t_1;
20708   int __pyx_t_2;
20709   PyObject *__pyx_t_3 = NULL;
20710   PyObject *__pyx_t_4 = NULL;
20711   PyObject *__pyx_t_5 = NULL;
20712   PyObject *__pyx_t_6 = NULL;
20713   int __pyx_t_7;
20714   int __pyx_t_8;
20715   int __pyx_t_9;
20716   int __pyx_lineno = 0;
20717   const char *__pyx_filename = NULL;
20718   int __pyx_clineno = 0;
20719   __Pyx_RefNannySetupContext("get_gcps", 0);
20720 
20721   /* "rasterio/_base.pyx":1297
20722  *     def get_gcps(self):
20723  *         """Get GCPs and their associated CRS."""
20724  *         cdef const char *wkt_b = GDALGetGCPProjection(self.handle())             # <<<<<<<<<<<<<<
20725  *         if wkt_b == NULL:
20726  *             raise ValueError("Unexpected NULL spatial reference")
20727  */
20728   __pyx_t_1 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->handle(__pyx_v_self); if (unlikely(__pyx_t_1 == ((GDALDatasetH)NULL))) __PYX_ERR(0, 1297, __pyx_L1_error)
20729   __pyx_v_wkt_b = GDALGetGCPProjection(__pyx_t_1);
20730 
20731   /* "rasterio/_base.pyx":1298
20732  *         """Get GCPs and their associated CRS."""
20733  *         cdef const char *wkt_b = GDALGetGCPProjection(self.handle())
20734  *         if wkt_b == NULL:             # <<<<<<<<<<<<<<
20735  *             raise ValueError("Unexpected NULL spatial reference")
20736  *         wkt = wkt_b
20737  */
20738   __pyx_t_2 = ((__pyx_v_wkt_b == NULL) != 0);
20739   if (unlikely(__pyx_t_2)) {
20740 
20741     /* "rasterio/_base.pyx":1299
20742  *         cdef const char *wkt_b = GDALGetGCPProjection(self.handle())
20743  *         if wkt_b == NULL:
20744  *             raise ValueError("Unexpected NULL spatial reference")             # <<<<<<<<<<<<<<
20745  *         wkt = wkt_b
20746  *         crs = self._handle_crswkt(wkt)
20747  */
20748     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1299, __pyx_L1_error)
20749     __Pyx_GOTREF(__pyx_t_3);
20750     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
20751     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20752     __PYX_ERR(0, 1299, __pyx_L1_error)
20753 
20754     /* "rasterio/_base.pyx":1298
20755  *         """Get GCPs and their associated CRS."""
20756  *         cdef const char *wkt_b = GDALGetGCPProjection(self.handle())
20757  *         if wkt_b == NULL:             # <<<<<<<<<<<<<<
20758  *             raise ValueError("Unexpected NULL spatial reference")
20759  *         wkt = wkt_b
20760  */
20761   }
20762 
20763   /* "rasterio/_base.pyx":1300
20764  *         if wkt_b == NULL:
20765  *             raise ValueError("Unexpected NULL spatial reference")
20766  *         wkt = wkt_b             # <<<<<<<<<<<<<<
20767  *         crs = self._handle_crswkt(wkt)
20768  *
20769  */
20770   __pyx_v_wkt = __pyx_v_wkt_b;
20771 
20772   /* "rasterio/_base.pyx":1301
20773  *             raise ValueError("Unexpected NULL spatial reference")
20774  *         wkt = wkt_b
20775  *         crs = self._handle_crswkt(wkt)             # <<<<<<<<<<<<<<
20776  *
20777  *         cdef const GDAL_GCP *gcplist = NULL
20778  */
20779   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_handle_crswkt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1301, __pyx_L1_error)
20780   __Pyx_GOTREF(__pyx_t_4);
20781   __pyx_t_5 = __Pyx_PyUnicode_FromString(__pyx_v_wkt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1301, __pyx_L1_error)
20782   __Pyx_GOTREF(__pyx_t_5);
20783   __pyx_t_6 = NULL;
20784   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
20785     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
20786     if (likely(__pyx_t_6)) {
20787       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
20788       __Pyx_INCREF(__pyx_t_6);
20789       __Pyx_INCREF(function);
20790       __Pyx_DECREF_SET(__pyx_t_4, function);
20791     }
20792   }
20793   __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
20794   __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
20795   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
20796   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1301, __pyx_L1_error)
20797   __Pyx_GOTREF(__pyx_t_3);
20798   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20799   __pyx_v_crs = __pyx_t_3;
20800   __pyx_t_3 = 0;
20801 
20802   /* "rasterio/_base.pyx":1303
20803  *         crs = self._handle_crswkt(wkt)
20804  *
20805  *         cdef const GDAL_GCP *gcplist = NULL             # <<<<<<<<<<<<<<
20806  *         gcplist = GDALGetGCPs(self.handle())
20807  *         num_gcps = GDALGetGCPCount(self.handle())
20808  */
20809   __pyx_v_gcplist = NULL;
20810 
20811   /* "rasterio/_base.pyx":1304
20812  *
20813  *         cdef const GDAL_GCP *gcplist = NULL
20814  *         gcplist = GDALGetGCPs(self.handle())             # <<<<<<<<<<<<<<
20815  *         num_gcps = GDALGetGCPCount(self.handle())
20816  *
20817  */
20818   __pyx_t_1 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->handle(__pyx_v_self); if (unlikely(__pyx_t_1 == ((GDALDatasetH)NULL))) __PYX_ERR(0, 1304, __pyx_L1_error)
20819   __pyx_v_gcplist = GDALGetGCPs(__pyx_t_1);
20820 
20821   /* "rasterio/_base.pyx":1305
20822  *         cdef const GDAL_GCP *gcplist = NULL
20823  *         gcplist = GDALGetGCPs(self.handle())
20824  *         num_gcps = GDALGetGCPCount(self.handle())             # <<<<<<<<<<<<<<
20825  *
20826  *         return ([GroundControlPoint(col=gcplist[i].dfGCPPixel,
20827  */
20828   __pyx_t_1 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->handle(__pyx_v_self); if (unlikely(__pyx_t_1 == ((GDALDatasetH)NULL))) __PYX_ERR(0, 1305, __pyx_L1_error)
20829   __pyx_v_num_gcps = GDALGetGCPCount(__pyx_t_1);
20830 
20831   /* "rasterio/_base.pyx":1307
20832  *         num_gcps = GDALGetGCPCount(self.handle())
20833  *
20834  *         return ([GroundControlPoint(col=gcplist[i].dfGCPPixel,             # <<<<<<<<<<<<<<
20835  *                                          row=gcplist[i].dfGCPLine,
20836  *                                          x=gcplist[i].dfGCPX,
20837  */
20838   __Pyx_XDECREF(__pyx_r);
20839   { /* enter inner scope */
20840     __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1307, __pyx_L1_error)
20841     __Pyx_GOTREF(__pyx_t_3);
20842 
20843     /* "rasterio/_base.pyx":1314
20844  *                                          id=gcplist[i].pszId,
20845  *                                          info=gcplist[i].pszInfo)
20846  *                                          for i in range(num_gcps)], crs)             # <<<<<<<<<<<<<<
20847  *
20848  *     def _set_gcps(self, values):
20849  */
20850     __pyx_t_7 = __pyx_v_num_gcps;
20851     __pyx_t_8 = __pyx_t_7;
20852     for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
20853       __pyx_9genexpr13__pyx_v_i = __pyx_t_9;
20854 
20855       /* "rasterio/_base.pyx":1307
20856  *         num_gcps = GDALGetGCPCount(self.handle())
20857  *
20858  *         return ([GroundControlPoint(col=gcplist[i].dfGCPPixel,             # <<<<<<<<<<<<<<
20859  *                                          row=gcplist[i].dfGCPLine,
20860  *                                          x=gcplist[i].dfGCPX,
20861  */
20862       __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_GroundControlPoint); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1307, __pyx_L1_error)
20863       __Pyx_GOTREF(__pyx_t_4);
20864       __pyx_t_5 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1307, __pyx_L1_error)
20865       __Pyx_GOTREF(__pyx_t_5);
20866       __pyx_t_6 = PyFloat_FromDouble((__pyx_v_gcplist[__pyx_9genexpr13__pyx_v_i]).dfGCPPixel); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1307, __pyx_L1_error)
20867       __Pyx_GOTREF(__pyx_t_6);
20868       if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_col, __pyx_t_6) < 0) __PYX_ERR(0, 1307, __pyx_L1_error)
20869       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20870 
20871       /* "rasterio/_base.pyx":1308
20872  *
20873  *         return ([GroundControlPoint(col=gcplist[i].dfGCPPixel,
20874  *                                          row=gcplist[i].dfGCPLine,             # <<<<<<<<<<<<<<
20875  *                                          x=gcplist[i].dfGCPX,
20876  *                                          y=gcplist[i].dfGCPY,
20877  */
20878       __pyx_t_6 = PyFloat_FromDouble((__pyx_v_gcplist[__pyx_9genexpr13__pyx_v_i]).dfGCPLine); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1308, __pyx_L1_error)
20879       __Pyx_GOTREF(__pyx_t_6);
20880       if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_row, __pyx_t_6) < 0) __PYX_ERR(0, 1307, __pyx_L1_error)
20881       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20882 
20883       /* "rasterio/_base.pyx":1309
20884  *         return ([GroundControlPoint(col=gcplist[i].dfGCPPixel,
20885  *                                          row=gcplist[i].dfGCPLine,
20886  *                                          x=gcplist[i].dfGCPX,             # <<<<<<<<<<<<<<
20887  *                                          y=gcplist[i].dfGCPY,
20888  *                                          z=gcplist[i].dfGCPZ,
20889  */
20890       __pyx_t_6 = PyFloat_FromDouble((__pyx_v_gcplist[__pyx_9genexpr13__pyx_v_i]).dfGCPX); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1309, __pyx_L1_error)
20891       __Pyx_GOTREF(__pyx_t_6);
20892       if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_x, __pyx_t_6) < 0) __PYX_ERR(0, 1307, __pyx_L1_error)
20893       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20894 
20895       /* "rasterio/_base.pyx":1310
20896  *                                          row=gcplist[i].dfGCPLine,
20897  *                                          x=gcplist[i].dfGCPX,
20898  *                                          y=gcplist[i].dfGCPY,             # <<<<<<<<<<<<<<
20899  *                                          z=gcplist[i].dfGCPZ,
20900  *                                          id=gcplist[i].pszId,
20901  */
20902       __pyx_t_6 = PyFloat_FromDouble((__pyx_v_gcplist[__pyx_9genexpr13__pyx_v_i]).dfGCPY); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1310, __pyx_L1_error)
20903       __Pyx_GOTREF(__pyx_t_6);
20904       if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_y, __pyx_t_6) < 0) __PYX_ERR(0, 1307, __pyx_L1_error)
20905       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20906 
20907       /* "rasterio/_base.pyx":1311
20908  *                                          x=gcplist[i].dfGCPX,
20909  *                                          y=gcplist[i].dfGCPY,
20910  *                                          z=gcplist[i].dfGCPZ,             # <<<<<<<<<<<<<<
20911  *                                          id=gcplist[i].pszId,
20912  *                                          info=gcplist[i].pszInfo)
20913  */
20914       __pyx_t_6 = PyFloat_FromDouble((__pyx_v_gcplist[__pyx_9genexpr13__pyx_v_i]).dfGCPZ); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1311, __pyx_L1_error)
20915       __Pyx_GOTREF(__pyx_t_6);
20916       if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_z, __pyx_t_6) < 0) __PYX_ERR(0, 1307, __pyx_L1_error)
20917       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20918 
20919       /* "rasterio/_base.pyx":1312
20920  *                                          y=gcplist[i].dfGCPY,
20921  *                                          z=gcplist[i].dfGCPZ,
20922  *                                          id=gcplist[i].pszId,             # <<<<<<<<<<<<<<
20923  *                                          info=gcplist[i].pszInfo)
20924  *                                          for i in range(num_gcps)], crs)
20925  */
20926       __pyx_t_6 = __Pyx_PyUnicode_FromString((__pyx_v_gcplist[__pyx_9genexpr13__pyx_v_i]).pszId); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1312, __pyx_L1_error)
20927       __Pyx_GOTREF(__pyx_t_6);
20928       if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_id, __pyx_t_6) < 0) __PYX_ERR(0, 1307, __pyx_L1_error)
20929       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20930 
20931       /* "rasterio/_base.pyx":1313
20932  *                                          z=gcplist[i].dfGCPZ,
20933  *                                          id=gcplist[i].pszId,
20934  *                                          info=gcplist[i].pszInfo)             # <<<<<<<<<<<<<<
20935  *                                          for i in range(num_gcps)], crs)
20936  *
20937  */
20938       __pyx_t_6 = __Pyx_PyUnicode_FromString((__pyx_v_gcplist[__pyx_9genexpr13__pyx_v_i]).pszInfo); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1313, __pyx_L1_error)
20939       __Pyx_GOTREF(__pyx_t_6);
20940       if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_info, __pyx_t_6) < 0) __PYX_ERR(0, 1307, __pyx_L1_error)
20941       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20942 
20943       /* "rasterio/_base.pyx":1307
20944  *         num_gcps = GDALGetGCPCount(self.handle())
20945  *
20946  *         return ([GroundControlPoint(col=gcplist[i].dfGCPPixel,             # <<<<<<<<<<<<<<
20947  *                                          row=gcplist[i].dfGCPLine,
20948  *                                          x=gcplist[i].dfGCPX,
20949  */
20950       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1307, __pyx_L1_error)
20951       __Pyx_GOTREF(__pyx_t_6);
20952       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20953       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
20954       if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 1307, __pyx_L1_error)
20955       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20956     }
20957   } /* exit inner scope */
20958 
20959   /* "rasterio/_base.pyx":1314
20960  *                                          id=gcplist[i].pszId,
20961  *                                          info=gcplist[i].pszInfo)
20962  *                                          for i in range(num_gcps)], crs)             # <<<<<<<<<<<<<<
20963  *
20964  *     def _set_gcps(self, values):
20965  */
20966   __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1307, __pyx_L1_error)
20967   __Pyx_GOTREF(__pyx_t_6);
20968   __Pyx_GIVEREF(__pyx_t_3);
20969   PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
20970   __Pyx_INCREF(__pyx_v_crs);
20971   __Pyx_GIVEREF(__pyx_v_crs);
20972   PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_crs);
20973   __pyx_t_3 = 0;
20974   __pyx_r = __pyx_t_6;
20975   __pyx_t_6 = 0;
20976   goto __pyx_L0;
20977 
20978   /* "rasterio/_base.pyx":1295
20979  *
20980  *
20981  *     def get_gcps(self):             # <<<<<<<<<<<<<<
20982  *         """Get GCPs and their associated CRS."""
20983  *         cdef const char *wkt_b = GDALGetGCPProjection(self.handle())
20984  */
20985 
20986   /* function exit code */
20987   __pyx_L1_error:;
20988   __Pyx_XDECREF(__pyx_t_3);
20989   __Pyx_XDECREF(__pyx_t_4);
20990   __Pyx_XDECREF(__pyx_t_5);
20991   __Pyx_XDECREF(__pyx_t_6);
20992   __Pyx_AddTraceback("rasterio._base.DatasetBase.get_gcps", __pyx_clineno, __pyx_lineno, __pyx_filename);
20993   __pyx_r = NULL;
20994   __pyx_L0:;
20995   __Pyx_XDECREF(__pyx_v_crs);
20996   __Pyx_XGIVEREF(__pyx_r);
20997   __Pyx_RefNannyFinishContext();
20998   return __pyx_r;
20999 }
21000 
21001 /* "rasterio/_base.pyx":1316
21002  *                                          for i in range(num_gcps)], crs)
21003  *
21004  *     def _set_gcps(self, values):             # <<<<<<<<<<<<<<
21005  *         raise DatasetAttributeError("read-only attribute")
21006  *
21007  */
21008 
21009 /* Python wrapper */
21010 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_74_set_gcps(PyObject *__pyx_v_self, PyObject *__pyx_v_values); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_74_set_gcps(PyObject * __pyx_v_self,PyObject * __pyx_v_values)21011 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_74_set_gcps(PyObject *__pyx_v_self, PyObject *__pyx_v_values) {
21012   PyObject *__pyx_r = 0;
21013   __Pyx_RefNannyDeclarations
21014   __Pyx_RefNannySetupContext("_set_gcps (wrapper)", 0);
21015   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_73_set_gcps(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_values));
21016 
21017   /* function exit code */
21018   __Pyx_RefNannyFinishContext();
21019   return __pyx_r;
21020 }
21021 
__pyx_pf_8rasterio_5_base_11DatasetBase_73_set_gcps(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_values)21022 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_73_set_gcps(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_values) {
21023   PyObject *__pyx_r = NULL;
21024   __Pyx_RefNannyDeclarations
21025   PyObject *__pyx_t_1 = NULL;
21026   PyObject *__pyx_t_2 = NULL;
21027   PyObject *__pyx_t_3 = NULL;
21028   int __pyx_lineno = 0;
21029   const char *__pyx_filename = NULL;
21030   int __pyx_clineno = 0;
21031   __Pyx_RefNannySetupContext("_set_gcps", 0);
21032 
21033   /* "rasterio/_base.pyx":1317
21034  *
21035  *     def _set_gcps(self, values):
21036  *         raise DatasetAttributeError("read-only attribute")             # <<<<<<<<<<<<<<
21037  *
21038  *     property gcps:
21039  */
21040   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DatasetAttributeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1317, __pyx_L1_error)
21041   __Pyx_GOTREF(__pyx_t_2);
21042   __pyx_t_3 = NULL;
21043   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
21044     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
21045     if (likely(__pyx_t_3)) {
21046       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
21047       __Pyx_INCREF(__pyx_t_3);
21048       __Pyx_INCREF(function);
21049       __Pyx_DECREF_SET(__pyx_t_2, function);
21050     }
21051   }
21052   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_read_only_attribute) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_read_only_attribute);
21053   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
21054   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1317, __pyx_L1_error)
21055   __Pyx_GOTREF(__pyx_t_1);
21056   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21057   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
21058   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21059   __PYX_ERR(0, 1317, __pyx_L1_error)
21060 
21061   /* "rasterio/_base.pyx":1316
21062  *                                          for i in range(num_gcps)], crs)
21063  *
21064  *     def _set_gcps(self, values):             # <<<<<<<<<<<<<<
21065  *         raise DatasetAttributeError("read-only attribute")
21066  *
21067  */
21068 
21069   /* function exit code */
21070   __pyx_L1_error:;
21071   __Pyx_XDECREF(__pyx_t_1);
21072   __Pyx_XDECREF(__pyx_t_2);
21073   __Pyx_XDECREF(__pyx_t_3);
21074   __Pyx_AddTraceback("rasterio._base.DatasetBase._set_gcps", __pyx_clineno, __pyx_lineno, __pyx_filename);
21075   __pyx_r = NULL;
21076   __Pyx_XGIVEREF(__pyx_r);
21077   __Pyx_RefNannyFinishContext();
21078   return __pyx_r;
21079 }
21080 
21081 /* "rasterio/_base.pyx":1329
21082  *             The coordinate reference system of the ground control points.
21083  *         """
21084  *         def __get__(self):             # <<<<<<<<<<<<<<
21085  *             if not self._gcps:
21086  *                 self._gcps = self.get_gcps()
21087  */
21088 
21089 /* Python wrapper */
21090 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_4gcps_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_4gcps_1__get__(PyObject * __pyx_v_self)21091 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_4gcps_1__get__(PyObject *__pyx_v_self) {
21092   PyObject *__pyx_r = 0;
21093   __Pyx_RefNannyDeclarations
21094   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
21095   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_4gcps___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
21096 
21097   /* function exit code */
21098   __Pyx_RefNannyFinishContext();
21099   return __pyx_r;
21100 }
21101 
__pyx_pf_8rasterio_5_base_11DatasetBase_4gcps___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)21102 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4gcps___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
21103   PyObject *__pyx_r = NULL;
21104   __Pyx_RefNannyDeclarations
21105   int __pyx_t_1;
21106   int __pyx_t_2;
21107   PyObject *__pyx_t_3 = NULL;
21108   PyObject *__pyx_t_4 = NULL;
21109   PyObject *__pyx_t_5 = NULL;
21110   int __pyx_lineno = 0;
21111   const char *__pyx_filename = NULL;
21112   int __pyx_clineno = 0;
21113   __Pyx_RefNannySetupContext("__get__", 0);
21114 
21115   /* "rasterio/_base.pyx":1330
21116  *         """
21117  *         def __get__(self):
21118  *             if not self._gcps:             # <<<<<<<<<<<<<<
21119  *                 self._gcps = self.get_gcps()
21120  *             return self._gcps
21121  */
21122   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_gcps); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1330, __pyx_L1_error)
21123   __pyx_t_2 = ((!__pyx_t_1) != 0);
21124   if (__pyx_t_2) {
21125 
21126     /* "rasterio/_base.pyx":1331
21127  *         def __get__(self):
21128  *             if not self._gcps:
21129  *                 self._gcps = self.get_gcps()             # <<<<<<<<<<<<<<
21130  *             return self._gcps
21131  *
21132  */
21133     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_gcps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1331, __pyx_L1_error)
21134     __Pyx_GOTREF(__pyx_t_4);
21135     __pyx_t_5 = NULL;
21136     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
21137       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
21138       if (likely(__pyx_t_5)) {
21139         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
21140         __Pyx_INCREF(__pyx_t_5);
21141         __Pyx_INCREF(function);
21142         __Pyx_DECREF_SET(__pyx_t_4, function);
21143       }
21144     }
21145     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
21146     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
21147     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1331, __pyx_L1_error)
21148     __Pyx_GOTREF(__pyx_t_3);
21149     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21150     __Pyx_GIVEREF(__pyx_t_3);
21151     __Pyx_GOTREF(__pyx_v_self->_gcps);
21152     __Pyx_DECREF(__pyx_v_self->_gcps);
21153     __pyx_v_self->_gcps = __pyx_t_3;
21154     __pyx_t_3 = 0;
21155 
21156     /* "rasterio/_base.pyx":1330
21157  *         """
21158  *         def __get__(self):
21159  *             if not self._gcps:             # <<<<<<<<<<<<<<
21160  *                 self._gcps = self.get_gcps()
21161  *             return self._gcps
21162  */
21163   }
21164 
21165   /* "rasterio/_base.pyx":1332
21166  *             if not self._gcps:
21167  *                 self._gcps = self.get_gcps()
21168  *             return self._gcps             # <<<<<<<<<<<<<<
21169  *
21170  *         def __set__(self, value):
21171  */
21172   __Pyx_XDECREF(__pyx_r);
21173   __Pyx_INCREF(__pyx_v_self->_gcps);
21174   __pyx_r = __pyx_v_self->_gcps;
21175   goto __pyx_L0;
21176 
21177   /* "rasterio/_base.pyx":1329
21178  *             The coordinate reference system of the ground control points.
21179  *         """
21180  *         def __get__(self):             # <<<<<<<<<<<<<<
21181  *             if not self._gcps:
21182  *                 self._gcps = self.get_gcps()
21183  */
21184 
21185   /* function exit code */
21186   __pyx_L1_error:;
21187   __Pyx_XDECREF(__pyx_t_3);
21188   __Pyx_XDECREF(__pyx_t_4);
21189   __Pyx_XDECREF(__pyx_t_5);
21190   __Pyx_AddTraceback("rasterio._base.DatasetBase.gcps.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21191   __pyx_r = NULL;
21192   __pyx_L0:;
21193   __Pyx_XGIVEREF(__pyx_r);
21194   __Pyx_RefNannyFinishContext();
21195   return __pyx_r;
21196 }
21197 
21198 /* "rasterio/_base.pyx":1334
21199  *             return self._gcps
21200  *
21201  *         def __set__(self, value):             # <<<<<<<<<<<<<<
21202  *             gcps, crs = value
21203  *             self._set_gcps(gcps, crs)
21204  */
21205 
21206 /* Python wrapper */
21207 static int __pyx_pw_8rasterio_5_base_11DatasetBase_4gcps_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_4gcps_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)21208 static int __pyx_pw_8rasterio_5_base_11DatasetBase_4gcps_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
21209   int __pyx_r;
21210   __Pyx_RefNannyDeclarations
21211   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
21212   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_4gcps_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
21213 
21214   /* function exit code */
21215   __Pyx_RefNannyFinishContext();
21216   return __pyx_r;
21217 }
21218 
__pyx_pf_8rasterio_5_base_11DatasetBase_4gcps_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)21219 static int __pyx_pf_8rasterio_5_base_11DatasetBase_4gcps_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
21220   PyObject *__pyx_v_gcps = NULL;
21221   PyObject *__pyx_v_crs = NULL;
21222   int __pyx_r;
21223   __Pyx_RefNannyDeclarations
21224   PyObject *__pyx_t_1 = NULL;
21225   PyObject *__pyx_t_2 = NULL;
21226   PyObject *__pyx_t_3 = NULL;
21227   PyObject *(*__pyx_t_4)(PyObject *);
21228   int __pyx_t_5;
21229   PyObject *__pyx_t_6 = NULL;
21230   int __pyx_lineno = 0;
21231   const char *__pyx_filename = NULL;
21232   int __pyx_clineno = 0;
21233   __Pyx_RefNannySetupContext("__set__", 0);
21234 
21235   /* "rasterio/_base.pyx":1335
21236  *
21237  *         def __set__(self, value):
21238  *             gcps, crs = value             # <<<<<<<<<<<<<<
21239  *             self._set_gcps(gcps, crs)
21240  *
21241  */
21242   if ((likely(PyTuple_CheckExact(__pyx_v_value))) || (PyList_CheckExact(__pyx_v_value))) {
21243     PyObject* sequence = __pyx_v_value;
21244     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
21245     if (unlikely(size != 2)) {
21246       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
21247       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
21248       __PYX_ERR(0, 1335, __pyx_L1_error)
21249     }
21250     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
21251     if (likely(PyTuple_CheckExact(sequence))) {
21252       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
21253       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
21254     } else {
21255       __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
21256       __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
21257     }
21258     __Pyx_INCREF(__pyx_t_1);
21259     __Pyx_INCREF(__pyx_t_2);
21260     #else
21261     __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1335, __pyx_L1_error)
21262     __Pyx_GOTREF(__pyx_t_1);
21263     __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1335, __pyx_L1_error)
21264     __Pyx_GOTREF(__pyx_t_2);
21265     #endif
21266   } else {
21267     Py_ssize_t index = -1;
21268     __pyx_t_3 = PyObject_GetIter(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1335, __pyx_L1_error)
21269     __Pyx_GOTREF(__pyx_t_3);
21270     __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
21271     index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
21272     __Pyx_GOTREF(__pyx_t_1);
21273     index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
21274     __Pyx_GOTREF(__pyx_t_2);
21275     if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(0, 1335, __pyx_L1_error)
21276     __pyx_t_4 = NULL;
21277     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21278     goto __pyx_L4_unpacking_done;
21279     __pyx_L3_unpacking_failed:;
21280     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21281     __pyx_t_4 = NULL;
21282     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
21283     __PYX_ERR(0, 1335, __pyx_L1_error)
21284     __pyx_L4_unpacking_done:;
21285   }
21286   __pyx_v_gcps = __pyx_t_1;
21287   __pyx_t_1 = 0;
21288   __pyx_v_crs = __pyx_t_2;
21289   __pyx_t_2 = 0;
21290 
21291   /* "rasterio/_base.pyx":1336
21292  *         def __set__(self, value):
21293  *             gcps, crs = value
21294  *             self._set_gcps(gcps, crs)             # <<<<<<<<<<<<<<
21295  *
21296  *     def _get_rpcs(self):
21297  */
21298   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_gcps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1336, __pyx_L1_error)
21299   __Pyx_GOTREF(__pyx_t_1);
21300   __pyx_t_3 = NULL;
21301   __pyx_t_5 = 0;
21302   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
21303     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
21304     if (likely(__pyx_t_3)) {
21305       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
21306       __Pyx_INCREF(__pyx_t_3);
21307       __Pyx_INCREF(function);
21308       __Pyx_DECREF_SET(__pyx_t_1, function);
21309       __pyx_t_5 = 1;
21310     }
21311   }
21312   #if CYTHON_FAST_PYCALL
21313   if (PyFunction_Check(__pyx_t_1)) {
21314     PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_gcps, __pyx_v_crs};
21315     __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1336, __pyx_L1_error)
21316     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
21317     __Pyx_GOTREF(__pyx_t_2);
21318   } else
21319   #endif
21320   #if CYTHON_FAST_PYCCALL
21321   if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
21322     PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_gcps, __pyx_v_crs};
21323     __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1336, __pyx_L1_error)
21324     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
21325     __Pyx_GOTREF(__pyx_t_2);
21326   } else
21327   #endif
21328   {
21329     __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1336, __pyx_L1_error)
21330     __Pyx_GOTREF(__pyx_t_6);
21331     if (__pyx_t_3) {
21332       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
21333     }
21334     __Pyx_INCREF(__pyx_v_gcps);
21335     __Pyx_GIVEREF(__pyx_v_gcps);
21336     PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_gcps);
21337     __Pyx_INCREF(__pyx_v_crs);
21338     __Pyx_GIVEREF(__pyx_v_crs);
21339     PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_crs);
21340     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1336, __pyx_L1_error)
21341     __Pyx_GOTREF(__pyx_t_2);
21342     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21343   }
21344   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21345   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21346 
21347   /* "rasterio/_base.pyx":1334
21348  *             return self._gcps
21349  *
21350  *         def __set__(self, value):             # <<<<<<<<<<<<<<
21351  *             gcps, crs = value
21352  *             self._set_gcps(gcps, crs)
21353  */
21354 
21355   /* function exit code */
21356   __pyx_r = 0;
21357   goto __pyx_L0;
21358   __pyx_L1_error:;
21359   __Pyx_XDECREF(__pyx_t_1);
21360   __Pyx_XDECREF(__pyx_t_2);
21361   __Pyx_XDECREF(__pyx_t_3);
21362   __Pyx_XDECREF(__pyx_t_6);
21363   __Pyx_AddTraceback("rasterio._base.DatasetBase.gcps.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21364   __pyx_r = -1;
21365   __pyx_L0:;
21366   __Pyx_XDECREF(__pyx_v_gcps);
21367   __Pyx_XDECREF(__pyx_v_crs);
21368   __Pyx_RefNannyFinishContext();
21369   return __pyx_r;
21370 }
21371 
21372 /* "rasterio/_base.pyx":1338
21373  *             self._set_gcps(gcps, crs)
21374  *
21375  *     def _get_rpcs(self):             # <<<<<<<<<<<<<<
21376  *         """Get RPCs if exists"""
21377  *         md = self.tags(ns='RPC')
21378  */
21379 
21380 /* Python wrapper */
21381 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_76_get_rpcs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
21382 static char __pyx_doc_8rasterio_5_base_11DatasetBase_75_get_rpcs[] = "Get RPCs if exists";
__pyx_pw_8rasterio_5_base_11DatasetBase_76_get_rpcs(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)21383 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_76_get_rpcs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
21384   PyObject *__pyx_r = 0;
21385   __Pyx_RefNannyDeclarations
21386   __Pyx_RefNannySetupContext("_get_rpcs (wrapper)", 0);
21387   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_75_get_rpcs(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
21388 
21389   /* function exit code */
21390   __Pyx_RefNannyFinishContext();
21391   return __pyx_r;
21392 }
21393 
__pyx_pf_8rasterio_5_base_11DatasetBase_75_get_rpcs(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)21394 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_75_get_rpcs(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
21395   PyObject *__pyx_v_md = NULL;
21396   PyObject *__pyx_r = NULL;
21397   __Pyx_RefNannyDeclarations
21398   PyObject *__pyx_t_1 = NULL;
21399   PyObject *__pyx_t_2 = NULL;
21400   PyObject *__pyx_t_3 = NULL;
21401   int __pyx_t_4;
21402   int __pyx_lineno = 0;
21403   const char *__pyx_filename = NULL;
21404   int __pyx_clineno = 0;
21405   __Pyx_RefNannySetupContext("_get_rpcs", 0);
21406 
21407   /* "rasterio/_base.pyx":1340
21408  *     def _get_rpcs(self):
21409  *         """Get RPCs if exists"""
21410  *         md = self.tags(ns='RPC')             # <<<<<<<<<<<<<<
21411  *         if md:
21412  *             return RPC.from_gdal(md)
21413  */
21414   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1340, __pyx_L1_error)
21415   __Pyx_GOTREF(__pyx_t_1);
21416   __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1340, __pyx_L1_error)
21417   __Pyx_GOTREF(__pyx_t_2);
21418   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_ns, __pyx_n_u_RPC) < 0) __PYX_ERR(0, 1340, __pyx_L1_error)
21419   __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1340, __pyx_L1_error)
21420   __Pyx_GOTREF(__pyx_t_3);
21421   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21422   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21423   __pyx_v_md = __pyx_t_3;
21424   __pyx_t_3 = 0;
21425 
21426   /* "rasterio/_base.pyx":1341
21427  *         """Get RPCs if exists"""
21428  *         md = self.tags(ns='RPC')
21429  *         if md:             # <<<<<<<<<<<<<<
21430  *             return RPC.from_gdal(md)
21431  *
21432  */
21433   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_md); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1341, __pyx_L1_error)
21434   if (__pyx_t_4) {
21435 
21436     /* "rasterio/_base.pyx":1342
21437  *         md = self.tags(ns='RPC')
21438  *         if md:
21439  *             return RPC.from_gdal(md)             # <<<<<<<<<<<<<<
21440  *
21441  *     def _set_rpcs(self, values):
21442  */
21443     __Pyx_XDECREF(__pyx_r);
21444     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RPC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1342, __pyx_L1_error)
21445     __Pyx_GOTREF(__pyx_t_2);
21446     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_from_gdal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1342, __pyx_L1_error)
21447     __Pyx_GOTREF(__pyx_t_1);
21448     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21449     __pyx_t_2 = NULL;
21450     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
21451       __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
21452       if (likely(__pyx_t_2)) {
21453         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
21454         __Pyx_INCREF(__pyx_t_2);
21455         __Pyx_INCREF(function);
21456         __Pyx_DECREF_SET(__pyx_t_1, function);
21457       }
21458     }
21459     __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_md) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_md);
21460     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
21461     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1342, __pyx_L1_error)
21462     __Pyx_GOTREF(__pyx_t_3);
21463     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21464     __pyx_r = __pyx_t_3;
21465     __pyx_t_3 = 0;
21466     goto __pyx_L0;
21467 
21468     /* "rasterio/_base.pyx":1341
21469  *         """Get RPCs if exists"""
21470  *         md = self.tags(ns='RPC')
21471  *         if md:             # <<<<<<<<<<<<<<
21472  *             return RPC.from_gdal(md)
21473  *
21474  */
21475   }
21476 
21477   /* "rasterio/_base.pyx":1338
21478  *             self._set_gcps(gcps, crs)
21479  *
21480  *     def _get_rpcs(self):             # <<<<<<<<<<<<<<
21481  *         """Get RPCs if exists"""
21482  *         md = self.tags(ns='RPC')
21483  */
21484 
21485   /* function exit code */
21486   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21487   goto __pyx_L0;
21488   __pyx_L1_error:;
21489   __Pyx_XDECREF(__pyx_t_1);
21490   __Pyx_XDECREF(__pyx_t_2);
21491   __Pyx_XDECREF(__pyx_t_3);
21492   __Pyx_AddTraceback("rasterio._base.DatasetBase._get_rpcs", __pyx_clineno, __pyx_lineno, __pyx_filename);
21493   __pyx_r = NULL;
21494   __pyx_L0:;
21495   __Pyx_XDECREF(__pyx_v_md);
21496   __Pyx_XGIVEREF(__pyx_r);
21497   __Pyx_RefNannyFinishContext();
21498   return __pyx_r;
21499 }
21500 
21501 /* "rasterio/_base.pyx":1344
21502  *             return RPC.from_gdal(md)
21503  *
21504  *     def _set_rpcs(self, values):             # <<<<<<<<<<<<<<
21505  *         raise DatasetAttributeError("read-only attribute")
21506  *
21507  */
21508 
21509 /* Python wrapper */
21510 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_78_set_rpcs(PyObject *__pyx_v_self, PyObject *__pyx_v_values); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_78_set_rpcs(PyObject * __pyx_v_self,PyObject * __pyx_v_values)21511 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_78_set_rpcs(PyObject *__pyx_v_self, PyObject *__pyx_v_values) {
21512   PyObject *__pyx_r = 0;
21513   __Pyx_RefNannyDeclarations
21514   __Pyx_RefNannySetupContext("_set_rpcs (wrapper)", 0);
21515   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_77_set_rpcs(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_values));
21516 
21517   /* function exit code */
21518   __Pyx_RefNannyFinishContext();
21519   return __pyx_r;
21520 }
21521 
__pyx_pf_8rasterio_5_base_11DatasetBase_77_set_rpcs(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_values)21522 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_77_set_rpcs(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_values) {
21523   PyObject *__pyx_r = NULL;
21524   __Pyx_RefNannyDeclarations
21525   PyObject *__pyx_t_1 = NULL;
21526   PyObject *__pyx_t_2 = NULL;
21527   PyObject *__pyx_t_3 = NULL;
21528   int __pyx_lineno = 0;
21529   const char *__pyx_filename = NULL;
21530   int __pyx_clineno = 0;
21531   __Pyx_RefNannySetupContext("_set_rpcs", 0);
21532 
21533   /* "rasterio/_base.pyx":1345
21534  *
21535  *     def _set_rpcs(self, values):
21536  *         raise DatasetAttributeError("read-only attribute")             # <<<<<<<<<<<<<<
21537  *
21538  *     property rpcs:
21539  */
21540   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DatasetAttributeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1345, __pyx_L1_error)
21541   __Pyx_GOTREF(__pyx_t_2);
21542   __pyx_t_3 = NULL;
21543   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
21544     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
21545     if (likely(__pyx_t_3)) {
21546       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
21547       __Pyx_INCREF(__pyx_t_3);
21548       __Pyx_INCREF(function);
21549       __Pyx_DECREF_SET(__pyx_t_2, function);
21550     }
21551   }
21552   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_read_only_attribute) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_read_only_attribute);
21553   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
21554   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1345, __pyx_L1_error)
21555   __Pyx_GOTREF(__pyx_t_1);
21556   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21557   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
21558   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21559   __PYX_ERR(0, 1345, __pyx_L1_error)
21560 
21561   /* "rasterio/_base.pyx":1344
21562  *             return RPC.from_gdal(md)
21563  *
21564  *     def _set_rpcs(self, values):             # <<<<<<<<<<<<<<
21565  *         raise DatasetAttributeError("read-only attribute")
21566  *
21567  */
21568 
21569   /* function exit code */
21570   __pyx_L1_error:;
21571   __Pyx_XDECREF(__pyx_t_1);
21572   __Pyx_XDECREF(__pyx_t_2);
21573   __Pyx_XDECREF(__pyx_t_3);
21574   __Pyx_AddTraceback("rasterio._base.DatasetBase._set_rpcs", __pyx_clineno, __pyx_lineno, __pyx_filename);
21575   __pyx_r = NULL;
21576   __Pyx_XGIVEREF(__pyx_r);
21577   __Pyx_RefNannyFinishContext();
21578   return __pyx_r;
21579 }
21580 
21581 /* "rasterio/_base.pyx":1355
21582  *         metadata in the "RPC" domain.
21583  *         """
21584  *         def __get__(self):             # <<<<<<<<<<<<<<
21585  *             if not self._rpcs:
21586  *                 self._rpcs = self._get_rpcs()
21587  */
21588 
21589 /* Python wrapper */
21590 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_4rpcs_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_4rpcs_1__get__(PyObject * __pyx_v_self)21591 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_4rpcs_1__get__(PyObject *__pyx_v_self) {
21592   PyObject *__pyx_r = 0;
21593   __Pyx_RefNannyDeclarations
21594   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
21595   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_4rpcs___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
21596 
21597   /* function exit code */
21598   __Pyx_RefNannyFinishContext();
21599   return __pyx_r;
21600 }
21601 
__pyx_pf_8rasterio_5_base_11DatasetBase_4rpcs___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)21602 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4rpcs___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
21603   PyObject *__pyx_r = NULL;
21604   __Pyx_RefNannyDeclarations
21605   int __pyx_t_1;
21606   int __pyx_t_2;
21607   PyObject *__pyx_t_3 = NULL;
21608   PyObject *__pyx_t_4 = NULL;
21609   PyObject *__pyx_t_5 = NULL;
21610   int __pyx_lineno = 0;
21611   const char *__pyx_filename = NULL;
21612   int __pyx_clineno = 0;
21613   __Pyx_RefNannySetupContext("__get__", 0);
21614 
21615   /* "rasterio/_base.pyx":1356
21616  *         """
21617  *         def __get__(self):
21618  *             if not self._rpcs:             # <<<<<<<<<<<<<<
21619  *                 self._rpcs = self._get_rpcs()
21620  *             return self._rpcs
21621  */
21622   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_rpcs); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1356, __pyx_L1_error)
21623   __pyx_t_2 = ((!__pyx_t_1) != 0);
21624   if (__pyx_t_2) {
21625 
21626     /* "rasterio/_base.pyx":1357
21627  *         def __get__(self):
21628  *             if not self._rpcs:
21629  *                 self._rpcs = self._get_rpcs()             # <<<<<<<<<<<<<<
21630  *             return self._rpcs
21631  *
21632  */
21633     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_rpcs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1357, __pyx_L1_error)
21634     __Pyx_GOTREF(__pyx_t_4);
21635     __pyx_t_5 = NULL;
21636     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
21637       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
21638       if (likely(__pyx_t_5)) {
21639         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
21640         __Pyx_INCREF(__pyx_t_5);
21641         __Pyx_INCREF(function);
21642         __Pyx_DECREF_SET(__pyx_t_4, function);
21643       }
21644     }
21645     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
21646     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
21647     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1357, __pyx_L1_error)
21648     __Pyx_GOTREF(__pyx_t_3);
21649     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21650     __Pyx_GIVEREF(__pyx_t_3);
21651     __Pyx_GOTREF(__pyx_v_self->_rpcs);
21652     __Pyx_DECREF(__pyx_v_self->_rpcs);
21653     __pyx_v_self->_rpcs = __pyx_t_3;
21654     __pyx_t_3 = 0;
21655 
21656     /* "rasterio/_base.pyx":1356
21657  *         """
21658  *         def __get__(self):
21659  *             if not self._rpcs:             # <<<<<<<<<<<<<<
21660  *                 self._rpcs = self._get_rpcs()
21661  *             return self._rpcs
21662  */
21663   }
21664 
21665   /* "rasterio/_base.pyx":1358
21666  *             if not self._rpcs:
21667  *                 self._rpcs = self._get_rpcs()
21668  *             return self._rpcs             # <<<<<<<<<<<<<<
21669  *
21670  *         def __set__(self, value):
21671  */
21672   __Pyx_XDECREF(__pyx_r);
21673   __Pyx_INCREF(__pyx_v_self->_rpcs);
21674   __pyx_r = __pyx_v_self->_rpcs;
21675   goto __pyx_L0;
21676 
21677   /* "rasterio/_base.pyx":1355
21678  *         metadata in the "RPC" domain.
21679  *         """
21680  *         def __get__(self):             # <<<<<<<<<<<<<<
21681  *             if not self._rpcs:
21682  *                 self._rpcs = self._get_rpcs()
21683  */
21684 
21685   /* function exit code */
21686   __pyx_L1_error:;
21687   __Pyx_XDECREF(__pyx_t_3);
21688   __Pyx_XDECREF(__pyx_t_4);
21689   __Pyx_XDECREF(__pyx_t_5);
21690   __Pyx_AddTraceback("rasterio._base.DatasetBase.rpcs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21691   __pyx_r = NULL;
21692   __pyx_L0:;
21693   __Pyx_XGIVEREF(__pyx_r);
21694   __Pyx_RefNannyFinishContext();
21695   return __pyx_r;
21696 }
21697 
21698 /* "rasterio/_base.pyx":1360
21699  *             return self._rpcs
21700  *
21701  *         def __set__(self, value):             # <<<<<<<<<<<<<<
21702  *             rpcs = value.to_gdal()
21703  *             self._set_rpcs(rpcs)
21704  */
21705 
21706 /* Python wrapper */
21707 static int __pyx_pw_8rasterio_5_base_11DatasetBase_4rpcs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_4rpcs_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)21708 static int __pyx_pw_8rasterio_5_base_11DatasetBase_4rpcs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
21709   int __pyx_r;
21710   __Pyx_RefNannyDeclarations
21711   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
21712   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_4rpcs_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
21713 
21714   /* function exit code */
21715   __Pyx_RefNannyFinishContext();
21716   return __pyx_r;
21717 }
21718 
__pyx_pf_8rasterio_5_base_11DatasetBase_4rpcs_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)21719 static int __pyx_pf_8rasterio_5_base_11DatasetBase_4rpcs_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
21720   PyObject *__pyx_v_rpcs = NULL;
21721   int __pyx_r;
21722   __Pyx_RefNannyDeclarations
21723   PyObject *__pyx_t_1 = NULL;
21724   PyObject *__pyx_t_2 = NULL;
21725   PyObject *__pyx_t_3 = NULL;
21726   int __pyx_lineno = 0;
21727   const char *__pyx_filename = NULL;
21728   int __pyx_clineno = 0;
21729   __Pyx_RefNannySetupContext("__set__", 0);
21730 
21731   /* "rasterio/_base.pyx":1361
21732  *
21733  *         def __set__(self, value):
21734  *             rpcs = value.to_gdal()             # <<<<<<<<<<<<<<
21735  *             self._set_rpcs(rpcs)
21736  *
21737  */
21738   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_to_gdal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1361, __pyx_L1_error)
21739   __Pyx_GOTREF(__pyx_t_2);
21740   __pyx_t_3 = NULL;
21741   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
21742     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
21743     if (likely(__pyx_t_3)) {
21744       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
21745       __Pyx_INCREF(__pyx_t_3);
21746       __Pyx_INCREF(function);
21747       __Pyx_DECREF_SET(__pyx_t_2, function);
21748     }
21749   }
21750   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
21751   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
21752   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1361, __pyx_L1_error)
21753   __Pyx_GOTREF(__pyx_t_1);
21754   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21755   __pyx_v_rpcs = __pyx_t_1;
21756   __pyx_t_1 = 0;
21757 
21758   /* "rasterio/_base.pyx":1362
21759  *         def __set__(self, value):
21760  *             rpcs = value.to_gdal()
21761  *             self._set_rpcs(rpcs)             # <<<<<<<<<<<<<<
21762  *
21763  *     property files:
21764  */
21765   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_rpcs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1362, __pyx_L1_error)
21766   __Pyx_GOTREF(__pyx_t_2);
21767   __pyx_t_3 = NULL;
21768   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
21769     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
21770     if (likely(__pyx_t_3)) {
21771       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
21772       __Pyx_INCREF(__pyx_t_3);
21773       __Pyx_INCREF(function);
21774       __Pyx_DECREF_SET(__pyx_t_2, function);
21775     }
21776   }
21777   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_rpcs) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_rpcs);
21778   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
21779   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1362, __pyx_L1_error)
21780   __Pyx_GOTREF(__pyx_t_1);
21781   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21782   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21783 
21784   /* "rasterio/_base.pyx":1360
21785  *             return self._rpcs
21786  *
21787  *         def __set__(self, value):             # <<<<<<<<<<<<<<
21788  *             rpcs = value.to_gdal()
21789  *             self._set_rpcs(rpcs)
21790  */
21791 
21792   /* function exit code */
21793   __pyx_r = 0;
21794   goto __pyx_L0;
21795   __pyx_L1_error:;
21796   __Pyx_XDECREF(__pyx_t_1);
21797   __Pyx_XDECREF(__pyx_t_2);
21798   __Pyx_XDECREF(__pyx_t_3);
21799   __Pyx_AddTraceback("rasterio._base.DatasetBase.rpcs.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21800   __pyx_r = -1;
21801   __pyx_L0:;
21802   __Pyx_XDECREF(__pyx_v_rpcs);
21803   __Pyx_RefNannyFinishContext();
21804   return __pyx_r;
21805 }
21806 
21807 /* "rasterio/_base.pyx":1373
21808  *         """
21809  *
21810  *         def __get__(self):             # <<<<<<<<<<<<<<
21811  *             cdef GDALDatasetH h_dataset = NULL
21812  *             h_dataset = self.handle()
21813  */
21814 
21815 /* Python wrapper */
21816 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5files_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5files_1__get__(PyObject * __pyx_v_self)21817 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5files_1__get__(PyObject *__pyx_v_self) {
21818   PyObject *__pyx_r = 0;
21819   __Pyx_RefNannyDeclarations
21820   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
21821   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5files___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
21822 
21823   /* function exit code */
21824   __Pyx_RefNannyFinishContext();
21825   return __pyx_r;
21826 }
21827 
__pyx_pf_8rasterio_5_base_11DatasetBase_5files___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)21828 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5files___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
21829   GDALDatasetH __pyx_v_h_dataset;
21830   char **__pyx_v_file_list;
21831   int __pyx_v_num_items;
21832   int __pyx_9genexpr14__pyx_v_i;
21833   PyObject *__pyx_r = NULL;
21834   __Pyx_RefNannyDeclarations
21835   GDALDatasetH __pyx_t_1;
21836   PyObject *__pyx_t_2 = NULL;
21837   int __pyx_t_3;
21838   int __pyx_t_4;
21839   int __pyx_t_5;
21840   PyObject *__pyx_t_6 = NULL;
21841   char const *__pyx_t_7;
21842   PyObject *__pyx_t_8 = NULL;
21843   PyObject *__pyx_t_9 = NULL;
21844   PyObject *__pyx_t_10 = NULL;
21845   PyObject *__pyx_t_11 = NULL;
21846   PyObject *__pyx_t_12 = NULL;
21847   PyObject *__pyx_t_13 = NULL;
21848   int __pyx_lineno = 0;
21849   const char *__pyx_filename = NULL;
21850   int __pyx_clineno = 0;
21851   __Pyx_RefNannySetupContext("__get__", 0);
21852 
21853   /* "rasterio/_base.pyx":1374
21854  *
21855  *         def __get__(self):
21856  *             cdef GDALDatasetH h_dataset = NULL             # <<<<<<<<<<<<<<
21857  *             h_dataset = self.handle()
21858  *             with nogil:
21859  */
21860   __pyx_v_h_dataset = NULL;
21861 
21862   /* "rasterio/_base.pyx":1375
21863  *         def __get__(self):
21864  *             cdef GDALDatasetH h_dataset = NULL
21865  *             h_dataset = self.handle()             # <<<<<<<<<<<<<<
21866  *             with nogil:
21867  *                 file_list = GDALGetFileList(h_dataset)
21868  */
21869   __pyx_t_1 = ((struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase *)__pyx_v_self->__pyx_vtab)->handle(__pyx_v_self); if (unlikely(__pyx_t_1 == ((GDALDatasetH)NULL))) __PYX_ERR(0, 1375, __pyx_L1_error)
21870   __pyx_v_h_dataset = __pyx_t_1;
21871 
21872   /* "rasterio/_base.pyx":1376
21873  *             cdef GDALDatasetH h_dataset = NULL
21874  *             h_dataset = self.handle()
21875  *             with nogil:             # <<<<<<<<<<<<<<
21876  *                 file_list = GDALGetFileList(h_dataset)
21877  *             num_items = CSLCount(file_list)
21878  */
21879   {
21880       #ifdef WITH_THREAD
21881       PyThreadState *_save;
21882       Py_UNBLOCK_THREADS
21883       __Pyx_FastGIL_Remember();
21884       #endif
21885       /*try:*/ {
21886 
21887         /* "rasterio/_base.pyx":1377
21888  *             h_dataset = self.handle()
21889  *             with nogil:
21890  *                 file_list = GDALGetFileList(h_dataset)             # <<<<<<<<<<<<<<
21891  *             num_items = CSLCount(file_list)
21892  *             try:
21893  */
21894         __pyx_v_file_list = GDALGetFileList(__pyx_v_h_dataset);
21895       }
21896 
21897       /* "rasterio/_base.pyx":1376
21898  *             cdef GDALDatasetH h_dataset = NULL
21899  *             h_dataset = self.handle()
21900  *             with nogil:             # <<<<<<<<<<<<<<
21901  *                 file_list = GDALGetFileList(h_dataset)
21902  *             num_items = CSLCount(file_list)
21903  */
21904       /*finally:*/ {
21905         /*normal exit:*/{
21906           #ifdef WITH_THREAD
21907           __Pyx_FastGIL_Forget();
21908           Py_BLOCK_THREADS
21909           #endif
21910           goto __pyx_L5;
21911         }
21912         __pyx_L5:;
21913       }
21914   }
21915 
21916   /* "rasterio/_base.pyx":1378
21917  *             with nogil:
21918  *                 file_list = GDALGetFileList(h_dataset)
21919  *             num_items = CSLCount(file_list)             # <<<<<<<<<<<<<<
21920  *             try:
21921  *                 return list([file_list[i] for i in range(num_items)])
21922  */
21923   __pyx_v_num_items = CSLCount(__pyx_v_file_list);
21924 
21925   /* "rasterio/_base.pyx":1379
21926  *                 file_list = GDALGetFileList(h_dataset)
21927  *             num_items = CSLCount(file_list)
21928  *             try:             # <<<<<<<<<<<<<<
21929  *                 return list([file_list[i] for i in range(num_items)])
21930  *             finally:
21931  */
21932   /*try:*/ {
21933 
21934     /* "rasterio/_base.pyx":1380
21935  *             num_items = CSLCount(file_list)
21936  *             try:
21937  *                 return list([file_list[i] for i in range(num_items)])             # <<<<<<<<<<<<<<
21938  *             finally:
21939  *                 CSLDestroy(file_list)
21940  */
21941     __Pyx_XDECREF(__pyx_r);
21942     { /* enter inner scope */
21943       __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1380, __pyx_L7_error)
21944       __Pyx_GOTREF(__pyx_t_2);
21945       __pyx_t_3 = __pyx_v_num_items;
21946       __pyx_t_4 = __pyx_t_3;
21947       for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
21948         __pyx_9genexpr14__pyx_v_i = __pyx_t_5;
21949         __pyx_t_6 = __Pyx_PyUnicode_FromString((__pyx_v_file_list[__pyx_9genexpr14__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1380, __pyx_L7_error)
21950         __Pyx_GOTREF(__pyx_t_6);
21951         if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 1380, __pyx_L7_error)
21952         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21953       }
21954     } /* exit inner scope */
21955     __pyx_t_6 = PySequence_List(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1380, __pyx_L7_error)
21956     __Pyx_GOTREF(__pyx_t_6);
21957     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21958     __pyx_r = __pyx_t_6;
21959     __pyx_t_6 = 0;
21960     goto __pyx_L6_return;
21961   }
21962 
21963   /* "rasterio/_base.pyx":1382
21964  *                 return list([file_list[i] for i in range(num_items)])
21965  *             finally:
21966  *                 CSLDestroy(file_list)             # <<<<<<<<<<<<<<
21967  *
21968  *
21969  */
21970   /*finally:*/ {
21971     __pyx_L7_error:;
21972     /*exception exit:*/{
21973       __Pyx_PyThreadState_declare
21974       __Pyx_PyThreadState_assign
21975       __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
21976       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
21977       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
21978       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
21979       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
21980       __Pyx_XGOTREF(__pyx_t_8);
21981       __Pyx_XGOTREF(__pyx_t_9);
21982       __Pyx_XGOTREF(__pyx_t_10);
21983       __Pyx_XGOTREF(__pyx_t_11);
21984       __Pyx_XGOTREF(__pyx_t_12);
21985       __Pyx_XGOTREF(__pyx_t_13);
21986       __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
21987       {
21988         CSLDestroy(__pyx_v_file_list);
21989       }
21990       if (PY_MAJOR_VERSION >= 3) {
21991         __Pyx_XGIVEREF(__pyx_t_11);
21992         __Pyx_XGIVEREF(__pyx_t_12);
21993         __Pyx_XGIVEREF(__pyx_t_13);
21994         __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
21995       }
21996       __Pyx_XGIVEREF(__pyx_t_8);
21997       __Pyx_XGIVEREF(__pyx_t_9);
21998       __Pyx_XGIVEREF(__pyx_t_10);
21999       __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
22000       __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
22001       __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_7;
22002       goto __pyx_L1_error;
22003     }
22004     __pyx_L6_return: {
22005       __pyx_t_13 = __pyx_r;
22006       __pyx_r = 0;
22007       CSLDestroy(__pyx_v_file_list);
22008       __pyx_r = __pyx_t_13;
22009       __pyx_t_13 = 0;
22010       goto __pyx_L0;
22011     }
22012   }
22013 
22014   /* "rasterio/_base.pyx":1373
22015  *         """
22016  *
22017  *         def __get__(self):             # <<<<<<<<<<<<<<
22018  *             cdef GDALDatasetH h_dataset = NULL
22019  *             h_dataset = self.handle()
22020  */
22021 
22022   /* function exit code */
22023   __pyx_L1_error:;
22024   __Pyx_XDECREF(__pyx_t_2);
22025   __Pyx_XDECREF(__pyx_t_6);
22026   __Pyx_AddTraceback("rasterio._base.DatasetBase.files.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22027   __pyx_r = NULL;
22028   __pyx_L0:;
22029   __Pyx_XGIVEREF(__pyx_r);
22030   __Pyx_RefNannyFinishContext();
22031   return __pyx_r;
22032 }
22033 
22034 /* "rasterio/_base.pxd":9
22035  *
22036  *     cdef GDALDatasetH _hds
22037  *     cdef readonly object name             # <<<<<<<<<<<<<<
22038  *     cdef readonly object mode
22039  *     cdef readonly object options
22040  */
22041 
22042 /* Python wrapper */
22043 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_4name_1__get__(PyObject * __pyx_v_self)22044 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_4name_1__get__(PyObject *__pyx_v_self) {
22045   PyObject *__pyx_r = 0;
22046   __Pyx_RefNannyDeclarations
22047   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22048   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_4name___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22049 
22050   /* function exit code */
22051   __Pyx_RefNannyFinishContext();
22052   return __pyx_r;
22053 }
22054 
__pyx_pf_8rasterio_5_base_11DatasetBase_4name___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22055 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4name___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22056   PyObject *__pyx_r = NULL;
22057   __Pyx_RefNannyDeclarations
22058   __Pyx_RefNannySetupContext("__get__", 0);
22059   __Pyx_XDECREF(__pyx_r);
22060   __Pyx_INCREF(__pyx_v_self->name);
22061   __pyx_r = __pyx_v_self->name;
22062   goto __pyx_L0;
22063 
22064   /* function exit code */
22065   __pyx_L0:;
22066   __Pyx_XGIVEREF(__pyx_r);
22067   __Pyx_RefNannyFinishContext();
22068   return __pyx_r;
22069 }
22070 
22071 /* "rasterio/_base.pxd":10
22072  *     cdef GDALDatasetH _hds
22073  *     cdef readonly object name
22074  *     cdef readonly object mode             # <<<<<<<<<<<<<<
22075  *     cdef readonly object options
22076  *     cdef readonly object width
22077  */
22078 
22079 /* Python wrapper */
22080 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_4mode_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_4mode_1__get__(PyObject * __pyx_v_self)22081 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_4mode_1__get__(PyObject *__pyx_v_self) {
22082   PyObject *__pyx_r = 0;
22083   __Pyx_RefNannyDeclarations
22084   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22085   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_4mode___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22086 
22087   /* function exit code */
22088   __Pyx_RefNannyFinishContext();
22089   return __pyx_r;
22090 }
22091 
__pyx_pf_8rasterio_5_base_11DatasetBase_4mode___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22092 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4mode___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22093   PyObject *__pyx_r = NULL;
22094   __Pyx_RefNannyDeclarations
22095   __Pyx_RefNannySetupContext("__get__", 0);
22096   __Pyx_XDECREF(__pyx_r);
22097   __Pyx_INCREF(__pyx_v_self->mode);
22098   __pyx_r = __pyx_v_self->mode;
22099   goto __pyx_L0;
22100 
22101   /* function exit code */
22102   __pyx_L0:;
22103   __Pyx_XGIVEREF(__pyx_r);
22104   __Pyx_RefNannyFinishContext();
22105   return __pyx_r;
22106 }
22107 
22108 /* "rasterio/_base.pxd":11
22109  *     cdef readonly object name
22110  *     cdef readonly object mode
22111  *     cdef readonly object options             # <<<<<<<<<<<<<<
22112  *     cdef readonly object width
22113  *     cdef readonly object height
22114  */
22115 
22116 /* Python wrapper */
22117 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7options_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7options_1__get__(PyObject * __pyx_v_self)22118 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7options_1__get__(PyObject *__pyx_v_self) {
22119   PyObject *__pyx_r = 0;
22120   __Pyx_RefNannyDeclarations
22121   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22122   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_7options___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22123 
22124   /* function exit code */
22125   __Pyx_RefNannyFinishContext();
22126   return __pyx_r;
22127 }
22128 
__pyx_pf_8rasterio_5_base_11DatasetBase_7options___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22129 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_7options___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22130   PyObject *__pyx_r = NULL;
22131   __Pyx_RefNannyDeclarations
22132   __Pyx_RefNannySetupContext("__get__", 0);
22133   __Pyx_XDECREF(__pyx_r);
22134   __Pyx_INCREF(__pyx_v_self->options);
22135   __pyx_r = __pyx_v_self->options;
22136   goto __pyx_L0;
22137 
22138   /* function exit code */
22139   __pyx_L0:;
22140   __Pyx_XGIVEREF(__pyx_r);
22141   __Pyx_RefNannyFinishContext();
22142   return __pyx_r;
22143 }
22144 
22145 /* "rasterio/_base.pxd":12
22146  *     cdef readonly object mode
22147  *     cdef readonly object options
22148  *     cdef readonly object width             # <<<<<<<<<<<<<<
22149  *     cdef readonly object height
22150  *     cdef readonly object shape
22151  */
22152 
22153 /* Python wrapper */
22154 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5width_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5width_1__get__(PyObject * __pyx_v_self)22155 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5width_1__get__(PyObject *__pyx_v_self) {
22156   PyObject *__pyx_r = 0;
22157   __Pyx_RefNannyDeclarations
22158   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22159   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5width___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22160 
22161   /* function exit code */
22162   __Pyx_RefNannyFinishContext();
22163   return __pyx_r;
22164 }
22165 
__pyx_pf_8rasterio_5_base_11DatasetBase_5width___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22166 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5width___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22167   PyObject *__pyx_r = NULL;
22168   __Pyx_RefNannyDeclarations
22169   __Pyx_RefNannySetupContext("__get__", 0);
22170   __Pyx_XDECREF(__pyx_r);
22171   __Pyx_INCREF(__pyx_v_self->width);
22172   __pyx_r = __pyx_v_self->width;
22173   goto __pyx_L0;
22174 
22175   /* function exit code */
22176   __pyx_L0:;
22177   __Pyx_XGIVEREF(__pyx_r);
22178   __Pyx_RefNannyFinishContext();
22179   return __pyx_r;
22180 }
22181 
22182 /* "rasterio/_base.pxd":13
22183  *     cdef readonly object options
22184  *     cdef readonly object width
22185  *     cdef readonly object height             # <<<<<<<<<<<<<<
22186  *     cdef readonly object shape
22187  *     cdef public object driver
22188  */
22189 
22190 /* Python wrapper */
22191 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6height_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6height_1__get__(PyObject * __pyx_v_self)22192 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6height_1__get__(PyObject *__pyx_v_self) {
22193   PyObject *__pyx_r = 0;
22194   __Pyx_RefNannyDeclarations
22195   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22196   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6height___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22197 
22198   /* function exit code */
22199   __Pyx_RefNannyFinishContext();
22200   return __pyx_r;
22201 }
22202 
__pyx_pf_8rasterio_5_base_11DatasetBase_6height___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22203 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6height___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22204   PyObject *__pyx_r = NULL;
22205   __Pyx_RefNannyDeclarations
22206   __Pyx_RefNannySetupContext("__get__", 0);
22207   __Pyx_XDECREF(__pyx_r);
22208   __Pyx_INCREF(__pyx_v_self->height);
22209   __pyx_r = __pyx_v_self->height;
22210   goto __pyx_L0;
22211 
22212   /* function exit code */
22213   __pyx_L0:;
22214   __Pyx_XGIVEREF(__pyx_r);
22215   __Pyx_RefNannyFinishContext();
22216   return __pyx_r;
22217 }
22218 
22219 /* "rasterio/_base.pxd":14
22220  *     cdef readonly object width
22221  *     cdef readonly object height
22222  *     cdef readonly object shape             # <<<<<<<<<<<<<<
22223  *     cdef public object driver
22224  *     cdef public object _count
22225  */
22226 
22227 /* Python wrapper */
22228 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5shape_1__get__(PyObject * __pyx_v_self)22229 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5shape_1__get__(PyObject *__pyx_v_self) {
22230   PyObject *__pyx_r = 0;
22231   __Pyx_RefNannyDeclarations
22232   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22233   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5shape___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22234 
22235   /* function exit code */
22236   __Pyx_RefNannyFinishContext();
22237   return __pyx_r;
22238 }
22239 
__pyx_pf_8rasterio_5_base_11DatasetBase_5shape___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22240 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5shape___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22241   PyObject *__pyx_r = NULL;
22242   __Pyx_RefNannyDeclarations
22243   __Pyx_RefNannySetupContext("__get__", 0);
22244   __Pyx_XDECREF(__pyx_r);
22245   __Pyx_INCREF(__pyx_v_self->shape);
22246   __pyx_r = __pyx_v_self->shape;
22247   goto __pyx_L0;
22248 
22249   /* function exit code */
22250   __pyx_L0:;
22251   __Pyx_XGIVEREF(__pyx_r);
22252   __Pyx_RefNannyFinishContext();
22253   return __pyx_r;
22254 }
22255 
22256 /* "rasterio/_base.pxd":15
22257  *     cdef readonly object height
22258  *     cdef readonly object shape
22259  *     cdef public object driver             # <<<<<<<<<<<<<<
22260  *     cdef public object _count
22261  *     cdef public object _dtypes
22262  */
22263 
22264 /* Python wrapper */
22265 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6driver_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6driver_1__get__(PyObject * __pyx_v_self)22266 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6driver_1__get__(PyObject *__pyx_v_self) {
22267   PyObject *__pyx_r = 0;
22268   __Pyx_RefNannyDeclarations
22269   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22270   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6driver___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22271 
22272   /* function exit code */
22273   __Pyx_RefNannyFinishContext();
22274   return __pyx_r;
22275 }
22276 
__pyx_pf_8rasterio_5_base_11DatasetBase_6driver___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22277 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6driver___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22278   PyObject *__pyx_r = NULL;
22279   __Pyx_RefNannyDeclarations
22280   __Pyx_RefNannySetupContext("__get__", 0);
22281   __Pyx_XDECREF(__pyx_r);
22282   __Pyx_INCREF(__pyx_v_self->driver);
22283   __pyx_r = __pyx_v_self->driver;
22284   goto __pyx_L0;
22285 
22286   /* function exit code */
22287   __pyx_L0:;
22288   __Pyx_XGIVEREF(__pyx_r);
22289   __Pyx_RefNannyFinishContext();
22290   return __pyx_r;
22291 }
22292 
22293 /* Python wrapper */
22294 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6driver_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6driver_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)22295 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6driver_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
22296   int __pyx_r;
22297   __Pyx_RefNannyDeclarations
22298   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
22299   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6driver_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
22300 
22301   /* function exit code */
22302   __Pyx_RefNannyFinishContext();
22303   return __pyx_r;
22304 }
22305 
__pyx_pf_8rasterio_5_base_11DatasetBase_6driver_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)22306 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6driver_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
22307   int __pyx_r;
22308   __Pyx_RefNannyDeclarations
22309   __Pyx_RefNannySetupContext("__set__", 0);
22310   __Pyx_INCREF(__pyx_v_value);
22311   __Pyx_GIVEREF(__pyx_v_value);
22312   __Pyx_GOTREF(__pyx_v_self->driver);
22313   __Pyx_DECREF(__pyx_v_self->driver);
22314   __pyx_v_self->driver = __pyx_v_value;
22315 
22316   /* function exit code */
22317   __pyx_r = 0;
22318   __Pyx_RefNannyFinishContext();
22319   return __pyx_r;
22320 }
22321 
22322 /* Python wrapper */
22323 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6driver_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6driver_5__del__(PyObject * __pyx_v_self)22324 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6driver_5__del__(PyObject *__pyx_v_self) {
22325   int __pyx_r;
22326   __Pyx_RefNannyDeclarations
22327   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
22328   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6driver_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22329 
22330   /* function exit code */
22331   __Pyx_RefNannyFinishContext();
22332   return __pyx_r;
22333 }
22334 
__pyx_pf_8rasterio_5_base_11DatasetBase_6driver_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22335 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6driver_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22336   int __pyx_r;
22337   __Pyx_RefNannyDeclarations
22338   __Pyx_RefNannySetupContext("__del__", 0);
22339   __Pyx_INCREF(Py_None);
22340   __Pyx_GIVEREF(Py_None);
22341   __Pyx_GOTREF(__pyx_v_self->driver);
22342   __Pyx_DECREF(__pyx_v_self->driver);
22343   __pyx_v_self->driver = Py_None;
22344 
22345   /* function exit code */
22346   __pyx_r = 0;
22347   __Pyx_RefNannyFinishContext();
22348   return __pyx_r;
22349 }
22350 
22351 /* "rasterio/_base.pxd":16
22352  *     cdef readonly object shape
22353  *     cdef public object driver
22354  *     cdef public object _count             # <<<<<<<<<<<<<<
22355  *     cdef public object _dtypes
22356  *     cdef public object _closed
22357  */
22358 
22359 /* Python wrapper */
22360 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6_count_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6_count_1__get__(PyObject * __pyx_v_self)22361 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6_count_1__get__(PyObject *__pyx_v_self) {
22362   PyObject *__pyx_r = 0;
22363   __Pyx_RefNannyDeclarations
22364   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22365   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6_count___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22366 
22367   /* function exit code */
22368   __Pyx_RefNannyFinishContext();
22369   return __pyx_r;
22370 }
22371 
__pyx_pf_8rasterio_5_base_11DatasetBase_6_count___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22372 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6_count___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22373   PyObject *__pyx_r = NULL;
22374   __Pyx_RefNannyDeclarations
22375   __Pyx_RefNannySetupContext("__get__", 0);
22376   __Pyx_XDECREF(__pyx_r);
22377   __Pyx_INCREF(__pyx_v_self->_count);
22378   __pyx_r = __pyx_v_self->_count;
22379   goto __pyx_L0;
22380 
22381   /* function exit code */
22382   __pyx_L0:;
22383   __Pyx_XGIVEREF(__pyx_r);
22384   __Pyx_RefNannyFinishContext();
22385   return __pyx_r;
22386 }
22387 
22388 /* Python wrapper */
22389 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6_count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6_count_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)22390 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6_count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
22391   int __pyx_r;
22392   __Pyx_RefNannyDeclarations
22393   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
22394   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6_count_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
22395 
22396   /* function exit code */
22397   __Pyx_RefNannyFinishContext();
22398   return __pyx_r;
22399 }
22400 
__pyx_pf_8rasterio_5_base_11DatasetBase_6_count_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)22401 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6_count_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
22402   int __pyx_r;
22403   __Pyx_RefNannyDeclarations
22404   __Pyx_RefNannySetupContext("__set__", 0);
22405   __Pyx_INCREF(__pyx_v_value);
22406   __Pyx_GIVEREF(__pyx_v_value);
22407   __Pyx_GOTREF(__pyx_v_self->_count);
22408   __Pyx_DECREF(__pyx_v_self->_count);
22409   __pyx_v_self->_count = __pyx_v_value;
22410 
22411   /* function exit code */
22412   __pyx_r = 0;
22413   __Pyx_RefNannyFinishContext();
22414   return __pyx_r;
22415 }
22416 
22417 /* Python wrapper */
22418 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6_count_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6_count_5__del__(PyObject * __pyx_v_self)22419 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6_count_5__del__(PyObject *__pyx_v_self) {
22420   int __pyx_r;
22421   __Pyx_RefNannyDeclarations
22422   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
22423   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6_count_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22424 
22425   /* function exit code */
22426   __Pyx_RefNannyFinishContext();
22427   return __pyx_r;
22428 }
22429 
__pyx_pf_8rasterio_5_base_11DatasetBase_6_count_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22430 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6_count_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22431   int __pyx_r;
22432   __Pyx_RefNannyDeclarations
22433   __Pyx_RefNannySetupContext("__del__", 0);
22434   __Pyx_INCREF(Py_None);
22435   __Pyx_GIVEREF(Py_None);
22436   __Pyx_GOTREF(__pyx_v_self->_count);
22437   __Pyx_DECREF(__pyx_v_self->_count);
22438   __pyx_v_self->_count = Py_None;
22439 
22440   /* function exit code */
22441   __pyx_r = 0;
22442   __Pyx_RefNannyFinishContext();
22443   return __pyx_r;
22444 }
22445 
22446 /* "rasterio/_base.pxd":17
22447  *     cdef public object driver
22448  *     cdef public object _count
22449  *     cdef public object _dtypes             # <<<<<<<<<<<<<<
22450  *     cdef public object _closed
22451  *     cdef public object _crs
22452  */
22453 
22454 /* Python wrapper */
22455 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7_dtypes_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7_dtypes_1__get__(PyObject * __pyx_v_self)22456 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7_dtypes_1__get__(PyObject *__pyx_v_self) {
22457   PyObject *__pyx_r = 0;
22458   __Pyx_RefNannyDeclarations
22459   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22460   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_7_dtypes___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22461 
22462   /* function exit code */
22463   __Pyx_RefNannyFinishContext();
22464   return __pyx_r;
22465 }
22466 
__pyx_pf_8rasterio_5_base_11DatasetBase_7_dtypes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22467 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_7_dtypes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22468   PyObject *__pyx_r = NULL;
22469   __Pyx_RefNannyDeclarations
22470   __Pyx_RefNannySetupContext("__get__", 0);
22471   __Pyx_XDECREF(__pyx_r);
22472   __Pyx_INCREF(__pyx_v_self->_dtypes);
22473   __pyx_r = __pyx_v_self->_dtypes;
22474   goto __pyx_L0;
22475 
22476   /* function exit code */
22477   __pyx_L0:;
22478   __Pyx_XGIVEREF(__pyx_r);
22479   __Pyx_RefNannyFinishContext();
22480   return __pyx_r;
22481 }
22482 
22483 /* Python wrapper */
22484 static int __pyx_pw_8rasterio_5_base_11DatasetBase_7_dtypes_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7_dtypes_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)22485 static int __pyx_pw_8rasterio_5_base_11DatasetBase_7_dtypes_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
22486   int __pyx_r;
22487   __Pyx_RefNannyDeclarations
22488   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
22489   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_7_dtypes_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
22490 
22491   /* function exit code */
22492   __Pyx_RefNannyFinishContext();
22493   return __pyx_r;
22494 }
22495 
__pyx_pf_8rasterio_5_base_11DatasetBase_7_dtypes_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)22496 static int __pyx_pf_8rasterio_5_base_11DatasetBase_7_dtypes_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
22497   int __pyx_r;
22498   __Pyx_RefNannyDeclarations
22499   __Pyx_RefNannySetupContext("__set__", 0);
22500   __Pyx_INCREF(__pyx_v_value);
22501   __Pyx_GIVEREF(__pyx_v_value);
22502   __Pyx_GOTREF(__pyx_v_self->_dtypes);
22503   __Pyx_DECREF(__pyx_v_self->_dtypes);
22504   __pyx_v_self->_dtypes = __pyx_v_value;
22505 
22506   /* function exit code */
22507   __pyx_r = 0;
22508   __Pyx_RefNannyFinishContext();
22509   return __pyx_r;
22510 }
22511 
22512 /* Python wrapper */
22513 static int __pyx_pw_8rasterio_5_base_11DatasetBase_7_dtypes_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7_dtypes_5__del__(PyObject * __pyx_v_self)22514 static int __pyx_pw_8rasterio_5_base_11DatasetBase_7_dtypes_5__del__(PyObject *__pyx_v_self) {
22515   int __pyx_r;
22516   __Pyx_RefNannyDeclarations
22517   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
22518   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_7_dtypes_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22519 
22520   /* function exit code */
22521   __Pyx_RefNannyFinishContext();
22522   return __pyx_r;
22523 }
22524 
__pyx_pf_8rasterio_5_base_11DatasetBase_7_dtypes_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22525 static int __pyx_pf_8rasterio_5_base_11DatasetBase_7_dtypes_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22526   int __pyx_r;
22527   __Pyx_RefNannyDeclarations
22528   __Pyx_RefNannySetupContext("__del__", 0);
22529   __Pyx_INCREF(Py_None);
22530   __Pyx_GIVEREF(Py_None);
22531   __Pyx_GOTREF(__pyx_v_self->_dtypes);
22532   __Pyx_DECREF(__pyx_v_self->_dtypes);
22533   __pyx_v_self->_dtypes = Py_None;
22534 
22535   /* function exit code */
22536   __pyx_r = 0;
22537   __Pyx_RefNannyFinishContext();
22538   return __pyx_r;
22539 }
22540 
22541 /* "rasterio/_base.pxd":18
22542  *     cdef public object _count
22543  *     cdef public object _dtypes
22544  *     cdef public object _closed             # <<<<<<<<<<<<<<
22545  *     cdef public object _crs
22546  *     cdef public object _crs_wkt
22547  */
22548 
22549 /* Python wrapper */
22550 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7_closed_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7_closed_1__get__(PyObject * __pyx_v_self)22551 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7_closed_1__get__(PyObject *__pyx_v_self) {
22552   PyObject *__pyx_r = 0;
22553   __Pyx_RefNannyDeclarations
22554   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22555   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_7_closed___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22556 
22557   /* function exit code */
22558   __Pyx_RefNannyFinishContext();
22559   return __pyx_r;
22560 }
22561 
__pyx_pf_8rasterio_5_base_11DatasetBase_7_closed___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22562 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_7_closed___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22563   PyObject *__pyx_r = NULL;
22564   __Pyx_RefNannyDeclarations
22565   __Pyx_RefNannySetupContext("__get__", 0);
22566   __Pyx_XDECREF(__pyx_r);
22567   __Pyx_INCREF(__pyx_v_self->_closed);
22568   __pyx_r = __pyx_v_self->_closed;
22569   goto __pyx_L0;
22570 
22571   /* function exit code */
22572   __pyx_L0:;
22573   __Pyx_XGIVEREF(__pyx_r);
22574   __Pyx_RefNannyFinishContext();
22575   return __pyx_r;
22576 }
22577 
22578 /* Python wrapper */
22579 static int __pyx_pw_8rasterio_5_base_11DatasetBase_7_closed_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7_closed_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)22580 static int __pyx_pw_8rasterio_5_base_11DatasetBase_7_closed_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
22581   int __pyx_r;
22582   __Pyx_RefNannyDeclarations
22583   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
22584   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_7_closed_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
22585 
22586   /* function exit code */
22587   __Pyx_RefNannyFinishContext();
22588   return __pyx_r;
22589 }
22590 
__pyx_pf_8rasterio_5_base_11DatasetBase_7_closed_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)22591 static int __pyx_pf_8rasterio_5_base_11DatasetBase_7_closed_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
22592   int __pyx_r;
22593   __Pyx_RefNannyDeclarations
22594   __Pyx_RefNannySetupContext("__set__", 0);
22595   __Pyx_INCREF(__pyx_v_value);
22596   __Pyx_GIVEREF(__pyx_v_value);
22597   __Pyx_GOTREF(__pyx_v_self->_closed);
22598   __Pyx_DECREF(__pyx_v_self->_closed);
22599   __pyx_v_self->_closed = __pyx_v_value;
22600 
22601   /* function exit code */
22602   __pyx_r = 0;
22603   __Pyx_RefNannyFinishContext();
22604   return __pyx_r;
22605 }
22606 
22607 /* Python wrapper */
22608 static int __pyx_pw_8rasterio_5_base_11DatasetBase_7_closed_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7_closed_5__del__(PyObject * __pyx_v_self)22609 static int __pyx_pw_8rasterio_5_base_11DatasetBase_7_closed_5__del__(PyObject *__pyx_v_self) {
22610   int __pyx_r;
22611   __Pyx_RefNannyDeclarations
22612   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
22613   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_7_closed_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22614 
22615   /* function exit code */
22616   __Pyx_RefNannyFinishContext();
22617   return __pyx_r;
22618 }
22619 
__pyx_pf_8rasterio_5_base_11DatasetBase_7_closed_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22620 static int __pyx_pf_8rasterio_5_base_11DatasetBase_7_closed_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22621   int __pyx_r;
22622   __Pyx_RefNannyDeclarations
22623   __Pyx_RefNannySetupContext("__del__", 0);
22624   __Pyx_INCREF(Py_None);
22625   __Pyx_GIVEREF(Py_None);
22626   __Pyx_GOTREF(__pyx_v_self->_closed);
22627   __Pyx_DECREF(__pyx_v_self->_closed);
22628   __pyx_v_self->_closed = Py_None;
22629 
22630   /* function exit code */
22631   __pyx_r = 0;
22632   __Pyx_RefNannyFinishContext();
22633   return __pyx_r;
22634 }
22635 
22636 /* "rasterio/_base.pxd":19
22637  *     cdef public object _dtypes
22638  *     cdef public object _closed
22639  *     cdef public object _crs             # <<<<<<<<<<<<<<
22640  *     cdef public object _crs_wkt
22641  *     cdef public object _transform
22642  */
22643 
22644 /* Python wrapper */
22645 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_4_crs_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_4_crs_1__get__(PyObject * __pyx_v_self)22646 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_4_crs_1__get__(PyObject *__pyx_v_self) {
22647   PyObject *__pyx_r = 0;
22648   __Pyx_RefNannyDeclarations
22649   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22650   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_4_crs___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22651 
22652   /* function exit code */
22653   __Pyx_RefNannyFinishContext();
22654   return __pyx_r;
22655 }
22656 
__pyx_pf_8rasterio_5_base_11DatasetBase_4_crs___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22657 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4_crs___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22658   PyObject *__pyx_r = NULL;
22659   __Pyx_RefNannyDeclarations
22660   __Pyx_RefNannySetupContext("__get__", 0);
22661   __Pyx_XDECREF(__pyx_r);
22662   __Pyx_INCREF(__pyx_v_self->_crs);
22663   __pyx_r = __pyx_v_self->_crs;
22664   goto __pyx_L0;
22665 
22666   /* function exit code */
22667   __pyx_L0:;
22668   __Pyx_XGIVEREF(__pyx_r);
22669   __Pyx_RefNannyFinishContext();
22670   return __pyx_r;
22671 }
22672 
22673 /* Python wrapper */
22674 static int __pyx_pw_8rasterio_5_base_11DatasetBase_4_crs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_4_crs_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)22675 static int __pyx_pw_8rasterio_5_base_11DatasetBase_4_crs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
22676   int __pyx_r;
22677   __Pyx_RefNannyDeclarations
22678   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
22679   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_4_crs_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
22680 
22681   /* function exit code */
22682   __Pyx_RefNannyFinishContext();
22683   return __pyx_r;
22684 }
22685 
__pyx_pf_8rasterio_5_base_11DatasetBase_4_crs_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)22686 static int __pyx_pf_8rasterio_5_base_11DatasetBase_4_crs_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
22687   int __pyx_r;
22688   __Pyx_RefNannyDeclarations
22689   __Pyx_RefNannySetupContext("__set__", 0);
22690   __Pyx_INCREF(__pyx_v_value);
22691   __Pyx_GIVEREF(__pyx_v_value);
22692   __Pyx_GOTREF(__pyx_v_self->_crs);
22693   __Pyx_DECREF(__pyx_v_self->_crs);
22694   __pyx_v_self->_crs = __pyx_v_value;
22695 
22696   /* function exit code */
22697   __pyx_r = 0;
22698   __Pyx_RefNannyFinishContext();
22699   return __pyx_r;
22700 }
22701 
22702 /* Python wrapper */
22703 static int __pyx_pw_8rasterio_5_base_11DatasetBase_4_crs_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_4_crs_5__del__(PyObject * __pyx_v_self)22704 static int __pyx_pw_8rasterio_5_base_11DatasetBase_4_crs_5__del__(PyObject *__pyx_v_self) {
22705   int __pyx_r;
22706   __Pyx_RefNannyDeclarations
22707   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
22708   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_4_crs_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22709 
22710   /* function exit code */
22711   __Pyx_RefNannyFinishContext();
22712   return __pyx_r;
22713 }
22714 
__pyx_pf_8rasterio_5_base_11DatasetBase_4_crs_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22715 static int __pyx_pf_8rasterio_5_base_11DatasetBase_4_crs_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22716   int __pyx_r;
22717   __Pyx_RefNannyDeclarations
22718   __Pyx_RefNannySetupContext("__del__", 0);
22719   __Pyx_INCREF(Py_None);
22720   __Pyx_GIVEREF(Py_None);
22721   __Pyx_GOTREF(__pyx_v_self->_crs);
22722   __Pyx_DECREF(__pyx_v_self->_crs);
22723   __pyx_v_self->_crs = Py_None;
22724 
22725   /* function exit code */
22726   __pyx_r = 0;
22727   __Pyx_RefNannyFinishContext();
22728   return __pyx_r;
22729 }
22730 
22731 /* "rasterio/_base.pxd":20
22732  *     cdef public object _closed
22733  *     cdef public object _crs
22734  *     cdef public object _crs_wkt             # <<<<<<<<<<<<<<
22735  *     cdef public object _transform
22736  *     cdef public object _block_shapes
22737  */
22738 
22739 /* Python wrapper */
22740 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_8_crs_wkt_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_8_crs_wkt_1__get__(PyObject * __pyx_v_self)22741 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_8_crs_wkt_1__get__(PyObject *__pyx_v_self) {
22742   PyObject *__pyx_r = 0;
22743   __Pyx_RefNannyDeclarations
22744   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22745   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_8_crs_wkt___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22746 
22747   /* function exit code */
22748   __Pyx_RefNannyFinishContext();
22749   return __pyx_r;
22750 }
22751 
__pyx_pf_8rasterio_5_base_11DatasetBase_8_crs_wkt___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22752 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_8_crs_wkt___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22753   PyObject *__pyx_r = NULL;
22754   __Pyx_RefNannyDeclarations
22755   __Pyx_RefNannySetupContext("__get__", 0);
22756   __Pyx_XDECREF(__pyx_r);
22757   __Pyx_INCREF(__pyx_v_self->_crs_wkt);
22758   __pyx_r = __pyx_v_self->_crs_wkt;
22759   goto __pyx_L0;
22760 
22761   /* function exit code */
22762   __pyx_L0:;
22763   __Pyx_XGIVEREF(__pyx_r);
22764   __Pyx_RefNannyFinishContext();
22765   return __pyx_r;
22766 }
22767 
22768 /* Python wrapper */
22769 static int __pyx_pw_8rasterio_5_base_11DatasetBase_8_crs_wkt_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_8_crs_wkt_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)22770 static int __pyx_pw_8rasterio_5_base_11DatasetBase_8_crs_wkt_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
22771   int __pyx_r;
22772   __Pyx_RefNannyDeclarations
22773   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
22774   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_8_crs_wkt_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
22775 
22776   /* function exit code */
22777   __Pyx_RefNannyFinishContext();
22778   return __pyx_r;
22779 }
22780 
__pyx_pf_8rasterio_5_base_11DatasetBase_8_crs_wkt_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)22781 static int __pyx_pf_8rasterio_5_base_11DatasetBase_8_crs_wkt_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
22782   int __pyx_r;
22783   __Pyx_RefNannyDeclarations
22784   __Pyx_RefNannySetupContext("__set__", 0);
22785   __Pyx_INCREF(__pyx_v_value);
22786   __Pyx_GIVEREF(__pyx_v_value);
22787   __Pyx_GOTREF(__pyx_v_self->_crs_wkt);
22788   __Pyx_DECREF(__pyx_v_self->_crs_wkt);
22789   __pyx_v_self->_crs_wkt = __pyx_v_value;
22790 
22791   /* function exit code */
22792   __pyx_r = 0;
22793   __Pyx_RefNannyFinishContext();
22794   return __pyx_r;
22795 }
22796 
22797 /* Python wrapper */
22798 static int __pyx_pw_8rasterio_5_base_11DatasetBase_8_crs_wkt_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_8_crs_wkt_5__del__(PyObject * __pyx_v_self)22799 static int __pyx_pw_8rasterio_5_base_11DatasetBase_8_crs_wkt_5__del__(PyObject *__pyx_v_self) {
22800   int __pyx_r;
22801   __Pyx_RefNannyDeclarations
22802   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
22803   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_8_crs_wkt_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22804 
22805   /* function exit code */
22806   __Pyx_RefNannyFinishContext();
22807   return __pyx_r;
22808 }
22809 
__pyx_pf_8rasterio_5_base_11DatasetBase_8_crs_wkt_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22810 static int __pyx_pf_8rasterio_5_base_11DatasetBase_8_crs_wkt_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22811   int __pyx_r;
22812   __Pyx_RefNannyDeclarations
22813   __Pyx_RefNannySetupContext("__del__", 0);
22814   __Pyx_INCREF(Py_None);
22815   __Pyx_GIVEREF(Py_None);
22816   __Pyx_GOTREF(__pyx_v_self->_crs_wkt);
22817   __Pyx_DECREF(__pyx_v_self->_crs_wkt);
22818   __pyx_v_self->_crs_wkt = Py_None;
22819 
22820   /* function exit code */
22821   __pyx_r = 0;
22822   __Pyx_RefNannyFinishContext();
22823   return __pyx_r;
22824 }
22825 
22826 /* "rasterio/_base.pxd":21
22827  *     cdef public object _crs
22828  *     cdef public object _crs_wkt
22829  *     cdef public object _transform             # <<<<<<<<<<<<<<
22830  *     cdef public object _block_shapes
22831  *     cdef public object _nodatavals
22832  */
22833 
22834 /* Python wrapper */
22835 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_10_transform_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_10_transform_1__get__(PyObject * __pyx_v_self)22836 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_10_transform_1__get__(PyObject *__pyx_v_self) {
22837   PyObject *__pyx_r = 0;
22838   __Pyx_RefNannyDeclarations
22839   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22840   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_10_transform___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22841 
22842   /* function exit code */
22843   __Pyx_RefNannyFinishContext();
22844   return __pyx_r;
22845 }
22846 
__pyx_pf_8rasterio_5_base_11DatasetBase_10_transform___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22847 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_10_transform___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22848   PyObject *__pyx_r = NULL;
22849   __Pyx_RefNannyDeclarations
22850   __Pyx_RefNannySetupContext("__get__", 0);
22851   __Pyx_XDECREF(__pyx_r);
22852   __Pyx_INCREF(__pyx_v_self->_transform);
22853   __pyx_r = __pyx_v_self->_transform;
22854   goto __pyx_L0;
22855 
22856   /* function exit code */
22857   __pyx_L0:;
22858   __Pyx_XGIVEREF(__pyx_r);
22859   __Pyx_RefNannyFinishContext();
22860   return __pyx_r;
22861 }
22862 
22863 /* Python wrapper */
22864 static int __pyx_pw_8rasterio_5_base_11DatasetBase_10_transform_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_10_transform_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)22865 static int __pyx_pw_8rasterio_5_base_11DatasetBase_10_transform_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
22866   int __pyx_r;
22867   __Pyx_RefNannyDeclarations
22868   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
22869   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_10_transform_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
22870 
22871   /* function exit code */
22872   __Pyx_RefNannyFinishContext();
22873   return __pyx_r;
22874 }
22875 
__pyx_pf_8rasterio_5_base_11DatasetBase_10_transform_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)22876 static int __pyx_pf_8rasterio_5_base_11DatasetBase_10_transform_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
22877   int __pyx_r;
22878   __Pyx_RefNannyDeclarations
22879   __Pyx_RefNannySetupContext("__set__", 0);
22880   __Pyx_INCREF(__pyx_v_value);
22881   __Pyx_GIVEREF(__pyx_v_value);
22882   __Pyx_GOTREF(__pyx_v_self->_transform);
22883   __Pyx_DECREF(__pyx_v_self->_transform);
22884   __pyx_v_self->_transform = __pyx_v_value;
22885 
22886   /* function exit code */
22887   __pyx_r = 0;
22888   __Pyx_RefNannyFinishContext();
22889   return __pyx_r;
22890 }
22891 
22892 /* Python wrapper */
22893 static int __pyx_pw_8rasterio_5_base_11DatasetBase_10_transform_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_10_transform_5__del__(PyObject * __pyx_v_self)22894 static int __pyx_pw_8rasterio_5_base_11DatasetBase_10_transform_5__del__(PyObject *__pyx_v_self) {
22895   int __pyx_r;
22896   __Pyx_RefNannyDeclarations
22897   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
22898   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_10_transform_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22899 
22900   /* function exit code */
22901   __Pyx_RefNannyFinishContext();
22902   return __pyx_r;
22903 }
22904 
__pyx_pf_8rasterio_5_base_11DatasetBase_10_transform_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22905 static int __pyx_pf_8rasterio_5_base_11DatasetBase_10_transform_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22906   int __pyx_r;
22907   __Pyx_RefNannyDeclarations
22908   __Pyx_RefNannySetupContext("__del__", 0);
22909   __Pyx_INCREF(Py_None);
22910   __Pyx_GIVEREF(Py_None);
22911   __Pyx_GOTREF(__pyx_v_self->_transform);
22912   __Pyx_DECREF(__pyx_v_self->_transform);
22913   __pyx_v_self->_transform = Py_None;
22914 
22915   /* function exit code */
22916   __pyx_r = 0;
22917   __Pyx_RefNannyFinishContext();
22918   return __pyx_r;
22919 }
22920 
22921 /* "rasterio/_base.pxd":22
22922  *     cdef public object _crs_wkt
22923  *     cdef public object _transform
22924  *     cdef public object _block_shapes             # <<<<<<<<<<<<<<
22925  *     cdef public object _nodatavals
22926  *     cdef public object _units
22927  */
22928 
22929 /* Python wrapper */
22930 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_13_block_shapes_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_13_block_shapes_1__get__(PyObject * __pyx_v_self)22931 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_13_block_shapes_1__get__(PyObject *__pyx_v_self) {
22932   PyObject *__pyx_r = 0;
22933   __Pyx_RefNannyDeclarations
22934   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22935   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_13_block_shapes___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22936 
22937   /* function exit code */
22938   __Pyx_RefNannyFinishContext();
22939   return __pyx_r;
22940 }
22941 
__pyx_pf_8rasterio_5_base_11DatasetBase_13_block_shapes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)22942 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_13_block_shapes___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
22943   PyObject *__pyx_r = NULL;
22944   __Pyx_RefNannyDeclarations
22945   __Pyx_RefNannySetupContext("__get__", 0);
22946   __Pyx_XDECREF(__pyx_r);
22947   __Pyx_INCREF(__pyx_v_self->_block_shapes);
22948   __pyx_r = __pyx_v_self->_block_shapes;
22949   goto __pyx_L0;
22950 
22951   /* function exit code */
22952   __pyx_L0:;
22953   __Pyx_XGIVEREF(__pyx_r);
22954   __Pyx_RefNannyFinishContext();
22955   return __pyx_r;
22956 }
22957 
22958 /* Python wrapper */
22959 static int __pyx_pw_8rasterio_5_base_11DatasetBase_13_block_shapes_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_13_block_shapes_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)22960 static int __pyx_pw_8rasterio_5_base_11DatasetBase_13_block_shapes_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
22961   int __pyx_r;
22962   __Pyx_RefNannyDeclarations
22963   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
22964   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_13_block_shapes_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
22965 
22966   /* function exit code */
22967   __Pyx_RefNannyFinishContext();
22968   return __pyx_r;
22969 }
22970 
__pyx_pf_8rasterio_5_base_11DatasetBase_13_block_shapes_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)22971 static int __pyx_pf_8rasterio_5_base_11DatasetBase_13_block_shapes_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
22972   int __pyx_r;
22973   __Pyx_RefNannyDeclarations
22974   __Pyx_RefNannySetupContext("__set__", 0);
22975   __Pyx_INCREF(__pyx_v_value);
22976   __Pyx_GIVEREF(__pyx_v_value);
22977   __Pyx_GOTREF(__pyx_v_self->_block_shapes);
22978   __Pyx_DECREF(__pyx_v_self->_block_shapes);
22979   __pyx_v_self->_block_shapes = __pyx_v_value;
22980 
22981   /* function exit code */
22982   __pyx_r = 0;
22983   __Pyx_RefNannyFinishContext();
22984   return __pyx_r;
22985 }
22986 
22987 /* Python wrapper */
22988 static int __pyx_pw_8rasterio_5_base_11DatasetBase_13_block_shapes_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_13_block_shapes_5__del__(PyObject * __pyx_v_self)22989 static int __pyx_pw_8rasterio_5_base_11DatasetBase_13_block_shapes_5__del__(PyObject *__pyx_v_self) {
22990   int __pyx_r;
22991   __Pyx_RefNannyDeclarations
22992   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
22993   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_13_block_shapes_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
22994 
22995   /* function exit code */
22996   __Pyx_RefNannyFinishContext();
22997   return __pyx_r;
22998 }
22999 
__pyx_pf_8rasterio_5_base_11DatasetBase_13_block_shapes_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23000 static int __pyx_pf_8rasterio_5_base_11DatasetBase_13_block_shapes_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23001   int __pyx_r;
23002   __Pyx_RefNannyDeclarations
23003   __Pyx_RefNannySetupContext("__del__", 0);
23004   __Pyx_INCREF(Py_None);
23005   __Pyx_GIVEREF(Py_None);
23006   __Pyx_GOTREF(__pyx_v_self->_block_shapes);
23007   __Pyx_DECREF(__pyx_v_self->_block_shapes);
23008   __pyx_v_self->_block_shapes = Py_None;
23009 
23010   /* function exit code */
23011   __pyx_r = 0;
23012   __Pyx_RefNannyFinishContext();
23013   return __pyx_r;
23014 }
23015 
23016 /* "rasterio/_base.pxd":23
23017  *     cdef public object _transform
23018  *     cdef public object _block_shapes
23019  *     cdef public object _nodatavals             # <<<<<<<<<<<<<<
23020  *     cdef public object _units
23021  *     cdef public object _descriptions
23022  */
23023 
23024 /* Python wrapper */
23025 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_11_nodatavals_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_11_nodatavals_1__get__(PyObject * __pyx_v_self)23026 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_11_nodatavals_1__get__(PyObject *__pyx_v_self) {
23027   PyObject *__pyx_r = 0;
23028   __Pyx_RefNannyDeclarations
23029   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23030   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_11_nodatavals___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23031 
23032   /* function exit code */
23033   __Pyx_RefNannyFinishContext();
23034   return __pyx_r;
23035 }
23036 
__pyx_pf_8rasterio_5_base_11DatasetBase_11_nodatavals___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23037 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_11_nodatavals___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23038   PyObject *__pyx_r = NULL;
23039   __Pyx_RefNannyDeclarations
23040   __Pyx_RefNannySetupContext("__get__", 0);
23041   __Pyx_XDECREF(__pyx_r);
23042   __Pyx_INCREF(__pyx_v_self->_nodatavals);
23043   __pyx_r = __pyx_v_self->_nodatavals;
23044   goto __pyx_L0;
23045 
23046   /* function exit code */
23047   __pyx_L0:;
23048   __Pyx_XGIVEREF(__pyx_r);
23049   __Pyx_RefNannyFinishContext();
23050   return __pyx_r;
23051 }
23052 
23053 /* Python wrapper */
23054 static int __pyx_pw_8rasterio_5_base_11DatasetBase_11_nodatavals_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_11_nodatavals_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)23055 static int __pyx_pw_8rasterio_5_base_11DatasetBase_11_nodatavals_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
23056   int __pyx_r;
23057   __Pyx_RefNannyDeclarations
23058   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
23059   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_11_nodatavals_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
23060 
23061   /* function exit code */
23062   __Pyx_RefNannyFinishContext();
23063   return __pyx_r;
23064 }
23065 
__pyx_pf_8rasterio_5_base_11DatasetBase_11_nodatavals_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)23066 static int __pyx_pf_8rasterio_5_base_11DatasetBase_11_nodatavals_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
23067   int __pyx_r;
23068   __Pyx_RefNannyDeclarations
23069   __Pyx_RefNannySetupContext("__set__", 0);
23070   __Pyx_INCREF(__pyx_v_value);
23071   __Pyx_GIVEREF(__pyx_v_value);
23072   __Pyx_GOTREF(__pyx_v_self->_nodatavals);
23073   __Pyx_DECREF(__pyx_v_self->_nodatavals);
23074   __pyx_v_self->_nodatavals = __pyx_v_value;
23075 
23076   /* function exit code */
23077   __pyx_r = 0;
23078   __Pyx_RefNannyFinishContext();
23079   return __pyx_r;
23080 }
23081 
23082 /* Python wrapper */
23083 static int __pyx_pw_8rasterio_5_base_11DatasetBase_11_nodatavals_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_11_nodatavals_5__del__(PyObject * __pyx_v_self)23084 static int __pyx_pw_8rasterio_5_base_11DatasetBase_11_nodatavals_5__del__(PyObject *__pyx_v_self) {
23085   int __pyx_r;
23086   __Pyx_RefNannyDeclarations
23087   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
23088   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_11_nodatavals_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23089 
23090   /* function exit code */
23091   __Pyx_RefNannyFinishContext();
23092   return __pyx_r;
23093 }
23094 
__pyx_pf_8rasterio_5_base_11DatasetBase_11_nodatavals_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23095 static int __pyx_pf_8rasterio_5_base_11DatasetBase_11_nodatavals_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23096   int __pyx_r;
23097   __Pyx_RefNannyDeclarations
23098   __Pyx_RefNannySetupContext("__del__", 0);
23099   __Pyx_INCREF(Py_None);
23100   __Pyx_GIVEREF(Py_None);
23101   __Pyx_GOTREF(__pyx_v_self->_nodatavals);
23102   __Pyx_DECREF(__pyx_v_self->_nodatavals);
23103   __pyx_v_self->_nodatavals = Py_None;
23104 
23105   /* function exit code */
23106   __pyx_r = 0;
23107   __Pyx_RefNannyFinishContext();
23108   return __pyx_r;
23109 }
23110 
23111 /* "rasterio/_base.pxd":24
23112  *     cdef public object _block_shapes
23113  *     cdef public object _nodatavals
23114  *     cdef public object _units             # <<<<<<<<<<<<<<
23115  *     cdef public object _descriptions
23116  *     cdef public object _scales
23117  */
23118 
23119 /* Python wrapper */
23120 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6_units_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6_units_1__get__(PyObject * __pyx_v_self)23121 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_6_units_1__get__(PyObject *__pyx_v_self) {
23122   PyObject *__pyx_r = 0;
23123   __Pyx_RefNannyDeclarations
23124   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23125   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6_units___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23126 
23127   /* function exit code */
23128   __Pyx_RefNannyFinishContext();
23129   return __pyx_r;
23130 }
23131 
__pyx_pf_8rasterio_5_base_11DatasetBase_6_units___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23132 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_6_units___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23133   PyObject *__pyx_r = NULL;
23134   __Pyx_RefNannyDeclarations
23135   __Pyx_RefNannySetupContext("__get__", 0);
23136   __Pyx_XDECREF(__pyx_r);
23137   __Pyx_INCREF(__pyx_v_self->_units);
23138   __pyx_r = __pyx_v_self->_units;
23139   goto __pyx_L0;
23140 
23141   /* function exit code */
23142   __pyx_L0:;
23143   __Pyx_XGIVEREF(__pyx_r);
23144   __Pyx_RefNannyFinishContext();
23145   return __pyx_r;
23146 }
23147 
23148 /* Python wrapper */
23149 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6_units_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6_units_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)23150 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6_units_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
23151   int __pyx_r;
23152   __Pyx_RefNannyDeclarations
23153   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
23154   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6_units_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
23155 
23156   /* function exit code */
23157   __Pyx_RefNannyFinishContext();
23158   return __pyx_r;
23159 }
23160 
__pyx_pf_8rasterio_5_base_11DatasetBase_6_units_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)23161 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6_units_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
23162   int __pyx_r;
23163   __Pyx_RefNannyDeclarations
23164   __Pyx_RefNannySetupContext("__set__", 0);
23165   __Pyx_INCREF(__pyx_v_value);
23166   __Pyx_GIVEREF(__pyx_v_value);
23167   __Pyx_GOTREF(__pyx_v_self->_units);
23168   __Pyx_DECREF(__pyx_v_self->_units);
23169   __pyx_v_self->_units = __pyx_v_value;
23170 
23171   /* function exit code */
23172   __pyx_r = 0;
23173   __Pyx_RefNannyFinishContext();
23174   return __pyx_r;
23175 }
23176 
23177 /* Python wrapper */
23178 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6_units_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_6_units_5__del__(PyObject * __pyx_v_self)23179 static int __pyx_pw_8rasterio_5_base_11DatasetBase_6_units_5__del__(PyObject *__pyx_v_self) {
23180   int __pyx_r;
23181   __Pyx_RefNannyDeclarations
23182   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
23183   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_6_units_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23184 
23185   /* function exit code */
23186   __Pyx_RefNannyFinishContext();
23187   return __pyx_r;
23188 }
23189 
__pyx_pf_8rasterio_5_base_11DatasetBase_6_units_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23190 static int __pyx_pf_8rasterio_5_base_11DatasetBase_6_units_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23191   int __pyx_r;
23192   __Pyx_RefNannyDeclarations
23193   __Pyx_RefNannySetupContext("__del__", 0);
23194   __Pyx_INCREF(Py_None);
23195   __Pyx_GIVEREF(Py_None);
23196   __Pyx_GOTREF(__pyx_v_self->_units);
23197   __Pyx_DECREF(__pyx_v_self->_units);
23198   __pyx_v_self->_units = Py_None;
23199 
23200   /* function exit code */
23201   __pyx_r = 0;
23202   __Pyx_RefNannyFinishContext();
23203   return __pyx_r;
23204 }
23205 
23206 /* "rasterio/_base.pxd":25
23207  *     cdef public object _nodatavals
23208  *     cdef public object _units
23209  *     cdef public object _descriptions             # <<<<<<<<<<<<<<
23210  *     cdef public object _scales
23211  *     cdef public object _offsets
23212  */
23213 
23214 /* Python wrapper */
23215 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_13_descriptions_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_13_descriptions_1__get__(PyObject * __pyx_v_self)23216 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_13_descriptions_1__get__(PyObject *__pyx_v_self) {
23217   PyObject *__pyx_r = 0;
23218   __Pyx_RefNannyDeclarations
23219   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23220   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_13_descriptions___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23221 
23222   /* function exit code */
23223   __Pyx_RefNannyFinishContext();
23224   return __pyx_r;
23225 }
23226 
__pyx_pf_8rasterio_5_base_11DatasetBase_13_descriptions___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23227 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_13_descriptions___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23228   PyObject *__pyx_r = NULL;
23229   __Pyx_RefNannyDeclarations
23230   __Pyx_RefNannySetupContext("__get__", 0);
23231   __Pyx_XDECREF(__pyx_r);
23232   __Pyx_INCREF(__pyx_v_self->_descriptions);
23233   __pyx_r = __pyx_v_self->_descriptions;
23234   goto __pyx_L0;
23235 
23236   /* function exit code */
23237   __pyx_L0:;
23238   __Pyx_XGIVEREF(__pyx_r);
23239   __Pyx_RefNannyFinishContext();
23240   return __pyx_r;
23241 }
23242 
23243 /* Python wrapper */
23244 static int __pyx_pw_8rasterio_5_base_11DatasetBase_13_descriptions_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_13_descriptions_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)23245 static int __pyx_pw_8rasterio_5_base_11DatasetBase_13_descriptions_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
23246   int __pyx_r;
23247   __Pyx_RefNannyDeclarations
23248   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
23249   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_13_descriptions_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
23250 
23251   /* function exit code */
23252   __Pyx_RefNannyFinishContext();
23253   return __pyx_r;
23254 }
23255 
__pyx_pf_8rasterio_5_base_11DatasetBase_13_descriptions_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)23256 static int __pyx_pf_8rasterio_5_base_11DatasetBase_13_descriptions_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
23257   int __pyx_r;
23258   __Pyx_RefNannyDeclarations
23259   __Pyx_RefNannySetupContext("__set__", 0);
23260   __Pyx_INCREF(__pyx_v_value);
23261   __Pyx_GIVEREF(__pyx_v_value);
23262   __Pyx_GOTREF(__pyx_v_self->_descriptions);
23263   __Pyx_DECREF(__pyx_v_self->_descriptions);
23264   __pyx_v_self->_descriptions = __pyx_v_value;
23265 
23266   /* function exit code */
23267   __pyx_r = 0;
23268   __Pyx_RefNannyFinishContext();
23269   return __pyx_r;
23270 }
23271 
23272 /* Python wrapper */
23273 static int __pyx_pw_8rasterio_5_base_11DatasetBase_13_descriptions_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_13_descriptions_5__del__(PyObject * __pyx_v_self)23274 static int __pyx_pw_8rasterio_5_base_11DatasetBase_13_descriptions_5__del__(PyObject *__pyx_v_self) {
23275   int __pyx_r;
23276   __Pyx_RefNannyDeclarations
23277   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
23278   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_13_descriptions_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23279 
23280   /* function exit code */
23281   __Pyx_RefNannyFinishContext();
23282   return __pyx_r;
23283 }
23284 
__pyx_pf_8rasterio_5_base_11DatasetBase_13_descriptions_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23285 static int __pyx_pf_8rasterio_5_base_11DatasetBase_13_descriptions_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23286   int __pyx_r;
23287   __Pyx_RefNannyDeclarations
23288   __Pyx_RefNannySetupContext("__del__", 0);
23289   __Pyx_INCREF(Py_None);
23290   __Pyx_GIVEREF(Py_None);
23291   __Pyx_GOTREF(__pyx_v_self->_descriptions);
23292   __Pyx_DECREF(__pyx_v_self->_descriptions);
23293   __pyx_v_self->_descriptions = Py_None;
23294 
23295   /* function exit code */
23296   __pyx_r = 0;
23297   __Pyx_RefNannyFinishContext();
23298   return __pyx_r;
23299 }
23300 
23301 /* "rasterio/_base.pxd":26
23302  *     cdef public object _units
23303  *     cdef public object _descriptions
23304  *     cdef public object _scales             # <<<<<<<<<<<<<<
23305  *     cdef public object _offsets
23306  *     cdef public object _read
23307  */
23308 
23309 /* Python wrapper */
23310 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7_scales_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7_scales_1__get__(PyObject * __pyx_v_self)23311 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_7_scales_1__get__(PyObject *__pyx_v_self) {
23312   PyObject *__pyx_r = 0;
23313   __Pyx_RefNannyDeclarations
23314   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23315   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_7_scales___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23316 
23317   /* function exit code */
23318   __Pyx_RefNannyFinishContext();
23319   return __pyx_r;
23320 }
23321 
__pyx_pf_8rasterio_5_base_11DatasetBase_7_scales___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23322 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_7_scales___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23323   PyObject *__pyx_r = NULL;
23324   __Pyx_RefNannyDeclarations
23325   __Pyx_RefNannySetupContext("__get__", 0);
23326   __Pyx_XDECREF(__pyx_r);
23327   __Pyx_INCREF(__pyx_v_self->_scales);
23328   __pyx_r = __pyx_v_self->_scales;
23329   goto __pyx_L0;
23330 
23331   /* function exit code */
23332   __pyx_L0:;
23333   __Pyx_XGIVEREF(__pyx_r);
23334   __Pyx_RefNannyFinishContext();
23335   return __pyx_r;
23336 }
23337 
23338 /* Python wrapper */
23339 static int __pyx_pw_8rasterio_5_base_11DatasetBase_7_scales_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7_scales_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)23340 static int __pyx_pw_8rasterio_5_base_11DatasetBase_7_scales_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
23341   int __pyx_r;
23342   __Pyx_RefNannyDeclarations
23343   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
23344   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_7_scales_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
23345 
23346   /* function exit code */
23347   __Pyx_RefNannyFinishContext();
23348   return __pyx_r;
23349 }
23350 
__pyx_pf_8rasterio_5_base_11DatasetBase_7_scales_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)23351 static int __pyx_pf_8rasterio_5_base_11DatasetBase_7_scales_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
23352   int __pyx_r;
23353   __Pyx_RefNannyDeclarations
23354   __Pyx_RefNannySetupContext("__set__", 0);
23355   __Pyx_INCREF(__pyx_v_value);
23356   __Pyx_GIVEREF(__pyx_v_value);
23357   __Pyx_GOTREF(__pyx_v_self->_scales);
23358   __Pyx_DECREF(__pyx_v_self->_scales);
23359   __pyx_v_self->_scales = __pyx_v_value;
23360 
23361   /* function exit code */
23362   __pyx_r = 0;
23363   __Pyx_RefNannyFinishContext();
23364   return __pyx_r;
23365 }
23366 
23367 /* Python wrapper */
23368 static int __pyx_pw_8rasterio_5_base_11DatasetBase_7_scales_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_7_scales_5__del__(PyObject * __pyx_v_self)23369 static int __pyx_pw_8rasterio_5_base_11DatasetBase_7_scales_5__del__(PyObject *__pyx_v_self) {
23370   int __pyx_r;
23371   __Pyx_RefNannyDeclarations
23372   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
23373   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_7_scales_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23374 
23375   /* function exit code */
23376   __Pyx_RefNannyFinishContext();
23377   return __pyx_r;
23378 }
23379 
__pyx_pf_8rasterio_5_base_11DatasetBase_7_scales_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23380 static int __pyx_pf_8rasterio_5_base_11DatasetBase_7_scales_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23381   int __pyx_r;
23382   __Pyx_RefNannyDeclarations
23383   __Pyx_RefNannySetupContext("__del__", 0);
23384   __Pyx_INCREF(Py_None);
23385   __Pyx_GIVEREF(Py_None);
23386   __Pyx_GOTREF(__pyx_v_self->_scales);
23387   __Pyx_DECREF(__pyx_v_self->_scales);
23388   __pyx_v_self->_scales = Py_None;
23389 
23390   /* function exit code */
23391   __pyx_r = 0;
23392   __Pyx_RefNannyFinishContext();
23393   return __pyx_r;
23394 }
23395 
23396 /* "rasterio/_base.pxd":27
23397  *     cdef public object _descriptions
23398  *     cdef public object _scales
23399  *     cdef public object _offsets             # <<<<<<<<<<<<<<
23400  *     cdef public object _read
23401  *     cdef public object _gcps
23402  */
23403 
23404 /* Python wrapper */
23405 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_8_offsets_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_8_offsets_1__get__(PyObject * __pyx_v_self)23406 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_8_offsets_1__get__(PyObject *__pyx_v_self) {
23407   PyObject *__pyx_r = 0;
23408   __Pyx_RefNannyDeclarations
23409   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23410   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_8_offsets___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23411 
23412   /* function exit code */
23413   __Pyx_RefNannyFinishContext();
23414   return __pyx_r;
23415 }
23416 
__pyx_pf_8rasterio_5_base_11DatasetBase_8_offsets___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23417 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_8_offsets___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23418   PyObject *__pyx_r = NULL;
23419   __Pyx_RefNannyDeclarations
23420   __Pyx_RefNannySetupContext("__get__", 0);
23421   __Pyx_XDECREF(__pyx_r);
23422   __Pyx_INCREF(__pyx_v_self->_offsets);
23423   __pyx_r = __pyx_v_self->_offsets;
23424   goto __pyx_L0;
23425 
23426   /* function exit code */
23427   __pyx_L0:;
23428   __Pyx_XGIVEREF(__pyx_r);
23429   __Pyx_RefNannyFinishContext();
23430   return __pyx_r;
23431 }
23432 
23433 /* Python wrapper */
23434 static int __pyx_pw_8rasterio_5_base_11DatasetBase_8_offsets_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_8_offsets_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)23435 static int __pyx_pw_8rasterio_5_base_11DatasetBase_8_offsets_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
23436   int __pyx_r;
23437   __Pyx_RefNannyDeclarations
23438   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
23439   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_8_offsets_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
23440 
23441   /* function exit code */
23442   __Pyx_RefNannyFinishContext();
23443   return __pyx_r;
23444 }
23445 
__pyx_pf_8rasterio_5_base_11DatasetBase_8_offsets_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)23446 static int __pyx_pf_8rasterio_5_base_11DatasetBase_8_offsets_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
23447   int __pyx_r;
23448   __Pyx_RefNannyDeclarations
23449   __Pyx_RefNannySetupContext("__set__", 0);
23450   __Pyx_INCREF(__pyx_v_value);
23451   __Pyx_GIVEREF(__pyx_v_value);
23452   __Pyx_GOTREF(__pyx_v_self->_offsets);
23453   __Pyx_DECREF(__pyx_v_self->_offsets);
23454   __pyx_v_self->_offsets = __pyx_v_value;
23455 
23456   /* function exit code */
23457   __pyx_r = 0;
23458   __Pyx_RefNannyFinishContext();
23459   return __pyx_r;
23460 }
23461 
23462 /* Python wrapper */
23463 static int __pyx_pw_8rasterio_5_base_11DatasetBase_8_offsets_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_8_offsets_5__del__(PyObject * __pyx_v_self)23464 static int __pyx_pw_8rasterio_5_base_11DatasetBase_8_offsets_5__del__(PyObject *__pyx_v_self) {
23465   int __pyx_r;
23466   __Pyx_RefNannyDeclarations
23467   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
23468   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_8_offsets_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23469 
23470   /* function exit code */
23471   __Pyx_RefNannyFinishContext();
23472   return __pyx_r;
23473 }
23474 
__pyx_pf_8rasterio_5_base_11DatasetBase_8_offsets_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23475 static int __pyx_pf_8rasterio_5_base_11DatasetBase_8_offsets_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23476   int __pyx_r;
23477   __Pyx_RefNannyDeclarations
23478   __Pyx_RefNannySetupContext("__del__", 0);
23479   __Pyx_INCREF(Py_None);
23480   __Pyx_GIVEREF(Py_None);
23481   __Pyx_GOTREF(__pyx_v_self->_offsets);
23482   __Pyx_DECREF(__pyx_v_self->_offsets);
23483   __pyx_v_self->_offsets = Py_None;
23484 
23485   /* function exit code */
23486   __pyx_r = 0;
23487   __Pyx_RefNannyFinishContext();
23488   return __pyx_r;
23489 }
23490 
23491 /* "rasterio/_base.pxd":28
23492  *     cdef public object _scales
23493  *     cdef public object _offsets
23494  *     cdef public object _read             # <<<<<<<<<<<<<<
23495  *     cdef public object _gcps
23496  *     cdef public object _rpcs
23497  */
23498 
23499 /* Python wrapper */
23500 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5_read_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5_read_1__get__(PyObject * __pyx_v_self)23501 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5_read_1__get__(PyObject *__pyx_v_self) {
23502   PyObject *__pyx_r = 0;
23503   __Pyx_RefNannyDeclarations
23504   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23505   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5_read___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23506 
23507   /* function exit code */
23508   __Pyx_RefNannyFinishContext();
23509   return __pyx_r;
23510 }
23511 
__pyx_pf_8rasterio_5_base_11DatasetBase_5_read___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23512 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5_read___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23513   PyObject *__pyx_r = NULL;
23514   __Pyx_RefNannyDeclarations
23515   __Pyx_RefNannySetupContext("__get__", 0);
23516   __Pyx_XDECREF(__pyx_r);
23517   __Pyx_INCREF(__pyx_v_self->_read);
23518   __pyx_r = __pyx_v_self->_read;
23519   goto __pyx_L0;
23520 
23521   /* function exit code */
23522   __pyx_L0:;
23523   __Pyx_XGIVEREF(__pyx_r);
23524   __Pyx_RefNannyFinishContext();
23525   return __pyx_r;
23526 }
23527 
23528 /* Python wrapper */
23529 static int __pyx_pw_8rasterio_5_base_11DatasetBase_5_read_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5_read_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)23530 static int __pyx_pw_8rasterio_5_base_11DatasetBase_5_read_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
23531   int __pyx_r;
23532   __Pyx_RefNannyDeclarations
23533   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
23534   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5_read_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
23535 
23536   /* function exit code */
23537   __Pyx_RefNannyFinishContext();
23538   return __pyx_r;
23539 }
23540 
__pyx_pf_8rasterio_5_base_11DatasetBase_5_read_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)23541 static int __pyx_pf_8rasterio_5_base_11DatasetBase_5_read_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
23542   int __pyx_r;
23543   __Pyx_RefNannyDeclarations
23544   __Pyx_RefNannySetupContext("__set__", 0);
23545   __Pyx_INCREF(__pyx_v_value);
23546   __Pyx_GIVEREF(__pyx_v_value);
23547   __Pyx_GOTREF(__pyx_v_self->_read);
23548   __Pyx_DECREF(__pyx_v_self->_read);
23549   __pyx_v_self->_read = __pyx_v_value;
23550 
23551   /* function exit code */
23552   __pyx_r = 0;
23553   __Pyx_RefNannyFinishContext();
23554   return __pyx_r;
23555 }
23556 
23557 /* Python wrapper */
23558 static int __pyx_pw_8rasterio_5_base_11DatasetBase_5_read_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5_read_5__del__(PyObject * __pyx_v_self)23559 static int __pyx_pw_8rasterio_5_base_11DatasetBase_5_read_5__del__(PyObject *__pyx_v_self) {
23560   int __pyx_r;
23561   __Pyx_RefNannyDeclarations
23562   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
23563   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5_read_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23564 
23565   /* function exit code */
23566   __Pyx_RefNannyFinishContext();
23567   return __pyx_r;
23568 }
23569 
__pyx_pf_8rasterio_5_base_11DatasetBase_5_read_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23570 static int __pyx_pf_8rasterio_5_base_11DatasetBase_5_read_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23571   int __pyx_r;
23572   __Pyx_RefNannyDeclarations
23573   __Pyx_RefNannySetupContext("__del__", 0);
23574   __Pyx_INCREF(Py_None);
23575   __Pyx_GIVEREF(Py_None);
23576   __Pyx_GOTREF(__pyx_v_self->_read);
23577   __Pyx_DECREF(__pyx_v_self->_read);
23578   __pyx_v_self->_read = Py_None;
23579 
23580   /* function exit code */
23581   __pyx_r = 0;
23582   __Pyx_RefNannyFinishContext();
23583   return __pyx_r;
23584 }
23585 
23586 /* "rasterio/_base.pxd":29
23587  *     cdef public object _offsets
23588  *     cdef public object _read
23589  *     cdef public object _gcps             # <<<<<<<<<<<<<<
23590  *     cdef public object _rpcs
23591  *     cdef public object _env
23592  */
23593 
23594 /* Python wrapper */
23595 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5_gcps_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5_gcps_1__get__(PyObject * __pyx_v_self)23596 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5_gcps_1__get__(PyObject *__pyx_v_self) {
23597   PyObject *__pyx_r = 0;
23598   __Pyx_RefNannyDeclarations
23599   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23600   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5_gcps___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23601 
23602   /* function exit code */
23603   __Pyx_RefNannyFinishContext();
23604   return __pyx_r;
23605 }
23606 
__pyx_pf_8rasterio_5_base_11DatasetBase_5_gcps___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23607 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5_gcps___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23608   PyObject *__pyx_r = NULL;
23609   __Pyx_RefNannyDeclarations
23610   __Pyx_RefNannySetupContext("__get__", 0);
23611   __Pyx_XDECREF(__pyx_r);
23612   __Pyx_INCREF(__pyx_v_self->_gcps);
23613   __pyx_r = __pyx_v_self->_gcps;
23614   goto __pyx_L0;
23615 
23616   /* function exit code */
23617   __pyx_L0:;
23618   __Pyx_XGIVEREF(__pyx_r);
23619   __Pyx_RefNannyFinishContext();
23620   return __pyx_r;
23621 }
23622 
23623 /* Python wrapper */
23624 static int __pyx_pw_8rasterio_5_base_11DatasetBase_5_gcps_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5_gcps_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)23625 static int __pyx_pw_8rasterio_5_base_11DatasetBase_5_gcps_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
23626   int __pyx_r;
23627   __Pyx_RefNannyDeclarations
23628   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
23629   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5_gcps_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
23630 
23631   /* function exit code */
23632   __Pyx_RefNannyFinishContext();
23633   return __pyx_r;
23634 }
23635 
__pyx_pf_8rasterio_5_base_11DatasetBase_5_gcps_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)23636 static int __pyx_pf_8rasterio_5_base_11DatasetBase_5_gcps_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
23637   int __pyx_r;
23638   __Pyx_RefNannyDeclarations
23639   __Pyx_RefNannySetupContext("__set__", 0);
23640   __Pyx_INCREF(__pyx_v_value);
23641   __Pyx_GIVEREF(__pyx_v_value);
23642   __Pyx_GOTREF(__pyx_v_self->_gcps);
23643   __Pyx_DECREF(__pyx_v_self->_gcps);
23644   __pyx_v_self->_gcps = __pyx_v_value;
23645 
23646   /* function exit code */
23647   __pyx_r = 0;
23648   __Pyx_RefNannyFinishContext();
23649   return __pyx_r;
23650 }
23651 
23652 /* Python wrapper */
23653 static int __pyx_pw_8rasterio_5_base_11DatasetBase_5_gcps_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5_gcps_5__del__(PyObject * __pyx_v_self)23654 static int __pyx_pw_8rasterio_5_base_11DatasetBase_5_gcps_5__del__(PyObject *__pyx_v_self) {
23655   int __pyx_r;
23656   __Pyx_RefNannyDeclarations
23657   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
23658   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5_gcps_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23659 
23660   /* function exit code */
23661   __Pyx_RefNannyFinishContext();
23662   return __pyx_r;
23663 }
23664 
__pyx_pf_8rasterio_5_base_11DatasetBase_5_gcps_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23665 static int __pyx_pf_8rasterio_5_base_11DatasetBase_5_gcps_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23666   int __pyx_r;
23667   __Pyx_RefNannyDeclarations
23668   __Pyx_RefNannySetupContext("__del__", 0);
23669   __Pyx_INCREF(Py_None);
23670   __Pyx_GIVEREF(Py_None);
23671   __Pyx_GOTREF(__pyx_v_self->_gcps);
23672   __Pyx_DECREF(__pyx_v_self->_gcps);
23673   __pyx_v_self->_gcps = Py_None;
23674 
23675   /* function exit code */
23676   __pyx_r = 0;
23677   __Pyx_RefNannyFinishContext();
23678   return __pyx_r;
23679 }
23680 
23681 /* "rasterio/_base.pxd":30
23682  *     cdef public object _read
23683  *     cdef public object _gcps
23684  *     cdef public object _rpcs             # <<<<<<<<<<<<<<
23685  *     cdef public object _env
23686  *     cdef GDALDatasetH handle(self) except NULL
23687  */
23688 
23689 /* Python wrapper */
23690 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5_rpcs_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5_rpcs_1__get__(PyObject * __pyx_v_self)23691 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_5_rpcs_1__get__(PyObject *__pyx_v_self) {
23692   PyObject *__pyx_r = 0;
23693   __Pyx_RefNannyDeclarations
23694   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23695   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5_rpcs___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23696 
23697   /* function exit code */
23698   __Pyx_RefNannyFinishContext();
23699   return __pyx_r;
23700 }
23701 
__pyx_pf_8rasterio_5_base_11DatasetBase_5_rpcs___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23702 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_5_rpcs___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23703   PyObject *__pyx_r = NULL;
23704   __Pyx_RefNannyDeclarations
23705   __Pyx_RefNannySetupContext("__get__", 0);
23706   __Pyx_XDECREF(__pyx_r);
23707   __Pyx_INCREF(__pyx_v_self->_rpcs);
23708   __pyx_r = __pyx_v_self->_rpcs;
23709   goto __pyx_L0;
23710 
23711   /* function exit code */
23712   __pyx_L0:;
23713   __Pyx_XGIVEREF(__pyx_r);
23714   __Pyx_RefNannyFinishContext();
23715   return __pyx_r;
23716 }
23717 
23718 /* Python wrapper */
23719 static int __pyx_pw_8rasterio_5_base_11DatasetBase_5_rpcs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5_rpcs_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)23720 static int __pyx_pw_8rasterio_5_base_11DatasetBase_5_rpcs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
23721   int __pyx_r;
23722   __Pyx_RefNannyDeclarations
23723   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
23724   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5_rpcs_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
23725 
23726   /* function exit code */
23727   __Pyx_RefNannyFinishContext();
23728   return __pyx_r;
23729 }
23730 
__pyx_pf_8rasterio_5_base_11DatasetBase_5_rpcs_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)23731 static int __pyx_pf_8rasterio_5_base_11DatasetBase_5_rpcs_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
23732   int __pyx_r;
23733   __Pyx_RefNannyDeclarations
23734   __Pyx_RefNannySetupContext("__set__", 0);
23735   __Pyx_INCREF(__pyx_v_value);
23736   __Pyx_GIVEREF(__pyx_v_value);
23737   __Pyx_GOTREF(__pyx_v_self->_rpcs);
23738   __Pyx_DECREF(__pyx_v_self->_rpcs);
23739   __pyx_v_self->_rpcs = __pyx_v_value;
23740 
23741   /* function exit code */
23742   __pyx_r = 0;
23743   __Pyx_RefNannyFinishContext();
23744   return __pyx_r;
23745 }
23746 
23747 /* Python wrapper */
23748 static int __pyx_pw_8rasterio_5_base_11DatasetBase_5_rpcs_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_5_rpcs_5__del__(PyObject * __pyx_v_self)23749 static int __pyx_pw_8rasterio_5_base_11DatasetBase_5_rpcs_5__del__(PyObject *__pyx_v_self) {
23750   int __pyx_r;
23751   __Pyx_RefNannyDeclarations
23752   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
23753   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_5_rpcs_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23754 
23755   /* function exit code */
23756   __Pyx_RefNannyFinishContext();
23757   return __pyx_r;
23758 }
23759 
__pyx_pf_8rasterio_5_base_11DatasetBase_5_rpcs_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23760 static int __pyx_pf_8rasterio_5_base_11DatasetBase_5_rpcs_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23761   int __pyx_r;
23762   __Pyx_RefNannyDeclarations
23763   __Pyx_RefNannySetupContext("__del__", 0);
23764   __Pyx_INCREF(Py_None);
23765   __Pyx_GIVEREF(Py_None);
23766   __Pyx_GOTREF(__pyx_v_self->_rpcs);
23767   __Pyx_DECREF(__pyx_v_self->_rpcs);
23768   __pyx_v_self->_rpcs = Py_None;
23769 
23770   /* function exit code */
23771   __pyx_r = 0;
23772   __Pyx_RefNannyFinishContext();
23773   return __pyx_r;
23774 }
23775 
23776 /* "rasterio/_base.pxd":31
23777  *     cdef public object _gcps
23778  *     cdef public object _rpcs
23779  *     cdef public object _env             # <<<<<<<<<<<<<<
23780  *     cdef GDALDatasetH handle(self) except NULL
23781  *     cdef GDALRasterBandH band(self, int bidx) except NULL
23782  */
23783 
23784 /* Python wrapper */
23785 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_4_env_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_4_env_1__get__(PyObject * __pyx_v_self)23786 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_4_env_1__get__(PyObject *__pyx_v_self) {
23787   PyObject *__pyx_r = 0;
23788   __Pyx_RefNannyDeclarations
23789   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23790   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_4_env___get__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23791 
23792   /* function exit code */
23793   __Pyx_RefNannyFinishContext();
23794   return __pyx_r;
23795 }
23796 
__pyx_pf_8rasterio_5_base_11DatasetBase_4_env___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23797 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_4_env___get__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23798   PyObject *__pyx_r = NULL;
23799   __Pyx_RefNannyDeclarations
23800   __Pyx_RefNannySetupContext("__get__", 0);
23801   __Pyx_XDECREF(__pyx_r);
23802   __Pyx_INCREF(__pyx_v_self->_env);
23803   __pyx_r = __pyx_v_self->_env;
23804   goto __pyx_L0;
23805 
23806   /* function exit code */
23807   __pyx_L0:;
23808   __Pyx_XGIVEREF(__pyx_r);
23809   __Pyx_RefNannyFinishContext();
23810   return __pyx_r;
23811 }
23812 
23813 /* Python wrapper */
23814 static int __pyx_pw_8rasterio_5_base_11DatasetBase_4_env_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_4_env_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)23815 static int __pyx_pw_8rasterio_5_base_11DatasetBase_4_env_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
23816   int __pyx_r;
23817   __Pyx_RefNannyDeclarations
23818   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
23819   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_4_env_2__set__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v_value));
23820 
23821   /* function exit code */
23822   __Pyx_RefNannyFinishContext();
23823   return __pyx_r;
23824 }
23825 
__pyx_pf_8rasterio_5_base_11DatasetBase_4_env_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,PyObject * __pyx_v_value)23826 static int __pyx_pf_8rasterio_5_base_11DatasetBase_4_env_2__set__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, PyObject *__pyx_v_value) {
23827   int __pyx_r;
23828   __Pyx_RefNannyDeclarations
23829   __Pyx_RefNannySetupContext("__set__", 0);
23830   __Pyx_INCREF(__pyx_v_value);
23831   __Pyx_GIVEREF(__pyx_v_value);
23832   __Pyx_GOTREF(__pyx_v_self->_env);
23833   __Pyx_DECREF(__pyx_v_self->_env);
23834   __pyx_v_self->_env = __pyx_v_value;
23835 
23836   /* function exit code */
23837   __pyx_r = 0;
23838   __Pyx_RefNannyFinishContext();
23839   return __pyx_r;
23840 }
23841 
23842 /* Python wrapper */
23843 static int __pyx_pw_8rasterio_5_base_11DatasetBase_4_env_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_4_env_5__del__(PyObject * __pyx_v_self)23844 static int __pyx_pw_8rasterio_5_base_11DatasetBase_4_env_5__del__(PyObject *__pyx_v_self) {
23845   int __pyx_r;
23846   __Pyx_RefNannyDeclarations
23847   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
23848   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_4_env_4__del__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23849 
23850   /* function exit code */
23851   __Pyx_RefNannyFinishContext();
23852   return __pyx_r;
23853 }
23854 
__pyx_pf_8rasterio_5_base_11DatasetBase_4_env_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23855 static int __pyx_pf_8rasterio_5_base_11DatasetBase_4_env_4__del__(struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23856   int __pyx_r;
23857   __Pyx_RefNannyDeclarations
23858   __Pyx_RefNannySetupContext("__del__", 0);
23859   __Pyx_INCREF(Py_None);
23860   __Pyx_GIVEREF(Py_None);
23861   __Pyx_GOTREF(__pyx_v_self->_env);
23862   __Pyx_DECREF(__pyx_v_self->_env);
23863   __pyx_v_self->_env = Py_None;
23864 
23865   /* function exit code */
23866   __pyx_r = 0;
23867   __Pyx_RefNannyFinishContext();
23868   return __pyx_r;
23869 }
23870 
23871 /* "(tree fragment)":1
23872  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
23873  *     raise TypeError("self._hds cannot be converted to a Python object for pickling")
23874  * def __setstate_cython__(self, __pyx_state):
23875  */
23876 
23877 /* Python wrapper */
23878 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_80__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_80__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)23879 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_80__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
23880   PyObject *__pyx_r = 0;
23881   __Pyx_RefNannyDeclarations
23882   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
23883   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_79__reduce_cython__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self));
23884 
23885   /* function exit code */
23886   __Pyx_RefNannyFinishContext();
23887   return __pyx_r;
23888 }
23889 
__pyx_pf_8rasterio_5_base_11DatasetBase_79__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self)23890 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_79__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self) {
23891   PyObject *__pyx_r = NULL;
23892   __Pyx_RefNannyDeclarations
23893   PyObject *__pyx_t_1 = NULL;
23894   int __pyx_lineno = 0;
23895   const char *__pyx_filename = NULL;
23896   int __pyx_clineno = 0;
23897   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
23898 
23899   /* "(tree fragment)":2
23900  * def __reduce_cython__(self):
23901  *     raise TypeError("self._hds cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
23902  * def __setstate_cython__(self, __pyx_state):
23903  *     raise TypeError("self._hds cannot be converted to a Python object for pickling")
23904  */
23905   __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)
23906   __Pyx_GOTREF(__pyx_t_1);
23907   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
23908   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23909   __PYX_ERR(1, 2, __pyx_L1_error)
23910 
23911   /* "(tree fragment)":1
23912  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
23913  *     raise TypeError("self._hds cannot be converted to a Python object for pickling")
23914  * def __setstate_cython__(self, __pyx_state):
23915  */
23916 
23917   /* function exit code */
23918   __pyx_L1_error:;
23919   __Pyx_XDECREF(__pyx_t_1);
23920   __Pyx_AddTraceback("rasterio._base.DatasetBase.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
23921   __pyx_r = NULL;
23922   __Pyx_XGIVEREF(__pyx_r);
23923   __Pyx_RefNannyFinishContext();
23924   return __pyx_r;
23925 }
23926 
23927 /* "(tree fragment)":3
23928  * def __reduce_cython__(self):
23929  *     raise TypeError("self._hds cannot be converted to a Python object for pickling")
23930  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
23931  *     raise TypeError("self._hds cannot be converted to a Python object for pickling")
23932  */
23933 
23934 /* Python wrapper */
23935 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_82__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_8rasterio_5_base_11DatasetBase_82__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)23936 static PyObject *__pyx_pw_8rasterio_5_base_11DatasetBase_82__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
23937   PyObject *__pyx_r = 0;
23938   __Pyx_RefNannyDeclarations
23939   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
23940   __pyx_r = __pyx_pf_8rasterio_5_base_11DatasetBase_81__setstate_cython__(((struct __pyx_obj_8rasterio_5_base_DatasetBase *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
23941 
23942   /* function exit code */
23943   __Pyx_RefNannyFinishContext();
23944   return __pyx_r;
23945 }
23946 
__pyx_pf_8rasterio_5_base_11DatasetBase_81__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)23947 static PyObject *__pyx_pf_8rasterio_5_base_11DatasetBase_81__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_8rasterio_5_base_DatasetBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
23948   PyObject *__pyx_r = NULL;
23949   __Pyx_RefNannyDeclarations
23950   PyObject *__pyx_t_1 = NULL;
23951   int __pyx_lineno = 0;
23952   const char *__pyx_filename = NULL;
23953   int __pyx_clineno = 0;
23954   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
23955 
23956   /* "(tree fragment)":4
23957  *     raise TypeError("self._hds cannot be converted to a Python object for pickling")
23958  * def __setstate_cython__(self, __pyx_state):
23959  *     raise TypeError("self._hds cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
23960  */
23961   __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)
23962   __Pyx_GOTREF(__pyx_t_1);
23963   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
23964   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23965   __PYX_ERR(1, 4, __pyx_L1_error)
23966 
23967   /* "(tree fragment)":3
23968  * def __reduce_cython__(self):
23969  *     raise TypeError("self._hds cannot be converted to a Python object for pickling")
23970  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
23971  *     raise TypeError("self._hds cannot be converted to a Python object for pickling")
23972  */
23973 
23974   /* function exit code */
23975   __pyx_L1_error:;
23976   __Pyx_XDECREF(__pyx_t_1);
23977   __Pyx_AddTraceback("rasterio._base.DatasetBase.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
23978   __pyx_r = NULL;
23979   __Pyx_XGIVEREF(__pyx_r);
23980   __Pyx_RefNannyFinishContext();
23981   return __pyx_r;
23982 }
23983 
23984 /* "rasterio/_base.pyx":1385
23985  *
23986  *
23987  * def _transform(src_crs, dst_crs, xs, ys, zs):             # <<<<<<<<<<<<<<
23988  *     """Transform input arrays from src to dst CRS."""
23989  *     cdef double *x = NULL
23990  */
23991 
23992 /* Python wrapper */
23993 static PyObject *__pyx_pw_8rasterio_5_base_15_transform(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
23994 static char __pyx_doc_8rasterio_5_base_14_transform[] = "Transform input arrays from src to dst CRS.";
23995 static PyMethodDef __pyx_mdef_8rasterio_5_base_15_transform = {"_transform", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8rasterio_5_base_15_transform, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8rasterio_5_base_14_transform};
__pyx_pw_8rasterio_5_base_15_transform(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)23996 static PyObject *__pyx_pw_8rasterio_5_base_15_transform(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
23997   PyObject *__pyx_v_src_crs = 0;
23998   PyObject *__pyx_v_dst_crs = 0;
23999   PyObject *__pyx_v_xs = 0;
24000   PyObject *__pyx_v_ys = 0;
24001   PyObject *__pyx_v_zs = 0;
24002   int __pyx_lineno = 0;
24003   const char *__pyx_filename = NULL;
24004   int __pyx_clineno = 0;
24005   PyObject *__pyx_r = 0;
24006   __Pyx_RefNannyDeclarations
24007   __Pyx_RefNannySetupContext("_transform (wrapper)", 0);
24008   {
24009     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_src_crs,&__pyx_n_s_dst_crs,&__pyx_n_s_xs,&__pyx_n_s_ys,&__pyx_n_s_zs,0};
24010     PyObject* values[5] = {0,0,0,0,0};
24011     if (unlikely(__pyx_kwds)) {
24012       Py_ssize_t kw_args;
24013       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
24014       switch (pos_args) {
24015         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
24016         CYTHON_FALLTHROUGH;
24017         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
24018         CYTHON_FALLTHROUGH;
24019         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
24020         CYTHON_FALLTHROUGH;
24021         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
24022         CYTHON_FALLTHROUGH;
24023         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
24024         CYTHON_FALLTHROUGH;
24025         case  0: break;
24026         default: goto __pyx_L5_argtuple_error;
24027       }
24028       kw_args = PyDict_Size(__pyx_kwds);
24029       switch (pos_args) {
24030         case  0:
24031         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_src_crs)) != 0)) kw_args--;
24032         else goto __pyx_L5_argtuple_error;
24033         CYTHON_FALLTHROUGH;
24034         case  1:
24035         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dst_crs)) != 0)) kw_args--;
24036         else {
24037           __Pyx_RaiseArgtupleInvalid("_transform", 1, 5, 5, 1); __PYX_ERR(0, 1385, __pyx_L3_error)
24038         }
24039         CYTHON_FALLTHROUGH;
24040         case  2:
24041         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xs)) != 0)) kw_args--;
24042         else {
24043           __Pyx_RaiseArgtupleInvalid("_transform", 1, 5, 5, 2); __PYX_ERR(0, 1385, __pyx_L3_error)
24044         }
24045         CYTHON_FALLTHROUGH;
24046         case  3:
24047         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ys)) != 0)) kw_args--;
24048         else {
24049           __Pyx_RaiseArgtupleInvalid("_transform", 1, 5, 5, 3); __PYX_ERR(0, 1385, __pyx_L3_error)
24050         }
24051         CYTHON_FALLTHROUGH;
24052         case  4:
24053         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zs)) != 0)) kw_args--;
24054         else {
24055           __Pyx_RaiseArgtupleInvalid("_transform", 1, 5, 5, 4); __PYX_ERR(0, 1385, __pyx_L3_error)
24056         }
24057       }
24058       if (unlikely(kw_args > 0)) {
24059         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_transform") < 0)) __PYX_ERR(0, 1385, __pyx_L3_error)
24060       }
24061     } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
24062       goto __pyx_L5_argtuple_error;
24063     } else {
24064       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
24065       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
24066       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
24067       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
24068       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
24069     }
24070     __pyx_v_src_crs = values[0];
24071     __pyx_v_dst_crs = values[1];
24072     __pyx_v_xs = values[2];
24073     __pyx_v_ys = values[3];
24074     __pyx_v_zs = values[4];
24075   }
24076   goto __pyx_L4_argument_unpacking_done;
24077   __pyx_L5_argtuple_error:;
24078   __Pyx_RaiseArgtupleInvalid("_transform", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1385, __pyx_L3_error)
24079   __pyx_L3_error:;
24080   __Pyx_AddTraceback("rasterio._base._transform", __pyx_clineno, __pyx_lineno, __pyx_filename);
24081   __Pyx_RefNannyFinishContext();
24082   return NULL;
24083   __pyx_L4_argument_unpacking_done:;
24084   __pyx_r = __pyx_pf_8rasterio_5_base_14_transform(__pyx_self, __pyx_v_src_crs, __pyx_v_dst_crs, __pyx_v_xs, __pyx_v_ys, __pyx_v_zs);
24085 
24086   /* function exit code */
24087   __Pyx_RefNannyFinishContext();
24088   return __pyx_r;
24089 }
24090 
__pyx_pf_8rasterio_5_base_14_transform(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_src_crs,PyObject * __pyx_v_dst_crs,PyObject * __pyx_v_xs,PyObject * __pyx_v_ys,PyObject * __pyx_v_zs)24091 static PyObject *__pyx_pf_8rasterio_5_base_14_transform(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_src_crs, PyObject *__pyx_v_dst_crs, PyObject *__pyx_v_xs, PyObject *__pyx_v_ys, PyObject *__pyx_v_zs) {
24092   double *__pyx_v_x;
24093   double *__pyx_v_y;
24094   double *__pyx_v_z;
24095   OGRSpatialReferenceH __pyx_v_src;
24096   OGRSpatialReferenceH __pyx_v_dst;
24097   OGRCoordinateTransformationH __pyx_v_transform;
24098   int __pyx_v_i;
24099   PyObject *__pyx_v_n = NULL;
24100   PyObject *__pyx_v_res_xs = NULL;
24101   PyObject *__pyx_v_res_ys = NULL;
24102   PyObject *__pyx_v_res_zs = NULL;
24103   PyObject *__pyx_r = NULL;
24104   __Pyx_RefNannyDeclarations
24105   Py_ssize_t __pyx_t_1;
24106   Py_ssize_t __pyx_t_2;
24107   int __pyx_t_3;
24108   int __pyx_t_4;
24109   int __pyx_t_5;
24110   OGRSpatialReferenceH __pyx_t_6;
24111   PyObject *__pyx_t_7 = NULL;
24112   PyObject *__pyx_t_8 = NULL;
24113   size_t __pyx_t_9;
24114   long __pyx_t_10;
24115   long __pyx_t_11;
24116   int __pyx_t_12;
24117   double __pyx_t_13;
24118   void *__pyx_t_14;
24119   int __pyx_t_15;
24120   char const *__pyx_t_16;
24121   PyObject *__pyx_t_17 = NULL;
24122   PyObject *__pyx_t_18 = NULL;
24123   PyObject *__pyx_t_19 = NULL;
24124   PyObject *__pyx_t_20 = NULL;
24125   PyObject *__pyx_t_21 = NULL;
24126   PyObject *__pyx_t_22 = NULL;
24127   int __pyx_lineno = 0;
24128   const char *__pyx_filename = NULL;
24129   int __pyx_clineno = 0;
24130   __Pyx_RefNannySetupContext("_transform", 0);
24131 
24132   /* "rasterio/_base.pyx":1387
24133  * def _transform(src_crs, dst_crs, xs, ys, zs):
24134  *     """Transform input arrays from src to dst CRS."""
24135  *     cdef double *x = NULL             # <<<<<<<<<<<<<<
24136  *     cdef double *y = NULL
24137  *     cdef double *z = NULL
24138  */
24139   __pyx_v_x = NULL;
24140 
24141   /* "rasterio/_base.pyx":1388
24142  *     """Transform input arrays from src to dst CRS."""
24143  *     cdef double *x = NULL
24144  *     cdef double *y = NULL             # <<<<<<<<<<<<<<
24145  *     cdef double *z = NULL
24146  *     cdef OGRSpatialReferenceH src = NULL
24147  */
24148   __pyx_v_y = NULL;
24149 
24150   /* "rasterio/_base.pyx":1389
24151  *     cdef double *x = NULL
24152  *     cdef double *y = NULL
24153  *     cdef double *z = NULL             # <<<<<<<<<<<<<<
24154  *     cdef OGRSpatialReferenceH src = NULL
24155  *     cdef OGRSpatialReferenceH dst = NULL
24156  */
24157   __pyx_v_z = NULL;
24158 
24159   /* "rasterio/_base.pyx":1390
24160  *     cdef double *y = NULL
24161  *     cdef double *z = NULL
24162  *     cdef OGRSpatialReferenceH src = NULL             # <<<<<<<<<<<<<<
24163  *     cdef OGRSpatialReferenceH dst = NULL
24164  *     cdef OGRCoordinateTransformationH transform = NULL
24165  */
24166   __pyx_v_src = NULL;
24167 
24168   /* "rasterio/_base.pyx":1391
24169  *     cdef double *z = NULL
24170  *     cdef OGRSpatialReferenceH src = NULL
24171  *     cdef OGRSpatialReferenceH dst = NULL             # <<<<<<<<<<<<<<
24172  *     cdef OGRCoordinateTransformationH transform = NULL
24173  *     cdef int i
24174  */
24175   __pyx_v_dst = NULL;
24176 
24177   /* "rasterio/_base.pyx":1392
24178  *     cdef OGRSpatialReferenceH src = NULL
24179  *     cdef OGRSpatialReferenceH dst = NULL
24180  *     cdef OGRCoordinateTransformationH transform = NULL             # <<<<<<<<<<<<<<
24181  *     cdef int i
24182  *
24183  */
24184   __pyx_v_transform = NULL;
24185 
24186   /* "rasterio/_base.pyx":1395
24187  *     cdef int i
24188  *
24189  *     assert len(xs) == len(ys)             # <<<<<<<<<<<<<<
24190  *     assert zs is None or len(xs) == len(zs)
24191  *
24192  */
24193   #ifndef CYTHON_WITHOUT_ASSERTIONS
24194   if (unlikely(!Py_OptimizeFlag)) {
24195     __pyx_t_1 = PyObject_Length(__pyx_v_xs); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1395, __pyx_L1_error)
24196     __pyx_t_2 = PyObject_Length(__pyx_v_ys); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1395, __pyx_L1_error)
24197     if (unlikely(!((__pyx_t_1 == __pyx_t_2) != 0))) {
24198       PyErr_SetNone(PyExc_AssertionError);
24199       __PYX_ERR(0, 1395, __pyx_L1_error)
24200     }
24201   }
24202   #endif
24203 
24204   /* "rasterio/_base.pyx":1396
24205  *
24206  *     assert len(xs) == len(ys)
24207  *     assert zs is None or len(xs) == len(zs)             # <<<<<<<<<<<<<<
24208  *
24209  *     src = _osr_from_crs(src_crs)
24210  */
24211   #ifndef CYTHON_WITHOUT_ASSERTIONS
24212   if (unlikely(!Py_OptimizeFlag)) {
24213     __pyx_t_4 = (__pyx_v_zs == Py_None);
24214     __pyx_t_5 = (__pyx_t_4 != 0);
24215     if (!__pyx_t_5) {
24216     } else {
24217       __pyx_t_3 = __pyx_t_5;
24218       goto __pyx_L3_bool_binop_done;
24219     }
24220     __pyx_t_2 = PyObject_Length(__pyx_v_xs); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1396, __pyx_L1_error)
24221     __pyx_t_1 = PyObject_Length(__pyx_v_zs); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1396, __pyx_L1_error)
24222     __pyx_t_5 = ((__pyx_t_2 == __pyx_t_1) != 0);
24223     __pyx_t_3 = __pyx_t_5;
24224     __pyx_L3_bool_binop_done:;
24225     if (unlikely(!__pyx_t_3)) {
24226       PyErr_SetNone(PyExc_AssertionError);
24227       __PYX_ERR(0, 1396, __pyx_L1_error)
24228     }
24229   }
24230   #endif
24231 
24232   /* "rasterio/_base.pyx":1398
24233  *     assert zs is None or len(xs) == len(zs)
24234  *
24235  *     src = _osr_from_crs(src_crs)             # <<<<<<<<<<<<<<
24236  *     dst = _osr_from_crs(dst_crs)
24237  *
24238  */
24239   __pyx_t_6 = __pyx_f_8rasterio_5_base__osr_from_crs(__pyx_v_src_crs); if (unlikely(__pyx_t_6 == ((OGRSpatialReferenceH)NULL))) __PYX_ERR(0, 1398, __pyx_L1_error)
24240   __pyx_v_src = __pyx_t_6;
24241 
24242   /* "rasterio/_base.pyx":1399
24243  *
24244  *     src = _osr_from_crs(src_crs)
24245  *     dst = _osr_from_crs(dst_crs)             # <<<<<<<<<<<<<<
24246  *
24247  *     n = len(xs)
24248  */
24249   __pyx_t_6 = __pyx_f_8rasterio_5_base__osr_from_crs(__pyx_v_dst_crs); if (unlikely(__pyx_t_6 == ((OGRSpatialReferenceH)NULL))) __PYX_ERR(0, 1399, __pyx_L1_error)
24250   __pyx_v_dst = __pyx_t_6;
24251 
24252   /* "rasterio/_base.pyx":1401
24253  *     dst = _osr_from_crs(dst_crs)
24254  *
24255  *     n = len(xs)             # <<<<<<<<<<<<<<
24256  *     x = <double *>CPLMalloc(n*sizeof(double))
24257  *     y = <double *>CPLMalloc(n*sizeof(double))
24258  */
24259   __pyx_t_1 = PyObject_Length(__pyx_v_xs); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1401, __pyx_L1_error)
24260   __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1401, __pyx_L1_error)
24261   __Pyx_GOTREF(__pyx_t_7);
24262   __pyx_v_n = __pyx_t_7;
24263   __pyx_t_7 = 0;
24264 
24265   /* "rasterio/_base.pyx":1402
24266  *
24267  *     n = len(xs)
24268  *     x = <double *>CPLMalloc(n*sizeof(double))             # <<<<<<<<<<<<<<
24269  *     y = <double *>CPLMalloc(n*sizeof(double))
24270  *     for i in range(n):
24271  */
24272   __pyx_t_7 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1402, __pyx_L1_error)
24273   __Pyx_GOTREF(__pyx_t_7);
24274   __pyx_t_8 = PyNumber_Multiply(__pyx_v_n, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1402, __pyx_L1_error)
24275   __Pyx_GOTREF(__pyx_t_8);
24276   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
24277   __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_8); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1402, __pyx_L1_error)
24278   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24279   __pyx_v_x = ((double *)CPLMalloc(__pyx_t_9));
24280 
24281   /* "rasterio/_base.pyx":1403
24282  *     n = len(xs)
24283  *     x = <double *>CPLMalloc(n*sizeof(double))
24284  *     y = <double *>CPLMalloc(n*sizeof(double))             # <<<<<<<<<<<<<<
24285  *     for i in range(n):
24286  *         x[i] = xs[i]
24287  */
24288   __pyx_t_8 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1403, __pyx_L1_error)
24289   __Pyx_GOTREF(__pyx_t_8);
24290   __pyx_t_7 = PyNumber_Multiply(__pyx_v_n, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1403, __pyx_L1_error)
24291   __Pyx_GOTREF(__pyx_t_7);
24292   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24293   __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1403, __pyx_L1_error)
24294   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
24295   __pyx_v_y = ((double *)CPLMalloc(__pyx_t_9));
24296 
24297   /* "rasterio/_base.pyx":1404
24298  *     x = <double *>CPLMalloc(n*sizeof(double))
24299  *     y = <double *>CPLMalloc(n*sizeof(double))
24300  *     for i in range(n):             # <<<<<<<<<<<<<<
24301  *         x[i] = xs[i]
24302  *         y[i] = ys[i]
24303  */
24304   __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_v_n); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1404, __pyx_L1_error)
24305   __pyx_t_11 = __pyx_t_10;
24306   for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
24307     __pyx_v_i = __pyx_t_12;
24308 
24309     /* "rasterio/_base.pyx":1405
24310  *     y = <double *>CPLMalloc(n*sizeof(double))
24311  *     for i in range(n):
24312  *         x[i] = xs[i]             # <<<<<<<<<<<<<<
24313  *         y[i] = ys[i]
24314  *
24315  */
24316     __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_xs, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1405, __pyx_L1_error)
24317     __Pyx_GOTREF(__pyx_t_7);
24318     __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1405, __pyx_L1_error)
24319     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
24320     (__pyx_v_x[__pyx_v_i]) = __pyx_t_13;
24321 
24322     /* "rasterio/_base.pyx":1406
24323  *     for i in range(n):
24324  *         x[i] = xs[i]
24325  *         y[i] = ys[i]             # <<<<<<<<<<<<<<
24326  *
24327  *     if zs is not None:
24328  */
24329     __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_ys, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1406, __pyx_L1_error)
24330     __Pyx_GOTREF(__pyx_t_7);
24331     __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1406, __pyx_L1_error)
24332     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
24333     (__pyx_v_y[__pyx_v_i]) = __pyx_t_13;
24334   }
24335 
24336   /* "rasterio/_base.pyx":1408
24337  *         y[i] = ys[i]
24338  *
24339  *     if zs is not None:             # <<<<<<<<<<<<<<
24340  *         z = <double *>CPLMalloc(n*sizeof(double))
24341  *         for i in range(n):
24342  */
24343   __pyx_t_3 = (__pyx_v_zs != Py_None);
24344   __pyx_t_5 = (__pyx_t_3 != 0);
24345   if (__pyx_t_5) {
24346 
24347     /* "rasterio/_base.pyx":1409
24348  *
24349  *     if zs is not None:
24350  *         z = <double *>CPLMalloc(n*sizeof(double))             # <<<<<<<<<<<<<<
24351  *         for i in range(n):
24352  *             z[i] = zs[i]
24353  */
24354     __pyx_t_7 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1409, __pyx_L1_error)
24355     __Pyx_GOTREF(__pyx_t_7);
24356     __pyx_t_8 = PyNumber_Multiply(__pyx_v_n, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1409, __pyx_L1_error)
24357     __Pyx_GOTREF(__pyx_t_8);
24358     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
24359     __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_8); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1409, __pyx_L1_error)
24360     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24361     __pyx_v_z = ((double *)CPLMalloc(__pyx_t_9));
24362 
24363     /* "rasterio/_base.pyx":1410
24364  *     if zs is not None:
24365  *         z = <double *>CPLMalloc(n*sizeof(double))
24366  *         for i in range(n):             # <<<<<<<<<<<<<<
24367  *             z[i] = zs[i]
24368  *
24369  */
24370     __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_v_n); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1410, __pyx_L1_error)
24371     __pyx_t_11 = __pyx_t_10;
24372     for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
24373       __pyx_v_i = __pyx_t_12;
24374 
24375       /* "rasterio/_base.pyx":1411
24376  *         z = <double *>CPLMalloc(n*sizeof(double))
24377  *         for i in range(n):
24378  *             z[i] = zs[i]             # <<<<<<<<<<<<<<
24379  *
24380  *     try:
24381  */
24382       __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_zs, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1411, __pyx_L1_error)
24383       __Pyx_GOTREF(__pyx_t_8);
24384       __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1411, __pyx_L1_error)
24385       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24386       (__pyx_v_z[__pyx_v_i]) = __pyx_t_13;
24387     }
24388 
24389     /* "rasterio/_base.pyx":1408
24390  *         y[i] = ys[i]
24391  *
24392  *     if zs is not None:             # <<<<<<<<<<<<<<
24393  *         z = <double *>CPLMalloc(n*sizeof(double))
24394  *         for i in range(n):
24395  */
24396   }
24397 
24398   /* "rasterio/_base.pyx":1413
24399  *             z[i] = zs[i]
24400  *
24401  *     try:             # <<<<<<<<<<<<<<
24402  *         transform = OCTNewCoordinateTransformation(src, dst)
24403  *         transform = exc_wrap_pointer(transform)
24404  */
24405   /*try:*/ {
24406 
24407     /* "rasterio/_base.pyx":1414
24408  *
24409  *     try:
24410  *         transform = OCTNewCoordinateTransformation(src, dst)             # <<<<<<<<<<<<<<
24411  *         transform = exc_wrap_pointer(transform)
24412  *         # OCTTransform() returns TRUE/FALSE contrary to most GDAL API functions
24413  */
24414     __pyx_v_transform = OCTNewCoordinateTransformation(__pyx_v_src, __pyx_v_dst);
24415 
24416     /* "rasterio/_base.pyx":1415
24417  *     try:
24418  *         transform = OCTNewCoordinateTransformation(src, dst)
24419  *         transform = exc_wrap_pointer(transform)             # <<<<<<<<<<<<<<
24420  *         # OCTTransform() returns TRUE/FALSE contrary to most GDAL API functions
24421  *         exc_wrap_int(OCTTransform(transform, n, x, y, z) == 0)
24422  */
24423     __pyx_t_14 = __pyx_f_8rasterio_4_err_exc_wrap_pointer(__pyx_v_transform); if (unlikely(__pyx_t_14 == ((void *)NULL))) __PYX_ERR(0, 1415, __pyx_L11_error)
24424     __pyx_v_transform = __pyx_t_14;
24425 
24426     /* "rasterio/_base.pyx":1417
24427  *         transform = exc_wrap_pointer(transform)
24428  *         # OCTTransform() returns TRUE/FALSE contrary to most GDAL API functions
24429  *         exc_wrap_int(OCTTransform(transform, n, x, y, z) == 0)             # <<<<<<<<<<<<<<
24430  *
24431  *         res_xs = [0]*n
24432  */
24433     __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_n); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1417, __pyx_L11_error)
24434     __pyx_t_15 = __pyx_f_8rasterio_4_err_exc_wrap_int((OCTTransform(__pyx_v_transform, __pyx_t_12, __pyx_v_x, __pyx_v_y, __pyx_v_z) == 0)); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1417, __pyx_L11_error)
24435 
24436     /* "rasterio/_base.pyx":1419
24437  *         exc_wrap_int(OCTTransform(transform, n, x, y, z) == 0)
24438  *
24439  *         res_xs = [0]*n             # <<<<<<<<<<<<<<
24440  *         res_ys = [0]*n
24441  *         for i in range(n):
24442  */
24443     __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1419, __pyx_L11_error)
24444     __Pyx_GOTREF(__pyx_t_8);
24445     __Pyx_INCREF(__pyx_int_0);
24446     __Pyx_GIVEREF(__pyx_int_0);
24447     PyList_SET_ITEM(__pyx_t_8, 0, __pyx_int_0);
24448     { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_8, __pyx_v_n); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 1419, __pyx_L11_error)
24449       __Pyx_GOTREF(__pyx_temp);
24450       __Pyx_DECREF(__pyx_t_8);
24451       __pyx_t_8 = __pyx_temp;
24452     }
24453     __pyx_v_res_xs = ((PyObject*)__pyx_t_8);
24454     __pyx_t_8 = 0;
24455 
24456     /* "rasterio/_base.pyx":1420
24457  *
24458  *         res_xs = [0]*n
24459  *         res_ys = [0]*n             # <<<<<<<<<<<<<<
24460  *         for i in range(n):
24461  *             res_xs[i] = x[i]
24462  */
24463     __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1420, __pyx_L11_error)
24464     __Pyx_GOTREF(__pyx_t_8);
24465     __Pyx_INCREF(__pyx_int_0);
24466     __Pyx_GIVEREF(__pyx_int_0);
24467     PyList_SET_ITEM(__pyx_t_8, 0, __pyx_int_0);
24468     { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_8, __pyx_v_n); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 1420, __pyx_L11_error)
24469       __Pyx_GOTREF(__pyx_temp);
24470       __Pyx_DECREF(__pyx_t_8);
24471       __pyx_t_8 = __pyx_temp;
24472     }
24473     __pyx_v_res_ys = ((PyObject*)__pyx_t_8);
24474     __pyx_t_8 = 0;
24475 
24476     /* "rasterio/_base.pyx":1421
24477  *         res_xs = [0]*n
24478  *         res_ys = [0]*n
24479  *         for i in range(n):             # <<<<<<<<<<<<<<
24480  *             res_xs[i] = x[i]
24481  *             res_ys[i] = y[i]
24482  */
24483     __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_v_n); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1421, __pyx_L11_error)
24484     __pyx_t_11 = __pyx_t_10;
24485     for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_11; __pyx_t_15+=1) {
24486       __pyx_v_i = __pyx_t_15;
24487 
24488       /* "rasterio/_base.pyx":1422
24489  *         res_ys = [0]*n
24490  *         for i in range(n):
24491  *             res_xs[i] = x[i]             # <<<<<<<<<<<<<<
24492  *             res_ys[i] = y[i]
24493  *         if zs is not None:
24494  */
24495       __pyx_t_8 = PyFloat_FromDouble((__pyx_v_x[__pyx_v_i])); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1422, __pyx_L11_error)
24496       __Pyx_GOTREF(__pyx_t_8);
24497       if (unlikely(__Pyx_SetItemInt(__pyx_v_res_xs, __pyx_v_i, __pyx_t_8, int, 1, __Pyx_PyInt_From_int, 1, 1, 0) < 0)) __PYX_ERR(0, 1422, __pyx_L11_error)
24498       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24499 
24500       /* "rasterio/_base.pyx":1423
24501  *         for i in range(n):
24502  *             res_xs[i] = x[i]
24503  *             res_ys[i] = y[i]             # <<<<<<<<<<<<<<
24504  *         if zs is not None:
24505  *             res_zs = [0]*n
24506  */
24507       __pyx_t_8 = PyFloat_FromDouble((__pyx_v_y[__pyx_v_i])); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1423, __pyx_L11_error)
24508       __Pyx_GOTREF(__pyx_t_8);
24509       if (unlikely(__Pyx_SetItemInt(__pyx_v_res_ys, __pyx_v_i, __pyx_t_8, int, 1, __Pyx_PyInt_From_int, 1, 1, 0) < 0)) __PYX_ERR(0, 1423, __pyx_L11_error)
24510       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24511     }
24512 
24513     /* "rasterio/_base.pyx":1424
24514  *             res_xs[i] = x[i]
24515  *             res_ys[i] = y[i]
24516  *         if zs is not None:             # <<<<<<<<<<<<<<
24517  *             res_zs = [0]*n
24518  *             for i in range(n):
24519  */
24520     __pyx_t_5 = (__pyx_v_zs != Py_None);
24521     __pyx_t_3 = (__pyx_t_5 != 0);
24522     if (__pyx_t_3) {
24523 
24524       /* "rasterio/_base.pyx":1425
24525  *             res_ys[i] = y[i]
24526  *         if zs is not None:
24527  *             res_zs = [0]*n             # <<<<<<<<<<<<<<
24528  *             for i in range(n):
24529  *                 res_zs[i] = z[i]
24530  */
24531       __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1425, __pyx_L11_error)
24532       __Pyx_GOTREF(__pyx_t_8);
24533       __Pyx_INCREF(__pyx_int_0);
24534       __Pyx_GIVEREF(__pyx_int_0);
24535       PyList_SET_ITEM(__pyx_t_8, 0, __pyx_int_0);
24536       { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_8, __pyx_v_n); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 1425, __pyx_L11_error)
24537         __Pyx_GOTREF(__pyx_temp);
24538         __Pyx_DECREF(__pyx_t_8);
24539         __pyx_t_8 = __pyx_temp;
24540       }
24541       __pyx_v_res_zs = ((PyObject*)__pyx_t_8);
24542       __pyx_t_8 = 0;
24543 
24544       /* "rasterio/_base.pyx":1426
24545  *         if zs is not None:
24546  *             res_zs = [0]*n
24547  *             for i in range(n):             # <<<<<<<<<<<<<<
24548  *                 res_zs[i] = z[i]
24549  *             return (res_xs, res_ys, res_zs)
24550  */
24551       __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_v_n); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1426, __pyx_L11_error)
24552       __pyx_t_11 = __pyx_t_10;
24553       for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_11; __pyx_t_15+=1) {
24554         __pyx_v_i = __pyx_t_15;
24555 
24556         /* "rasterio/_base.pyx":1427
24557  *             res_zs = [0]*n
24558  *             for i in range(n):
24559  *                 res_zs[i] = z[i]             # <<<<<<<<<<<<<<
24560  *             return (res_xs, res_ys, res_zs)
24561  *         else:
24562  */
24563         __pyx_t_8 = PyFloat_FromDouble((__pyx_v_z[__pyx_v_i])); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1427, __pyx_L11_error)
24564         __Pyx_GOTREF(__pyx_t_8);
24565         if (unlikely(__Pyx_SetItemInt(__pyx_v_res_zs, __pyx_v_i, __pyx_t_8, int, 1, __Pyx_PyInt_From_int, 1, 1, 0) < 0)) __PYX_ERR(0, 1427, __pyx_L11_error)
24566         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24567       }
24568 
24569       /* "rasterio/_base.pyx":1428
24570  *             for i in range(n):
24571  *                 res_zs[i] = z[i]
24572  *             return (res_xs, res_ys, res_zs)             # <<<<<<<<<<<<<<
24573  *         else:
24574  *             return (res_xs, res_ys)
24575  */
24576       __Pyx_XDECREF(__pyx_r);
24577       __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1428, __pyx_L11_error)
24578       __Pyx_GOTREF(__pyx_t_8);
24579       __Pyx_INCREF(__pyx_v_res_xs);
24580       __Pyx_GIVEREF(__pyx_v_res_xs);
24581       PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_res_xs);
24582       __Pyx_INCREF(__pyx_v_res_ys);
24583       __Pyx_GIVEREF(__pyx_v_res_ys);
24584       PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_res_ys);
24585       __Pyx_INCREF(__pyx_v_res_zs);
24586       __Pyx_GIVEREF(__pyx_v_res_zs);
24587       PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_res_zs);
24588       __pyx_r = __pyx_t_8;
24589       __pyx_t_8 = 0;
24590       goto __pyx_L10_return;
24591 
24592       /* "rasterio/_base.pyx":1424
24593  *             res_xs[i] = x[i]
24594  *             res_ys[i] = y[i]
24595  *         if zs is not None:             # <<<<<<<<<<<<<<
24596  *             res_zs = [0]*n
24597  *             for i in range(n):
24598  */
24599     }
24600 
24601     /* "rasterio/_base.pyx":1430
24602  *             return (res_xs, res_ys, res_zs)
24603  *         else:
24604  *             return (res_xs, res_ys)             # <<<<<<<<<<<<<<
24605  *
24606  *     finally:
24607  */
24608     /*else*/ {
24609       __Pyx_XDECREF(__pyx_r);
24610       __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1430, __pyx_L11_error)
24611       __Pyx_GOTREF(__pyx_t_8);
24612       __Pyx_INCREF(__pyx_v_res_xs);
24613       __Pyx_GIVEREF(__pyx_v_res_xs);
24614       PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_res_xs);
24615       __Pyx_INCREF(__pyx_v_res_ys);
24616       __Pyx_GIVEREF(__pyx_v_res_ys);
24617       PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_res_ys);
24618       __pyx_r = __pyx_t_8;
24619       __pyx_t_8 = 0;
24620       goto __pyx_L10_return;
24621     }
24622   }
24623 
24624   /* "rasterio/_base.pyx":1433
24625  *
24626  *     finally:
24627  *         CPLFree(x)             # <<<<<<<<<<<<<<
24628  *         CPLFree(y)
24629  *         CPLFree(z)
24630  */
24631   /*finally:*/ {
24632     __pyx_L11_error:;
24633     /*exception exit:*/{
24634       __Pyx_PyThreadState_declare
24635       __Pyx_PyThreadState_assign
24636       __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
24637       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
24638       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
24639       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
24640       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
24641       __Pyx_XGOTREF(__pyx_t_17);
24642       __Pyx_XGOTREF(__pyx_t_18);
24643       __Pyx_XGOTREF(__pyx_t_19);
24644       __Pyx_XGOTREF(__pyx_t_20);
24645       __Pyx_XGOTREF(__pyx_t_21);
24646       __Pyx_XGOTREF(__pyx_t_22);
24647       __pyx_t_15 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
24648       {
24649         CPLFree(__pyx_v_x);
24650 
24651         /* "rasterio/_base.pyx":1434
24652  *     finally:
24653  *         CPLFree(x)
24654  *         CPLFree(y)             # <<<<<<<<<<<<<<
24655  *         CPLFree(z)
24656  *         OCTDestroyCoordinateTransformation(transform)
24657  */
24658         CPLFree(__pyx_v_y);
24659 
24660         /* "rasterio/_base.pyx":1435
24661  *         CPLFree(x)
24662  *         CPLFree(y)
24663  *         CPLFree(z)             # <<<<<<<<<<<<<<
24664  *         OCTDestroyCoordinateTransformation(transform)
24665  *         _safe_osr_release(src)
24666  */
24667         CPLFree(__pyx_v_z);
24668 
24669         /* "rasterio/_base.pyx":1436
24670  *         CPLFree(y)
24671  *         CPLFree(z)
24672  *         OCTDestroyCoordinateTransformation(transform)             # <<<<<<<<<<<<<<
24673  *         _safe_osr_release(src)
24674  *         _safe_osr_release(dst)
24675  */
24676         OCTDestroyCoordinateTransformation(__pyx_v_transform);
24677 
24678         /* "rasterio/_base.pyx":1437
24679  *         CPLFree(z)
24680  *         OCTDestroyCoordinateTransformation(transform)
24681  *         _safe_osr_release(src)             # <<<<<<<<<<<<<<
24682  *         _safe_osr_release(dst)
24683  *
24684  */
24685         __pyx_t_8 = __pyx_f_8rasterio_5_base__safe_osr_release(__pyx_v_src); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1437, __pyx_L19_error)
24686         __Pyx_GOTREF(__pyx_t_8);
24687         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24688 
24689         /* "rasterio/_base.pyx":1438
24690  *         OCTDestroyCoordinateTransformation(transform)
24691  *         _safe_osr_release(src)
24692  *         _safe_osr_release(dst)             # <<<<<<<<<<<<<<
24693  *
24694  *
24695  */
24696         __pyx_t_8 = __pyx_f_8rasterio_5_base__safe_osr_release(__pyx_v_dst); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1438, __pyx_L19_error)
24697         __Pyx_GOTREF(__pyx_t_8);
24698         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24699       }
24700       if (PY_MAJOR_VERSION >= 3) {
24701         __Pyx_XGIVEREF(__pyx_t_20);
24702         __Pyx_XGIVEREF(__pyx_t_21);
24703         __Pyx_XGIVEREF(__pyx_t_22);
24704         __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
24705       }
24706       __Pyx_XGIVEREF(__pyx_t_17);
24707       __Pyx_XGIVEREF(__pyx_t_18);
24708       __Pyx_XGIVEREF(__pyx_t_19);
24709       __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19);
24710       __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
24711       __pyx_lineno = __pyx_t_15; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_16;
24712       goto __pyx_L1_error;
24713       __pyx_L19_error:;
24714       if (PY_MAJOR_VERSION >= 3) {
24715         __Pyx_XGIVEREF(__pyx_t_20);
24716         __Pyx_XGIVEREF(__pyx_t_21);
24717         __Pyx_XGIVEREF(__pyx_t_22);
24718         __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
24719       }
24720       __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
24721       __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
24722       __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
24723       __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
24724       goto __pyx_L1_error;
24725     }
24726     __pyx_L10_return: {
24727       __pyx_t_22 = __pyx_r;
24728       __pyx_r = 0;
24729 
24730       /* "rasterio/_base.pyx":1433
24731  *
24732  *     finally:
24733  *         CPLFree(x)             # <<<<<<<<<<<<<<
24734  *         CPLFree(y)
24735  *         CPLFree(z)
24736  */
24737       CPLFree(__pyx_v_x);
24738 
24739       /* "rasterio/_base.pyx":1434
24740  *     finally:
24741  *         CPLFree(x)
24742  *         CPLFree(y)             # <<<<<<<<<<<<<<
24743  *         CPLFree(z)
24744  *         OCTDestroyCoordinateTransformation(transform)
24745  */
24746       CPLFree(__pyx_v_y);
24747 
24748       /* "rasterio/_base.pyx":1435
24749  *         CPLFree(x)
24750  *         CPLFree(y)
24751  *         CPLFree(z)             # <<<<<<<<<<<<<<
24752  *         OCTDestroyCoordinateTransformation(transform)
24753  *         _safe_osr_release(src)
24754  */
24755       CPLFree(__pyx_v_z);
24756 
24757       /* "rasterio/_base.pyx":1436
24758  *         CPLFree(y)
24759  *         CPLFree(z)
24760  *         OCTDestroyCoordinateTransformation(transform)             # <<<<<<<<<<<<<<
24761  *         _safe_osr_release(src)
24762  *         _safe_osr_release(dst)
24763  */
24764       OCTDestroyCoordinateTransformation(__pyx_v_transform);
24765 
24766       /* "rasterio/_base.pyx":1437
24767  *         CPLFree(z)
24768  *         OCTDestroyCoordinateTransformation(transform)
24769  *         _safe_osr_release(src)             # <<<<<<<<<<<<<<
24770  *         _safe_osr_release(dst)
24771  *
24772  */
24773       __pyx_t_8 = __pyx_f_8rasterio_5_base__safe_osr_release(__pyx_v_src); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1437, __pyx_L1_error)
24774       __Pyx_GOTREF(__pyx_t_8);
24775       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24776 
24777       /* "rasterio/_base.pyx":1438
24778  *         OCTDestroyCoordinateTransformation(transform)
24779  *         _safe_osr_release(src)
24780  *         _safe_osr_release(dst)             # <<<<<<<<<<<<<<
24781  *
24782  *
24783  */
24784       __pyx_t_8 = __pyx_f_8rasterio_5_base__safe_osr_release(__pyx_v_dst); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1438, __pyx_L1_error)
24785       __Pyx_GOTREF(__pyx_t_8);
24786       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24787       __pyx_r = __pyx_t_22;
24788       __pyx_t_22 = 0;
24789       goto __pyx_L0;
24790     }
24791   }
24792 
24793   /* "rasterio/_base.pyx":1385
24794  *
24795  *
24796  * def _transform(src_crs, dst_crs, xs, ys, zs):             # <<<<<<<<<<<<<<
24797  *     """Transform input arrays from src to dst CRS."""
24798  *     cdef double *x = NULL
24799  */
24800 
24801   /* function exit code */
24802   __pyx_L1_error:;
24803   __Pyx_XDECREF(__pyx_t_7);
24804   __Pyx_XDECREF(__pyx_t_8);
24805   __Pyx_AddTraceback("rasterio._base._transform", __pyx_clineno, __pyx_lineno, __pyx_filename);
24806   __pyx_r = NULL;
24807   __pyx_L0:;
24808   __Pyx_XDECREF(__pyx_v_n);
24809   __Pyx_XDECREF(__pyx_v_res_xs);
24810   __Pyx_XDECREF(__pyx_v_res_ys);
24811   __Pyx_XDECREF(__pyx_v_res_zs);
24812   __Pyx_XGIVEREF(__pyx_r);
24813   __Pyx_RefNannyFinishContext();
24814   return __pyx_r;
24815 }
24816 
24817 /* "rasterio/_base.pyx":1441
24818  *
24819  *
24820  * cdef OGRSpatialReferenceH _osr_from_crs(object crs) except NULL:             # <<<<<<<<<<<<<<
24821  *     """Returns a reference to memory that must be deallocated
24822  *     by the caller."""
24823  */
24824 
__pyx_f_8rasterio_5_base__osr_from_crs(PyObject * __pyx_v_crs)24825 static OGRSpatialReferenceH __pyx_f_8rasterio_5_base__osr_from_crs(PyObject *__pyx_v_crs) {
24826   PyObject *__pyx_v_init = NULL;
24827   PyObject *__pyx_v_auth = NULL;
24828   PyObject *__pyx_v_val = NULL;
24829   PyObject *__pyx_v_proj = NULL;
24830   OGRSpatialReferenceH __pyx_v_osr;
24831   int __pyx_v_retval;
24832   PyObject *__pyx_v_exc = NULL;
24833   OGRSpatialReferenceH __pyx_r;
24834   __Pyx_RefNannyDeclarations
24835   PyObject *__pyx_t_1 = NULL;
24836   PyObject *__pyx_t_2 = NULL;
24837   PyObject *__pyx_t_3 = NULL;
24838   int __pyx_t_4;
24839   PyObject *__pyx_t_5 = NULL;
24840   PyObject *(*__pyx_t_6)(PyObject *);
24841   int __pyx_t_7;
24842   int __pyx_t_8;
24843   PyObject *__pyx_t_9 = NULL;
24844   int __pyx_t_10;
24845   PyObject *__pyx_t_11 = NULL;
24846   PyObject *__pyx_t_12 = NULL;
24847   PyObject *__pyx_t_13 = NULL;
24848   char const *__pyx_t_14;
24849   PyObject *__pyx_t_15 = NULL;
24850   PyObject *__pyx_t_16 = NULL;
24851   int __pyx_t_17;
24852   char const *__pyx_t_18;
24853   PyObject *__pyx_t_19 = NULL;
24854   PyObject *__pyx_t_20 = NULL;
24855   PyObject *__pyx_t_21 = NULL;
24856   PyObject *__pyx_t_22 = NULL;
24857   PyObject *__pyx_t_23 = NULL;
24858   PyObject *__pyx_t_24 = NULL;
24859   int __pyx_lineno = 0;
24860   const char *__pyx_filename = NULL;
24861   int __pyx_clineno = 0;
24862   __Pyx_RefNannySetupContext("_osr_from_crs", 0);
24863   __Pyx_INCREF(__pyx_v_crs);
24864 
24865   /* "rasterio/_base.pyx":1444
24866  *     """Returns a reference to memory that must be deallocated
24867  *     by the caller."""
24868  *     crs = CRS.from_user_input(crs)             # <<<<<<<<<<<<<<
24869  *
24870  *     # EPSG is a special case.
24871  */
24872   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CRS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1444, __pyx_L1_error)
24873   __Pyx_GOTREF(__pyx_t_2);
24874   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_from_user_input); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1444, __pyx_L1_error)
24875   __Pyx_GOTREF(__pyx_t_3);
24876   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
24877   __pyx_t_2 = NULL;
24878   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
24879     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
24880     if (likely(__pyx_t_2)) {
24881       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
24882       __Pyx_INCREF(__pyx_t_2);
24883       __Pyx_INCREF(function);
24884       __Pyx_DECREF_SET(__pyx_t_3, function);
24885     }
24886   }
24887   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_crs) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_crs);
24888   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
24889   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1444, __pyx_L1_error)
24890   __Pyx_GOTREF(__pyx_t_1);
24891   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24892   __Pyx_DECREF_SET(__pyx_v_crs, __pyx_t_1);
24893   __pyx_t_1 = 0;
24894 
24895   /* "rasterio/_base.pyx":1447
24896  *
24897  *     # EPSG is a special case.
24898  *     init = crs.get('init')             # <<<<<<<<<<<<<<
24899  *     if init:
24900  *         auth, val = init.strip().split(':')
24901  */
24902   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_crs, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1447, __pyx_L1_error)
24903   __Pyx_GOTREF(__pyx_t_3);
24904   __pyx_t_2 = NULL;
24905   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
24906     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
24907     if (likely(__pyx_t_2)) {
24908       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
24909       __Pyx_INCREF(__pyx_t_2);
24910       __Pyx_INCREF(function);
24911       __Pyx_DECREF_SET(__pyx_t_3, function);
24912     }
24913   }
24914   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_n_u_init) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_init);
24915   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
24916   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1447, __pyx_L1_error)
24917   __Pyx_GOTREF(__pyx_t_1);
24918   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24919   __pyx_v_init = __pyx_t_1;
24920   __pyx_t_1 = 0;
24921 
24922   /* "rasterio/_base.pyx":1448
24923  *     # EPSG is a special case.
24924  *     init = crs.get('init')
24925  *     if init:             # <<<<<<<<<<<<<<
24926  *         auth, val = init.strip().split(':')
24927  *
24928  */
24929   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_init); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1448, __pyx_L1_error)
24930   if (__pyx_t_4) {
24931 
24932     /* "rasterio/_base.pyx":1449
24933  *     init = crs.get('init')
24934  *     if init:
24935  *         auth, val = init.strip().split(':')             # <<<<<<<<<<<<<<
24936  *
24937  *         if not val or auth.upper() != 'EPSG':
24938  */
24939     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_init, __pyx_n_s_strip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1449, __pyx_L1_error)
24940     __Pyx_GOTREF(__pyx_t_2);
24941     __pyx_t_5 = NULL;
24942     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
24943       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
24944       if (likely(__pyx_t_5)) {
24945         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
24946         __Pyx_INCREF(__pyx_t_5);
24947         __Pyx_INCREF(function);
24948         __Pyx_DECREF_SET(__pyx_t_2, function);
24949       }
24950     }
24951     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
24952     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
24953     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1449, __pyx_L1_error)
24954     __Pyx_GOTREF(__pyx_t_3);
24955     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
24956     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1449, __pyx_L1_error)
24957     __Pyx_GOTREF(__pyx_t_2);
24958     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24959     __pyx_t_3 = NULL;
24960     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
24961       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
24962       if (likely(__pyx_t_3)) {
24963         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
24964         __Pyx_INCREF(__pyx_t_3);
24965         __Pyx_INCREF(function);
24966         __Pyx_DECREF_SET(__pyx_t_2, function);
24967       }
24968     }
24969     __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u__18) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u__18);
24970     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
24971     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1449, __pyx_L1_error)
24972     __Pyx_GOTREF(__pyx_t_1);
24973     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
24974     if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
24975       PyObject* sequence = __pyx_t_1;
24976       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
24977       if (unlikely(size != 2)) {
24978         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
24979         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
24980         __PYX_ERR(0, 1449, __pyx_L1_error)
24981       }
24982       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24983       if (likely(PyTuple_CheckExact(sequence))) {
24984         __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
24985         __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
24986       } else {
24987         __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
24988         __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
24989       }
24990       __Pyx_INCREF(__pyx_t_2);
24991       __Pyx_INCREF(__pyx_t_3);
24992       #else
24993       __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1449, __pyx_L1_error)
24994       __Pyx_GOTREF(__pyx_t_2);
24995       __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1449, __pyx_L1_error)
24996       __Pyx_GOTREF(__pyx_t_3);
24997       #endif
24998       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24999     } else {
25000       Py_ssize_t index = -1;
25001       __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1449, __pyx_L1_error)
25002       __Pyx_GOTREF(__pyx_t_5);
25003       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25004       __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
25005       index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
25006       __Pyx_GOTREF(__pyx_t_2);
25007       index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
25008       __Pyx_GOTREF(__pyx_t_3);
25009       if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1449, __pyx_L1_error)
25010       __pyx_t_6 = NULL;
25011       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25012       goto __pyx_L5_unpacking_done;
25013       __pyx_L4_unpacking_failed:;
25014       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25015       __pyx_t_6 = NULL;
25016       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
25017       __PYX_ERR(0, 1449, __pyx_L1_error)
25018       __pyx_L5_unpacking_done:;
25019     }
25020     __pyx_v_auth = __pyx_t_2;
25021     __pyx_t_2 = 0;
25022     __pyx_v_val = __pyx_t_3;
25023     __pyx_t_3 = 0;
25024 
25025     /* "rasterio/_base.pyx":1451
25026  *         auth, val = init.strip().split(':')
25027  *
25028  *         if not val or auth.upper() != 'EPSG':             # <<<<<<<<<<<<<<
25029  *             raise CRSError("Invalid CRS: {!r}".format(crs))
25030  *         proj = 'EPSG:{}'.format(val).encode('utf-8')
25031  */
25032     __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1451, __pyx_L1_error)
25033     __pyx_t_8 = ((!__pyx_t_7) != 0);
25034     if (!__pyx_t_8) {
25035     } else {
25036       __pyx_t_4 = __pyx_t_8;
25037       goto __pyx_L7_bool_binop_done;
25038     }
25039     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_auth, __pyx_n_s_upper); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1451, __pyx_L1_error)
25040     __Pyx_GOTREF(__pyx_t_3);
25041     __pyx_t_2 = NULL;
25042     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
25043       __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
25044       if (likely(__pyx_t_2)) {
25045         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
25046         __Pyx_INCREF(__pyx_t_2);
25047         __Pyx_INCREF(function);
25048         __Pyx_DECREF_SET(__pyx_t_3, function);
25049       }
25050     }
25051     __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
25052     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
25053     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1451, __pyx_L1_error)
25054     __Pyx_GOTREF(__pyx_t_1);
25055     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25056     __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_EPSG, Py_NE)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1451, __pyx_L1_error)
25057     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25058     __pyx_t_4 = __pyx_t_8;
25059     __pyx_L7_bool_binop_done:;
25060     if (unlikely(__pyx_t_4)) {
25061 
25062       /* "rasterio/_base.pyx":1452
25063  *
25064  *         if not val or auth.upper() != 'EPSG':
25065  *             raise CRSError("Invalid CRS: {!r}".format(crs))             # <<<<<<<<<<<<<<
25066  *         proj = 'EPSG:{}'.format(val).encode('utf-8')
25067  *     else:
25068  */
25069       __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CRSError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1452, __pyx_L1_error)
25070       __Pyx_GOTREF(__pyx_t_3);
25071       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Invalid_CRS_r, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1452, __pyx_L1_error)
25072       __Pyx_GOTREF(__pyx_t_5);
25073       __pyx_t_9 = NULL;
25074       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
25075         __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
25076         if (likely(__pyx_t_9)) {
25077           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
25078           __Pyx_INCREF(__pyx_t_9);
25079           __Pyx_INCREF(function);
25080           __Pyx_DECREF_SET(__pyx_t_5, function);
25081         }
25082       }
25083       __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_v_crs) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_crs);
25084       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
25085       if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1452, __pyx_L1_error)
25086       __Pyx_GOTREF(__pyx_t_2);
25087       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25088       __pyx_t_5 = NULL;
25089       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
25090         __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
25091         if (likely(__pyx_t_5)) {
25092           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
25093           __Pyx_INCREF(__pyx_t_5);
25094           __Pyx_INCREF(function);
25095           __Pyx_DECREF_SET(__pyx_t_3, function);
25096         }
25097       }
25098       __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
25099       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
25100       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25101       if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1452, __pyx_L1_error)
25102       __Pyx_GOTREF(__pyx_t_1);
25103       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25104       __Pyx_Raise(__pyx_t_1, 0, 0, 0);
25105       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25106       __PYX_ERR(0, 1452, __pyx_L1_error)
25107 
25108       /* "rasterio/_base.pyx":1451
25109  *         auth, val = init.strip().split(':')
25110  *
25111  *         if not val or auth.upper() != 'EPSG':             # <<<<<<<<<<<<<<
25112  *             raise CRSError("Invalid CRS: {!r}".format(crs))
25113  *         proj = 'EPSG:{}'.format(val).encode('utf-8')
25114  */
25115     }
25116 
25117     /* "rasterio/_base.pyx":1453
25118  *         if not val or auth.upper() != 'EPSG':
25119  *             raise CRSError("Invalid CRS: {!r}".format(crs))
25120  *         proj = 'EPSG:{}'.format(val).encode('utf-8')             # <<<<<<<<<<<<<<
25121  *     else:
25122  *         proj = crs.to_string().encode('utf-8')
25123  */
25124     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_EPSG_2, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1453, __pyx_L1_error)
25125     __Pyx_GOTREF(__pyx_t_2);
25126     __pyx_t_5 = NULL;
25127     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
25128       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
25129       if (likely(__pyx_t_5)) {
25130         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
25131         __Pyx_INCREF(__pyx_t_5);
25132         __Pyx_INCREF(function);
25133         __Pyx_DECREF_SET(__pyx_t_2, function);
25134       }
25135     }
25136     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_val) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_val);
25137     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
25138     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1453, __pyx_L1_error)
25139     __Pyx_GOTREF(__pyx_t_3);
25140     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25141     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1453, __pyx_L1_error)
25142     __Pyx_GOTREF(__pyx_t_2);
25143     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25144     __pyx_t_3 = NULL;
25145     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
25146       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
25147       if (likely(__pyx_t_3)) {
25148         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
25149         __Pyx_INCREF(__pyx_t_3);
25150         __Pyx_INCREF(function);
25151         __Pyx_DECREF_SET(__pyx_t_2, function);
25152       }
25153     }
25154     __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_utf_8);
25155     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
25156     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1453, __pyx_L1_error)
25157     __Pyx_GOTREF(__pyx_t_1);
25158     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25159     __pyx_v_proj = __pyx_t_1;
25160     __pyx_t_1 = 0;
25161 
25162     /* "rasterio/_base.pyx":1448
25163  *     # EPSG is a special case.
25164  *     init = crs.get('init')
25165  *     if init:             # <<<<<<<<<<<<<<
25166  *         auth, val = init.strip().split(':')
25167  *
25168  */
25169     goto __pyx_L3;
25170   }
25171 
25172   /* "rasterio/_base.pyx":1455
25173  *         proj = 'EPSG:{}'.format(val).encode('utf-8')
25174  *     else:
25175  *         proj = crs.to_string().encode('utf-8')             # <<<<<<<<<<<<<<
25176  *         log.debug("PROJ.4 to be imported: %r", proj)
25177  *
25178  */
25179   /*else*/ {
25180     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_crs, __pyx_n_s_to_string); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1455, __pyx_L1_error)
25181     __Pyx_GOTREF(__pyx_t_3);
25182     __pyx_t_5 = NULL;
25183     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
25184       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
25185       if (likely(__pyx_t_5)) {
25186         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
25187         __Pyx_INCREF(__pyx_t_5);
25188         __Pyx_INCREF(function);
25189         __Pyx_DECREF_SET(__pyx_t_3, function);
25190       }
25191     }
25192     __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
25193     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
25194     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1455, __pyx_L1_error)
25195     __Pyx_GOTREF(__pyx_t_2);
25196     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25197     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1455, __pyx_L1_error)
25198     __Pyx_GOTREF(__pyx_t_3);
25199     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25200     __pyx_t_2 = NULL;
25201     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
25202       __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
25203       if (likely(__pyx_t_2)) {
25204         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
25205         __Pyx_INCREF(__pyx_t_2);
25206         __Pyx_INCREF(function);
25207         __Pyx_DECREF_SET(__pyx_t_3, function);
25208       }
25209     }
25210     __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_utf_8);
25211     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
25212     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1455, __pyx_L1_error)
25213     __Pyx_GOTREF(__pyx_t_1);
25214     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25215     __pyx_v_proj = __pyx_t_1;
25216     __pyx_t_1 = 0;
25217 
25218     /* "rasterio/_base.pyx":1456
25219  *     else:
25220  *         proj = crs.to_string().encode('utf-8')
25221  *         log.debug("PROJ.4 to be imported: %r", proj)             # <<<<<<<<<<<<<<
25222  *
25223  *     cdef OGRSpatialReferenceH osr = OSRNewSpatialReference(NULL)
25224  */
25225     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1456, __pyx_L1_error)
25226     __Pyx_GOTREF(__pyx_t_3);
25227     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1456, __pyx_L1_error)
25228     __Pyx_GOTREF(__pyx_t_2);
25229     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25230     __pyx_t_3 = NULL;
25231     __pyx_t_10 = 0;
25232     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
25233       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
25234       if (likely(__pyx_t_3)) {
25235         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
25236         __Pyx_INCREF(__pyx_t_3);
25237         __Pyx_INCREF(function);
25238         __Pyx_DECREF_SET(__pyx_t_2, function);
25239         __pyx_t_10 = 1;
25240       }
25241     }
25242     #if CYTHON_FAST_PYCALL
25243     if (PyFunction_Check(__pyx_t_2)) {
25244       PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_PROJ_4_to_be_imported_r, __pyx_v_proj};
25245       __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1456, __pyx_L1_error)
25246       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
25247       __Pyx_GOTREF(__pyx_t_1);
25248     } else
25249     #endif
25250     #if CYTHON_FAST_PYCCALL
25251     if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
25252       PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_PROJ_4_to_be_imported_r, __pyx_v_proj};
25253       __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1456, __pyx_L1_error)
25254       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
25255       __Pyx_GOTREF(__pyx_t_1);
25256     } else
25257     #endif
25258     {
25259       __pyx_t_5 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1456, __pyx_L1_error)
25260       __Pyx_GOTREF(__pyx_t_5);
25261       if (__pyx_t_3) {
25262         __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
25263       }
25264       __Pyx_INCREF(__pyx_kp_u_PROJ_4_to_be_imported_r);
25265       __Pyx_GIVEREF(__pyx_kp_u_PROJ_4_to_be_imported_r);
25266       PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_10, __pyx_kp_u_PROJ_4_to_be_imported_r);
25267       __Pyx_INCREF(__pyx_v_proj);
25268       __Pyx_GIVEREF(__pyx_v_proj);
25269       PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_10, __pyx_v_proj);
25270       __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1456, __pyx_L1_error)
25271       __Pyx_GOTREF(__pyx_t_1);
25272       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25273     }
25274     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25275     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25276   }
25277   __pyx_L3:;
25278 
25279   /* "rasterio/_base.pyx":1458
25280  *         log.debug("PROJ.4 to be imported: %r", proj)
25281  *
25282  *     cdef OGRSpatialReferenceH osr = OSRNewSpatialReference(NULL)             # <<<<<<<<<<<<<<
25283  *     try:
25284  *         retval = exc_wrap_int(OSRSetFromUserInput(osr, <const char *>proj))
25285  */
25286   __pyx_v_osr = OSRNewSpatialReference(NULL);
25287 
25288   /* "rasterio/_base.pyx":1459
25289  *
25290  *     cdef OGRSpatialReferenceH osr = OSRNewSpatialReference(NULL)
25291  *     try:             # <<<<<<<<<<<<<<
25292  *         retval = exc_wrap_int(OSRSetFromUserInput(osr, <const char *>proj))
25293  *         if retval:
25294  */
25295   {
25296     __Pyx_PyThreadState_declare
25297     __Pyx_PyThreadState_assign
25298     __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
25299     __Pyx_XGOTREF(__pyx_t_11);
25300     __Pyx_XGOTREF(__pyx_t_12);
25301     __Pyx_XGOTREF(__pyx_t_13);
25302     /*try:*/ {
25303 
25304       /* "rasterio/_base.pyx":1460
25305  *     cdef OGRSpatialReferenceH osr = OSRNewSpatialReference(NULL)
25306  *     try:
25307  *         retval = exc_wrap_int(OSRSetFromUserInput(osr, <const char *>proj))             # <<<<<<<<<<<<<<
25308  *         if retval:
25309  *             _safe_osr_release(osr)
25310  */
25311       __pyx_t_14 = __Pyx_PyObject_AsString(__pyx_v_proj); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) __PYX_ERR(0, 1460, __pyx_L9_error)
25312       __pyx_t_10 = __pyx_f_8rasterio_4_err_exc_wrap_int(OSRSetFromUserInput(__pyx_v_osr, ((char const *)__pyx_t_14))); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 1460, __pyx_L9_error)
25313       __pyx_v_retval = __pyx_t_10;
25314 
25315       /* "rasterio/_base.pyx":1461
25316  *     try:
25317  *         retval = exc_wrap_int(OSRSetFromUserInput(osr, <const char *>proj))
25318  *         if retval:             # <<<<<<<<<<<<<<
25319  *             _safe_osr_release(osr)
25320  *             raise CRSError("Invalid CRS: {!r}".format(crs))
25321  */
25322       __pyx_t_4 = (__pyx_v_retval != 0);
25323       if (unlikely(__pyx_t_4)) {
25324 
25325         /* "rasterio/_base.pyx":1462
25326  *         retval = exc_wrap_int(OSRSetFromUserInput(osr, <const char *>proj))
25327  *         if retval:
25328  *             _safe_osr_release(osr)             # <<<<<<<<<<<<<<
25329  *             raise CRSError("Invalid CRS: {!r}".format(crs))
25330  *     except CPLE_BaseError as exc:
25331  */
25332         __pyx_t_1 = __pyx_f_8rasterio_5_base__safe_osr_release(__pyx_v_osr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1462, __pyx_L9_error)
25333         __Pyx_GOTREF(__pyx_t_1);
25334         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25335 
25336         /* "rasterio/_base.pyx":1463
25337  *         if retval:
25338  *             _safe_osr_release(osr)
25339  *             raise CRSError("Invalid CRS: {!r}".format(crs))             # <<<<<<<<<<<<<<
25340  *     except CPLE_BaseError as exc:
25341  *         _safe_osr_release(osr)
25342  */
25343         __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CRSError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1463, __pyx_L9_error)
25344         __Pyx_GOTREF(__pyx_t_2);
25345         __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Invalid_CRS_r, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1463, __pyx_L9_error)
25346         __Pyx_GOTREF(__pyx_t_3);
25347         __pyx_t_9 = NULL;
25348         if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
25349           __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
25350           if (likely(__pyx_t_9)) {
25351             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
25352             __Pyx_INCREF(__pyx_t_9);
25353             __Pyx_INCREF(function);
25354             __Pyx_DECREF_SET(__pyx_t_3, function);
25355           }
25356         }
25357         __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_9, __pyx_v_crs) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_crs);
25358         __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
25359         if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1463, __pyx_L9_error)
25360         __Pyx_GOTREF(__pyx_t_5);
25361         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25362         __pyx_t_3 = NULL;
25363         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
25364           __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
25365           if (likely(__pyx_t_3)) {
25366             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
25367             __Pyx_INCREF(__pyx_t_3);
25368             __Pyx_INCREF(function);
25369             __Pyx_DECREF_SET(__pyx_t_2, function);
25370           }
25371         }
25372         __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
25373         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
25374         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25375         if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1463, __pyx_L9_error)
25376         __Pyx_GOTREF(__pyx_t_1);
25377         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25378         __Pyx_Raise(__pyx_t_1, 0, 0, 0);
25379         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25380         __PYX_ERR(0, 1463, __pyx_L9_error)
25381 
25382         /* "rasterio/_base.pyx":1461
25383  *     try:
25384  *         retval = exc_wrap_int(OSRSetFromUserInput(osr, <const char *>proj))
25385  *         if retval:             # <<<<<<<<<<<<<<
25386  *             _safe_osr_release(osr)
25387  *             raise CRSError("Invalid CRS: {!r}".format(crs))
25388  */
25389       }
25390 
25391       /* "rasterio/_base.pyx":1459
25392  *
25393  *     cdef OGRSpatialReferenceH osr = OSRNewSpatialReference(NULL)
25394  *     try:             # <<<<<<<<<<<<<<
25395  *         retval = exc_wrap_int(OSRSetFromUserInput(osr, <const char *>proj))
25396  *         if retval:
25397  */
25398     }
25399 
25400     /* "rasterio/_base.pyx":1468
25401  *         raise CRSError(str(exc))
25402  *     else:
25403  *         if not gdal_version().startswith("3"):             # <<<<<<<<<<<<<<
25404  *             exc_wrap_int(OSRMorphFromESRI(osr))
25405  *         osr_set_traditional_axis_mapping_strategy(osr)
25406  */
25407     /*else:*/ {
25408       __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_gdal_version); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1468, __pyx_L11_except_error)
25409       __Pyx_GOTREF(__pyx_t_5);
25410       __pyx_t_3 = NULL;
25411       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
25412         __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
25413         if (likely(__pyx_t_3)) {
25414           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
25415           __Pyx_INCREF(__pyx_t_3);
25416           __Pyx_INCREF(function);
25417           __Pyx_DECREF_SET(__pyx_t_5, function);
25418         }
25419       }
25420       __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
25421       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
25422       if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1468, __pyx_L11_except_error)
25423       __Pyx_GOTREF(__pyx_t_2);
25424       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25425       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_startswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1468, __pyx_L11_except_error)
25426       __Pyx_GOTREF(__pyx_t_5);
25427       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25428       __pyx_t_2 = NULL;
25429       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
25430         __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
25431         if (likely(__pyx_t_2)) {
25432           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
25433           __Pyx_INCREF(__pyx_t_2);
25434           __Pyx_INCREF(function);
25435           __Pyx_DECREF_SET(__pyx_t_5, function);
25436         }
25437       }
25438       __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_kp_u_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_3);
25439       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
25440       if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1468, __pyx_L11_except_error)
25441       __Pyx_GOTREF(__pyx_t_1);
25442       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25443       __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1468, __pyx_L11_except_error)
25444       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25445       __pyx_t_8 = ((!__pyx_t_4) != 0);
25446       if (__pyx_t_8) {
25447 
25448         /* "rasterio/_base.pyx":1469
25449  *     else:
25450  *         if not gdal_version().startswith("3"):
25451  *             exc_wrap_int(OSRMorphFromESRI(osr))             # <<<<<<<<<<<<<<
25452  *         osr_set_traditional_axis_mapping_strategy(osr)
25453  *         return osr
25454  */
25455         __pyx_t_10 = __pyx_f_8rasterio_4_err_exc_wrap_int(OSRMorphFromESRI(__pyx_v_osr)); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 1469, __pyx_L11_except_error)
25456 
25457         /* "rasterio/_base.pyx":1468
25458  *         raise CRSError(str(exc))
25459  *     else:
25460  *         if not gdal_version().startswith("3"):             # <<<<<<<<<<<<<<
25461  *             exc_wrap_int(OSRMorphFromESRI(osr))
25462  *         osr_set_traditional_axis_mapping_strategy(osr)
25463  */
25464       }
25465 
25466       /* "rasterio/_base.pyx":1470
25467  *         if not gdal_version().startswith("3"):
25468  *             exc_wrap_int(OSRMorphFromESRI(osr))
25469  *         osr_set_traditional_axis_mapping_strategy(osr)             # <<<<<<<<<<<<<<
25470  *         return osr
25471  *
25472  */
25473       __pyx_f_8rasterio_5_shim_osr_set_traditional_axis_mapping_strategy(__pyx_v_osr);
25474 
25475       /* "rasterio/_base.pyx":1471
25476  *             exc_wrap_int(OSRMorphFromESRI(osr))
25477  *         osr_set_traditional_axis_mapping_strategy(osr)
25478  *         return osr             # <<<<<<<<<<<<<<
25479  *
25480  *
25481  */
25482       __pyx_r = __pyx_v_osr;
25483       goto __pyx_L12_except_return;
25484     }
25485     __pyx_L9_error:;
25486     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
25487     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
25488     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
25489     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
25490     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
25491 
25492     /* "rasterio/_base.pyx":1464
25493  *             _safe_osr_release(osr)
25494  *             raise CRSError("Invalid CRS: {!r}".format(crs))
25495  *     except CPLE_BaseError as exc:             # <<<<<<<<<<<<<<
25496  *         _safe_osr_release(osr)
25497  *         raise CRSError(str(exc))
25498  */
25499     __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_2);
25500     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CPLE_BaseError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1464, __pyx_L11_except_error)
25501     __Pyx_GOTREF(__pyx_t_3);
25502     __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_3);
25503     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25504     __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_2);
25505     __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_2 = 0;
25506     if (__pyx_t_10) {
25507       __Pyx_AddTraceback("rasterio._base._osr_from_crs", __pyx_clineno, __pyx_lineno, __pyx_filename);
25508       if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(0, 1464, __pyx_L11_except_error)
25509       __Pyx_GOTREF(__pyx_t_2);
25510       __Pyx_GOTREF(__pyx_t_5);
25511       __Pyx_GOTREF(__pyx_t_1);
25512       __Pyx_INCREF(__pyx_t_5);
25513       __pyx_v_exc = __pyx_t_5;
25514       /*try:*/ {
25515 
25516         /* "rasterio/_base.pyx":1465
25517  *             raise CRSError("Invalid CRS: {!r}".format(crs))
25518  *     except CPLE_BaseError as exc:
25519  *         _safe_osr_release(osr)             # <<<<<<<<<<<<<<
25520  *         raise CRSError(str(exc))
25521  *     else:
25522  */
25523         __pyx_t_3 = __pyx_f_8rasterio_5_base__safe_osr_release(__pyx_v_osr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1465, __pyx_L22_error)
25524         __Pyx_GOTREF(__pyx_t_3);
25525         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25526 
25527         /* "rasterio/_base.pyx":1466
25528  *     except CPLE_BaseError as exc:
25529  *         _safe_osr_release(osr)
25530  *         raise CRSError(str(exc))             # <<<<<<<<<<<<<<
25531  *     else:
25532  *         if not gdal_version().startswith("3"):
25533  */
25534         __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_CRSError); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1466, __pyx_L22_error)
25535         __Pyx_GOTREF(__pyx_t_9);
25536         __pyx_t_15 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_exc); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1466, __pyx_L22_error)
25537         __Pyx_GOTREF(__pyx_t_15);
25538         __pyx_t_16 = NULL;
25539         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
25540           __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_9);
25541           if (likely(__pyx_t_16)) {
25542             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
25543             __Pyx_INCREF(__pyx_t_16);
25544             __Pyx_INCREF(function);
25545             __Pyx_DECREF_SET(__pyx_t_9, function);
25546           }
25547         }
25548         __pyx_t_3 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_16, __pyx_t_15) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_15);
25549         __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
25550         __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
25551         if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1466, __pyx_L22_error)
25552         __Pyx_GOTREF(__pyx_t_3);
25553         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
25554         __Pyx_Raise(__pyx_t_3, 0, 0, 0);
25555         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25556         __PYX_ERR(0, 1466, __pyx_L22_error)
25557       }
25558 
25559       /* "rasterio/_base.pyx":1464
25560  *             _safe_osr_release(osr)
25561  *             raise CRSError("Invalid CRS: {!r}".format(crs))
25562  *     except CPLE_BaseError as exc:             # <<<<<<<<<<<<<<
25563  *         _safe_osr_release(osr)
25564  *         raise CRSError(str(exc))
25565  */
25566       /*finally:*/ {
25567         __pyx_L22_error:;
25568         /*exception exit:*/{
25569           __Pyx_PyThreadState_declare
25570           __Pyx_PyThreadState_assign
25571           __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
25572           __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
25573           __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
25574           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
25575           __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
25576           if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24);
25577           if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
25578           __Pyx_XGOTREF(__pyx_t_19);
25579           __Pyx_XGOTREF(__pyx_t_20);
25580           __Pyx_XGOTREF(__pyx_t_21);
25581           __Pyx_XGOTREF(__pyx_t_22);
25582           __Pyx_XGOTREF(__pyx_t_23);
25583           __Pyx_XGOTREF(__pyx_t_24);
25584           __pyx_t_10 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_18 = __pyx_filename;
25585           {
25586             __Pyx_DECREF(__pyx_v_exc);
25587             __pyx_v_exc = NULL;
25588           }
25589           if (PY_MAJOR_VERSION >= 3) {
25590             __Pyx_XGIVEREF(__pyx_t_22);
25591             __Pyx_XGIVEREF(__pyx_t_23);
25592             __Pyx_XGIVEREF(__pyx_t_24);
25593             __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24);
25594           }
25595           __Pyx_XGIVEREF(__pyx_t_19);
25596           __Pyx_XGIVEREF(__pyx_t_20);
25597           __Pyx_XGIVEREF(__pyx_t_21);
25598           __Pyx_ErrRestore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
25599           __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
25600           __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_18;
25601           goto __pyx_L11_except_error;
25602         }
25603       }
25604     }
25605     goto __pyx_L11_except_error;
25606     __pyx_L11_except_error:;
25607 
25608     /* "rasterio/_base.pyx":1459
25609  *
25610  *     cdef OGRSpatialReferenceH osr = OSRNewSpatialReference(NULL)
25611  *     try:             # <<<<<<<<<<<<<<
25612  *         retval = exc_wrap_int(OSRSetFromUserInput(osr, <const char *>proj))
25613  *         if retval:
25614  */
25615     __Pyx_XGIVEREF(__pyx_t_11);
25616     __Pyx_XGIVEREF(__pyx_t_12);
25617     __Pyx_XGIVEREF(__pyx_t_13);
25618     __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
25619     goto __pyx_L1_error;
25620     __pyx_L12_except_return:;
25621     __Pyx_XGIVEREF(__pyx_t_11);
25622     __Pyx_XGIVEREF(__pyx_t_12);
25623     __Pyx_XGIVEREF(__pyx_t_13);
25624     __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
25625     goto __pyx_L0;
25626   }
25627 
25628   /* "rasterio/_base.pyx":1441
25629  *
25630  *
25631  * cdef OGRSpatialReferenceH _osr_from_crs(object crs) except NULL:             # <<<<<<<<<<<<<<
25632  *     """Returns a reference to memory that must be deallocated
25633  *     by the caller."""
25634  */
25635 
25636   /* function exit code */
25637   __pyx_L1_error:;
25638   __Pyx_XDECREF(__pyx_t_1);
25639   __Pyx_XDECREF(__pyx_t_2);
25640   __Pyx_XDECREF(__pyx_t_3);
25641   __Pyx_XDECREF(__pyx_t_5);
25642   __Pyx_XDECREF(__pyx_t_9);
25643   __Pyx_XDECREF(__pyx_t_15);
25644   __Pyx_XDECREF(__pyx_t_16);
25645   __Pyx_AddTraceback("rasterio._base._osr_from_crs", __pyx_clineno, __pyx_lineno, __pyx_filename);
25646   __pyx_r = NULL;
25647   __pyx_L0:;
25648   __Pyx_XDECREF(__pyx_v_init);
25649   __Pyx_XDECREF(__pyx_v_auth);
25650   __Pyx_XDECREF(__pyx_v_val);
25651   __Pyx_XDECREF(__pyx_v_proj);
25652   __Pyx_XDECREF(__pyx_v_exc);
25653   __Pyx_XDECREF(__pyx_v_crs);
25654   __Pyx_RefNannyFinishContext();
25655   return __pyx_r;
25656 }
25657 
25658 /* "rasterio/_base.pyx":1474
25659  *
25660  *
25661  * cdef _safe_osr_release(OGRSpatialReferenceH srs):             # <<<<<<<<<<<<<<
25662  *     """Wrapper to handle OSR release when NULL."""
25663  *
25664  */
25665 
__pyx_f_8rasterio_5_base__safe_osr_release(OGRSpatialReferenceH __pyx_v_srs)25666 static PyObject *__pyx_f_8rasterio_5_base__safe_osr_release(OGRSpatialReferenceH __pyx_v_srs) {
25667   PyObject *__pyx_r = NULL;
25668   __Pyx_RefNannyDeclarations
25669   int __pyx_t_1;
25670   __Pyx_RefNannySetupContext("_safe_osr_release", 0);
25671 
25672   /* "rasterio/_base.pyx":1477
25673  *     """Wrapper to handle OSR release when NULL."""
25674  *
25675  *     if srs != NULL:             # <<<<<<<<<<<<<<
25676  *         OSRRelease(srs)
25677  *     srs = NULL
25678  */
25679   __pyx_t_1 = ((__pyx_v_srs != NULL) != 0);
25680   if (__pyx_t_1) {
25681 
25682     /* "rasterio/_base.pyx":1478
25683  *
25684  *     if srs != NULL:
25685  *         OSRRelease(srs)             # <<<<<<<<<<<<<<
25686  *     srs = NULL
25687  *
25688  */
25689     OSRRelease(__pyx_v_srs);
25690 
25691     /* "rasterio/_base.pyx":1477
25692  *     """Wrapper to handle OSR release when NULL."""
25693  *
25694  *     if srs != NULL:             # <<<<<<<<<<<<<<
25695  *         OSRRelease(srs)
25696  *     srs = NULL
25697  */
25698   }
25699 
25700   /* "rasterio/_base.pyx":1479
25701  *     if srs != NULL:
25702  *         OSRRelease(srs)
25703  *     srs = NULL             # <<<<<<<<<<<<<<
25704  *
25705  *
25706  */
25707   __pyx_v_srs = NULL;
25708 
25709   /* "rasterio/_base.pyx":1474
25710  *
25711  *
25712  * cdef _safe_osr_release(OGRSpatialReferenceH srs):             # <<<<<<<<<<<<<<
25713  *     """Wrapper to handle OSR release when NULL."""
25714  *
25715  */
25716 
25717   /* function exit code */
25718   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
25719   __Pyx_XGIVEREF(__pyx_r);
25720   __Pyx_RefNannyFinishContext();
25721   return __pyx_r;
25722 }
25723 
25724 /* "rasterio/_base.pyx":1482
25725  *
25726  *
25727  * def _can_create_osr(crs):             # <<<<<<<<<<<<<<
25728  *     """Evaluate if a valid OGRSpatialReference can be created from crs.
25729  *
25730  */
25731 
25732 /* Python wrapper */
25733 static PyObject *__pyx_pw_8rasterio_5_base_17_can_create_osr(PyObject *__pyx_self, PyObject *__pyx_v_crs); /*proto*/
25734 static char __pyx_doc_8rasterio_5_base_16_can_create_osr[] = "Evaluate if a valid OGRSpatialReference can be created from crs.\n\n    Specifically, it must not be None or an empty dict or string.\n\n    Parameters\n    ----------\n    crs: Source coordinate reference system, in rasterio dict format.\n\n    Returns\n    -------\n    out: bool\n        True if source coordinate reference appears valid.\n    ";
25735 static PyMethodDef __pyx_mdef_8rasterio_5_base_17_can_create_osr = {"_can_create_osr", (PyCFunction)__pyx_pw_8rasterio_5_base_17_can_create_osr, METH_O, __pyx_doc_8rasterio_5_base_16_can_create_osr};
__pyx_pw_8rasterio_5_base_17_can_create_osr(PyObject * __pyx_self,PyObject * __pyx_v_crs)25736 static PyObject *__pyx_pw_8rasterio_5_base_17_can_create_osr(PyObject *__pyx_self, PyObject *__pyx_v_crs) {
25737   PyObject *__pyx_r = 0;
25738   __Pyx_RefNannyDeclarations
25739   __Pyx_RefNannySetupContext("_can_create_osr (wrapper)", 0);
25740   __pyx_r = __pyx_pf_8rasterio_5_base_16_can_create_osr(__pyx_self, ((PyObject *)__pyx_v_crs));
25741 
25742   /* function exit code */
25743   __Pyx_RefNannyFinishContext();
25744   return __pyx_r;
25745 }
25746 
__pyx_pf_8rasterio_5_base_16_can_create_osr(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_crs)25747 static PyObject *__pyx_pf_8rasterio_5_base_16_can_create_osr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_crs) {
25748   char *__pyx_v_wkt;
25749   OGRSpatialReferenceH __pyx_v_osr;
25750   PyObject *__pyx_r = NULL;
25751   __Pyx_RefNannyDeclarations
25752   PyObject *__pyx_t_1 = NULL;
25753   PyObject *__pyx_t_2 = NULL;
25754   PyObject *__pyx_t_3 = NULL;
25755   OGRSpatialReferenceH __pyx_t_4;
25756   PyObject *__pyx_t_5 = NULL;
25757   int __pyx_t_6;
25758   PyObject *__pyx_t_7 = NULL;
25759   PyObject *__pyx_t_8 = NULL;
25760   PyObject *__pyx_t_9 = NULL;
25761   int __pyx_t_10;
25762   int __pyx_t_11;
25763   char const *__pyx_t_12;
25764   PyObject *__pyx_t_13 = NULL;
25765   PyObject *__pyx_t_14 = NULL;
25766   PyObject *__pyx_t_15 = NULL;
25767   int __pyx_lineno = 0;
25768   const char *__pyx_filename = NULL;
25769   int __pyx_clineno = 0;
25770   __Pyx_RefNannySetupContext("_can_create_osr", 0);
25771 
25772   /* "rasterio/_base.pyx":1497
25773  *     """
25774  *
25775  *     cdef char *wkt = NULL             # <<<<<<<<<<<<<<
25776  *     cdef OGRSpatialReferenceH osr = NULL
25777  *
25778  */
25779   __pyx_v_wkt = NULL;
25780 
25781   /* "rasterio/_base.pyx":1498
25782  *
25783  *     cdef char *wkt = NULL
25784  *     cdef OGRSpatialReferenceH osr = NULL             # <<<<<<<<<<<<<<
25785  *
25786  *     try:
25787  */
25788   __pyx_v_osr = NULL;
25789 
25790   /* "rasterio/_base.pyx":1500
25791  *     cdef OGRSpatialReferenceH osr = NULL
25792  *
25793  *     try:             # <<<<<<<<<<<<<<
25794  *         # Note: _osr_from_crs() has "except NULL" in its signature.
25795  *         # It raises, it does not return NULL.
25796  */
25797   /*try:*/ {
25798     {
25799       __Pyx_PyThreadState_declare
25800       __Pyx_PyThreadState_assign
25801       __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
25802       __Pyx_XGOTREF(__pyx_t_1);
25803       __Pyx_XGOTREF(__pyx_t_2);
25804       __Pyx_XGOTREF(__pyx_t_3);
25805       /*try:*/ {
25806 
25807         /* "rasterio/_base.pyx":1503
25808  *         # Note: _osr_from_crs() has "except NULL" in its signature.
25809  *         # It raises, it does not return NULL.
25810  *         osr = _osr_from_crs(crs)             # <<<<<<<<<<<<<<
25811  *         OSRExportToWkt(osr, &wkt)
25812  *
25813  */
25814         __pyx_t_4 = __pyx_f_8rasterio_5_base__osr_from_crs(__pyx_v_crs); if (unlikely(__pyx_t_4 == ((OGRSpatialReferenceH)NULL))) __PYX_ERR(0, 1503, __pyx_L6_error)
25815         __pyx_v_osr = __pyx_t_4;
25816 
25817         /* "rasterio/_base.pyx":1504
25818  *         # It raises, it does not return NULL.
25819  *         osr = _osr_from_crs(crs)
25820  *         OSRExportToWkt(osr, &wkt)             # <<<<<<<<<<<<<<
25821  *
25822  *         # If input was empty, WKT can be too; otherwise the conversion
25823  */
25824         (void)(OSRExportToWkt(__pyx_v_osr, (&__pyx_v_wkt)));
25825 
25826         /* "rasterio/_base.pyx":1508
25827  *         # If input was empty, WKT can be too; otherwise the conversion
25828  *         # didn't work properly and indicates an error.
25829  *         return wkt != NULL and bool(crs) == (wkt[0] != 0)             # <<<<<<<<<<<<<<
25830  *
25831  *     except CRSError:
25832  */
25833         __Pyx_XDECREF(__pyx_r);
25834         __pyx_t_6 = (__pyx_v_wkt != NULL);
25835         if (__pyx_t_6) {
25836         } else {
25837           __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1508, __pyx_L6_error)
25838           __Pyx_GOTREF(__pyx_t_7);
25839           __pyx_t_5 = __pyx_t_7;
25840           __pyx_t_7 = 0;
25841           goto __pyx_L12_bool_binop_done;
25842         }
25843         __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_crs); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1508, __pyx_L6_error)
25844         __pyx_t_7 = __Pyx_PyBool_FromLong((!(!__pyx_t_6))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1508, __pyx_L6_error)
25845         __Pyx_GOTREF(__pyx_t_7);
25846         __pyx_t_8 = __Pyx_PyBool_FromLong(((__pyx_v_wkt[0]) != 0)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1508, __pyx_L6_error)
25847         __Pyx_GOTREF(__pyx_t_8);
25848         __pyx_t_9 = PyObject_RichCompare(__pyx_t_7, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1508, __pyx_L6_error)
25849         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
25850         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
25851         __Pyx_INCREF(__pyx_t_9);
25852         __pyx_t_5 = __pyx_t_9;
25853         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
25854         __pyx_L12_bool_binop_done:;
25855         __pyx_r = __pyx_t_5;
25856         __pyx_t_5 = 0;
25857         goto __pyx_L10_try_return;
25858 
25859         /* "rasterio/_base.pyx":1500
25860  *     cdef OGRSpatialReferenceH osr = NULL
25861  *
25862  *     try:             # <<<<<<<<<<<<<<
25863  *         # Note: _osr_from_crs() has "except NULL" in its signature.
25864  *         # It raises, it does not return NULL.
25865  */
25866       }
25867       __pyx_L6_error:;
25868       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
25869       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
25870       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
25871       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
25872 
25873       /* "rasterio/_base.pyx":1510
25874  *         return wkt != NULL and bool(crs) == (wkt[0] != 0)
25875  *
25876  *     except CRSError:             # <<<<<<<<<<<<<<
25877  *         return False
25878  *
25879  */
25880       __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_9, &__pyx_t_8);
25881       __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_CRSError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1510, __pyx_L8_except_error)
25882       __Pyx_GOTREF(__pyx_t_7);
25883       __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_5, __pyx_t_7);
25884       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
25885       __Pyx_ErrRestore(__pyx_t_5, __pyx_t_9, __pyx_t_8);
25886       __pyx_t_5 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0;
25887       if (__pyx_t_10) {
25888         __Pyx_AddTraceback("rasterio._base._can_create_osr", __pyx_clineno, __pyx_lineno, __pyx_filename);
25889         if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_5) < 0) __PYX_ERR(0, 1510, __pyx_L8_except_error)
25890         __Pyx_GOTREF(__pyx_t_8);
25891         __Pyx_GOTREF(__pyx_t_9);
25892         __Pyx_GOTREF(__pyx_t_5);
25893 
25894         /* "rasterio/_base.pyx":1511
25895  *
25896  *     except CRSError:
25897  *         return False             # <<<<<<<<<<<<<<
25898  *
25899  *     finally:
25900  */
25901         __Pyx_XDECREF(__pyx_r);
25902         __Pyx_INCREF(Py_False);
25903         __pyx_r = Py_False;
25904         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25905         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
25906         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
25907         goto __pyx_L9_except_return;
25908       }
25909       goto __pyx_L8_except_error;
25910       __pyx_L8_except_error:;
25911 
25912       /* "rasterio/_base.pyx":1500
25913  *     cdef OGRSpatialReferenceH osr = NULL
25914  *
25915  *     try:             # <<<<<<<<<<<<<<
25916  *         # Note: _osr_from_crs() has "except NULL" in its signature.
25917  *         # It raises, it does not return NULL.
25918  */
25919       __Pyx_XGIVEREF(__pyx_t_1);
25920       __Pyx_XGIVEREF(__pyx_t_2);
25921       __Pyx_XGIVEREF(__pyx_t_3);
25922       __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
25923       goto __pyx_L4_error;
25924       __pyx_L10_try_return:;
25925       __Pyx_XGIVEREF(__pyx_t_1);
25926       __Pyx_XGIVEREF(__pyx_t_2);
25927       __Pyx_XGIVEREF(__pyx_t_3);
25928       __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
25929       goto __pyx_L3_return;
25930       __pyx_L9_except_return:;
25931       __Pyx_XGIVEREF(__pyx_t_1);
25932       __Pyx_XGIVEREF(__pyx_t_2);
25933       __Pyx_XGIVEREF(__pyx_t_3);
25934       __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
25935       goto __pyx_L3_return;
25936     }
25937   }
25938 
25939   /* "rasterio/_base.pyx":1514
25940  *
25941  *     finally:
25942  *         _safe_osr_release(osr)             # <<<<<<<<<<<<<<
25943  *         CPLFree(wkt)
25944  */
25945   /*finally:*/ {
25946     __pyx_L4_error:;
25947     /*exception exit:*/{
25948       __Pyx_PyThreadState_declare
25949       __Pyx_PyThreadState_assign
25950       __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
25951       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
25952       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
25953       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
25954       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
25955       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
25956       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
25957       __Pyx_XGOTREF(__pyx_t_3);
25958       __Pyx_XGOTREF(__pyx_t_2);
25959       __Pyx_XGOTREF(__pyx_t_1);
25960       __Pyx_XGOTREF(__pyx_t_13);
25961       __Pyx_XGOTREF(__pyx_t_14);
25962       __Pyx_XGOTREF(__pyx_t_15);
25963       __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
25964       {
25965         __pyx_t_5 = __pyx_f_8rasterio_5_base__safe_osr_release(__pyx_v_osr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1514, __pyx_L17_error)
25966         __Pyx_GOTREF(__pyx_t_5);
25967         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25968 
25969         /* "rasterio/_base.pyx":1515
25970  *     finally:
25971  *         _safe_osr_release(osr)
25972  *         CPLFree(wkt)             # <<<<<<<<<<<<<<
25973  */
25974         CPLFree(__pyx_v_wkt);
25975       }
25976       if (PY_MAJOR_VERSION >= 3) {
25977         __Pyx_XGIVEREF(__pyx_t_13);
25978         __Pyx_XGIVEREF(__pyx_t_14);
25979         __Pyx_XGIVEREF(__pyx_t_15);
25980         __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
25981       }
25982       __Pyx_XGIVEREF(__pyx_t_3);
25983       __Pyx_XGIVEREF(__pyx_t_2);
25984       __Pyx_XGIVEREF(__pyx_t_1);
25985       __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
25986       __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
25987       __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
25988       goto __pyx_L1_error;
25989       __pyx_L17_error:;
25990       if (PY_MAJOR_VERSION >= 3) {
25991         __Pyx_XGIVEREF(__pyx_t_13);
25992         __Pyx_XGIVEREF(__pyx_t_14);
25993         __Pyx_XGIVEREF(__pyx_t_15);
25994         __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
25995       }
25996       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
25997       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
25998       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
25999       __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
26000       goto __pyx_L1_error;
26001     }
26002     __pyx_L3_return: {
26003       __pyx_t_15 = __pyx_r;
26004       __pyx_r = 0;
26005 
26006       /* "rasterio/_base.pyx":1514
26007  *
26008  *     finally:
26009  *         _safe_osr_release(osr)             # <<<<<<<<<<<<<<
26010  *         CPLFree(wkt)
26011  */
26012       __pyx_t_5 = __pyx_f_8rasterio_5_base__safe_osr_release(__pyx_v_osr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1514, __pyx_L1_error)
26013       __Pyx_GOTREF(__pyx_t_5);
26014       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
26015 
26016       /* "rasterio/_base.pyx":1515
26017  *     finally:
26018  *         _safe_osr_release(osr)
26019  *         CPLFree(wkt)             # <<<<<<<<<<<<<<
26020  */
26021       CPLFree(__pyx_v_wkt);
26022       __pyx_r = __pyx_t_15;
26023       __pyx_t_15 = 0;
26024       goto __pyx_L0;
26025     }
26026   }
26027 
26028   /* "rasterio/_base.pyx":1482
26029  *
26030  *
26031  * def _can_create_osr(crs):             # <<<<<<<<<<<<<<
26032  *     """Evaluate if a valid OGRSpatialReference can be created from crs.
26033  *
26034  */
26035 
26036   /* function exit code */
26037   __pyx_L1_error:;
26038   __Pyx_XDECREF(__pyx_t_5);
26039   __Pyx_XDECREF(__pyx_t_7);
26040   __Pyx_XDECREF(__pyx_t_8);
26041   __Pyx_XDECREF(__pyx_t_9);
26042   __Pyx_AddTraceback("rasterio._base._can_create_osr", __pyx_clineno, __pyx_lineno, __pyx_filename);
26043   __pyx_r = NULL;
26044   __pyx_L0:;
26045   __Pyx_XGIVEREF(__pyx_r);
26046   __Pyx_RefNannyFinishContext();
26047   return __pyx_r;
26048 }
26049 
26050 /* "View.MemoryView":122
26051  *         cdef bint dtype_is_object
26052  *
26053  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
26054  *                   mode="c", bint allocate_buffer=True):
26055  *
26056  */
26057 
26058 /* Python wrapper */
26059 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_array___cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)26060 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
26061   PyObject *__pyx_v_shape = 0;
26062   Py_ssize_t __pyx_v_itemsize;
26063   PyObject *__pyx_v_format = 0;
26064   PyObject *__pyx_v_mode = 0;
26065   int __pyx_v_allocate_buffer;
26066   int __pyx_lineno = 0;
26067   const char *__pyx_filename = NULL;
26068   int __pyx_clineno = 0;
26069   int __pyx_r;
26070   __Pyx_RefNannyDeclarations
26071   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
26072   {
26073     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode_2,&__pyx_n_s_allocate_buffer,0};
26074     PyObject* values[5] = {0,0,0,0,0};
26075     values[3] = ((PyObject *)__pyx_n_s_c);
26076     if (unlikely(__pyx_kwds)) {
26077       Py_ssize_t kw_args;
26078       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
26079       switch (pos_args) {
26080         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
26081         CYTHON_FALLTHROUGH;
26082         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
26083         CYTHON_FALLTHROUGH;
26084         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
26085         CYTHON_FALLTHROUGH;
26086         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
26087         CYTHON_FALLTHROUGH;
26088         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
26089         CYTHON_FALLTHROUGH;
26090         case  0: break;
26091         default: goto __pyx_L5_argtuple_error;
26092       }
26093       kw_args = PyDict_Size(__pyx_kwds);
26094       switch (pos_args) {
26095         case  0:
26096         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
26097         else goto __pyx_L5_argtuple_error;
26098         CYTHON_FALLTHROUGH;
26099         case  1:
26100         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
26101         else {
26102           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 122, __pyx_L3_error)
26103         }
26104         CYTHON_FALLTHROUGH;
26105         case  2:
26106         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
26107         else {
26108           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 122, __pyx_L3_error)
26109         }
26110         CYTHON_FALLTHROUGH;
26111         case  3:
26112         if (kw_args > 0) {
26113           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode_2);
26114           if (value) { values[3] = value; kw_args--; }
26115         }
26116         CYTHON_FALLTHROUGH;
26117         case  4:
26118         if (kw_args > 0) {
26119           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
26120           if (value) { values[4] = value; kw_args--; }
26121         }
26122       }
26123       if (unlikely(kw_args > 0)) {
26124         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 122, __pyx_L3_error)
26125       }
26126     } else {
26127       switch (PyTuple_GET_SIZE(__pyx_args)) {
26128         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
26129         CYTHON_FALLTHROUGH;
26130         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
26131         CYTHON_FALLTHROUGH;
26132         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
26133         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
26134         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
26135         break;
26136         default: goto __pyx_L5_argtuple_error;
26137       }
26138     }
26139     __pyx_v_shape = ((PyObject*)values[0]);
26140     __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 122, __pyx_L3_error)
26141     __pyx_v_format = values[2];
26142     __pyx_v_mode = values[3];
26143     if (values[4]) {
26144       __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 123, __pyx_L3_error)
26145     } else {
26146 
26147       /* "View.MemoryView":123
26148  *
26149  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
26150  *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
26151  *
26152  *         cdef int idx
26153  */
26154       __pyx_v_allocate_buffer = ((int)1);
26155     }
26156   }
26157   goto __pyx_L4_argument_unpacking_done;
26158   __pyx_L5_argtuple_error:;
26159   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 122, __pyx_L3_error)
26160   __pyx_L3_error:;
26161   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26162   __Pyx_RefNannyFinishContext();
26163   return -1;
26164   __pyx_L4_argument_unpacking_done:;
26165   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 122, __pyx_L1_error)
26166   if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
26167     PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 122, __pyx_L1_error)
26168   }
26169   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
26170 
26171   /* "View.MemoryView":122
26172  *         cdef bint dtype_is_object
26173  *
26174  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
26175  *                   mode="c", bint allocate_buffer=True):
26176  *
26177  */
26178 
26179   /* function exit code */
26180   goto __pyx_L0;
26181   __pyx_L1_error:;
26182   __pyx_r = -1;
26183   __pyx_L0:;
26184   __Pyx_RefNannyFinishContext();
26185   return __pyx_r;
26186 }
26187 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_shape,Py_ssize_t __pyx_v_itemsize,PyObject * __pyx_v_format,PyObject * __pyx_v_mode,int __pyx_v_allocate_buffer)26188 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
26189   int __pyx_v_idx;
26190   Py_ssize_t __pyx_v_i;
26191   Py_ssize_t __pyx_v_dim;
26192   PyObject **__pyx_v_p;
26193   char __pyx_v_order;
26194   int __pyx_r;
26195   __Pyx_RefNannyDeclarations
26196   Py_ssize_t __pyx_t_1;
26197   int __pyx_t_2;
26198   PyObject *__pyx_t_3 = NULL;
26199   int __pyx_t_4;
26200   PyObject *__pyx_t_5 = NULL;
26201   PyObject *__pyx_t_6 = NULL;
26202   char *__pyx_t_7;
26203   int __pyx_t_8;
26204   Py_ssize_t __pyx_t_9;
26205   PyObject *__pyx_t_10 = NULL;
26206   Py_ssize_t __pyx_t_11;
26207   int __pyx_lineno = 0;
26208   const char *__pyx_filename = NULL;
26209   int __pyx_clineno = 0;
26210   __Pyx_RefNannySetupContext("__cinit__", 0);
26211   __Pyx_INCREF(__pyx_v_format);
26212 
26213   /* "View.MemoryView":129
26214  *         cdef PyObject **p
26215  *
26216  *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
26217  *         self.itemsize = itemsize
26218  *
26219  */
26220   if (unlikely(__pyx_v_shape == Py_None)) {
26221     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
26222     __PYX_ERR(1, 129, __pyx_L1_error)
26223   }
26224   __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 129, __pyx_L1_error)
26225   __pyx_v_self->ndim = ((int)__pyx_t_1);
26226 
26227   /* "View.MemoryView":130
26228  *
26229  *         self.ndim = <int> len(shape)
26230  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
26231  *
26232  *         if not self.ndim:
26233  */
26234   __pyx_v_self->itemsize = __pyx_v_itemsize;
26235 
26236   /* "View.MemoryView":132
26237  *         self.itemsize = itemsize
26238  *
26239  *         if not self.ndim:             # <<<<<<<<<<<<<<
26240  *             raise ValueError("Empty shape tuple for cython.array")
26241  *
26242  */
26243   __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
26244   if (unlikely(__pyx_t_2)) {
26245 
26246     /* "View.MemoryView":133
26247  *
26248  *         if not self.ndim:
26249  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
26250  *
26251  *         if itemsize <= 0:
26252  */
26253     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 133, __pyx_L1_error)
26254     __Pyx_GOTREF(__pyx_t_3);
26255     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
26256     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26257     __PYX_ERR(1, 133, __pyx_L1_error)
26258 
26259     /* "View.MemoryView":132
26260  *         self.itemsize = itemsize
26261  *
26262  *         if not self.ndim:             # <<<<<<<<<<<<<<
26263  *             raise ValueError("Empty shape tuple for cython.array")
26264  *
26265  */
26266   }
26267 
26268   /* "View.MemoryView":135
26269  *             raise ValueError("Empty shape tuple for cython.array")
26270  *
26271  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
26272  *             raise ValueError("itemsize <= 0 for cython.array")
26273  *
26274  */
26275   __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
26276   if (unlikely(__pyx_t_2)) {
26277 
26278     /* "View.MemoryView":136
26279  *
26280  *         if itemsize <= 0:
26281  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
26282  *
26283  *         if not isinstance(format, bytes):
26284  */
26285     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error)
26286     __Pyx_GOTREF(__pyx_t_3);
26287     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
26288     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26289     __PYX_ERR(1, 136, __pyx_L1_error)
26290 
26291     /* "View.MemoryView":135
26292  *             raise ValueError("Empty shape tuple for cython.array")
26293  *
26294  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
26295  *             raise ValueError("itemsize <= 0 for cython.array")
26296  *
26297  */
26298   }
26299 
26300   /* "View.MemoryView":138
26301  *             raise ValueError("itemsize <= 0 for cython.array")
26302  *
26303  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
26304  *             format = format.encode('ASCII')
26305  *         self._format = format  # keep a reference to the byte string
26306  */
26307   __pyx_t_2 = PyBytes_Check(__pyx_v_format);
26308   __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
26309   if (__pyx_t_4) {
26310 
26311     /* "View.MemoryView":139
26312  *
26313  *         if not isinstance(format, bytes):
26314  *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
26315  *         self._format = format  # keep a reference to the byte string
26316  *         self.format = self._format
26317  */
26318     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 139, __pyx_L1_error)
26319     __Pyx_GOTREF(__pyx_t_5);
26320     __pyx_t_6 = NULL;
26321     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
26322       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
26323       if (likely(__pyx_t_6)) {
26324         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
26325         __Pyx_INCREF(__pyx_t_6);
26326         __Pyx_INCREF(function);
26327         __Pyx_DECREF_SET(__pyx_t_5, function);
26328       }
26329     }
26330     __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
26331     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
26332     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 139, __pyx_L1_error)
26333     __Pyx_GOTREF(__pyx_t_3);
26334     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
26335     __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
26336     __pyx_t_3 = 0;
26337 
26338     /* "View.MemoryView":138
26339  *             raise ValueError("itemsize <= 0 for cython.array")
26340  *
26341  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
26342  *             format = format.encode('ASCII')
26343  *         self._format = format  # keep a reference to the byte string
26344  */
26345   }
26346 
26347   /* "View.MemoryView":140
26348  *         if not isinstance(format, bytes):
26349  *             format = format.encode('ASCII')
26350  *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
26351  *         self.format = self._format
26352  *
26353  */
26354   if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(1, 140, __pyx_L1_error)
26355   __pyx_t_3 = __pyx_v_format;
26356   __Pyx_INCREF(__pyx_t_3);
26357   __Pyx_GIVEREF(__pyx_t_3);
26358   __Pyx_GOTREF(__pyx_v_self->_format);
26359   __Pyx_DECREF(__pyx_v_self->_format);
26360   __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
26361   __pyx_t_3 = 0;
26362 
26363   /* "View.MemoryView":141
26364  *             format = format.encode('ASCII')
26365  *         self._format = format  # keep a reference to the byte string
26366  *         self.format = self._format             # <<<<<<<<<<<<<<
26367  *
26368  *
26369  */
26370   if (unlikely(__pyx_v_self->_format == Py_None)) {
26371     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
26372     __PYX_ERR(1, 141, __pyx_L1_error)
26373   }
26374   __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 141, __pyx_L1_error)
26375   __pyx_v_self->format = __pyx_t_7;
26376 
26377   /* "View.MemoryView":144
26378  *
26379  *
26380  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
26381  *         self._strides = self._shape + self.ndim
26382  *
26383  */
26384   __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
26385 
26386   /* "View.MemoryView":145
26387  *
26388  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
26389  *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
26390  *
26391  *         if not self._shape:
26392  */
26393   __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
26394 
26395   /* "View.MemoryView":147
26396  *         self._strides = self._shape + self.ndim
26397  *
26398  *         if not self._shape:             # <<<<<<<<<<<<<<
26399  *             raise MemoryError("unable to allocate shape and strides.")
26400  *
26401  */
26402   __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
26403   if (unlikely(__pyx_t_4)) {
26404 
26405     /* "View.MemoryView":148
26406  *
26407  *         if not self._shape:
26408  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
26409  *
26410  *
26411  */
26412     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
26413     __Pyx_GOTREF(__pyx_t_3);
26414     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
26415     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26416     __PYX_ERR(1, 148, __pyx_L1_error)
26417 
26418     /* "View.MemoryView":147
26419  *         self._strides = self._shape + self.ndim
26420  *
26421  *         if not self._shape:             # <<<<<<<<<<<<<<
26422  *             raise MemoryError("unable to allocate shape and strides.")
26423  *
26424  */
26425   }
26426 
26427   /* "View.MemoryView":151
26428  *
26429  *
26430  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
26431  *             if dim <= 0:
26432  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
26433  */
26434   __pyx_t_8 = 0;
26435   __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
26436   for (;;) {
26437     if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
26438     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
26439     __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(1, 151, __pyx_L1_error)
26440     #else
26441     __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 151, __pyx_L1_error)
26442     __Pyx_GOTREF(__pyx_t_5);
26443     #endif
26444     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 151, __pyx_L1_error)
26445     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
26446     __pyx_v_dim = __pyx_t_9;
26447     __pyx_v_idx = __pyx_t_8;
26448     __pyx_t_8 = (__pyx_t_8 + 1);
26449 
26450     /* "View.MemoryView":152
26451  *
26452  *         for idx, dim in enumerate(shape):
26453  *             if dim <= 0:             # <<<<<<<<<<<<<<
26454  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
26455  *             self._shape[idx] = dim
26456  */
26457     __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
26458     if (unlikely(__pyx_t_4)) {
26459 
26460       /* "View.MemoryView":153
26461  *         for idx, dim in enumerate(shape):
26462  *             if dim <= 0:
26463  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
26464  *             self._shape[idx] = dim
26465  *
26466  */
26467       __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 153, __pyx_L1_error)
26468       __Pyx_GOTREF(__pyx_t_5);
26469       __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
26470       __Pyx_GOTREF(__pyx_t_6);
26471       __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
26472       __Pyx_GOTREF(__pyx_t_10);
26473       __Pyx_GIVEREF(__pyx_t_5);
26474       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
26475       __Pyx_GIVEREF(__pyx_t_6);
26476       PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
26477       __pyx_t_5 = 0;
26478       __pyx_t_6 = 0;
26479       __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
26480       __Pyx_GOTREF(__pyx_t_6);
26481       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
26482       __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
26483       __Pyx_GOTREF(__pyx_t_10);
26484       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
26485       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
26486       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
26487       __PYX_ERR(1, 153, __pyx_L1_error)
26488 
26489       /* "View.MemoryView":152
26490  *
26491  *         for idx, dim in enumerate(shape):
26492  *             if dim <= 0:             # <<<<<<<<<<<<<<
26493  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
26494  *             self._shape[idx] = dim
26495  */
26496     }
26497 
26498     /* "View.MemoryView":154
26499  *             if dim <= 0:
26500  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
26501  *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
26502  *
26503  *         cdef char order
26504  */
26505     (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
26506 
26507     /* "View.MemoryView":151
26508  *
26509  *
26510  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
26511  *             if dim <= 0:
26512  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
26513  */
26514   }
26515   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26516 
26517   /* "View.MemoryView":157
26518  *
26519  *         cdef char order
26520  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
26521  *             order = b'F'
26522  *             self.mode = u'fortran'
26523  */
26524   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 157, __pyx_L1_error)
26525   if (__pyx_t_4) {
26526 
26527     /* "View.MemoryView":158
26528  *         cdef char order
26529  *         if mode == 'fortran':
26530  *             order = b'F'             # <<<<<<<<<<<<<<
26531  *             self.mode = u'fortran'
26532  *         elif mode == 'c':
26533  */
26534     __pyx_v_order = 'F';
26535 
26536     /* "View.MemoryView":159
26537  *         if mode == 'fortran':
26538  *             order = b'F'
26539  *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
26540  *         elif mode == 'c':
26541  *             order = b'C'
26542  */
26543     __Pyx_INCREF(__pyx_n_u_fortran);
26544     __Pyx_GIVEREF(__pyx_n_u_fortran);
26545     __Pyx_GOTREF(__pyx_v_self->mode);
26546     __Pyx_DECREF(__pyx_v_self->mode);
26547     __pyx_v_self->mode = __pyx_n_u_fortran;
26548 
26549     /* "View.MemoryView":157
26550  *
26551  *         cdef char order
26552  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
26553  *             order = b'F'
26554  *             self.mode = u'fortran'
26555  */
26556     goto __pyx_L10;
26557   }
26558 
26559   /* "View.MemoryView":160
26560  *             order = b'F'
26561  *             self.mode = u'fortran'
26562  *         elif mode == 'c':             # <<<<<<<<<<<<<<
26563  *             order = b'C'
26564  *             self.mode = u'c'
26565  */
26566   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 160, __pyx_L1_error)
26567   if (likely(__pyx_t_4)) {
26568 
26569     /* "View.MemoryView":161
26570  *             self.mode = u'fortran'
26571  *         elif mode == 'c':
26572  *             order = b'C'             # <<<<<<<<<<<<<<
26573  *             self.mode = u'c'
26574  *         else:
26575  */
26576     __pyx_v_order = 'C';
26577 
26578     /* "View.MemoryView":162
26579  *         elif mode == 'c':
26580  *             order = b'C'
26581  *             self.mode = u'c'             # <<<<<<<<<<<<<<
26582  *         else:
26583  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
26584  */
26585     __Pyx_INCREF(__pyx_n_u_c);
26586     __Pyx_GIVEREF(__pyx_n_u_c);
26587     __Pyx_GOTREF(__pyx_v_self->mode);
26588     __Pyx_DECREF(__pyx_v_self->mode);
26589     __pyx_v_self->mode = __pyx_n_u_c;
26590 
26591     /* "View.MemoryView":160
26592  *             order = b'F'
26593  *             self.mode = u'fortran'
26594  *         elif mode == 'c':             # <<<<<<<<<<<<<<
26595  *             order = b'C'
26596  *             self.mode = u'c'
26597  */
26598     goto __pyx_L10;
26599   }
26600 
26601   /* "View.MemoryView":164
26602  *             self.mode = u'c'
26603  *         else:
26604  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
26605  *
26606  *         self.len = fill_contig_strides_array(self._shape, self._strides,
26607  */
26608   /*else*/ {
26609     __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 164, __pyx_L1_error)
26610     __Pyx_GOTREF(__pyx_t_3);
26611     __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 164, __pyx_L1_error)
26612     __Pyx_GOTREF(__pyx_t_10);
26613     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26614     __Pyx_Raise(__pyx_t_10, 0, 0, 0);
26615     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
26616     __PYX_ERR(1, 164, __pyx_L1_error)
26617   }
26618   __pyx_L10:;
26619 
26620   /* "View.MemoryView":166
26621  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
26622  *
26623  *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
26624  *                                              itemsize, self.ndim, order)
26625  *
26626  */
26627   __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
26628 
26629   /* "View.MemoryView":169
26630  *                                              itemsize, self.ndim, order)
26631  *
26632  *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
26633  *         self.dtype_is_object = format == b'O'
26634  *         if allocate_buffer:
26635  */
26636   __pyx_v_self->free_data = __pyx_v_allocate_buffer;
26637 
26638   /* "View.MemoryView":170
26639  *
26640  *         self.free_data = allocate_buffer
26641  *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
26642  *         if allocate_buffer:
26643  *
26644  */
26645   __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 170, __pyx_L1_error)
26646   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 170, __pyx_L1_error)
26647   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
26648   __pyx_v_self->dtype_is_object = __pyx_t_4;
26649 
26650   /* "View.MemoryView":171
26651  *         self.free_data = allocate_buffer
26652  *         self.dtype_is_object = format == b'O'
26653  *         if allocate_buffer:             # <<<<<<<<<<<<<<
26654  *
26655  *
26656  */
26657   __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
26658   if (__pyx_t_4) {
26659 
26660     /* "View.MemoryView":174
26661  *
26662  *
26663  *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
26664  *             if not self.data:
26665  *                 raise MemoryError("unable to allocate array data.")
26666  */
26667     __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
26668 
26669     /* "View.MemoryView":175
26670  *
26671  *             self.data = <char *>malloc(self.len)
26672  *             if not self.data:             # <<<<<<<<<<<<<<
26673  *                 raise MemoryError("unable to allocate array data.")
26674  *
26675  */
26676     __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
26677     if (unlikely(__pyx_t_4)) {
26678 
26679       /* "View.MemoryView":176
26680  *             self.data = <char *>malloc(self.len)
26681  *             if not self.data:
26682  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
26683  *
26684  *             if self.dtype_is_object:
26685  */
26686       __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 176, __pyx_L1_error)
26687       __Pyx_GOTREF(__pyx_t_10);
26688       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
26689       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
26690       __PYX_ERR(1, 176, __pyx_L1_error)
26691 
26692       /* "View.MemoryView":175
26693  *
26694  *             self.data = <char *>malloc(self.len)
26695  *             if not self.data:             # <<<<<<<<<<<<<<
26696  *                 raise MemoryError("unable to allocate array data.")
26697  *
26698  */
26699     }
26700 
26701     /* "View.MemoryView":178
26702  *                 raise MemoryError("unable to allocate array data.")
26703  *
26704  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
26705  *                 p = <PyObject **> self.data
26706  *                 for i in range(self.len / itemsize):
26707  */
26708     __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
26709     if (__pyx_t_4) {
26710 
26711       /* "View.MemoryView":179
26712  *
26713  *             if self.dtype_is_object:
26714  *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
26715  *                 for i in range(self.len / itemsize):
26716  *                     p[i] = Py_None
26717  */
26718       __pyx_v_p = ((PyObject **)__pyx_v_self->data);
26719 
26720       /* "View.MemoryView":180
26721  *             if self.dtype_is_object:
26722  *                 p = <PyObject **> self.data
26723  *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
26724  *                     p[i] = Py_None
26725  *                     Py_INCREF(Py_None)
26726  */
26727       if (unlikely(__pyx_v_itemsize == 0)) {
26728         PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
26729         __PYX_ERR(1, 180, __pyx_L1_error)
26730       }
26731       else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
26732         PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
26733         __PYX_ERR(1, 180, __pyx_L1_error)
26734       }
26735       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
26736       __pyx_t_9 = __pyx_t_1;
26737       for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
26738         __pyx_v_i = __pyx_t_11;
26739 
26740         /* "View.MemoryView":181
26741  *                 p = <PyObject **> self.data
26742  *                 for i in range(self.len / itemsize):
26743  *                     p[i] = Py_None             # <<<<<<<<<<<<<<
26744  *                     Py_INCREF(Py_None)
26745  *
26746  */
26747         (__pyx_v_p[__pyx_v_i]) = Py_None;
26748 
26749         /* "View.MemoryView":182
26750  *                 for i in range(self.len / itemsize):
26751  *                     p[i] = Py_None
26752  *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
26753  *
26754  *     @cname('getbuffer')
26755  */
26756         Py_INCREF(Py_None);
26757       }
26758 
26759       /* "View.MemoryView":178
26760  *                 raise MemoryError("unable to allocate array data.")
26761  *
26762  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
26763  *                 p = <PyObject **> self.data
26764  *                 for i in range(self.len / itemsize):
26765  */
26766     }
26767 
26768     /* "View.MemoryView":171
26769  *         self.free_data = allocate_buffer
26770  *         self.dtype_is_object = format == b'O'
26771  *         if allocate_buffer:             # <<<<<<<<<<<<<<
26772  *
26773  *
26774  */
26775   }
26776 
26777   /* "View.MemoryView":122
26778  *         cdef bint dtype_is_object
26779  *
26780  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
26781  *                   mode="c", bint allocate_buffer=True):
26782  *
26783  */
26784 
26785   /* function exit code */
26786   __pyx_r = 0;
26787   goto __pyx_L0;
26788   __pyx_L1_error:;
26789   __Pyx_XDECREF(__pyx_t_3);
26790   __Pyx_XDECREF(__pyx_t_5);
26791   __Pyx_XDECREF(__pyx_t_6);
26792   __Pyx_XDECREF(__pyx_t_10);
26793   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26794   __pyx_r = -1;
26795   __pyx_L0:;
26796   __Pyx_XDECREF(__pyx_v_format);
26797   __Pyx_RefNannyFinishContext();
26798   return __pyx_r;
26799 }
26800 
26801 /* "View.MemoryView":185
26802  *
26803  *     @cname('getbuffer')
26804  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
26805  *         cdef int bufmode = -1
26806  *         if self.mode == u"c":
26807  */
26808 
26809 /* Python wrapper */
26810 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_array_getbuffer(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)26811 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
26812   int __pyx_r;
26813   __Pyx_RefNannyDeclarations
26814   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
26815   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
26816 
26817   /* function exit code */
26818   __Pyx_RefNannyFinishContext();
26819   return __pyx_r;
26820 }
26821 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)26822 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
26823   int __pyx_v_bufmode;
26824   int __pyx_r;
26825   __Pyx_RefNannyDeclarations
26826   int __pyx_t_1;
26827   int __pyx_t_2;
26828   PyObject *__pyx_t_3 = NULL;
26829   char *__pyx_t_4;
26830   Py_ssize_t __pyx_t_5;
26831   int __pyx_t_6;
26832   Py_ssize_t *__pyx_t_7;
26833   int __pyx_lineno = 0;
26834   const char *__pyx_filename = NULL;
26835   int __pyx_clineno = 0;
26836   if (__pyx_v_info == NULL) {
26837     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
26838     return -1;
26839   }
26840   __Pyx_RefNannySetupContext("__getbuffer__", 0);
26841   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
26842   __Pyx_GIVEREF(__pyx_v_info->obj);
26843 
26844   /* "View.MemoryView":186
26845  *     @cname('getbuffer')
26846  *     def __getbuffer__(self, Py_buffer *info, int flags):
26847  *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
26848  *         if self.mode == u"c":
26849  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26850  */
26851   __pyx_v_bufmode = -1;
26852 
26853   /* "View.MemoryView":187
26854  *     def __getbuffer__(self, Py_buffer *info, int flags):
26855  *         cdef int bufmode = -1
26856  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
26857  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26858  *         elif self.mode == u"fortran":
26859  */
26860   __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 187, __pyx_L1_error)
26861   __pyx_t_2 = (__pyx_t_1 != 0);
26862   if (__pyx_t_2) {
26863 
26864     /* "View.MemoryView":188
26865  *         cdef int bufmode = -1
26866  *         if self.mode == u"c":
26867  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
26868  *         elif self.mode == u"fortran":
26869  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26870  */
26871     __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
26872 
26873     /* "View.MemoryView":187
26874  *     def __getbuffer__(self, Py_buffer *info, int flags):
26875  *         cdef int bufmode = -1
26876  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
26877  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26878  *         elif self.mode == u"fortran":
26879  */
26880     goto __pyx_L3;
26881   }
26882 
26883   /* "View.MemoryView":189
26884  *         if self.mode == u"c":
26885  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26886  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
26887  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26888  *         if not (flags & bufmode):
26889  */
26890   __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 189, __pyx_L1_error)
26891   __pyx_t_1 = (__pyx_t_2 != 0);
26892   if (__pyx_t_1) {
26893 
26894     /* "View.MemoryView":190
26895  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26896  *         elif self.mode == u"fortran":
26897  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
26898  *         if not (flags & bufmode):
26899  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
26900  */
26901     __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
26902 
26903     /* "View.MemoryView":189
26904  *         if self.mode == u"c":
26905  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26906  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
26907  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26908  *         if not (flags & bufmode):
26909  */
26910   }
26911   __pyx_L3:;
26912 
26913   /* "View.MemoryView":191
26914  *         elif self.mode == u"fortran":
26915  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26916  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
26917  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
26918  *         info.buf = self.data
26919  */
26920   __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
26921   if (unlikely(__pyx_t_1)) {
26922 
26923     /* "View.MemoryView":192
26924  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26925  *         if not (flags & bufmode):
26926  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
26927  *         info.buf = self.data
26928  *         info.len = self.len
26929  */
26930     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 192, __pyx_L1_error)
26931     __Pyx_GOTREF(__pyx_t_3);
26932     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
26933     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26934     __PYX_ERR(1, 192, __pyx_L1_error)
26935 
26936     /* "View.MemoryView":191
26937  *         elif self.mode == u"fortran":
26938  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26939  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
26940  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
26941  *         info.buf = self.data
26942  */
26943   }
26944 
26945   /* "View.MemoryView":193
26946  *         if not (flags & bufmode):
26947  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
26948  *         info.buf = self.data             # <<<<<<<<<<<<<<
26949  *         info.len = self.len
26950  *         info.ndim = self.ndim
26951  */
26952   __pyx_t_4 = __pyx_v_self->data;
26953   __pyx_v_info->buf = __pyx_t_4;
26954 
26955   /* "View.MemoryView":194
26956  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
26957  *         info.buf = self.data
26958  *         info.len = self.len             # <<<<<<<<<<<<<<
26959  *         info.ndim = self.ndim
26960  *         info.shape = self._shape
26961  */
26962   __pyx_t_5 = __pyx_v_self->len;
26963   __pyx_v_info->len = __pyx_t_5;
26964 
26965   /* "View.MemoryView":195
26966  *         info.buf = self.data
26967  *         info.len = self.len
26968  *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
26969  *         info.shape = self._shape
26970  *         info.strides = self._strides
26971  */
26972   __pyx_t_6 = __pyx_v_self->ndim;
26973   __pyx_v_info->ndim = __pyx_t_6;
26974 
26975   /* "View.MemoryView":196
26976  *         info.len = self.len
26977  *         info.ndim = self.ndim
26978  *         info.shape = self._shape             # <<<<<<<<<<<<<<
26979  *         info.strides = self._strides
26980  *         info.suboffsets = NULL
26981  */
26982   __pyx_t_7 = __pyx_v_self->_shape;
26983   __pyx_v_info->shape = __pyx_t_7;
26984 
26985   /* "View.MemoryView":197
26986  *         info.ndim = self.ndim
26987  *         info.shape = self._shape
26988  *         info.strides = self._strides             # <<<<<<<<<<<<<<
26989  *         info.suboffsets = NULL
26990  *         info.itemsize = self.itemsize
26991  */
26992   __pyx_t_7 = __pyx_v_self->_strides;
26993   __pyx_v_info->strides = __pyx_t_7;
26994 
26995   /* "View.MemoryView":198
26996  *         info.shape = self._shape
26997  *         info.strides = self._strides
26998  *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
26999  *         info.itemsize = self.itemsize
27000  *         info.readonly = 0
27001  */
27002   __pyx_v_info->suboffsets = NULL;
27003 
27004   /* "View.MemoryView":199
27005  *         info.strides = self._strides
27006  *         info.suboffsets = NULL
27007  *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
27008  *         info.readonly = 0
27009  *
27010  */
27011   __pyx_t_5 = __pyx_v_self->itemsize;
27012   __pyx_v_info->itemsize = __pyx_t_5;
27013 
27014   /* "View.MemoryView":200
27015  *         info.suboffsets = NULL
27016  *         info.itemsize = self.itemsize
27017  *         info.readonly = 0             # <<<<<<<<<<<<<<
27018  *
27019  *         if flags & PyBUF_FORMAT:
27020  */
27021   __pyx_v_info->readonly = 0;
27022 
27023   /* "View.MemoryView":202
27024  *         info.readonly = 0
27025  *
27026  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
27027  *             info.format = self.format
27028  *         else:
27029  */
27030   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
27031   if (__pyx_t_1) {
27032 
27033     /* "View.MemoryView":203
27034  *
27035  *         if flags & PyBUF_FORMAT:
27036  *             info.format = self.format             # <<<<<<<<<<<<<<
27037  *         else:
27038  *             info.format = NULL
27039  */
27040     __pyx_t_4 = __pyx_v_self->format;
27041     __pyx_v_info->format = __pyx_t_4;
27042 
27043     /* "View.MemoryView":202
27044  *         info.readonly = 0
27045  *
27046  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
27047  *             info.format = self.format
27048  *         else:
27049  */
27050     goto __pyx_L5;
27051   }
27052 
27053   /* "View.MemoryView":205
27054  *             info.format = self.format
27055  *         else:
27056  *             info.format = NULL             # <<<<<<<<<<<<<<
27057  *
27058  *         info.obj = self
27059  */
27060   /*else*/ {
27061     __pyx_v_info->format = NULL;
27062   }
27063   __pyx_L5:;
27064 
27065   /* "View.MemoryView":207
27066  *             info.format = NULL
27067  *
27068  *         info.obj = self             # <<<<<<<<<<<<<<
27069  *
27070  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
27071  */
27072   __Pyx_INCREF(((PyObject *)__pyx_v_self));
27073   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
27074   __Pyx_GOTREF(__pyx_v_info->obj);
27075   __Pyx_DECREF(__pyx_v_info->obj);
27076   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
27077 
27078   /* "View.MemoryView":185
27079  *
27080  *     @cname('getbuffer')
27081  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
27082  *         cdef int bufmode = -1
27083  *         if self.mode == u"c":
27084  */
27085 
27086   /* function exit code */
27087   __pyx_r = 0;
27088   goto __pyx_L0;
27089   __pyx_L1_error:;
27090   __Pyx_XDECREF(__pyx_t_3);
27091   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27092   __pyx_r = -1;
27093   if (__pyx_v_info->obj != NULL) {
27094     __Pyx_GOTREF(__pyx_v_info->obj);
27095     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
27096   }
27097   goto __pyx_L2;
27098   __pyx_L0:;
27099   if (__pyx_v_info->obj == Py_None) {
27100     __Pyx_GOTREF(__pyx_v_info->obj);
27101     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
27102   }
27103   __pyx_L2:;
27104   __Pyx_RefNannyFinishContext();
27105   return __pyx_r;
27106 }
27107 
27108 /* "View.MemoryView":211
27109  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
27110  *
27111  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
27112  *         if self.callback_free_data != NULL:
27113  *             self.callback_free_data(self.data)
27114  */
27115 
27116 /* Python wrapper */
27117 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___dealloc__(PyObject * __pyx_v_self)27118 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
27119   __Pyx_RefNannyDeclarations
27120   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
27121   __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
27122 
27123   /* function exit code */
27124   __Pyx_RefNannyFinishContext();
27125 }
27126 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj * __pyx_v_self)27127 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
27128   __Pyx_RefNannyDeclarations
27129   int __pyx_t_1;
27130   __Pyx_RefNannySetupContext("__dealloc__", 0);
27131 
27132   /* "View.MemoryView":212
27133  *
27134  *     def __dealloc__(array self):
27135  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
27136  *             self.callback_free_data(self.data)
27137  *         elif self.free_data:
27138  */
27139   __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
27140   if (__pyx_t_1) {
27141 
27142     /* "View.MemoryView":213
27143  *     def __dealloc__(array self):
27144  *         if self.callback_free_data != NULL:
27145  *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
27146  *         elif self.free_data:
27147  *             if self.dtype_is_object:
27148  */
27149     __pyx_v_self->callback_free_data(__pyx_v_self->data);
27150 
27151     /* "View.MemoryView":212
27152  *
27153  *     def __dealloc__(array self):
27154  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
27155  *             self.callback_free_data(self.data)
27156  *         elif self.free_data:
27157  */
27158     goto __pyx_L3;
27159   }
27160 
27161   /* "View.MemoryView":214
27162  *         if self.callback_free_data != NULL:
27163  *             self.callback_free_data(self.data)
27164  *         elif self.free_data:             # <<<<<<<<<<<<<<
27165  *             if self.dtype_is_object:
27166  *                 refcount_objects_in_slice(self.data, self._shape,
27167  */
27168   __pyx_t_1 = (__pyx_v_self->free_data != 0);
27169   if (__pyx_t_1) {
27170 
27171     /* "View.MemoryView":215
27172  *             self.callback_free_data(self.data)
27173  *         elif self.free_data:
27174  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
27175  *                 refcount_objects_in_slice(self.data, self._shape,
27176  *                                           self._strides, self.ndim, False)
27177  */
27178     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
27179     if (__pyx_t_1) {
27180 
27181       /* "View.MemoryView":216
27182  *         elif self.free_data:
27183  *             if self.dtype_is_object:
27184  *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
27185  *                                           self._strides, self.ndim, False)
27186  *             free(self.data)
27187  */
27188       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
27189 
27190       /* "View.MemoryView":215
27191  *             self.callback_free_data(self.data)
27192  *         elif self.free_data:
27193  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
27194  *                 refcount_objects_in_slice(self.data, self._shape,
27195  *                                           self._strides, self.ndim, False)
27196  */
27197     }
27198 
27199     /* "View.MemoryView":218
27200  *                 refcount_objects_in_slice(self.data, self._shape,
27201  *                                           self._strides, self.ndim, False)
27202  *             free(self.data)             # <<<<<<<<<<<<<<
27203  *         PyObject_Free(self._shape)
27204  *
27205  */
27206     free(__pyx_v_self->data);
27207 
27208     /* "View.MemoryView":214
27209  *         if self.callback_free_data != NULL:
27210  *             self.callback_free_data(self.data)
27211  *         elif self.free_data:             # <<<<<<<<<<<<<<
27212  *             if self.dtype_is_object:
27213  *                 refcount_objects_in_slice(self.data, self._shape,
27214  */
27215   }
27216   __pyx_L3:;
27217 
27218   /* "View.MemoryView":219
27219  *                                           self._strides, self.ndim, False)
27220  *             free(self.data)
27221  *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
27222  *
27223  *     @property
27224  */
27225   PyObject_Free(__pyx_v_self->_shape);
27226 
27227   /* "View.MemoryView":211
27228  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
27229  *
27230  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
27231  *         if self.callback_free_data != NULL:
27232  *             self.callback_free_data(self.data)
27233  */
27234 
27235   /* function exit code */
27236   __Pyx_RefNannyFinishContext();
27237 }
27238 
27239 /* "View.MemoryView":222
27240  *
27241  *     @property
27242  *     def memview(self):             # <<<<<<<<<<<<<<
27243  *         return self.get_memview()
27244  *
27245  */
27246 
27247 /* Python wrapper */
27248 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject * __pyx_v_self)27249 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
27250   PyObject *__pyx_r = 0;
27251   __Pyx_RefNannyDeclarations
27252   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
27253   __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
27254 
27255   /* function exit code */
27256   __Pyx_RefNannyFinishContext();
27257   return __pyx_r;
27258 }
27259 
__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj * __pyx_v_self)27260 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
27261   PyObject *__pyx_r = NULL;
27262   __Pyx_RefNannyDeclarations
27263   PyObject *__pyx_t_1 = NULL;
27264   int __pyx_lineno = 0;
27265   const char *__pyx_filename = NULL;
27266   int __pyx_clineno = 0;
27267   __Pyx_RefNannySetupContext("__get__", 0);
27268 
27269   /* "View.MemoryView":223
27270  *     @property
27271  *     def memview(self):
27272  *         return self.get_memview()             # <<<<<<<<<<<<<<
27273  *
27274  *     @cname('get_memview')
27275  */
27276   __Pyx_XDECREF(__pyx_r);
27277   __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 223, __pyx_L1_error)
27278   __Pyx_GOTREF(__pyx_t_1);
27279   __pyx_r = __pyx_t_1;
27280   __pyx_t_1 = 0;
27281   goto __pyx_L0;
27282 
27283   /* "View.MemoryView":222
27284  *
27285  *     @property
27286  *     def memview(self):             # <<<<<<<<<<<<<<
27287  *         return self.get_memview()
27288  *
27289  */
27290 
27291   /* function exit code */
27292   __pyx_L1_error:;
27293   __Pyx_XDECREF(__pyx_t_1);
27294   __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27295   __pyx_r = NULL;
27296   __pyx_L0:;
27297   __Pyx_XGIVEREF(__pyx_r);
27298   __Pyx_RefNannyFinishContext();
27299   return __pyx_r;
27300 }
27301 
27302 /* "View.MemoryView":226
27303  *
27304  *     @cname('get_memview')
27305  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
27306  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
27307  *         return  memoryview(self, flags, self.dtype_is_object)
27308  */
27309 
__pyx_array_get_memview(struct __pyx_array_obj * __pyx_v_self)27310 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
27311   int __pyx_v_flags;
27312   PyObject *__pyx_r = NULL;
27313   __Pyx_RefNannyDeclarations
27314   PyObject *__pyx_t_1 = NULL;
27315   PyObject *__pyx_t_2 = NULL;
27316   PyObject *__pyx_t_3 = NULL;
27317   int __pyx_lineno = 0;
27318   const char *__pyx_filename = NULL;
27319   int __pyx_clineno = 0;
27320   __Pyx_RefNannySetupContext("get_memview", 0);
27321 
27322   /* "View.MemoryView":227
27323  *     @cname('get_memview')
27324  *     cdef get_memview(self):
27325  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
27326  *         return  memoryview(self, flags, self.dtype_is_object)
27327  *
27328  */
27329   __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
27330 
27331   /* "View.MemoryView":228
27332  *     cdef get_memview(self):
27333  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
27334  *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
27335  *
27336  *     def __len__(self):
27337  */
27338   __Pyx_XDECREF(__pyx_r);
27339   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error)
27340   __Pyx_GOTREF(__pyx_t_1);
27341   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
27342   __Pyx_GOTREF(__pyx_t_2);
27343   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 228, __pyx_L1_error)
27344   __Pyx_GOTREF(__pyx_t_3);
27345   __Pyx_INCREF(((PyObject *)__pyx_v_self));
27346   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
27347   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
27348   __Pyx_GIVEREF(__pyx_t_1);
27349   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
27350   __Pyx_GIVEREF(__pyx_t_2);
27351   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
27352   __pyx_t_1 = 0;
27353   __pyx_t_2 = 0;
27354   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
27355   __Pyx_GOTREF(__pyx_t_2);
27356   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
27357   __pyx_r = __pyx_t_2;
27358   __pyx_t_2 = 0;
27359   goto __pyx_L0;
27360 
27361   /* "View.MemoryView":226
27362  *
27363  *     @cname('get_memview')
27364  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
27365  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
27366  *         return  memoryview(self, flags, self.dtype_is_object)
27367  */
27368 
27369   /* function exit code */
27370   __pyx_L1_error:;
27371   __Pyx_XDECREF(__pyx_t_1);
27372   __Pyx_XDECREF(__pyx_t_2);
27373   __Pyx_XDECREF(__pyx_t_3);
27374   __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
27375   __pyx_r = 0;
27376   __pyx_L0:;
27377   __Pyx_XGIVEREF(__pyx_r);
27378   __Pyx_RefNannyFinishContext();
27379   return __pyx_r;
27380 }
27381 
27382 /* "View.MemoryView":230
27383  *         return  memoryview(self, flags, self.dtype_is_object)
27384  *
27385  *     def __len__(self):             # <<<<<<<<<<<<<<
27386  *         return self._shape[0]
27387  *
27388  */
27389 
27390 /* Python wrapper */
27391 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___len__(PyObject * __pyx_v_self)27392 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
27393   Py_ssize_t __pyx_r;
27394   __Pyx_RefNannyDeclarations
27395   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
27396   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
27397 
27398   /* function exit code */
27399   __Pyx_RefNannyFinishContext();
27400   return __pyx_r;
27401 }
27402 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj * __pyx_v_self)27403 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
27404   Py_ssize_t __pyx_r;
27405   __Pyx_RefNannyDeclarations
27406   __Pyx_RefNannySetupContext("__len__", 0);
27407 
27408   /* "View.MemoryView":231
27409  *
27410  *     def __len__(self):
27411  *         return self._shape[0]             # <<<<<<<<<<<<<<
27412  *
27413  *     def __getattr__(self, attr):
27414  */
27415   __pyx_r = (__pyx_v_self->_shape[0]);
27416   goto __pyx_L0;
27417 
27418   /* "View.MemoryView":230
27419  *         return  memoryview(self, flags, self.dtype_is_object)
27420  *
27421  *     def __len__(self):             # <<<<<<<<<<<<<<
27422  *         return self._shape[0]
27423  *
27424  */
27425 
27426   /* function exit code */
27427   __pyx_L0:;
27428   __Pyx_RefNannyFinishContext();
27429   return __pyx_r;
27430 }
27431 
27432 /* "View.MemoryView":233
27433  *         return self._shape[0]
27434  *
27435  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
27436  *         return getattr(self.memview, attr)
27437  *
27438  */
27439 
27440 /* Python wrapper */
27441 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
__pyx_array___getattr__(PyObject * __pyx_v_self,PyObject * __pyx_v_attr)27442 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
27443   PyObject *__pyx_r = 0;
27444   __Pyx_RefNannyDeclarations
27445   __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
27446   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
27447 
27448   /* function exit code */
27449   __Pyx_RefNannyFinishContext();
27450   return __pyx_r;
27451 }
27452 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_attr)27453 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
27454   PyObject *__pyx_r = NULL;
27455   __Pyx_RefNannyDeclarations
27456   PyObject *__pyx_t_1 = NULL;
27457   PyObject *__pyx_t_2 = NULL;
27458   int __pyx_lineno = 0;
27459   const char *__pyx_filename = NULL;
27460   int __pyx_clineno = 0;
27461   __Pyx_RefNannySetupContext("__getattr__", 0);
27462 
27463   /* "View.MemoryView":234
27464  *
27465  *     def __getattr__(self, attr):
27466  *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
27467  *
27468  *     def __getitem__(self, item):
27469  */
27470   __Pyx_XDECREF(__pyx_r);
27471   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 234, __pyx_L1_error)
27472   __Pyx_GOTREF(__pyx_t_1);
27473   __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 234, __pyx_L1_error)
27474   __Pyx_GOTREF(__pyx_t_2);
27475   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27476   __pyx_r = __pyx_t_2;
27477   __pyx_t_2 = 0;
27478   goto __pyx_L0;
27479 
27480   /* "View.MemoryView":233
27481  *         return self._shape[0]
27482  *
27483  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
27484  *         return getattr(self.memview, attr)
27485  *
27486  */
27487 
27488   /* function exit code */
27489   __pyx_L1_error:;
27490   __Pyx_XDECREF(__pyx_t_1);
27491   __Pyx_XDECREF(__pyx_t_2);
27492   __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27493   __pyx_r = NULL;
27494   __pyx_L0:;
27495   __Pyx_XGIVEREF(__pyx_r);
27496   __Pyx_RefNannyFinishContext();
27497   return __pyx_r;
27498 }
27499 
27500 /* "View.MemoryView":236
27501  *         return getattr(self.memview, attr)
27502  *
27503  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
27504  *         return self.memview[item]
27505  *
27506  */
27507 
27508 /* Python wrapper */
27509 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
__pyx_array___getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_item)27510 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
27511   PyObject *__pyx_r = 0;
27512   __Pyx_RefNannyDeclarations
27513   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
27514   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
27515 
27516   /* function exit code */
27517   __Pyx_RefNannyFinishContext();
27518   return __pyx_r;
27519 }
27520 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item)27521 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
27522   PyObject *__pyx_r = NULL;
27523   __Pyx_RefNannyDeclarations
27524   PyObject *__pyx_t_1 = NULL;
27525   PyObject *__pyx_t_2 = NULL;
27526   int __pyx_lineno = 0;
27527   const char *__pyx_filename = NULL;
27528   int __pyx_clineno = 0;
27529   __Pyx_RefNannySetupContext("__getitem__", 0);
27530 
27531   /* "View.MemoryView":237
27532  *
27533  *     def __getitem__(self, item):
27534  *         return self.memview[item]             # <<<<<<<<<<<<<<
27535  *
27536  *     def __setitem__(self, item, value):
27537  */
27538   __Pyx_XDECREF(__pyx_r);
27539   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 237, __pyx_L1_error)
27540   __Pyx_GOTREF(__pyx_t_1);
27541   __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 237, __pyx_L1_error)
27542   __Pyx_GOTREF(__pyx_t_2);
27543   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27544   __pyx_r = __pyx_t_2;
27545   __pyx_t_2 = 0;
27546   goto __pyx_L0;
27547 
27548   /* "View.MemoryView":236
27549  *         return getattr(self.memview, attr)
27550  *
27551  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
27552  *         return self.memview[item]
27553  *
27554  */
27555 
27556   /* function exit code */
27557   __pyx_L1_error:;
27558   __Pyx_XDECREF(__pyx_t_1);
27559   __Pyx_XDECREF(__pyx_t_2);
27560   __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27561   __pyx_r = NULL;
27562   __pyx_L0:;
27563   __Pyx_XGIVEREF(__pyx_r);
27564   __Pyx_RefNannyFinishContext();
27565   return __pyx_r;
27566 }
27567 
27568 /* "View.MemoryView":239
27569  *         return self.memview[item]
27570  *
27571  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
27572  *         self.memview[item] = value
27573  *
27574  */
27575 
27576 /* Python wrapper */
27577 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
__pyx_array___setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_item,PyObject * __pyx_v_value)27578 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
27579   int __pyx_r;
27580   __Pyx_RefNannyDeclarations
27581   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
27582   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
27583 
27584   /* function exit code */
27585   __Pyx_RefNannyFinishContext();
27586   return __pyx_r;
27587 }
27588 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item,PyObject * __pyx_v_value)27589 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
27590   int __pyx_r;
27591   __Pyx_RefNannyDeclarations
27592   PyObject *__pyx_t_1 = NULL;
27593   int __pyx_lineno = 0;
27594   const char *__pyx_filename = NULL;
27595   int __pyx_clineno = 0;
27596   __Pyx_RefNannySetupContext("__setitem__", 0);
27597 
27598   /* "View.MemoryView":240
27599  *
27600  *     def __setitem__(self, item, value):
27601  *         self.memview[item] = value             # <<<<<<<<<<<<<<
27602  *
27603  *
27604  */
27605   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 240, __pyx_L1_error)
27606   __Pyx_GOTREF(__pyx_t_1);
27607   if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(1, 240, __pyx_L1_error)
27608   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27609 
27610   /* "View.MemoryView":239
27611  *         return self.memview[item]
27612  *
27613  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
27614  *         self.memview[item] = value
27615  *
27616  */
27617 
27618   /* function exit code */
27619   __pyx_r = 0;
27620   goto __pyx_L0;
27621   __pyx_L1_error:;
27622   __Pyx_XDECREF(__pyx_t_1);
27623   __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27624   __pyx_r = -1;
27625   __pyx_L0:;
27626   __Pyx_RefNannyFinishContext();
27627   return __pyx_r;
27628 }
27629 
27630 /* "(tree fragment)":1
27631  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
27632  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27633  * def __setstate_cython__(self, __pyx_state):
27634  */
27635 
27636 /* Python wrapper */
27637 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_array_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)27638 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
27639   PyObject *__pyx_r = 0;
27640   __Pyx_RefNannyDeclarations
27641   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
27642   __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
27643 
27644   /* function exit code */
27645   __Pyx_RefNannyFinishContext();
27646   return __pyx_r;
27647 }
27648 
__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self)27649 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
27650   PyObject *__pyx_r = NULL;
27651   __Pyx_RefNannyDeclarations
27652   PyObject *__pyx_t_1 = NULL;
27653   int __pyx_lineno = 0;
27654   const char *__pyx_filename = NULL;
27655   int __pyx_clineno = 0;
27656   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
27657 
27658   /* "(tree fragment)":2
27659  * def __reduce_cython__(self):
27660  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
27661  * def __setstate_cython__(self, __pyx_state):
27662  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27663  */
27664   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
27665   __Pyx_GOTREF(__pyx_t_1);
27666   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
27667   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27668   __PYX_ERR(1, 2, __pyx_L1_error)
27669 
27670   /* "(tree fragment)":1
27671  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
27672  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27673  * def __setstate_cython__(self, __pyx_state):
27674  */
27675 
27676   /* function exit code */
27677   __pyx_L1_error:;
27678   __Pyx_XDECREF(__pyx_t_1);
27679   __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27680   __pyx_r = NULL;
27681   __Pyx_XGIVEREF(__pyx_r);
27682   __Pyx_RefNannyFinishContext();
27683   return __pyx_r;
27684 }
27685 
27686 /* "(tree fragment)":3
27687  * def __reduce_cython__(self):
27688  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27689  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
27690  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27691  */
27692 
27693 /* Python wrapper */
27694 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_array_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)27695 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
27696   PyObject *__pyx_r = 0;
27697   __Pyx_RefNannyDeclarations
27698   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
27699   __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
27700 
27701   /* function exit code */
27702   __Pyx_RefNannyFinishContext();
27703   return __pyx_r;
27704 }
27705 
__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)27706 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
27707   PyObject *__pyx_r = NULL;
27708   __Pyx_RefNannyDeclarations
27709   PyObject *__pyx_t_1 = NULL;
27710   int __pyx_lineno = 0;
27711   const char *__pyx_filename = NULL;
27712   int __pyx_clineno = 0;
27713   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
27714 
27715   /* "(tree fragment)":4
27716  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27717  * def __setstate_cython__(self, __pyx_state):
27718  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
27719  */
27720   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
27721   __Pyx_GOTREF(__pyx_t_1);
27722   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
27723   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27724   __PYX_ERR(1, 4, __pyx_L1_error)
27725 
27726   /* "(tree fragment)":3
27727  * def __reduce_cython__(self):
27728  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27729  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
27730  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27731  */
27732 
27733   /* function exit code */
27734   __pyx_L1_error:;
27735   __Pyx_XDECREF(__pyx_t_1);
27736   __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27737   __pyx_r = NULL;
27738   __Pyx_XGIVEREF(__pyx_r);
27739   __Pyx_RefNannyFinishContext();
27740   return __pyx_r;
27741 }
27742 
27743 /* "View.MemoryView":244
27744  *
27745  * @cname("__pyx_array_new")
27746  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
27747  *                           char *mode, char *buf):
27748  *     cdef array result
27749  */
27750 
__pyx_array_new(PyObject * __pyx_v_shape,Py_ssize_t __pyx_v_itemsize,char * __pyx_v_format,char * __pyx_v_mode,char * __pyx_v_buf)27751 static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) {
27752   struct __pyx_array_obj *__pyx_v_result = 0;
27753   struct __pyx_array_obj *__pyx_r = NULL;
27754   __Pyx_RefNannyDeclarations
27755   int __pyx_t_1;
27756   PyObject *__pyx_t_2 = NULL;
27757   PyObject *__pyx_t_3 = NULL;
27758   PyObject *__pyx_t_4 = NULL;
27759   PyObject *__pyx_t_5 = NULL;
27760   int __pyx_lineno = 0;
27761   const char *__pyx_filename = NULL;
27762   int __pyx_clineno = 0;
27763   __Pyx_RefNannySetupContext("array_cwrapper", 0);
27764 
27765   /* "View.MemoryView":248
27766  *     cdef array result
27767  *
27768  *     if buf == NULL:             # <<<<<<<<<<<<<<
27769  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
27770  *     else:
27771  */
27772   __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
27773   if (__pyx_t_1) {
27774 
27775     /* "View.MemoryView":249
27776  *
27777  *     if buf == NULL:
27778  *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
27779  *     else:
27780  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
27781  */
27782     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 249, __pyx_L1_error)
27783     __Pyx_GOTREF(__pyx_t_2);
27784     __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 249, __pyx_L1_error)
27785     __Pyx_GOTREF(__pyx_t_3);
27786     __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
27787     __Pyx_GOTREF(__pyx_t_4);
27788     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 249, __pyx_L1_error)
27789     __Pyx_GOTREF(__pyx_t_5);
27790     __Pyx_INCREF(__pyx_v_shape);
27791     __Pyx_GIVEREF(__pyx_v_shape);
27792     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
27793     __Pyx_GIVEREF(__pyx_t_2);
27794     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
27795     __Pyx_GIVEREF(__pyx_t_3);
27796     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
27797     __Pyx_GIVEREF(__pyx_t_4);
27798     PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
27799     __pyx_t_2 = 0;
27800     __pyx_t_3 = 0;
27801     __pyx_t_4 = 0;
27802     __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
27803     __Pyx_GOTREF(__pyx_t_4);
27804     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
27805     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
27806     __pyx_t_4 = 0;
27807 
27808     /* "View.MemoryView":248
27809  *     cdef array result
27810  *
27811  *     if buf == NULL:             # <<<<<<<<<<<<<<
27812  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
27813  *     else:
27814  */
27815     goto __pyx_L3;
27816   }
27817 
27818   /* "View.MemoryView":251
27819  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
27820  *     else:
27821  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
27822  *                        allocate_buffer=False)
27823  *         result.data = buf
27824  */
27825   /*else*/ {
27826     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 251, __pyx_L1_error)
27827     __Pyx_GOTREF(__pyx_t_4);
27828     __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
27829     __Pyx_GOTREF(__pyx_t_5);
27830     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 251, __pyx_L1_error)
27831     __Pyx_GOTREF(__pyx_t_3);
27832     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 251, __pyx_L1_error)
27833     __Pyx_GOTREF(__pyx_t_2);
27834     __Pyx_INCREF(__pyx_v_shape);
27835     __Pyx_GIVEREF(__pyx_v_shape);
27836     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
27837     __Pyx_GIVEREF(__pyx_t_4);
27838     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
27839     __Pyx_GIVEREF(__pyx_t_5);
27840     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
27841     __Pyx_GIVEREF(__pyx_t_3);
27842     PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
27843     __pyx_t_4 = 0;
27844     __pyx_t_5 = 0;
27845     __pyx_t_3 = 0;
27846 
27847     /* "View.MemoryView":252
27848  *     else:
27849  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
27850  *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
27851  *         result.data = buf
27852  *
27853  */
27854     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
27855     __Pyx_GOTREF(__pyx_t_3);
27856     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 252, __pyx_L1_error)
27857 
27858     /* "View.MemoryView":251
27859  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
27860  *     else:
27861  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
27862  *                        allocate_buffer=False)
27863  *         result.data = buf
27864  */
27865     __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
27866     __Pyx_GOTREF(__pyx_t_5);
27867     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27868     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
27869     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
27870     __pyx_t_5 = 0;
27871 
27872     /* "View.MemoryView":253
27873  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
27874  *                        allocate_buffer=False)
27875  *         result.data = buf             # <<<<<<<<<<<<<<
27876  *
27877  *     return result
27878  */
27879     __pyx_v_result->data = __pyx_v_buf;
27880   }
27881   __pyx_L3:;
27882 
27883   /* "View.MemoryView":255
27884  *         result.data = buf
27885  *
27886  *     return result             # <<<<<<<<<<<<<<
27887  *
27888  *
27889  */
27890   __Pyx_XDECREF(((PyObject *)__pyx_r));
27891   __Pyx_INCREF(((PyObject *)__pyx_v_result));
27892   __pyx_r = __pyx_v_result;
27893   goto __pyx_L0;
27894 
27895   /* "View.MemoryView":244
27896  *
27897  * @cname("__pyx_array_new")
27898  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
27899  *                           char *mode, char *buf):
27900  *     cdef array result
27901  */
27902 
27903   /* function exit code */
27904   __pyx_L1_error:;
27905   __Pyx_XDECREF(__pyx_t_2);
27906   __Pyx_XDECREF(__pyx_t_3);
27907   __Pyx_XDECREF(__pyx_t_4);
27908   __Pyx_XDECREF(__pyx_t_5);
27909   __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
27910   __pyx_r = 0;
27911   __pyx_L0:;
27912   __Pyx_XDECREF((PyObject *)__pyx_v_result);
27913   __Pyx_XGIVEREF((PyObject *)__pyx_r);
27914   __Pyx_RefNannyFinishContext();
27915   return __pyx_r;
27916 }
27917 
27918 /* "View.MemoryView":281
27919  * cdef class Enum(object):
27920  *     cdef object name
27921  *     def __init__(self, name):             # <<<<<<<<<<<<<<
27922  *         self.name = name
27923  *     def __repr__(self):
27924  */
27925 
27926 /* Python wrapper */
27927 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_MemviewEnum___init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)27928 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
27929   PyObject *__pyx_v_name = 0;
27930   int __pyx_lineno = 0;
27931   const char *__pyx_filename = NULL;
27932   int __pyx_clineno = 0;
27933   int __pyx_r;
27934   __Pyx_RefNannyDeclarations
27935   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
27936   {
27937     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
27938     PyObject* values[1] = {0};
27939     if (unlikely(__pyx_kwds)) {
27940       Py_ssize_t kw_args;
27941       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
27942       switch (pos_args) {
27943         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27944         CYTHON_FALLTHROUGH;
27945         case  0: break;
27946         default: goto __pyx_L5_argtuple_error;
27947       }
27948       kw_args = PyDict_Size(__pyx_kwds);
27949       switch (pos_args) {
27950         case  0:
27951         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
27952         else goto __pyx_L5_argtuple_error;
27953       }
27954       if (unlikely(kw_args > 0)) {
27955         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 281, __pyx_L3_error)
27956       }
27957     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
27958       goto __pyx_L5_argtuple_error;
27959     } else {
27960       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27961     }
27962     __pyx_v_name = values[0];
27963   }
27964   goto __pyx_L4_argument_unpacking_done;
27965   __pyx_L5_argtuple_error:;
27966   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 281, __pyx_L3_error)
27967   __pyx_L3_error:;
27968   __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27969   __Pyx_RefNannyFinishContext();
27970   return -1;
27971   __pyx_L4_argument_unpacking_done:;
27972   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
27973 
27974   /* function exit code */
27975   __Pyx_RefNannyFinishContext();
27976   return __pyx_r;
27977 }
27978 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v_name)27979 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
27980   int __pyx_r;
27981   __Pyx_RefNannyDeclarations
27982   __Pyx_RefNannySetupContext("__init__", 0);
27983 
27984   /* "View.MemoryView":282
27985  *     cdef object name
27986  *     def __init__(self, name):
27987  *         self.name = name             # <<<<<<<<<<<<<<
27988  *     def __repr__(self):
27989  *         return self.name
27990  */
27991   __Pyx_INCREF(__pyx_v_name);
27992   __Pyx_GIVEREF(__pyx_v_name);
27993   __Pyx_GOTREF(__pyx_v_self->name);
27994   __Pyx_DECREF(__pyx_v_self->name);
27995   __pyx_v_self->name = __pyx_v_name;
27996 
27997   /* "View.MemoryView":281
27998  * cdef class Enum(object):
27999  *     cdef object name
28000  *     def __init__(self, name):             # <<<<<<<<<<<<<<
28001  *         self.name = name
28002  *     def __repr__(self):
28003  */
28004 
28005   /* function exit code */
28006   __pyx_r = 0;
28007   __Pyx_RefNannyFinishContext();
28008   return __pyx_r;
28009 }
28010 
28011 /* "View.MemoryView":283
28012  *     def __init__(self, name):
28013  *         self.name = name
28014  *     def __repr__(self):             # <<<<<<<<<<<<<<
28015  *         return self.name
28016  *
28017  */
28018 
28019 /* Python wrapper */
28020 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_MemviewEnum___repr__(PyObject * __pyx_v_self)28021 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
28022   PyObject *__pyx_r = 0;
28023   __Pyx_RefNannyDeclarations
28024   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
28025   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
28026 
28027   /* function exit code */
28028   __Pyx_RefNannyFinishContext();
28029   return __pyx_r;
28030 }
28031 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj * __pyx_v_self)28032 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
28033   PyObject *__pyx_r = NULL;
28034   __Pyx_RefNannyDeclarations
28035   __Pyx_RefNannySetupContext("__repr__", 0);
28036 
28037   /* "View.MemoryView":284
28038  *         self.name = name
28039  *     def __repr__(self):
28040  *         return self.name             # <<<<<<<<<<<<<<
28041  *
28042  * cdef generic = Enum("<strided and direct or indirect>")
28043  */
28044   __Pyx_XDECREF(__pyx_r);
28045   __Pyx_INCREF(__pyx_v_self->name);
28046   __pyx_r = __pyx_v_self->name;
28047   goto __pyx_L0;
28048 
28049   /* "View.MemoryView":283
28050  *     def __init__(self, name):
28051  *         self.name = name
28052  *     def __repr__(self):             # <<<<<<<<<<<<<<
28053  *         return self.name
28054  *
28055  */
28056 
28057   /* function exit code */
28058   __pyx_L0:;
28059   __Pyx_XGIVEREF(__pyx_r);
28060   __Pyx_RefNannyFinishContext();
28061   return __pyx_r;
28062 }
28063 
28064 /* "(tree fragment)":1
28065  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
28066  *     cdef tuple state
28067  *     cdef object _dict
28068  */
28069 
28070 /* Python wrapper */
28071 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)28072 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
28073   PyObject *__pyx_r = 0;
28074   __Pyx_RefNannyDeclarations
28075   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
28076   __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
28077 
28078   /* function exit code */
28079   __Pyx_RefNannyFinishContext();
28080   return __pyx_r;
28081 }
28082 
__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self)28083 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
28084   PyObject *__pyx_v_state = 0;
28085   PyObject *__pyx_v__dict = 0;
28086   int __pyx_v_use_setstate;
28087   PyObject *__pyx_r = NULL;
28088   __Pyx_RefNannyDeclarations
28089   PyObject *__pyx_t_1 = NULL;
28090   int __pyx_t_2;
28091   int __pyx_t_3;
28092   PyObject *__pyx_t_4 = NULL;
28093   PyObject *__pyx_t_5 = NULL;
28094   int __pyx_lineno = 0;
28095   const char *__pyx_filename = NULL;
28096   int __pyx_clineno = 0;
28097   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
28098 
28099   /* "(tree fragment)":5
28100  *     cdef object _dict
28101  *     cdef bint use_setstate
28102  *     state = (self.name,)             # <<<<<<<<<<<<<<
28103  *     _dict = getattr(self, '__dict__', None)
28104  *     if _dict is not None:
28105  */
28106   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
28107   __Pyx_GOTREF(__pyx_t_1);
28108   __Pyx_INCREF(__pyx_v_self->name);
28109   __Pyx_GIVEREF(__pyx_v_self->name);
28110   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
28111   __pyx_v_state = ((PyObject*)__pyx_t_1);
28112   __pyx_t_1 = 0;
28113 
28114   /* "(tree fragment)":6
28115  *     cdef bint use_setstate
28116  *     state = (self.name,)
28117  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
28118  *     if _dict is not None:
28119  *         state += (_dict,)
28120  */
28121   __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
28122   __Pyx_GOTREF(__pyx_t_1);
28123   __pyx_v__dict = __pyx_t_1;
28124   __pyx_t_1 = 0;
28125 
28126   /* "(tree fragment)":7
28127  *     state = (self.name,)
28128  *     _dict = getattr(self, '__dict__', None)
28129  *     if _dict is not None:             # <<<<<<<<<<<<<<
28130  *         state += (_dict,)
28131  *         use_setstate = True
28132  */
28133   __pyx_t_2 = (__pyx_v__dict != Py_None);
28134   __pyx_t_3 = (__pyx_t_2 != 0);
28135   if (__pyx_t_3) {
28136 
28137     /* "(tree fragment)":8
28138  *     _dict = getattr(self, '__dict__', None)
28139  *     if _dict is not None:
28140  *         state += (_dict,)             # <<<<<<<<<<<<<<
28141  *         use_setstate = True
28142  *     else:
28143  */
28144     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
28145     __Pyx_GOTREF(__pyx_t_1);
28146     __Pyx_INCREF(__pyx_v__dict);
28147     __Pyx_GIVEREF(__pyx_v__dict);
28148     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
28149     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
28150     __Pyx_GOTREF(__pyx_t_4);
28151     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
28152     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
28153     __pyx_t_4 = 0;
28154 
28155     /* "(tree fragment)":9
28156  *     if _dict is not None:
28157  *         state += (_dict,)
28158  *         use_setstate = True             # <<<<<<<<<<<<<<
28159  *     else:
28160  *         use_setstate = self.name is not None
28161  */
28162     __pyx_v_use_setstate = 1;
28163 
28164     /* "(tree fragment)":7
28165  *     state = (self.name,)
28166  *     _dict = getattr(self, '__dict__', None)
28167  *     if _dict is not None:             # <<<<<<<<<<<<<<
28168  *         state += (_dict,)
28169  *         use_setstate = True
28170  */
28171     goto __pyx_L3;
28172   }
28173 
28174   /* "(tree fragment)":11
28175  *         use_setstate = True
28176  *     else:
28177  *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
28178  *     if use_setstate:
28179  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
28180  */
28181   /*else*/ {
28182     __pyx_t_3 = (__pyx_v_self->name != Py_None);
28183     __pyx_v_use_setstate = __pyx_t_3;
28184   }
28185   __pyx_L3:;
28186 
28187   /* "(tree fragment)":12
28188  *     else:
28189  *         use_setstate = self.name is not None
28190  *     if use_setstate:             # <<<<<<<<<<<<<<
28191  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
28192  *     else:
28193  */
28194   __pyx_t_3 = (__pyx_v_use_setstate != 0);
28195   if (__pyx_t_3) {
28196 
28197     /* "(tree fragment)":13
28198  *         use_setstate = self.name is not None
28199  *     if use_setstate:
28200  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
28201  *     else:
28202  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
28203  */
28204     __Pyx_XDECREF(__pyx_r);
28205     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
28206     __Pyx_GOTREF(__pyx_t_4);
28207     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
28208     __Pyx_GOTREF(__pyx_t_1);
28209     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
28210     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
28211     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
28212     __Pyx_INCREF(__pyx_int_184977713);
28213     __Pyx_GIVEREF(__pyx_int_184977713);
28214     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
28215     __Pyx_INCREF(Py_None);
28216     __Pyx_GIVEREF(Py_None);
28217     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
28218     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
28219     __Pyx_GOTREF(__pyx_t_5);
28220     __Pyx_GIVEREF(__pyx_t_4);
28221     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
28222     __Pyx_GIVEREF(__pyx_t_1);
28223     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
28224     __Pyx_INCREF(__pyx_v_state);
28225     __Pyx_GIVEREF(__pyx_v_state);
28226     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
28227     __pyx_t_4 = 0;
28228     __pyx_t_1 = 0;
28229     __pyx_r = __pyx_t_5;
28230     __pyx_t_5 = 0;
28231     goto __pyx_L0;
28232 
28233     /* "(tree fragment)":12
28234  *     else:
28235  *         use_setstate = self.name is not None
28236  *     if use_setstate:             # <<<<<<<<<<<<<<
28237  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
28238  *     else:
28239  */
28240   }
28241 
28242   /* "(tree fragment)":15
28243  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
28244  *     else:
28245  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
28246  * def __setstate_cython__(self, __pyx_state):
28247  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
28248  */
28249   /*else*/ {
28250     __Pyx_XDECREF(__pyx_r);
28251     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
28252     __Pyx_GOTREF(__pyx_t_5);
28253     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
28254     __Pyx_GOTREF(__pyx_t_1);
28255     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
28256     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
28257     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
28258     __Pyx_INCREF(__pyx_int_184977713);
28259     __Pyx_GIVEREF(__pyx_int_184977713);
28260     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
28261     __Pyx_INCREF(__pyx_v_state);
28262     __Pyx_GIVEREF(__pyx_v_state);
28263     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
28264     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
28265     __Pyx_GOTREF(__pyx_t_4);
28266     __Pyx_GIVEREF(__pyx_t_5);
28267     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
28268     __Pyx_GIVEREF(__pyx_t_1);
28269     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
28270     __pyx_t_5 = 0;
28271     __pyx_t_1 = 0;
28272     __pyx_r = __pyx_t_4;
28273     __pyx_t_4 = 0;
28274     goto __pyx_L0;
28275   }
28276 
28277   /* "(tree fragment)":1
28278  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
28279  *     cdef tuple state
28280  *     cdef object _dict
28281  */
28282 
28283   /* function exit code */
28284   __pyx_L1_error:;
28285   __Pyx_XDECREF(__pyx_t_1);
28286   __Pyx_XDECREF(__pyx_t_4);
28287   __Pyx_XDECREF(__pyx_t_5);
28288   __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28289   __pyx_r = NULL;
28290   __pyx_L0:;
28291   __Pyx_XDECREF(__pyx_v_state);
28292   __Pyx_XDECREF(__pyx_v__dict);
28293   __Pyx_XGIVEREF(__pyx_r);
28294   __Pyx_RefNannyFinishContext();
28295   return __pyx_r;
28296 }
28297 
28298 /* "(tree fragment)":16
28299  *     else:
28300  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
28301  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
28302  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
28303  */
28304 
28305 /* Python wrapper */
28306 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)28307 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
28308   PyObject *__pyx_r = 0;
28309   __Pyx_RefNannyDeclarations
28310   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
28311   __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
28312 
28313   /* function exit code */
28314   __Pyx_RefNannyFinishContext();
28315   return __pyx_r;
28316 }
28317 
__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v___pyx_state)28318 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
28319   PyObject *__pyx_r = NULL;
28320   __Pyx_RefNannyDeclarations
28321   PyObject *__pyx_t_1 = NULL;
28322   int __pyx_lineno = 0;
28323   const char *__pyx_filename = NULL;
28324   int __pyx_clineno = 0;
28325   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
28326 
28327   /* "(tree fragment)":17
28328  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
28329  * def __setstate_cython__(self, __pyx_state):
28330  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
28331  */
28332   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
28333   __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
28334   __Pyx_GOTREF(__pyx_t_1);
28335   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
28336 
28337   /* "(tree fragment)":16
28338  *     else:
28339  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
28340  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
28341  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
28342  */
28343 
28344   /* function exit code */
28345   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
28346   goto __pyx_L0;
28347   __pyx_L1_error:;
28348   __Pyx_XDECREF(__pyx_t_1);
28349   __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28350   __pyx_r = NULL;
28351   __pyx_L0:;
28352   __Pyx_XGIVEREF(__pyx_r);
28353   __Pyx_RefNannyFinishContext();
28354   return __pyx_r;
28355 }
28356 
28357 /* "View.MemoryView":298
28358  *
28359  * @cname('__pyx_align_pointer')
28360  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
28361  *     "Align pointer memory on a given boundary"
28362  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
28363  */
28364 
__pyx_align_pointer(void * __pyx_v_memory,size_t __pyx_v_alignment)28365 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
28366   Py_intptr_t __pyx_v_aligned_p;
28367   size_t __pyx_v_offset;
28368   void *__pyx_r;
28369   int __pyx_t_1;
28370 
28371   /* "View.MemoryView":300
28372  * cdef void *align_pointer(void *memory, size_t alignment) nogil:
28373  *     "Align pointer memory on a given boundary"
28374  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
28375  *     cdef size_t offset
28376  *
28377  */
28378   __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
28379 
28380   /* "View.MemoryView":304
28381  *
28382  *     with cython.cdivision(True):
28383  *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
28384  *
28385  *     if offset > 0:
28386  */
28387   __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
28388 
28389   /* "View.MemoryView":306
28390  *         offset = aligned_p % alignment
28391  *
28392  *     if offset > 0:             # <<<<<<<<<<<<<<
28393  *         aligned_p += alignment - offset
28394  *
28395  */
28396   __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
28397   if (__pyx_t_1) {
28398 
28399     /* "View.MemoryView":307
28400  *
28401  *     if offset > 0:
28402  *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
28403  *
28404  *     return <void *> aligned_p
28405  */
28406     __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
28407 
28408     /* "View.MemoryView":306
28409  *         offset = aligned_p % alignment
28410  *
28411  *     if offset > 0:             # <<<<<<<<<<<<<<
28412  *         aligned_p += alignment - offset
28413  *
28414  */
28415   }
28416 
28417   /* "View.MemoryView":309
28418  *         aligned_p += alignment - offset
28419  *
28420  *     return <void *> aligned_p             # <<<<<<<<<<<<<<
28421  *
28422  *
28423  */
28424   __pyx_r = ((void *)__pyx_v_aligned_p);
28425   goto __pyx_L0;
28426 
28427   /* "View.MemoryView":298
28428  *
28429  * @cname('__pyx_align_pointer')
28430  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
28431  *     "Align pointer memory on a given boundary"
28432  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
28433  */
28434 
28435   /* function exit code */
28436   __pyx_L0:;
28437   return __pyx_r;
28438 }
28439 
28440 /* "View.MemoryView":345
28441  *     cdef __Pyx_TypeInfo *typeinfo
28442  *
28443  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
28444  *         self.obj = obj
28445  *         self.flags = flags
28446  */
28447 
28448 /* Python wrapper */
28449 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_memoryview___cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)28450 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
28451   PyObject *__pyx_v_obj = 0;
28452   int __pyx_v_flags;
28453   int __pyx_v_dtype_is_object;
28454   int __pyx_lineno = 0;
28455   const char *__pyx_filename = NULL;
28456   int __pyx_clineno = 0;
28457   int __pyx_r;
28458   __Pyx_RefNannyDeclarations
28459   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
28460   {
28461     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
28462     PyObject* values[3] = {0,0,0};
28463     if (unlikely(__pyx_kwds)) {
28464       Py_ssize_t kw_args;
28465       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
28466       switch (pos_args) {
28467         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
28468         CYTHON_FALLTHROUGH;
28469         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
28470         CYTHON_FALLTHROUGH;
28471         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
28472         CYTHON_FALLTHROUGH;
28473         case  0: break;
28474         default: goto __pyx_L5_argtuple_error;
28475       }
28476       kw_args = PyDict_Size(__pyx_kwds);
28477       switch (pos_args) {
28478         case  0:
28479         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
28480         else goto __pyx_L5_argtuple_error;
28481         CYTHON_FALLTHROUGH;
28482         case  1:
28483         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
28484         else {
28485           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 345, __pyx_L3_error)
28486         }
28487         CYTHON_FALLTHROUGH;
28488         case  2:
28489         if (kw_args > 0) {
28490           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
28491           if (value) { values[2] = value; kw_args--; }
28492         }
28493       }
28494       if (unlikely(kw_args > 0)) {
28495         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 345, __pyx_L3_error)
28496       }
28497     } else {
28498       switch (PyTuple_GET_SIZE(__pyx_args)) {
28499         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
28500         CYTHON_FALLTHROUGH;
28501         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
28502         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
28503         break;
28504         default: goto __pyx_L5_argtuple_error;
28505       }
28506     }
28507     __pyx_v_obj = values[0];
28508     __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
28509     if (values[2]) {
28510       __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
28511     } else {
28512       __pyx_v_dtype_is_object = ((int)0);
28513     }
28514   }
28515   goto __pyx_L4_argument_unpacking_done;
28516   __pyx_L5_argtuple_error:;
28517   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 345, __pyx_L3_error)
28518   __pyx_L3_error:;
28519   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28520   __Pyx_RefNannyFinishContext();
28521   return -1;
28522   __pyx_L4_argument_unpacking_done:;
28523   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
28524 
28525   /* function exit code */
28526   __Pyx_RefNannyFinishContext();
28527   return __pyx_r;
28528 }
28529 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj,int __pyx_v_flags,int __pyx_v_dtype_is_object)28530 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
28531   int __pyx_r;
28532   __Pyx_RefNannyDeclarations
28533   int __pyx_t_1;
28534   int __pyx_t_2;
28535   int __pyx_t_3;
28536   int __pyx_t_4;
28537   int __pyx_lineno = 0;
28538   const char *__pyx_filename = NULL;
28539   int __pyx_clineno = 0;
28540   __Pyx_RefNannySetupContext("__cinit__", 0);
28541 
28542   /* "View.MemoryView":346
28543  *
28544  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
28545  *         self.obj = obj             # <<<<<<<<<<<<<<
28546  *         self.flags = flags
28547  *         if type(self) is memoryview or obj is not None:
28548  */
28549   __Pyx_INCREF(__pyx_v_obj);
28550   __Pyx_GIVEREF(__pyx_v_obj);
28551   __Pyx_GOTREF(__pyx_v_self->obj);
28552   __Pyx_DECREF(__pyx_v_self->obj);
28553   __pyx_v_self->obj = __pyx_v_obj;
28554 
28555   /* "View.MemoryView":347
28556  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
28557  *         self.obj = obj
28558  *         self.flags = flags             # <<<<<<<<<<<<<<
28559  *         if type(self) is memoryview or obj is not None:
28560  *             __Pyx_GetBuffer(obj, &self.view, flags)
28561  */
28562   __pyx_v_self->flags = __pyx_v_flags;
28563 
28564   /* "View.MemoryView":348
28565  *         self.obj = obj
28566  *         self.flags = flags
28567  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
28568  *             __Pyx_GetBuffer(obj, &self.view, flags)
28569  *             if <PyObject *> self.view.obj == NULL:
28570  */
28571   __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
28572   __pyx_t_3 = (__pyx_t_2 != 0);
28573   if (!__pyx_t_3) {
28574   } else {
28575     __pyx_t_1 = __pyx_t_3;
28576     goto __pyx_L4_bool_binop_done;
28577   }
28578   __pyx_t_3 = (__pyx_v_obj != Py_None);
28579   __pyx_t_2 = (__pyx_t_3 != 0);
28580   __pyx_t_1 = __pyx_t_2;
28581   __pyx_L4_bool_binop_done:;
28582   if (__pyx_t_1) {
28583 
28584     /* "View.MemoryView":349
28585  *         self.flags = flags
28586  *         if type(self) is memoryview or obj is not None:
28587  *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
28588  *             if <PyObject *> self.view.obj == NULL:
28589  *                 (<__pyx_buffer *> &self.view).obj = Py_None
28590  */
28591     __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 349, __pyx_L1_error)
28592 
28593     /* "View.MemoryView":350
28594  *         if type(self) is memoryview or obj is not None:
28595  *             __Pyx_GetBuffer(obj, &self.view, flags)
28596  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
28597  *                 (<__pyx_buffer *> &self.view).obj = Py_None
28598  *                 Py_INCREF(Py_None)
28599  */
28600     __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
28601     if (__pyx_t_1) {
28602 
28603       /* "View.MemoryView":351
28604  *             __Pyx_GetBuffer(obj, &self.view, flags)
28605  *             if <PyObject *> self.view.obj == NULL:
28606  *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
28607  *                 Py_INCREF(Py_None)
28608  *
28609  */
28610       ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
28611 
28612       /* "View.MemoryView":352
28613  *             if <PyObject *> self.view.obj == NULL:
28614  *                 (<__pyx_buffer *> &self.view).obj = Py_None
28615  *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
28616  *
28617  *         global __pyx_memoryview_thread_locks_used
28618  */
28619       Py_INCREF(Py_None);
28620 
28621       /* "View.MemoryView":350
28622  *         if type(self) is memoryview or obj is not None:
28623  *             __Pyx_GetBuffer(obj, &self.view, flags)
28624  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
28625  *                 (<__pyx_buffer *> &self.view).obj = Py_None
28626  *                 Py_INCREF(Py_None)
28627  */
28628     }
28629 
28630     /* "View.MemoryView":348
28631  *         self.obj = obj
28632  *         self.flags = flags
28633  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
28634  *             __Pyx_GetBuffer(obj, &self.view, flags)
28635  *             if <PyObject *> self.view.obj == NULL:
28636  */
28637   }
28638 
28639   /* "View.MemoryView":355
28640  *
28641  *         global __pyx_memoryview_thread_locks_used
28642  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
28643  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
28644  *             __pyx_memoryview_thread_locks_used += 1
28645  */
28646   __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
28647   if (__pyx_t_1) {
28648 
28649     /* "View.MemoryView":356
28650  *         global __pyx_memoryview_thread_locks_used
28651  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
28652  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
28653  *             __pyx_memoryview_thread_locks_used += 1
28654  *         if self.lock is NULL:
28655  */
28656     __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
28657 
28658     /* "View.MemoryView":357
28659  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
28660  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
28661  *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
28662  *         if self.lock is NULL:
28663  *             self.lock = PyThread_allocate_lock()
28664  */
28665     __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
28666 
28667     /* "View.MemoryView":355
28668  *
28669  *         global __pyx_memoryview_thread_locks_used
28670  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
28671  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
28672  *             __pyx_memoryview_thread_locks_used += 1
28673  */
28674   }
28675 
28676   /* "View.MemoryView":358
28677  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
28678  *             __pyx_memoryview_thread_locks_used += 1
28679  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
28680  *             self.lock = PyThread_allocate_lock()
28681  *             if self.lock is NULL:
28682  */
28683   __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
28684   if (__pyx_t_1) {
28685 
28686     /* "View.MemoryView":359
28687  *             __pyx_memoryview_thread_locks_used += 1
28688  *         if self.lock is NULL:
28689  *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
28690  *             if self.lock is NULL:
28691  *                 raise MemoryError
28692  */
28693     __pyx_v_self->lock = PyThread_allocate_lock();
28694 
28695     /* "View.MemoryView":360
28696  *         if self.lock is NULL:
28697  *             self.lock = PyThread_allocate_lock()
28698  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
28699  *                 raise MemoryError
28700  *
28701  */
28702     __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
28703     if (unlikely(__pyx_t_1)) {
28704 
28705       /* "View.MemoryView":361
28706  *             self.lock = PyThread_allocate_lock()
28707  *             if self.lock is NULL:
28708  *                 raise MemoryError             # <<<<<<<<<<<<<<
28709  *
28710  *         if flags & PyBUF_FORMAT:
28711  */
28712       PyErr_NoMemory(); __PYX_ERR(1, 361, __pyx_L1_error)
28713 
28714       /* "View.MemoryView":360
28715  *         if self.lock is NULL:
28716  *             self.lock = PyThread_allocate_lock()
28717  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
28718  *                 raise MemoryError
28719  *
28720  */
28721     }
28722 
28723     /* "View.MemoryView":358
28724  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
28725  *             __pyx_memoryview_thread_locks_used += 1
28726  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
28727  *             self.lock = PyThread_allocate_lock()
28728  *             if self.lock is NULL:
28729  */
28730   }
28731 
28732   /* "View.MemoryView":363
28733  *                 raise MemoryError
28734  *
28735  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
28736  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
28737  *         else:
28738  */
28739   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
28740   if (__pyx_t_1) {
28741 
28742     /* "View.MemoryView":364
28743  *
28744  *         if flags & PyBUF_FORMAT:
28745  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
28746  *         else:
28747  *             self.dtype_is_object = dtype_is_object
28748  */
28749     __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
28750     if (__pyx_t_2) {
28751     } else {
28752       __pyx_t_1 = __pyx_t_2;
28753       goto __pyx_L11_bool_binop_done;
28754     }
28755     __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
28756     __pyx_t_1 = __pyx_t_2;
28757     __pyx_L11_bool_binop_done:;
28758     __pyx_v_self->dtype_is_object = __pyx_t_1;
28759 
28760     /* "View.MemoryView":363
28761  *                 raise MemoryError
28762  *
28763  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
28764  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
28765  *         else:
28766  */
28767     goto __pyx_L10;
28768   }
28769 
28770   /* "View.MemoryView":366
28771  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
28772  *         else:
28773  *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
28774  *
28775  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
28776  */
28777   /*else*/ {
28778     __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
28779   }
28780   __pyx_L10:;
28781 
28782   /* "View.MemoryView":368
28783  *             self.dtype_is_object = dtype_is_object
28784  *
28785  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
28786  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
28787  *         self.typeinfo = NULL
28788  */
28789   __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
28790 
28791   /* "View.MemoryView":370
28792  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
28793  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
28794  *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
28795  *
28796  *     def __dealloc__(memoryview self):
28797  */
28798   __pyx_v_self->typeinfo = NULL;
28799 
28800   /* "View.MemoryView":345
28801  *     cdef __Pyx_TypeInfo *typeinfo
28802  *
28803  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
28804  *         self.obj = obj
28805  *         self.flags = flags
28806  */
28807 
28808   /* function exit code */
28809   __pyx_r = 0;
28810   goto __pyx_L0;
28811   __pyx_L1_error:;
28812   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28813   __pyx_r = -1;
28814   __pyx_L0:;
28815   __Pyx_RefNannyFinishContext();
28816   return __pyx_r;
28817 }
28818 
28819 /* "View.MemoryView":372
28820  *         self.typeinfo = NULL
28821  *
28822  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
28823  *         if self.obj is not None:
28824  *             __Pyx_ReleaseBuffer(&self.view)
28825  */
28826 
28827 /* Python wrapper */
28828 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___dealloc__(PyObject * __pyx_v_self)28829 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
28830   __Pyx_RefNannyDeclarations
28831   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
28832   __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
28833 
28834   /* function exit code */
28835   __Pyx_RefNannyFinishContext();
28836 }
28837 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj * __pyx_v_self)28838 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
28839   int __pyx_v_i;
28840   __Pyx_RefNannyDeclarations
28841   int __pyx_t_1;
28842   int __pyx_t_2;
28843   int __pyx_t_3;
28844   int __pyx_t_4;
28845   int __pyx_t_5;
28846   PyThread_type_lock __pyx_t_6;
28847   PyThread_type_lock __pyx_t_7;
28848   __Pyx_RefNannySetupContext("__dealloc__", 0);
28849 
28850   /* "View.MemoryView":373
28851  *
28852  *     def __dealloc__(memoryview self):
28853  *         if self.obj is not None:             # <<<<<<<<<<<<<<
28854  *             __Pyx_ReleaseBuffer(&self.view)
28855  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
28856  */
28857   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
28858   __pyx_t_2 = (__pyx_t_1 != 0);
28859   if (__pyx_t_2) {
28860 
28861     /* "View.MemoryView":374
28862  *     def __dealloc__(memoryview self):
28863  *         if self.obj is not None:
28864  *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
28865  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
28866  *
28867  */
28868     __Pyx_ReleaseBuffer((&__pyx_v_self->view));
28869 
28870     /* "View.MemoryView":373
28871  *
28872  *     def __dealloc__(memoryview self):
28873  *         if self.obj is not None:             # <<<<<<<<<<<<<<
28874  *             __Pyx_ReleaseBuffer(&self.view)
28875  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
28876  */
28877     goto __pyx_L3;
28878   }
28879 
28880   /* "View.MemoryView":375
28881  *         if self.obj is not None:
28882  *             __Pyx_ReleaseBuffer(&self.view)
28883  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
28884  *
28885  *             (<__pyx_buffer *> &self.view).obj = NULL
28886  */
28887   __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
28888   if (__pyx_t_2) {
28889 
28890     /* "View.MemoryView":377
28891  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
28892  *
28893  *             (<__pyx_buffer *> &self.view).obj = NULL             # <<<<<<<<<<<<<<
28894  *             Py_DECREF(Py_None)
28895  *
28896  */
28897     ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
28898 
28899     /* "View.MemoryView":378
28900  *
28901  *             (<__pyx_buffer *> &self.view).obj = NULL
28902  *             Py_DECREF(Py_None)             # <<<<<<<<<<<<<<
28903  *
28904  *         cdef int i
28905  */
28906     Py_DECREF(Py_None);
28907 
28908     /* "View.MemoryView":375
28909  *         if self.obj is not None:
28910  *             __Pyx_ReleaseBuffer(&self.view)
28911  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
28912  *
28913  *             (<__pyx_buffer *> &self.view).obj = NULL
28914  */
28915   }
28916   __pyx_L3:;
28917 
28918   /* "View.MemoryView":382
28919  *         cdef int i
28920  *         global __pyx_memoryview_thread_locks_used
28921  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
28922  *             for i in range(__pyx_memoryview_thread_locks_used):
28923  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
28924  */
28925   __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
28926   if (__pyx_t_2) {
28927 
28928     /* "View.MemoryView":383
28929  *         global __pyx_memoryview_thread_locks_used
28930  *         if self.lock != NULL:
28931  *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
28932  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
28933  *                     __pyx_memoryview_thread_locks_used -= 1
28934  */
28935     __pyx_t_3 = __pyx_memoryview_thread_locks_used;
28936     __pyx_t_4 = __pyx_t_3;
28937     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
28938       __pyx_v_i = __pyx_t_5;
28939 
28940       /* "View.MemoryView":384
28941  *         if self.lock != NULL:
28942  *             for i in range(__pyx_memoryview_thread_locks_used):
28943  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
28944  *                     __pyx_memoryview_thread_locks_used -= 1
28945  *                     if i != __pyx_memoryview_thread_locks_used:
28946  */
28947       __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
28948       if (__pyx_t_2) {
28949 
28950         /* "View.MemoryView":385
28951  *             for i in range(__pyx_memoryview_thread_locks_used):
28952  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
28953  *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
28954  *                     if i != __pyx_memoryview_thread_locks_used:
28955  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
28956  */
28957         __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
28958 
28959         /* "View.MemoryView":386
28960  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
28961  *                     __pyx_memoryview_thread_locks_used -= 1
28962  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
28963  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
28964  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
28965  */
28966         __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
28967         if (__pyx_t_2) {
28968 
28969           /* "View.MemoryView":388
28970  *                     if i != __pyx_memoryview_thread_locks_used:
28971  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
28972  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
28973  *                     break
28974  *             else:
28975  */
28976           __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
28977           __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
28978 
28979           /* "View.MemoryView":387
28980  *                     __pyx_memoryview_thread_locks_used -= 1
28981  *                     if i != __pyx_memoryview_thread_locks_used:
28982  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
28983  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
28984  *                     break
28985  */
28986           (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
28987           (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
28988 
28989           /* "View.MemoryView":386
28990  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
28991  *                     __pyx_memoryview_thread_locks_used -= 1
28992  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
28993  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
28994  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
28995  */
28996         }
28997 
28998         /* "View.MemoryView":389
28999  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
29000  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
29001  *                     break             # <<<<<<<<<<<<<<
29002  *             else:
29003  *                 PyThread_free_lock(self.lock)
29004  */
29005         goto __pyx_L6_break;
29006 
29007         /* "View.MemoryView":384
29008  *         if self.lock != NULL:
29009  *             for i in range(__pyx_memoryview_thread_locks_used):
29010  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
29011  *                     __pyx_memoryview_thread_locks_used -= 1
29012  *                     if i != __pyx_memoryview_thread_locks_used:
29013  */
29014       }
29015     }
29016     /*else*/ {
29017 
29018       /* "View.MemoryView":391
29019  *                     break
29020  *             else:
29021  *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
29022  *
29023  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
29024  */
29025       PyThread_free_lock(__pyx_v_self->lock);
29026     }
29027     __pyx_L6_break:;
29028 
29029     /* "View.MemoryView":382
29030  *         cdef int i
29031  *         global __pyx_memoryview_thread_locks_used
29032  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
29033  *             for i in range(__pyx_memoryview_thread_locks_used):
29034  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
29035  */
29036   }
29037 
29038   /* "View.MemoryView":372
29039  *         self.typeinfo = NULL
29040  *
29041  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
29042  *         if self.obj is not None:
29043  *             __Pyx_ReleaseBuffer(&self.view)
29044  */
29045 
29046   /* function exit code */
29047   __Pyx_RefNannyFinishContext();
29048 }
29049 
29050 /* "View.MemoryView":393
29051  *                 PyThread_free_lock(self.lock)
29052  *
29053  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
29054  *         cdef Py_ssize_t dim
29055  *         cdef char *itemp = <char *> self.view.buf
29056  */
29057 
__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)29058 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
29059   Py_ssize_t __pyx_v_dim;
29060   char *__pyx_v_itemp;
29061   PyObject *__pyx_v_idx = NULL;
29062   char *__pyx_r;
29063   __Pyx_RefNannyDeclarations
29064   Py_ssize_t __pyx_t_1;
29065   PyObject *__pyx_t_2 = NULL;
29066   Py_ssize_t __pyx_t_3;
29067   PyObject *(*__pyx_t_4)(PyObject *);
29068   PyObject *__pyx_t_5 = NULL;
29069   Py_ssize_t __pyx_t_6;
29070   char *__pyx_t_7;
29071   int __pyx_lineno = 0;
29072   const char *__pyx_filename = NULL;
29073   int __pyx_clineno = 0;
29074   __Pyx_RefNannySetupContext("get_item_pointer", 0);
29075 
29076   /* "View.MemoryView":395
29077  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
29078  *         cdef Py_ssize_t dim
29079  *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
29080  *
29081  *         for dim, idx in enumerate(index):
29082  */
29083   __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
29084 
29085   /* "View.MemoryView":397
29086  *         cdef char *itemp = <char *> self.view.buf
29087  *
29088  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
29089  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
29090  *
29091  */
29092   __pyx_t_1 = 0;
29093   if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
29094     __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
29095     __pyx_t_4 = NULL;
29096   } else {
29097     __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 397, __pyx_L1_error)
29098     __Pyx_GOTREF(__pyx_t_2);
29099     __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 397, __pyx_L1_error)
29100   }
29101   for (;;) {
29102     if (likely(!__pyx_t_4)) {
29103       if (likely(PyList_CheckExact(__pyx_t_2))) {
29104         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
29105         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
29106         __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 397, __pyx_L1_error)
29107         #else
29108         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
29109         __Pyx_GOTREF(__pyx_t_5);
29110         #endif
29111       } else {
29112         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
29113         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
29114         __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 397, __pyx_L1_error)
29115         #else
29116         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
29117         __Pyx_GOTREF(__pyx_t_5);
29118         #endif
29119       }
29120     } else {
29121       __pyx_t_5 = __pyx_t_4(__pyx_t_2);
29122       if (unlikely(!__pyx_t_5)) {
29123         PyObject* exc_type = PyErr_Occurred();
29124         if (exc_type) {
29125           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
29126           else __PYX_ERR(1, 397, __pyx_L1_error)
29127         }
29128         break;
29129       }
29130       __Pyx_GOTREF(__pyx_t_5);
29131     }
29132     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
29133     __pyx_t_5 = 0;
29134     __pyx_v_dim = __pyx_t_1;
29135     __pyx_t_1 = (__pyx_t_1 + 1);
29136 
29137     /* "View.MemoryView":398
29138  *
29139  *         for dim, idx in enumerate(index):
29140  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
29141  *
29142  *         return itemp
29143  */
29144     __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 398, __pyx_L1_error)
29145     __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 398, __pyx_L1_error)
29146     __pyx_v_itemp = __pyx_t_7;
29147 
29148     /* "View.MemoryView":397
29149  *         cdef char *itemp = <char *> self.view.buf
29150  *
29151  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
29152  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
29153  *
29154  */
29155   }
29156   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29157 
29158   /* "View.MemoryView":400
29159  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
29160  *
29161  *         return itemp             # <<<<<<<<<<<<<<
29162  *
29163  *
29164  */
29165   __pyx_r = __pyx_v_itemp;
29166   goto __pyx_L0;
29167 
29168   /* "View.MemoryView":393
29169  *                 PyThread_free_lock(self.lock)
29170  *
29171  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
29172  *         cdef Py_ssize_t dim
29173  *         cdef char *itemp = <char *> self.view.buf
29174  */
29175 
29176   /* function exit code */
29177   __pyx_L1_error:;
29178   __Pyx_XDECREF(__pyx_t_2);
29179   __Pyx_XDECREF(__pyx_t_5);
29180   __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
29181   __pyx_r = NULL;
29182   __pyx_L0:;
29183   __Pyx_XDECREF(__pyx_v_idx);
29184   __Pyx_RefNannyFinishContext();
29185   return __pyx_r;
29186 }
29187 
29188 /* "View.MemoryView":403
29189  *
29190  *
29191  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
29192  *         if index is Ellipsis:
29193  *             return self
29194  */
29195 
29196 /* Python wrapper */
29197 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
__pyx_memoryview___getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_index)29198 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
29199   PyObject *__pyx_r = 0;
29200   __Pyx_RefNannyDeclarations
29201   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
29202   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
29203 
29204   /* function exit code */
29205   __Pyx_RefNannyFinishContext();
29206   return __pyx_r;
29207 }
29208 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)29209 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
29210   PyObject *__pyx_v_have_slices = NULL;
29211   PyObject *__pyx_v_indices = NULL;
29212   char *__pyx_v_itemp;
29213   PyObject *__pyx_r = NULL;
29214   __Pyx_RefNannyDeclarations
29215   int __pyx_t_1;
29216   int __pyx_t_2;
29217   PyObject *__pyx_t_3 = NULL;
29218   PyObject *__pyx_t_4 = NULL;
29219   PyObject *__pyx_t_5 = NULL;
29220   char *__pyx_t_6;
29221   int __pyx_lineno = 0;
29222   const char *__pyx_filename = NULL;
29223   int __pyx_clineno = 0;
29224   __Pyx_RefNannySetupContext("__getitem__", 0);
29225 
29226   /* "View.MemoryView":404
29227  *
29228  *     def __getitem__(memoryview self, object index):
29229  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
29230  *             return self
29231  *
29232  */
29233   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
29234   __pyx_t_2 = (__pyx_t_1 != 0);
29235   if (__pyx_t_2) {
29236 
29237     /* "View.MemoryView":405
29238  *     def __getitem__(memoryview self, object index):
29239  *         if index is Ellipsis:
29240  *             return self             # <<<<<<<<<<<<<<
29241  *
29242  *         have_slices, indices = _unellipsify(index, self.view.ndim)
29243  */
29244     __Pyx_XDECREF(__pyx_r);
29245     __Pyx_INCREF(((PyObject *)__pyx_v_self));
29246     __pyx_r = ((PyObject *)__pyx_v_self);
29247     goto __pyx_L0;
29248 
29249     /* "View.MemoryView":404
29250  *
29251  *     def __getitem__(memoryview self, object index):
29252  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
29253  *             return self
29254  *
29255  */
29256   }
29257 
29258   /* "View.MemoryView":407
29259  *             return self
29260  *
29261  *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
29262  *
29263  *         cdef char *itemp
29264  */
29265   __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 407, __pyx_L1_error)
29266   __Pyx_GOTREF(__pyx_t_3);
29267   if (likely(__pyx_t_3 != Py_None)) {
29268     PyObject* sequence = __pyx_t_3;
29269     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
29270     if (unlikely(size != 2)) {
29271       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
29272       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
29273       __PYX_ERR(1, 407, __pyx_L1_error)
29274     }
29275     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
29276     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
29277     __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
29278     __Pyx_INCREF(__pyx_t_4);
29279     __Pyx_INCREF(__pyx_t_5);
29280     #else
29281     __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 407, __pyx_L1_error)
29282     __Pyx_GOTREF(__pyx_t_4);
29283     __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 407, __pyx_L1_error)
29284     __Pyx_GOTREF(__pyx_t_5);
29285     #endif
29286     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29287   } else {
29288     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 407, __pyx_L1_error)
29289   }
29290   __pyx_v_have_slices = __pyx_t_4;
29291   __pyx_t_4 = 0;
29292   __pyx_v_indices = __pyx_t_5;
29293   __pyx_t_5 = 0;
29294 
29295   /* "View.MemoryView":410
29296  *
29297  *         cdef char *itemp
29298  *         if have_slices:             # <<<<<<<<<<<<<<
29299  *             return memview_slice(self, indices)
29300  *         else:
29301  */
29302   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 410, __pyx_L1_error)
29303   if (__pyx_t_2) {
29304 
29305     /* "View.MemoryView":411
29306  *         cdef char *itemp
29307  *         if have_slices:
29308  *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
29309  *         else:
29310  *             itemp = self.get_item_pointer(indices)
29311  */
29312     __Pyx_XDECREF(__pyx_r);
29313     __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error)
29314     __Pyx_GOTREF(__pyx_t_3);
29315     __pyx_r = __pyx_t_3;
29316     __pyx_t_3 = 0;
29317     goto __pyx_L0;
29318 
29319     /* "View.MemoryView":410
29320  *
29321  *         cdef char *itemp
29322  *         if have_slices:             # <<<<<<<<<<<<<<
29323  *             return memview_slice(self, indices)
29324  *         else:
29325  */
29326   }
29327 
29328   /* "View.MemoryView":413
29329  *             return memview_slice(self, indices)
29330  *         else:
29331  *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
29332  *             return self.convert_item_to_object(itemp)
29333  *
29334  */
29335   /*else*/ {
29336     __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(1, 413, __pyx_L1_error)
29337     __pyx_v_itemp = __pyx_t_6;
29338 
29339     /* "View.MemoryView":414
29340  *         else:
29341  *             itemp = self.get_item_pointer(indices)
29342  *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
29343  *
29344  *     def __setitem__(memoryview self, object index, object value):
29345  */
29346     __Pyx_XDECREF(__pyx_r);
29347     __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 414, __pyx_L1_error)
29348     __Pyx_GOTREF(__pyx_t_3);
29349     __pyx_r = __pyx_t_3;
29350     __pyx_t_3 = 0;
29351     goto __pyx_L0;
29352   }
29353 
29354   /* "View.MemoryView":403
29355  *
29356  *
29357  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
29358  *         if index is Ellipsis:
29359  *             return self
29360  */
29361 
29362   /* function exit code */
29363   __pyx_L1_error:;
29364   __Pyx_XDECREF(__pyx_t_3);
29365   __Pyx_XDECREF(__pyx_t_4);
29366   __Pyx_XDECREF(__pyx_t_5);
29367   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
29368   __pyx_r = NULL;
29369   __pyx_L0:;
29370   __Pyx_XDECREF(__pyx_v_have_slices);
29371   __Pyx_XDECREF(__pyx_v_indices);
29372   __Pyx_XGIVEREF(__pyx_r);
29373   __Pyx_RefNannyFinishContext();
29374   return __pyx_r;
29375 }
29376 
29377 /* "View.MemoryView":416
29378  *             return self.convert_item_to_object(itemp)
29379  *
29380  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
29381  *         if self.view.readonly:
29382  *             raise TypeError("Cannot assign to read-only memoryview")
29383  */
29384 
29385 /* Python wrapper */
29386 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
__pyx_memoryview___setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)29387 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
29388   int __pyx_r;
29389   __Pyx_RefNannyDeclarations
29390   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
29391   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
29392 
29393   /* function exit code */
29394   __Pyx_RefNannyFinishContext();
29395   return __pyx_r;
29396 }
29397 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)29398 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
29399   PyObject *__pyx_v_have_slices = NULL;
29400   PyObject *__pyx_v_obj = NULL;
29401   int __pyx_r;
29402   __Pyx_RefNannyDeclarations
29403   int __pyx_t_1;
29404   PyObject *__pyx_t_2 = NULL;
29405   PyObject *__pyx_t_3 = NULL;
29406   PyObject *__pyx_t_4 = NULL;
29407   int __pyx_lineno = 0;
29408   const char *__pyx_filename = NULL;
29409   int __pyx_clineno = 0;
29410   __Pyx_RefNannySetupContext("__setitem__", 0);
29411   __Pyx_INCREF(__pyx_v_index);
29412 
29413   /* "View.MemoryView":417
29414  *
29415  *     def __setitem__(memoryview self, object index, object value):
29416  *         if self.view.readonly:             # <<<<<<<<<<<<<<
29417  *             raise TypeError("Cannot assign to read-only memoryview")
29418  *
29419  */
29420   __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
29421   if (unlikely(__pyx_t_1)) {
29422 
29423     /* "View.MemoryView":418
29424  *     def __setitem__(memoryview self, object index, object value):
29425  *         if self.view.readonly:
29426  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
29427  *
29428  *         have_slices, index = _unellipsify(index, self.view.ndim)
29429  */
29430     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error)
29431     __Pyx_GOTREF(__pyx_t_2);
29432     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
29433     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29434     __PYX_ERR(1, 418, __pyx_L1_error)
29435 
29436     /* "View.MemoryView":417
29437  *
29438  *     def __setitem__(memoryview self, object index, object value):
29439  *         if self.view.readonly:             # <<<<<<<<<<<<<<
29440  *             raise TypeError("Cannot assign to read-only memoryview")
29441  *
29442  */
29443   }
29444 
29445   /* "View.MemoryView":420
29446  *             raise TypeError("Cannot assign to read-only memoryview")
29447  *
29448  *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
29449  *
29450  *         if have_slices:
29451  */
29452   __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 420, __pyx_L1_error)
29453   __Pyx_GOTREF(__pyx_t_2);
29454   if (likely(__pyx_t_2 != Py_None)) {
29455     PyObject* sequence = __pyx_t_2;
29456     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
29457     if (unlikely(size != 2)) {
29458       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
29459       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
29460       __PYX_ERR(1, 420, __pyx_L1_error)
29461     }
29462     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
29463     __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
29464     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
29465     __Pyx_INCREF(__pyx_t_3);
29466     __Pyx_INCREF(__pyx_t_4);
29467     #else
29468     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 420, __pyx_L1_error)
29469     __Pyx_GOTREF(__pyx_t_3);
29470     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 420, __pyx_L1_error)
29471     __Pyx_GOTREF(__pyx_t_4);
29472     #endif
29473     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29474   } else {
29475     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 420, __pyx_L1_error)
29476   }
29477   __pyx_v_have_slices = __pyx_t_3;
29478   __pyx_t_3 = 0;
29479   __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
29480   __pyx_t_4 = 0;
29481 
29482   /* "View.MemoryView":422
29483  *         have_slices, index = _unellipsify(index, self.view.ndim)
29484  *
29485  *         if have_slices:             # <<<<<<<<<<<<<<
29486  *             obj = self.is_slice(value)
29487  *             if obj:
29488  */
29489   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 422, __pyx_L1_error)
29490   if (__pyx_t_1) {
29491 
29492     /* "View.MemoryView":423
29493  *
29494  *         if have_slices:
29495  *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
29496  *             if obj:
29497  *                 self.setitem_slice_assignment(self[index], obj)
29498  */
29499     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 423, __pyx_L1_error)
29500     __Pyx_GOTREF(__pyx_t_2);
29501     __pyx_v_obj = __pyx_t_2;
29502     __pyx_t_2 = 0;
29503 
29504     /* "View.MemoryView":424
29505  *         if have_slices:
29506  *             obj = self.is_slice(value)
29507  *             if obj:             # <<<<<<<<<<<<<<
29508  *                 self.setitem_slice_assignment(self[index], obj)
29509  *             else:
29510  */
29511     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 424, __pyx_L1_error)
29512     if (__pyx_t_1) {
29513 
29514       /* "View.MemoryView":425
29515  *             obj = self.is_slice(value)
29516  *             if obj:
29517  *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
29518  *             else:
29519  *                 self.setitem_slice_assign_scalar(self[index], value)
29520  */
29521       __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
29522       __Pyx_GOTREF(__pyx_t_2);
29523       __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 425, __pyx_L1_error)
29524       __Pyx_GOTREF(__pyx_t_4);
29525       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29526       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
29527 
29528       /* "View.MemoryView":424
29529  *         if have_slices:
29530  *             obj = self.is_slice(value)
29531  *             if obj:             # <<<<<<<<<<<<<<
29532  *                 self.setitem_slice_assignment(self[index], obj)
29533  *             else:
29534  */
29535       goto __pyx_L5;
29536     }
29537 
29538     /* "View.MemoryView":427
29539  *                 self.setitem_slice_assignment(self[index], obj)
29540  *             else:
29541  *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
29542  *         else:
29543  *             self.setitem_indexed(index, value)
29544  */
29545     /*else*/ {
29546       __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 427, __pyx_L1_error)
29547       __Pyx_GOTREF(__pyx_t_4);
29548       if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(1, 427, __pyx_L1_error)
29549       __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 427, __pyx_L1_error)
29550       __Pyx_GOTREF(__pyx_t_2);
29551       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
29552       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29553     }
29554     __pyx_L5:;
29555 
29556     /* "View.MemoryView":422
29557  *         have_slices, index = _unellipsify(index, self.view.ndim)
29558  *
29559  *         if have_slices:             # <<<<<<<<<<<<<<
29560  *             obj = self.is_slice(value)
29561  *             if obj:
29562  */
29563     goto __pyx_L4;
29564   }
29565 
29566   /* "View.MemoryView":429
29567  *                 self.setitem_slice_assign_scalar(self[index], value)
29568  *         else:
29569  *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
29570  *
29571  *     cdef is_slice(self, obj):
29572  */
29573   /*else*/ {
29574     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 429, __pyx_L1_error)
29575     __Pyx_GOTREF(__pyx_t_2);
29576     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29577   }
29578   __pyx_L4:;
29579 
29580   /* "View.MemoryView":416
29581  *             return self.convert_item_to_object(itemp)
29582  *
29583  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
29584  *         if self.view.readonly:
29585  *             raise TypeError("Cannot assign to read-only memoryview")
29586  */
29587 
29588   /* function exit code */
29589   __pyx_r = 0;
29590   goto __pyx_L0;
29591   __pyx_L1_error:;
29592   __Pyx_XDECREF(__pyx_t_2);
29593   __Pyx_XDECREF(__pyx_t_3);
29594   __Pyx_XDECREF(__pyx_t_4);
29595   __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
29596   __pyx_r = -1;
29597   __pyx_L0:;
29598   __Pyx_XDECREF(__pyx_v_have_slices);
29599   __Pyx_XDECREF(__pyx_v_obj);
29600   __Pyx_XDECREF(__pyx_v_index);
29601   __Pyx_RefNannyFinishContext();
29602   return __pyx_r;
29603 }
29604 
29605 /* "View.MemoryView":431
29606  *             self.setitem_indexed(index, value)
29607  *
29608  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
29609  *         if not isinstance(obj, memoryview):
29610  *             try:
29611  */
29612 
__pyx_memoryview_is_slice(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj)29613 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
29614   PyObject *__pyx_r = NULL;
29615   __Pyx_RefNannyDeclarations
29616   int __pyx_t_1;
29617   int __pyx_t_2;
29618   PyObject *__pyx_t_3 = NULL;
29619   PyObject *__pyx_t_4 = NULL;
29620   PyObject *__pyx_t_5 = NULL;
29621   PyObject *__pyx_t_6 = NULL;
29622   PyObject *__pyx_t_7 = NULL;
29623   PyObject *__pyx_t_8 = NULL;
29624   int __pyx_t_9;
29625   int __pyx_lineno = 0;
29626   const char *__pyx_filename = NULL;
29627   int __pyx_clineno = 0;
29628   __Pyx_RefNannySetupContext("is_slice", 0);
29629   __Pyx_INCREF(__pyx_v_obj);
29630 
29631   /* "View.MemoryView":432
29632  *
29633  *     cdef is_slice(self, obj):
29634  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
29635  *             try:
29636  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
29637  */
29638   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
29639   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
29640   if (__pyx_t_2) {
29641 
29642     /* "View.MemoryView":433
29643  *     cdef is_slice(self, obj):
29644  *         if not isinstance(obj, memoryview):
29645  *             try:             # <<<<<<<<<<<<<<
29646  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
29647  *                                  self.dtype_is_object)
29648  */
29649     {
29650       __Pyx_PyThreadState_declare
29651       __Pyx_PyThreadState_assign
29652       __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
29653       __Pyx_XGOTREF(__pyx_t_3);
29654       __Pyx_XGOTREF(__pyx_t_4);
29655       __Pyx_XGOTREF(__pyx_t_5);
29656       /*try:*/ {
29657 
29658         /* "View.MemoryView":434
29659  *         if not isinstance(obj, memoryview):
29660  *             try:
29661  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
29662  *                                  self.dtype_is_object)
29663  *             except TypeError:
29664  */
29665         __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 434, __pyx_L4_error)
29666         __Pyx_GOTREF(__pyx_t_6);
29667 
29668         /* "View.MemoryView":435
29669  *             try:
29670  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
29671  *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
29672  *             except TypeError:
29673  *                 return None
29674  */
29675         __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 435, __pyx_L4_error)
29676         __Pyx_GOTREF(__pyx_t_7);
29677 
29678         /* "View.MemoryView":434
29679  *         if not isinstance(obj, memoryview):
29680  *             try:
29681  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
29682  *                                  self.dtype_is_object)
29683  *             except TypeError:
29684  */
29685         __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 434, __pyx_L4_error)
29686         __Pyx_GOTREF(__pyx_t_8);
29687         __Pyx_INCREF(__pyx_v_obj);
29688         __Pyx_GIVEREF(__pyx_v_obj);
29689         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
29690         __Pyx_GIVEREF(__pyx_t_6);
29691         PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
29692         __Pyx_GIVEREF(__pyx_t_7);
29693         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
29694         __pyx_t_6 = 0;
29695         __pyx_t_7 = 0;
29696         __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 434, __pyx_L4_error)
29697         __Pyx_GOTREF(__pyx_t_7);
29698         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
29699         __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
29700         __pyx_t_7 = 0;
29701 
29702         /* "View.MemoryView":433
29703  *     cdef is_slice(self, obj):
29704  *         if not isinstance(obj, memoryview):
29705  *             try:             # <<<<<<<<<<<<<<
29706  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
29707  *                                  self.dtype_is_object)
29708  */
29709       }
29710       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
29711       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
29712       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
29713       goto __pyx_L9_try_end;
29714       __pyx_L4_error:;
29715       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
29716       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
29717       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
29718 
29719       /* "View.MemoryView":436
29720  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
29721  *                                  self.dtype_is_object)
29722  *             except TypeError:             # <<<<<<<<<<<<<<
29723  *                 return None
29724  *
29725  */
29726       __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
29727       if (__pyx_t_9) {
29728         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
29729         if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 436, __pyx_L6_except_error)
29730         __Pyx_GOTREF(__pyx_t_7);
29731         __Pyx_GOTREF(__pyx_t_8);
29732         __Pyx_GOTREF(__pyx_t_6);
29733 
29734         /* "View.MemoryView":437
29735  *                                  self.dtype_is_object)
29736  *             except TypeError:
29737  *                 return None             # <<<<<<<<<<<<<<
29738  *
29739  *         return obj
29740  */
29741         __Pyx_XDECREF(__pyx_r);
29742         __pyx_r = Py_None; __Pyx_INCREF(Py_None);
29743         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29744         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
29745         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
29746         goto __pyx_L7_except_return;
29747       }
29748       goto __pyx_L6_except_error;
29749       __pyx_L6_except_error:;
29750 
29751       /* "View.MemoryView":433
29752  *     cdef is_slice(self, obj):
29753  *         if not isinstance(obj, memoryview):
29754  *             try:             # <<<<<<<<<<<<<<
29755  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
29756  *                                  self.dtype_is_object)
29757  */
29758       __Pyx_XGIVEREF(__pyx_t_3);
29759       __Pyx_XGIVEREF(__pyx_t_4);
29760       __Pyx_XGIVEREF(__pyx_t_5);
29761       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
29762       goto __pyx_L1_error;
29763       __pyx_L7_except_return:;
29764       __Pyx_XGIVEREF(__pyx_t_3);
29765       __Pyx_XGIVEREF(__pyx_t_4);
29766       __Pyx_XGIVEREF(__pyx_t_5);
29767       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
29768       goto __pyx_L0;
29769       __pyx_L9_try_end:;
29770     }
29771 
29772     /* "View.MemoryView":432
29773  *
29774  *     cdef is_slice(self, obj):
29775  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
29776  *             try:
29777  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
29778  */
29779   }
29780 
29781   /* "View.MemoryView":439
29782  *                 return None
29783  *
29784  *         return obj             # <<<<<<<<<<<<<<
29785  *
29786  *     cdef setitem_slice_assignment(self, dst, src):
29787  */
29788   __Pyx_XDECREF(__pyx_r);
29789   __Pyx_INCREF(__pyx_v_obj);
29790   __pyx_r = __pyx_v_obj;
29791   goto __pyx_L0;
29792 
29793   /* "View.MemoryView":431
29794  *             self.setitem_indexed(index, value)
29795  *
29796  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
29797  *         if not isinstance(obj, memoryview):
29798  *             try:
29799  */
29800 
29801   /* function exit code */
29802   __pyx_L1_error:;
29803   __Pyx_XDECREF(__pyx_t_6);
29804   __Pyx_XDECREF(__pyx_t_7);
29805   __Pyx_XDECREF(__pyx_t_8);
29806   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
29807   __pyx_r = 0;
29808   __pyx_L0:;
29809   __Pyx_XDECREF(__pyx_v_obj);
29810   __Pyx_XGIVEREF(__pyx_r);
29811   __Pyx_RefNannyFinishContext();
29812   return __pyx_r;
29813 }
29814 
29815 /* "View.MemoryView":441
29816  *         return obj
29817  *
29818  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
29819  *         cdef __Pyx_memviewslice dst_slice
29820  *         cdef __Pyx_memviewslice src_slice
29821  */
29822 
__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_dst,PyObject * __pyx_v_src)29823 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
29824   __Pyx_memviewslice __pyx_v_dst_slice;
29825   __Pyx_memviewslice __pyx_v_src_slice;
29826   PyObject *__pyx_r = NULL;
29827   __Pyx_RefNannyDeclarations
29828   __Pyx_memviewslice *__pyx_t_1;
29829   __Pyx_memviewslice *__pyx_t_2;
29830   PyObject *__pyx_t_3 = NULL;
29831   int __pyx_t_4;
29832   int __pyx_t_5;
29833   int __pyx_t_6;
29834   int __pyx_lineno = 0;
29835   const char *__pyx_filename = NULL;
29836   int __pyx_clineno = 0;
29837   __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
29838 
29839   /* "View.MemoryView":445
29840  *         cdef __Pyx_memviewslice src_slice
29841  *
29842  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
29843  *                                  get_slice_from_memview(dst, &dst_slice)[0],
29844  *                                  src.ndim, dst.ndim, self.dtype_is_object)
29845  */
29846   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 445, __pyx_L1_error)
29847   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 445, __pyx_L1_error)
29848 
29849   /* "View.MemoryView":446
29850  *
29851  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
29852  *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
29853  *                                  src.ndim, dst.ndim, self.dtype_is_object)
29854  *
29855  */
29856   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 446, __pyx_L1_error)
29857   __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 446, __pyx_L1_error)
29858 
29859   /* "View.MemoryView":447
29860  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
29861  *                                  get_slice_from_memview(dst, &dst_slice)[0],
29862  *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
29863  *
29864  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
29865  */
29866   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
29867   __Pyx_GOTREF(__pyx_t_3);
29868   __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
29869   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29870   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
29871   __Pyx_GOTREF(__pyx_t_3);
29872   __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
29873   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29874 
29875   /* "View.MemoryView":445
29876  *         cdef __Pyx_memviewslice src_slice
29877  *
29878  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
29879  *                                  get_slice_from_memview(dst, &dst_slice)[0],
29880  *                                  src.ndim, dst.ndim, self.dtype_is_object)
29881  */
29882   __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 445, __pyx_L1_error)
29883 
29884   /* "View.MemoryView":441
29885  *         return obj
29886  *
29887  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
29888  *         cdef __Pyx_memviewslice dst_slice
29889  *         cdef __Pyx_memviewslice src_slice
29890  */
29891 
29892   /* function exit code */
29893   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
29894   goto __pyx_L0;
29895   __pyx_L1_error:;
29896   __Pyx_XDECREF(__pyx_t_3);
29897   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
29898   __pyx_r = 0;
29899   __pyx_L0:;
29900   __Pyx_XGIVEREF(__pyx_r);
29901   __Pyx_RefNannyFinishContext();
29902   return __pyx_r;
29903 }
29904 
29905 /* "View.MemoryView":449
29906  *                                  src.ndim, dst.ndim, self.dtype_is_object)
29907  *
29908  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
29909  *         cdef int array[128]
29910  *         cdef void *tmp = NULL
29911  */
29912 
__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj * __pyx_v_self,struct __pyx_memoryview_obj * __pyx_v_dst,PyObject * __pyx_v_value)29913 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
29914   int __pyx_v_array[0x80];
29915   void *__pyx_v_tmp;
29916   void *__pyx_v_item;
29917   __Pyx_memviewslice *__pyx_v_dst_slice;
29918   __Pyx_memviewslice __pyx_v_tmp_slice;
29919   PyObject *__pyx_r = NULL;
29920   __Pyx_RefNannyDeclarations
29921   __Pyx_memviewslice *__pyx_t_1;
29922   int __pyx_t_2;
29923   PyObject *__pyx_t_3 = NULL;
29924   int __pyx_t_4;
29925   int __pyx_t_5;
29926   char const *__pyx_t_6;
29927   PyObject *__pyx_t_7 = NULL;
29928   PyObject *__pyx_t_8 = NULL;
29929   PyObject *__pyx_t_9 = NULL;
29930   PyObject *__pyx_t_10 = NULL;
29931   PyObject *__pyx_t_11 = NULL;
29932   PyObject *__pyx_t_12 = NULL;
29933   int __pyx_lineno = 0;
29934   const char *__pyx_filename = NULL;
29935   int __pyx_clineno = 0;
29936   __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
29937 
29938   /* "View.MemoryView":451
29939  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
29940  *         cdef int array[128]
29941  *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
29942  *         cdef void *item
29943  *
29944  */
29945   __pyx_v_tmp = NULL;
29946 
29947   /* "View.MemoryView":456
29948  *         cdef __Pyx_memviewslice *dst_slice
29949  *         cdef __Pyx_memviewslice tmp_slice
29950  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
29951  *
29952  *         if <size_t>self.view.itemsize > sizeof(array):
29953  */
29954   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 456, __pyx_L1_error)
29955   __pyx_v_dst_slice = __pyx_t_1;
29956 
29957   /* "View.MemoryView":458
29958  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
29959  *
29960  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
29961  *             tmp = PyMem_Malloc(self.view.itemsize)
29962  *             if tmp == NULL:
29963  */
29964   __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
29965   if (__pyx_t_2) {
29966 
29967     /* "View.MemoryView":459
29968  *
29969  *         if <size_t>self.view.itemsize > sizeof(array):
29970  *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
29971  *             if tmp == NULL:
29972  *                 raise MemoryError
29973  */
29974     __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
29975 
29976     /* "View.MemoryView":460
29977  *         if <size_t>self.view.itemsize > sizeof(array):
29978  *             tmp = PyMem_Malloc(self.view.itemsize)
29979  *             if tmp == NULL:             # <<<<<<<<<<<<<<
29980  *                 raise MemoryError
29981  *             item = tmp
29982  */
29983     __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
29984     if (unlikely(__pyx_t_2)) {
29985 
29986       /* "View.MemoryView":461
29987  *             tmp = PyMem_Malloc(self.view.itemsize)
29988  *             if tmp == NULL:
29989  *                 raise MemoryError             # <<<<<<<<<<<<<<
29990  *             item = tmp
29991  *         else:
29992  */
29993       PyErr_NoMemory(); __PYX_ERR(1, 461, __pyx_L1_error)
29994 
29995       /* "View.MemoryView":460
29996  *         if <size_t>self.view.itemsize > sizeof(array):
29997  *             tmp = PyMem_Malloc(self.view.itemsize)
29998  *             if tmp == NULL:             # <<<<<<<<<<<<<<
29999  *                 raise MemoryError
30000  *             item = tmp
30001  */
30002     }
30003 
30004     /* "View.MemoryView":462
30005  *             if tmp == NULL:
30006  *                 raise MemoryError
30007  *             item = tmp             # <<<<<<<<<<<<<<
30008  *         else:
30009  *             item = <void *> array
30010  */
30011     __pyx_v_item = __pyx_v_tmp;
30012 
30013     /* "View.MemoryView":458
30014  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
30015  *
30016  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
30017  *             tmp = PyMem_Malloc(self.view.itemsize)
30018  *             if tmp == NULL:
30019  */
30020     goto __pyx_L3;
30021   }
30022 
30023   /* "View.MemoryView":464
30024  *             item = tmp
30025  *         else:
30026  *             item = <void *> array             # <<<<<<<<<<<<<<
30027  *
30028  *         try:
30029  */
30030   /*else*/ {
30031     __pyx_v_item = ((void *)__pyx_v_array);
30032   }
30033   __pyx_L3:;
30034 
30035   /* "View.MemoryView":466
30036  *             item = <void *> array
30037  *
30038  *         try:             # <<<<<<<<<<<<<<
30039  *             if self.dtype_is_object:
30040  *                 (<PyObject **> item)[0] = <PyObject *> value
30041  */
30042   /*try:*/ {
30043 
30044     /* "View.MemoryView":467
30045  *
30046  *         try:
30047  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
30048  *                 (<PyObject **> item)[0] = <PyObject *> value
30049  *             else:
30050  */
30051     __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
30052     if (__pyx_t_2) {
30053 
30054       /* "View.MemoryView":468
30055  *         try:
30056  *             if self.dtype_is_object:
30057  *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
30058  *             else:
30059  *                 self.assign_item_from_object(<char *> item, value)
30060  */
30061       (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
30062 
30063       /* "View.MemoryView":467
30064  *
30065  *         try:
30066  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
30067  *                 (<PyObject **> item)[0] = <PyObject *> value
30068  *             else:
30069  */
30070       goto __pyx_L8;
30071     }
30072 
30073     /* "View.MemoryView":470
30074  *                 (<PyObject **> item)[0] = <PyObject *> value
30075  *             else:
30076  *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
30077  *
30078  *
30079  */
30080     /*else*/ {
30081       __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 470, __pyx_L6_error)
30082       __Pyx_GOTREF(__pyx_t_3);
30083       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30084     }
30085     __pyx_L8:;
30086 
30087     /* "View.MemoryView":474
30088  *
30089  *
30090  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
30091  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
30092  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
30093  */
30094     __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
30095     if (__pyx_t_2) {
30096 
30097       /* "View.MemoryView":475
30098  *
30099  *             if self.view.suboffsets != NULL:
30100  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
30101  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
30102  *                                 item, self.dtype_is_object)
30103  */
30104       __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error)
30105       __Pyx_GOTREF(__pyx_t_3);
30106       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30107 
30108       /* "View.MemoryView":474
30109  *
30110  *
30111  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
30112  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
30113  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
30114  */
30115     }
30116 
30117     /* "View.MemoryView":476
30118  *             if self.view.suboffsets != NULL:
30119  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
30120  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
30121  *                                 item, self.dtype_is_object)
30122  *         finally:
30123  */
30124     __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
30125   }
30126 
30127   /* "View.MemoryView":479
30128  *                                 item, self.dtype_is_object)
30129  *         finally:
30130  *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
30131  *
30132  *     cdef setitem_indexed(self, index, value):
30133  */
30134   /*finally:*/ {
30135     /*normal exit:*/{
30136       PyMem_Free(__pyx_v_tmp);
30137       goto __pyx_L7;
30138     }
30139     __pyx_L6_error:;
30140     /*exception exit:*/{
30141       __Pyx_PyThreadState_declare
30142       __Pyx_PyThreadState_assign
30143       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
30144       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
30145       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
30146       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
30147       __Pyx_XGOTREF(__pyx_t_7);
30148       __Pyx_XGOTREF(__pyx_t_8);
30149       __Pyx_XGOTREF(__pyx_t_9);
30150       __Pyx_XGOTREF(__pyx_t_10);
30151       __Pyx_XGOTREF(__pyx_t_11);
30152       __Pyx_XGOTREF(__pyx_t_12);
30153       __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
30154       {
30155         PyMem_Free(__pyx_v_tmp);
30156       }
30157       if (PY_MAJOR_VERSION >= 3) {
30158         __Pyx_XGIVEREF(__pyx_t_10);
30159         __Pyx_XGIVEREF(__pyx_t_11);
30160         __Pyx_XGIVEREF(__pyx_t_12);
30161         __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
30162       }
30163       __Pyx_XGIVEREF(__pyx_t_7);
30164       __Pyx_XGIVEREF(__pyx_t_8);
30165       __Pyx_XGIVEREF(__pyx_t_9);
30166       __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
30167       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
30168       __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
30169       goto __pyx_L1_error;
30170     }
30171     __pyx_L7:;
30172   }
30173 
30174   /* "View.MemoryView":449
30175  *                                  src.ndim, dst.ndim, self.dtype_is_object)
30176  *
30177  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
30178  *         cdef int array[128]
30179  *         cdef void *tmp = NULL
30180  */
30181 
30182   /* function exit code */
30183   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
30184   goto __pyx_L0;
30185   __pyx_L1_error:;
30186   __Pyx_XDECREF(__pyx_t_3);
30187   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
30188   __pyx_r = 0;
30189   __pyx_L0:;
30190   __Pyx_XGIVEREF(__pyx_r);
30191   __Pyx_RefNannyFinishContext();
30192   return __pyx_r;
30193 }
30194 
30195 /* "View.MemoryView":481
30196  *             PyMem_Free(tmp)
30197  *
30198  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
30199  *         cdef char *itemp = self.get_item_pointer(index)
30200  *         self.assign_item_from_object(itemp, value)
30201  */
30202 
__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)30203 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
30204   char *__pyx_v_itemp;
30205   PyObject *__pyx_r = NULL;
30206   __Pyx_RefNannyDeclarations
30207   char *__pyx_t_1;
30208   PyObject *__pyx_t_2 = NULL;
30209   int __pyx_lineno = 0;
30210   const char *__pyx_filename = NULL;
30211   int __pyx_clineno = 0;
30212   __Pyx_RefNannySetupContext("setitem_indexed", 0);
30213 
30214   /* "View.MemoryView":482
30215  *
30216  *     cdef setitem_indexed(self, index, value):
30217  *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
30218  *         self.assign_item_from_object(itemp, value)
30219  *
30220  */
30221   __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(1, 482, __pyx_L1_error)
30222   __pyx_v_itemp = __pyx_t_1;
30223 
30224   /* "View.MemoryView":483
30225  *     cdef setitem_indexed(self, index, value):
30226  *         cdef char *itemp = self.get_item_pointer(index)
30227  *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
30228  *
30229  *     cdef convert_item_to_object(self, char *itemp):
30230  */
30231   __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 483, __pyx_L1_error)
30232   __Pyx_GOTREF(__pyx_t_2);
30233   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30234 
30235   /* "View.MemoryView":481
30236  *             PyMem_Free(tmp)
30237  *
30238  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
30239  *         cdef char *itemp = self.get_item_pointer(index)
30240  *         self.assign_item_from_object(itemp, value)
30241  */
30242 
30243   /* function exit code */
30244   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
30245   goto __pyx_L0;
30246   __pyx_L1_error:;
30247   __Pyx_XDECREF(__pyx_t_2);
30248   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
30249   __pyx_r = 0;
30250   __pyx_L0:;
30251   __Pyx_XGIVEREF(__pyx_r);
30252   __Pyx_RefNannyFinishContext();
30253   return __pyx_r;
30254 }
30255 
30256 /* "View.MemoryView":485
30257  *         self.assign_item_from_object(itemp, value)
30258  *
30259  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
30260  *         """Only used if instantiated manually by the user, or if Cython doesn't
30261  *         know how to convert the type"""
30262  */
30263 
__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp)30264 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
30265   PyObject *__pyx_v_struct = NULL;
30266   PyObject *__pyx_v_bytesitem = 0;
30267   PyObject *__pyx_v_result = NULL;
30268   PyObject *__pyx_r = NULL;
30269   __Pyx_RefNannyDeclarations
30270   PyObject *__pyx_t_1 = NULL;
30271   PyObject *__pyx_t_2 = NULL;
30272   PyObject *__pyx_t_3 = NULL;
30273   PyObject *__pyx_t_4 = NULL;
30274   PyObject *__pyx_t_5 = NULL;
30275   PyObject *__pyx_t_6 = NULL;
30276   PyObject *__pyx_t_7 = NULL;
30277   int __pyx_t_8;
30278   PyObject *__pyx_t_9 = NULL;
30279   size_t __pyx_t_10;
30280   int __pyx_t_11;
30281   int __pyx_lineno = 0;
30282   const char *__pyx_filename = NULL;
30283   int __pyx_clineno = 0;
30284   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
30285 
30286   /* "View.MemoryView":488
30287  *         """Only used if instantiated manually by the user, or if Cython doesn't
30288  *         know how to convert the type"""
30289  *         import struct             # <<<<<<<<<<<<<<
30290  *         cdef bytes bytesitem
30291  *
30292  */
30293   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 488, __pyx_L1_error)
30294   __Pyx_GOTREF(__pyx_t_1);
30295   __pyx_v_struct = __pyx_t_1;
30296   __pyx_t_1 = 0;
30297 
30298   /* "View.MemoryView":491
30299  *         cdef bytes bytesitem
30300  *
30301  *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
30302  *         try:
30303  *             result = struct.unpack(self.view.format, bytesitem)
30304  */
30305   __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 491, __pyx_L1_error)
30306   __Pyx_GOTREF(__pyx_t_1);
30307   __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
30308   __pyx_t_1 = 0;
30309 
30310   /* "View.MemoryView":492
30311  *
30312  *         bytesitem = itemp[:self.view.itemsize]
30313  *         try:             # <<<<<<<<<<<<<<
30314  *             result = struct.unpack(self.view.format, bytesitem)
30315  *         except struct.error:
30316  */
30317   {
30318     __Pyx_PyThreadState_declare
30319     __Pyx_PyThreadState_assign
30320     __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
30321     __Pyx_XGOTREF(__pyx_t_2);
30322     __Pyx_XGOTREF(__pyx_t_3);
30323     __Pyx_XGOTREF(__pyx_t_4);
30324     /*try:*/ {
30325 
30326       /* "View.MemoryView":493
30327  *         bytesitem = itemp[:self.view.itemsize]
30328  *         try:
30329  *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
30330  *         except struct.error:
30331  *             raise ValueError("Unable to convert item to object")
30332  */
30333       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 493, __pyx_L3_error)
30334       __Pyx_GOTREF(__pyx_t_5);
30335       __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 493, __pyx_L3_error)
30336       __Pyx_GOTREF(__pyx_t_6);
30337       __pyx_t_7 = NULL;
30338       __pyx_t_8 = 0;
30339       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
30340         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
30341         if (likely(__pyx_t_7)) {
30342           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
30343           __Pyx_INCREF(__pyx_t_7);
30344           __Pyx_INCREF(function);
30345           __Pyx_DECREF_SET(__pyx_t_5, function);
30346           __pyx_t_8 = 1;
30347         }
30348       }
30349       #if CYTHON_FAST_PYCALL
30350       if (PyFunction_Check(__pyx_t_5)) {
30351         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
30352         __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
30353         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
30354         __Pyx_GOTREF(__pyx_t_1);
30355         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
30356       } else
30357       #endif
30358       #if CYTHON_FAST_PYCCALL
30359       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
30360         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
30361         __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
30362         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
30363         __Pyx_GOTREF(__pyx_t_1);
30364         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
30365       } else
30366       #endif
30367       {
30368         __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 493, __pyx_L3_error)
30369         __Pyx_GOTREF(__pyx_t_9);
30370         if (__pyx_t_7) {
30371           __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
30372         }
30373         __Pyx_GIVEREF(__pyx_t_6);
30374         PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
30375         __Pyx_INCREF(__pyx_v_bytesitem);
30376         __Pyx_GIVEREF(__pyx_v_bytesitem);
30377         PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
30378         __pyx_t_6 = 0;
30379         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
30380         __Pyx_GOTREF(__pyx_t_1);
30381         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
30382       }
30383       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30384       __pyx_v_result = __pyx_t_1;
30385       __pyx_t_1 = 0;
30386 
30387       /* "View.MemoryView":492
30388  *
30389  *         bytesitem = itemp[:self.view.itemsize]
30390  *         try:             # <<<<<<<<<<<<<<
30391  *             result = struct.unpack(self.view.format, bytesitem)
30392  *         except struct.error:
30393  */
30394     }
30395 
30396     /* "View.MemoryView":497
30397  *             raise ValueError("Unable to convert item to object")
30398  *         else:
30399  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
30400  *                 return result[0]
30401  *             return result
30402  */
30403     /*else:*/ {
30404       __pyx_t_10 = strlen(__pyx_v_self->view.format);
30405       __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
30406       if (__pyx_t_11) {
30407 
30408         /* "View.MemoryView":498
30409  *         else:
30410  *             if len(self.view.format) == 1:
30411  *                 return result[0]             # <<<<<<<<<<<<<<
30412  *             return result
30413  *
30414  */
30415         __Pyx_XDECREF(__pyx_r);
30416         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L5_except_error)
30417         __Pyx_GOTREF(__pyx_t_1);
30418         __pyx_r = __pyx_t_1;
30419         __pyx_t_1 = 0;
30420         goto __pyx_L6_except_return;
30421 
30422         /* "View.MemoryView":497
30423  *             raise ValueError("Unable to convert item to object")
30424  *         else:
30425  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
30426  *                 return result[0]
30427  *             return result
30428  */
30429       }
30430 
30431       /* "View.MemoryView":499
30432  *             if len(self.view.format) == 1:
30433  *                 return result[0]
30434  *             return result             # <<<<<<<<<<<<<<
30435  *
30436  *     cdef assign_item_from_object(self, char *itemp, object value):
30437  */
30438       __Pyx_XDECREF(__pyx_r);
30439       __Pyx_INCREF(__pyx_v_result);
30440       __pyx_r = __pyx_v_result;
30441       goto __pyx_L6_except_return;
30442     }
30443     __pyx_L3_error:;
30444     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
30445     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
30446     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
30447     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
30448     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
30449 
30450     /* "View.MemoryView":494
30451  *         try:
30452  *             result = struct.unpack(self.view.format, bytesitem)
30453  *         except struct.error:             # <<<<<<<<<<<<<<
30454  *             raise ValueError("Unable to convert item to object")
30455  *         else:
30456  */
30457     __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
30458     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 494, __pyx_L5_except_error)
30459     __Pyx_GOTREF(__pyx_t_6);
30460     __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
30461     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
30462     __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
30463     __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
30464     if (__pyx_t_8) {
30465       __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
30466       if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 494, __pyx_L5_except_error)
30467       __Pyx_GOTREF(__pyx_t_9);
30468       __Pyx_GOTREF(__pyx_t_5);
30469       __Pyx_GOTREF(__pyx_t_1);
30470 
30471       /* "View.MemoryView":495
30472  *             result = struct.unpack(self.view.format, bytesitem)
30473  *         except struct.error:
30474  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
30475  *         else:
30476  *             if len(self.view.format) == 1:
30477  */
30478       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 495, __pyx_L5_except_error)
30479       __Pyx_GOTREF(__pyx_t_6);
30480       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
30481       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
30482       __PYX_ERR(1, 495, __pyx_L5_except_error)
30483     }
30484     goto __pyx_L5_except_error;
30485     __pyx_L5_except_error:;
30486 
30487     /* "View.MemoryView":492
30488  *
30489  *         bytesitem = itemp[:self.view.itemsize]
30490  *         try:             # <<<<<<<<<<<<<<
30491  *             result = struct.unpack(self.view.format, bytesitem)
30492  *         except struct.error:
30493  */
30494     __Pyx_XGIVEREF(__pyx_t_2);
30495     __Pyx_XGIVEREF(__pyx_t_3);
30496     __Pyx_XGIVEREF(__pyx_t_4);
30497     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
30498     goto __pyx_L1_error;
30499     __pyx_L6_except_return:;
30500     __Pyx_XGIVEREF(__pyx_t_2);
30501     __Pyx_XGIVEREF(__pyx_t_3);
30502     __Pyx_XGIVEREF(__pyx_t_4);
30503     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
30504     goto __pyx_L0;
30505   }
30506 
30507   /* "View.MemoryView":485
30508  *         self.assign_item_from_object(itemp, value)
30509  *
30510  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
30511  *         """Only used if instantiated manually by the user, or if Cython doesn't
30512  *         know how to convert the type"""
30513  */
30514 
30515   /* function exit code */
30516   __pyx_L1_error:;
30517   __Pyx_XDECREF(__pyx_t_1);
30518   __Pyx_XDECREF(__pyx_t_5);
30519   __Pyx_XDECREF(__pyx_t_6);
30520   __Pyx_XDECREF(__pyx_t_7);
30521   __Pyx_XDECREF(__pyx_t_9);
30522   __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
30523   __pyx_r = 0;
30524   __pyx_L0:;
30525   __Pyx_XDECREF(__pyx_v_struct);
30526   __Pyx_XDECREF(__pyx_v_bytesitem);
30527   __Pyx_XDECREF(__pyx_v_result);
30528   __Pyx_XGIVEREF(__pyx_r);
30529   __Pyx_RefNannyFinishContext();
30530   return __pyx_r;
30531 }
30532 
30533 /* "View.MemoryView":501
30534  *             return result
30535  *
30536  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
30537  *         """Only used if instantiated manually by the user, or if Cython doesn't
30538  *         know how to convert the type"""
30539  */
30540 
__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)30541 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
30542   PyObject *__pyx_v_struct = NULL;
30543   char __pyx_v_c;
30544   PyObject *__pyx_v_bytesvalue = 0;
30545   Py_ssize_t __pyx_v_i;
30546   PyObject *__pyx_r = NULL;
30547   __Pyx_RefNannyDeclarations
30548   PyObject *__pyx_t_1 = NULL;
30549   int __pyx_t_2;
30550   int __pyx_t_3;
30551   PyObject *__pyx_t_4 = NULL;
30552   PyObject *__pyx_t_5 = NULL;
30553   PyObject *__pyx_t_6 = NULL;
30554   int __pyx_t_7;
30555   PyObject *__pyx_t_8 = NULL;
30556   Py_ssize_t __pyx_t_9;
30557   PyObject *__pyx_t_10 = NULL;
30558   char *__pyx_t_11;
30559   char *__pyx_t_12;
30560   char *__pyx_t_13;
30561   char *__pyx_t_14;
30562   int __pyx_lineno = 0;
30563   const char *__pyx_filename = NULL;
30564   int __pyx_clineno = 0;
30565   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
30566 
30567   /* "View.MemoryView":504
30568  *         """Only used if instantiated manually by the user, or if Cython doesn't
30569  *         know how to convert the type"""
30570  *         import struct             # <<<<<<<<<<<<<<
30571  *         cdef char c
30572  *         cdef bytes bytesvalue
30573  */
30574   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 504, __pyx_L1_error)
30575   __Pyx_GOTREF(__pyx_t_1);
30576   __pyx_v_struct = __pyx_t_1;
30577   __pyx_t_1 = 0;
30578 
30579   /* "View.MemoryView":509
30580  *         cdef Py_ssize_t i
30581  *
30582  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
30583  *             bytesvalue = struct.pack(self.view.format, *value)
30584  *         else:
30585  */
30586   __pyx_t_2 = PyTuple_Check(__pyx_v_value);
30587   __pyx_t_3 = (__pyx_t_2 != 0);
30588   if (__pyx_t_3) {
30589 
30590     /* "View.MemoryView":510
30591  *
30592  *         if isinstance(value, tuple):
30593  *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
30594  *         else:
30595  *             bytesvalue = struct.pack(self.view.format, value)
30596  */
30597     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 510, __pyx_L1_error)
30598     __Pyx_GOTREF(__pyx_t_1);
30599     __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
30600     __Pyx_GOTREF(__pyx_t_4);
30601     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 510, __pyx_L1_error)
30602     __Pyx_GOTREF(__pyx_t_5);
30603     __Pyx_GIVEREF(__pyx_t_4);
30604     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
30605     __pyx_t_4 = 0;
30606     __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
30607     __Pyx_GOTREF(__pyx_t_4);
30608     __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 510, __pyx_L1_error)
30609     __Pyx_GOTREF(__pyx_t_6);
30610     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30611     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30612     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
30613     __Pyx_GOTREF(__pyx_t_4);
30614     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30615     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
30616     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 510, __pyx_L1_error)
30617     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
30618     __pyx_t_4 = 0;
30619 
30620     /* "View.MemoryView":509
30621  *         cdef Py_ssize_t i
30622  *
30623  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
30624  *             bytesvalue = struct.pack(self.view.format, *value)
30625  *         else:
30626  */
30627     goto __pyx_L3;
30628   }
30629 
30630   /* "View.MemoryView":512
30631  *             bytesvalue = struct.pack(self.view.format, *value)
30632  *         else:
30633  *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
30634  *
30635  *         for i, c in enumerate(bytesvalue):
30636  */
30637   /*else*/ {
30638     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 512, __pyx_L1_error)
30639     __Pyx_GOTREF(__pyx_t_6);
30640     __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 512, __pyx_L1_error)
30641     __Pyx_GOTREF(__pyx_t_1);
30642     __pyx_t_5 = NULL;
30643     __pyx_t_7 = 0;
30644     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
30645       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
30646       if (likely(__pyx_t_5)) {
30647         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
30648         __Pyx_INCREF(__pyx_t_5);
30649         __Pyx_INCREF(function);
30650         __Pyx_DECREF_SET(__pyx_t_6, function);
30651         __pyx_t_7 = 1;
30652       }
30653     }
30654     #if CYTHON_FAST_PYCALL
30655     if (PyFunction_Check(__pyx_t_6)) {
30656       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
30657       __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
30658       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
30659       __Pyx_GOTREF(__pyx_t_4);
30660       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30661     } else
30662     #endif
30663     #if CYTHON_FAST_PYCCALL
30664     if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
30665       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
30666       __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
30667       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
30668       __Pyx_GOTREF(__pyx_t_4);
30669       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30670     } else
30671     #endif
30672     {
30673       __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 512, __pyx_L1_error)
30674       __Pyx_GOTREF(__pyx_t_8);
30675       if (__pyx_t_5) {
30676         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
30677       }
30678       __Pyx_GIVEREF(__pyx_t_1);
30679       PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
30680       __Pyx_INCREF(__pyx_v_value);
30681       __Pyx_GIVEREF(__pyx_v_value);
30682       PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
30683       __pyx_t_1 = 0;
30684       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
30685       __Pyx_GOTREF(__pyx_t_4);
30686       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
30687     }
30688     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
30689     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 512, __pyx_L1_error)
30690     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
30691     __pyx_t_4 = 0;
30692   }
30693   __pyx_L3:;
30694 
30695   /* "View.MemoryView":514
30696  *             bytesvalue = struct.pack(self.view.format, value)
30697  *
30698  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
30699  *             itemp[i] = c
30700  *
30701  */
30702   __pyx_t_9 = 0;
30703   if (unlikely(__pyx_v_bytesvalue == Py_None)) {
30704     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
30705     __PYX_ERR(1, 514, __pyx_L1_error)
30706   }
30707   __Pyx_INCREF(__pyx_v_bytesvalue);
30708   __pyx_t_10 = __pyx_v_bytesvalue;
30709   __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
30710   __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
30711   for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
30712     __pyx_t_11 = __pyx_t_14;
30713     __pyx_v_c = (__pyx_t_11[0]);
30714 
30715     /* "View.MemoryView":515
30716  *
30717  *         for i, c in enumerate(bytesvalue):
30718  *             itemp[i] = c             # <<<<<<<<<<<<<<
30719  *
30720  *     @cname('getbuffer')
30721  */
30722     __pyx_v_i = __pyx_t_9;
30723 
30724     /* "View.MemoryView":514
30725  *             bytesvalue = struct.pack(self.view.format, value)
30726  *
30727  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
30728  *             itemp[i] = c
30729  *
30730  */
30731     __pyx_t_9 = (__pyx_t_9 + 1);
30732 
30733     /* "View.MemoryView":515
30734  *
30735  *         for i, c in enumerate(bytesvalue):
30736  *             itemp[i] = c             # <<<<<<<<<<<<<<
30737  *
30738  *     @cname('getbuffer')
30739  */
30740     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
30741   }
30742   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
30743 
30744   /* "View.MemoryView":501
30745  *             return result
30746  *
30747  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
30748  *         """Only used if instantiated manually by the user, or if Cython doesn't
30749  *         know how to convert the type"""
30750  */
30751 
30752   /* function exit code */
30753   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
30754   goto __pyx_L0;
30755   __pyx_L1_error:;
30756   __Pyx_XDECREF(__pyx_t_1);
30757   __Pyx_XDECREF(__pyx_t_4);
30758   __Pyx_XDECREF(__pyx_t_5);
30759   __Pyx_XDECREF(__pyx_t_6);
30760   __Pyx_XDECREF(__pyx_t_8);
30761   __Pyx_XDECREF(__pyx_t_10);
30762   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
30763   __pyx_r = 0;
30764   __pyx_L0:;
30765   __Pyx_XDECREF(__pyx_v_struct);
30766   __Pyx_XDECREF(__pyx_v_bytesvalue);
30767   __Pyx_XGIVEREF(__pyx_r);
30768   __Pyx_RefNannyFinishContext();
30769   return __pyx_r;
30770 }
30771 
30772 /* "View.MemoryView":518
30773  *
30774  *     @cname('getbuffer')
30775  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
30776  *         if flags & PyBUF_WRITABLE and self.view.readonly:
30777  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
30778  */
30779 
30780 /* Python wrapper */
30781 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_memoryview_getbuffer(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)30782 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
30783   int __pyx_r;
30784   __Pyx_RefNannyDeclarations
30785   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
30786   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
30787 
30788   /* function exit code */
30789   __Pyx_RefNannyFinishContext();
30790   return __pyx_r;
30791 }
30792 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)30793 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
30794   int __pyx_r;
30795   __Pyx_RefNannyDeclarations
30796   int __pyx_t_1;
30797   int __pyx_t_2;
30798   PyObject *__pyx_t_3 = NULL;
30799   Py_ssize_t *__pyx_t_4;
30800   char *__pyx_t_5;
30801   void *__pyx_t_6;
30802   int __pyx_t_7;
30803   Py_ssize_t __pyx_t_8;
30804   int __pyx_lineno = 0;
30805   const char *__pyx_filename = NULL;
30806   int __pyx_clineno = 0;
30807   if (__pyx_v_info == NULL) {
30808     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
30809     return -1;
30810   }
30811   __Pyx_RefNannySetupContext("__getbuffer__", 0);
30812   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
30813   __Pyx_GIVEREF(__pyx_v_info->obj);
30814 
30815   /* "View.MemoryView":519
30816  *     @cname('getbuffer')
30817  *     def __getbuffer__(self, Py_buffer *info, int flags):
30818  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
30819  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
30820  *
30821  */
30822   __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
30823   if (__pyx_t_2) {
30824   } else {
30825     __pyx_t_1 = __pyx_t_2;
30826     goto __pyx_L4_bool_binop_done;
30827   }
30828   __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
30829   __pyx_t_1 = __pyx_t_2;
30830   __pyx_L4_bool_binop_done:;
30831   if (unlikely(__pyx_t_1)) {
30832 
30833     /* "View.MemoryView":520
30834  *     def __getbuffer__(self, Py_buffer *info, int flags):
30835  *         if flags & PyBUF_WRITABLE and self.view.readonly:
30836  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
30837  *
30838  *         if flags & PyBUF_ND:
30839  */
30840     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 520, __pyx_L1_error)
30841     __Pyx_GOTREF(__pyx_t_3);
30842     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
30843     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30844     __PYX_ERR(1, 520, __pyx_L1_error)
30845 
30846     /* "View.MemoryView":519
30847  *     @cname('getbuffer')
30848  *     def __getbuffer__(self, Py_buffer *info, int flags):
30849  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
30850  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
30851  *
30852  */
30853   }
30854 
30855   /* "View.MemoryView":522
30856  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
30857  *
30858  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
30859  *             info.shape = self.view.shape
30860  *         else:
30861  */
30862   __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
30863   if (__pyx_t_1) {
30864 
30865     /* "View.MemoryView":523
30866  *
30867  *         if flags & PyBUF_ND:
30868  *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
30869  *         else:
30870  *             info.shape = NULL
30871  */
30872     __pyx_t_4 = __pyx_v_self->view.shape;
30873     __pyx_v_info->shape = __pyx_t_4;
30874 
30875     /* "View.MemoryView":522
30876  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
30877  *
30878  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
30879  *             info.shape = self.view.shape
30880  *         else:
30881  */
30882     goto __pyx_L6;
30883   }
30884 
30885   /* "View.MemoryView":525
30886  *             info.shape = self.view.shape
30887  *         else:
30888  *             info.shape = NULL             # <<<<<<<<<<<<<<
30889  *
30890  *         if flags & PyBUF_STRIDES:
30891  */
30892   /*else*/ {
30893     __pyx_v_info->shape = NULL;
30894   }
30895   __pyx_L6:;
30896 
30897   /* "View.MemoryView":527
30898  *             info.shape = NULL
30899  *
30900  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
30901  *             info.strides = self.view.strides
30902  *         else:
30903  */
30904   __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
30905   if (__pyx_t_1) {
30906 
30907     /* "View.MemoryView":528
30908  *
30909  *         if flags & PyBUF_STRIDES:
30910  *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
30911  *         else:
30912  *             info.strides = NULL
30913  */
30914     __pyx_t_4 = __pyx_v_self->view.strides;
30915     __pyx_v_info->strides = __pyx_t_4;
30916 
30917     /* "View.MemoryView":527
30918  *             info.shape = NULL
30919  *
30920  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
30921  *             info.strides = self.view.strides
30922  *         else:
30923  */
30924     goto __pyx_L7;
30925   }
30926 
30927   /* "View.MemoryView":530
30928  *             info.strides = self.view.strides
30929  *         else:
30930  *             info.strides = NULL             # <<<<<<<<<<<<<<
30931  *
30932  *         if flags & PyBUF_INDIRECT:
30933  */
30934   /*else*/ {
30935     __pyx_v_info->strides = NULL;
30936   }
30937   __pyx_L7:;
30938 
30939   /* "View.MemoryView":532
30940  *             info.strides = NULL
30941  *
30942  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
30943  *             info.suboffsets = self.view.suboffsets
30944  *         else:
30945  */
30946   __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
30947   if (__pyx_t_1) {
30948 
30949     /* "View.MemoryView":533
30950  *
30951  *         if flags & PyBUF_INDIRECT:
30952  *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
30953  *         else:
30954  *             info.suboffsets = NULL
30955  */
30956     __pyx_t_4 = __pyx_v_self->view.suboffsets;
30957     __pyx_v_info->suboffsets = __pyx_t_4;
30958 
30959     /* "View.MemoryView":532
30960  *             info.strides = NULL
30961  *
30962  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
30963  *             info.suboffsets = self.view.suboffsets
30964  *         else:
30965  */
30966     goto __pyx_L8;
30967   }
30968 
30969   /* "View.MemoryView":535
30970  *             info.suboffsets = self.view.suboffsets
30971  *         else:
30972  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
30973  *
30974  *         if flags & PyBUF_FORMAT:
30975  */
30976   /*else*/ {
30977     __pyx_v_info->suboffsets = NULL;
30978   }
30979   __pyx_L8:;
30980 
30981   /* "View.MemoryView":537
30982  *             info.suboffsets = NULL
30983  *
30984  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
30985  *             info.format = self.view.format
30986  *         else:
30987  */
30988   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
30989   if (__pyx_t_1) {
30990 
30991     /* "View.MemoryView":538
30992  *
30993  *         if flags & PyBUF_FORMAT:
30994  *             info.format = self.view.format             # <<<<<<<<<<<<<<
30995  *         else:
30996  *             info.format = NULL
30997  */
30998     __pyx_t_5 = __pyx_v_self->view.format;
30999     __pyx_v_info->format = __pyx_t_5;
31000 
31001     /* "View.MemoryView":537
31002  *             info.suboffsets = NULL
31003  *
31004  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
31005  *             info.format = self.view.format
31006  *         else:
31007  */
31008     goto __pyx_L9;
31009   }
31010 
31011   /* "View.MemoryView":540
31012  *             info.format = self.view.format
31013  *         else:
31014  *             info.format = NULL             # <<<<<<<<<<<<<<
31015  *
31016  *         info.buf = self.view.buf
31017  */
31018   /*else*/ {
31019     __pyx_v_info->format = NULL;
31020   }
31021   __pyx_L9:;
31022 
31023   /* "View.MemoryView":542
31024  *             info.format = NULL
31025  *
31026  *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
31027  *         info.ndim = self.view.ndim
31028  *         info.itemsize = self.view.itemsize
31029  */
31030   __pyx_t_6 = __pyx_v_self->view.buf;
31031   __pyx_v_info->buf = __pyx_t_6;
31032 
31033   /* "View.MemoryView":543
31034  *
31035  *         info.buf = self.view.buf
31036  *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
31037  *         info.itemsize = self.view.itemsize
31038  *         info.len = self.view.len
31039  */
31040   __pyx_t_7 = __pyx_v_self->view.ndim;
31041   __pyx_v_info->ndim = __pyx_t_7;
31042 
31043   /* "View.MemoryView":544
31044  *         info.buf = self.view.buf
31045  *         info.ndim = self.view.ndim
31046  *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
31047  *         info.len = self.view.len
31048  *         info.readonly = self.view.readonly
31049  */
31050   __pyx_t_8 = __pyx_v_self->view.itemsize;
31051   __pyx_v_info->itemsize = __pyx_t_8;
31052 
31053   /* "View.MemoryView":545
31054  *         info.ndim = self.view.ndim
31055  *         info.itemsize = self.view.itemsize
31056  *         info.len = self.view.len             # <<<<<<<<<<<<<<
31057  *         info.readonly = self.view.readonly
31058  *         info.obj = self
31059  */
31060   __pyx_t_8 = __pyx_v_self->view.len;
31061   __pyx_v_info->len = __pyx_t_8;
31062 
31063   /* "View.MemoryView":546
31064  *         info.itemsize = self.view.itemsize
31065  *         info.len = self.view.len
31066  *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
31067  *         info.obj = self
31068  *
31069  */
31070   __pyx_t_1 = __pyx_v_self->view.readonly;
31071   __pyx_v_info->readonly = __pyx_t_1;
31072 
31073   /* "View.MemoryView":547
31074  *         info.len = self.view.len
31075  *         info.readonly = self.view.readonly
31076  *         info.obj = self             # <<<<<<<<<<<<<<
31077  *
31078  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
31079  */
31080   __Pyx_INCREF(((PyObject *)__pyx_v_self));
31081   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
31082   __Pyx_GOTREF(__pyx_v_info->obj);
31083   __Pyx_DECREF(__pyx_v_info->obj);
31084   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
31085 
31086   /* "View.MemoryView":518
31087  *
31088  *     @cname('getbuffer')
31089  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
31090  *         if flags & PyBUF_WRITABLE and self.view.readonly:
31091  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
31092  */
31093 
31094   /* function exit code */
31095   __pyx_r = 0;
31096   goto __pyx_L0;
31097   __pyx_L1_error:;
31098   __Pyx_XDECREF(__pyx_t_3);
31099   __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31100   __pyx_r = -1;
31101   if (__pyx_v_info->obj != NULL) {
31102     __Pyx_GOTREF(__pyx_v_info->obj);
31103     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
31104   }
31105   goto __pyx_L2;
31106   __pyx_L0:;
31107   if (__pyx_v_info->obj == Py_None) {
31108     __Pyx_GOTREF(__pyx_v_info->obj);
31109     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
31110   }
31111   __pyx_L2:;
31112   __Pyx_RefNannyFinishContext();
31113   return __pyx_r;
31114 }
31115 
31116 /* "View.MemoryView":553
31117  *
31118  *     @property
31119  *     def T(self):             # <<<<<<<<<<<<<<
31120  *         cdef _memoryviewslice result = memoryview_copy(self)
31121  *         transpose_memslice(&result.from_slice)
31122  */
31123 
31124 /* Python wrapper */
31125 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject * __pyx_v_self)31126 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
31127   PyObject *__pyx_r = 0;
31128   __Pyx_RefNannyDeclarations
31129   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31130   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31131 
31132   /* function exit code */
31133   __Pyx_RefNannyFinishContext();
31134   return __pyx_r;
31135 }
31136 
__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj * __pyx_v_self)31137 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
31138   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
31139   PyObject *__pyx_r = NULL;
31140   __Pyx_RefNannyDeclarations
31141   PyObject *__pyx_t_1 = NULL;
31142   int __pyx_t_2;
31143   int __pyx_lineno = 0;
31144   const char *__pyx_filename = NULL;
31145   int __pyx_clineno = 0;
31146   __Pyx_RefNannySetupContext("__get__", 0);
31147 
31148   /* "View.MemoryView":554
31149  *     @property
31150  *     def T(self):
31151  *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
31152  *         transpose_memslice(&result.from_slice)
31153  *         return result
31154  */
31155   __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 554, __pyx_L1_error)
31156   __Pyx_GOTREF(__pyx_t_1);
31157   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 554, __pyx_L1_error)
31158   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
31159   __pyx_t_1 = 0;
31160 
31161   /* "View.MemoryView":555
31162  *     def T(self):
31163  *         cdef _memoryviewslice result = memoryview_copy(self)
31164  *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
31165  *         return result
31166  *
31167  */
31168   __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 555, __pyx_L1_error)
31169 
31170   /* "View.MemoryView":556
31171  *         cdef _memoryviewslice result = memoryview_copy(self)
31172  *         transpose_memslice(&result.from_slice)
31173  *         return result             # <<<<<<<<<<<<<<
31174  *
31175  *     @property
31176  */
31177   __Pyx_XDECREF(__pyx_r);
31178   __Pyx_INCREF(((PyObject *)__pyx_v_result));
31179   __pyx_r = ((PyObject *)__pyx_v_result);
31180   goto __pyx_L0;
31181 
31182   /* "View.MemoryView":553
31183  *
31184  *     @property
31185  *     def T(self):             # <<<<<<<<<<<<<<
31186  *         cdef _memoryviewslice result = memoryview_copy(self)
31187  *         transpose_memslice(&result.from_slice)
31188  */
31189 
31190   /* function exit code */
31191   __pyx_L1_error:;
31192   __Pyx_XDECREF(__pyx_t_1);
31193   __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31194   __pyx_r = NULL;
31195   __pyx_L0:;
31196   __Pyx_XDECREF((PyObject *)__pyx_v_result);
31197   __Pyx_XGIVEREF(__pyx_r);
31198   __Pyx_RefNannyFinishContext();
31199   return __pyx_r;
31200 }
31201 
31202 /* "View.MemoryView":559
31203  *
31204  *     @property
31205  *     def base(self):             # <<<<<<<<<<<<<<
31206  *         return self.obj
31207  *
31208  */
31209 
31210 /* Python wrapper */
31211 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject * __pyx_v_self)31212 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
31213   PyObject *__pyx_r = 0;
31214   __Pyx_RefNannyDeclarations
31215   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31216   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31217 
31218   /* function exit code */
31219   __Pyx_RefNannyFinishContext();
31220   return __pyx_r;
31221 }
31222 
__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj * __pyx_v_self)31223 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
31224   PyObject *__pyx_r = NULL;
31225   __Pyx_RefNannyDeclarations
31226   __Pyx_RefNannySetupContext("__get__", 0);
31227 
31228   /* "View.MemoryView":560
31229  *     @property
31230  *     def base(self):
31231  *         return self.obj             # <<<<<<<<<<<<<<
31232  *
31233  *     @property
31234  */
31235   __Pyx_XDECREF(__pyx_r);
31236   __Pyx_INCREF(__pyx_v_self->obj);
31237   __pyx_r = __pyx_v_self->obj;
31238   goto __pyx_L0;
31239 
31240   /* "View.MemoryView":559
31241  *
31242  *     @property
31243  *     def base(self):             # <<<<<<<<<<<<<<
31244  *         return self.obj
31245  *
31246  */
31247 
31248   /* function exit code */
31249   __pyx_L0:;
31250   __Pyx_XGIVEREF(__pyx_r);
31251   __Pyx_RefNannyFinishContext();
31252   return __pyx_r;
31253 }
31254 
31255 /* "View.MemoryView":563
31256  *
31257  *     @property
31258  *     def shape(self):             # <<<<<<<<<<<<<<
31259  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
31260  *
31261  */
31262 
31263 /* Python wrapper */
31264 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject * __pyx_v_self)31265 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
31266   PyObject *__pyx_r = 0;
31267   __Pyx_RefNannyDeclarations
31268   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31269   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31270 
31271   /* function exit code */
31272   __Pyx_RefNannyFinishContext();
31273   return __pyx_r;
31274 }
31275 
__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj * __pyx_v_self)31276 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
31277   Py_ssize_t __pyx_v_length;
31278   PyObject *__pyx_r = NULL;
31279   __Pyx_RefNannyDeclarations
31280   PyObject *__pyx_t_1 = NULL;
31281   Py_ssize_t *__pyx_t_2;
31282   Py_ssize_t *__pyx_t_3;
31283   Py_ssize_t *__pyx_t_4;
31284   PyObject *__pyx_t_5 = NULL;
31285   int __pyx_lineno = 0;
31286   const char *__pyx_filename = NULL;
31287   int __pyx_clineno = 0;
31288   __Pyx_RefNannySetupContext("__get__", 0);
31289 
31290   /* "View.MemoryView":564
31291  *     @property
31292  *     def shape(self):
31293  *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
31294  *
31295  *     @property
31296  */
31297   __Pyx_XDECREF(__pyx_r);
31298   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 564, __pyx_L1_error)
31299   __Pyx_GOTREF(__pyx_t_1);
31300   __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
31301   for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
31302     __pyx_t_2 = __pyx_t_4;
31303     __pyx_v_length = (__pyx_t_2[0]);
31304     __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
31305     __Pyx_GOTREF(__pyx_t_5);
31306     if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 564, __pyx_L1_error)
31307     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
31308   }
31309   __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
31310   __Pyx_GOTREF(__pyx_t_5);
31311   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31312   __pyx_r = __pyx_t_5;
31313   __pyx_t_5 = 0;
31314   goto __pyx_L0;
31315 
31316   /* "View.MemoryView":563
31317  *
31318  *     @property
31319  *     def shape(self):             # <<<<<<<<<<<<<<
31320  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
31321  *
31322  */
31323 
31324   /* function exit code */
31325   __pyx_L1_error:;
31326   __Pyx_XDECREF(__pyx_t_1);
31327   __Pyx_XDECREF(__pyx_t_5);
31328   __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31329   __pyx_r = NULL;
31330   __pyx_L0:;
31331   __Pyx_XGIVEREF(__pyx_r);
31332   __Pyx_RefNannyFinishContext();
31333   return __pyx_r;
31334 }
31335 
31336 /* "View.MemoryView":567
31337  *
31338  *     @property
31339  *     def strides(self):             # <<<<<<<<<<<<<<
31340  *         if self.view.strides == NULL:
31341  *
31342  */
31343 
31344 /* Python wrapper */
31345 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject * __pyx_v_self)31346 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
31347   PyObject *__pyx_r = 0;
31348   __Pyx_RefNannyDeclarations
31349   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31350   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31351 
31352   /* function exit code */
31353   __Pyx_RefNannyFinishContext();
31354   return __pyx_r;
31355 }
31356 
__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj * __pyx_v_self)31357 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
31358   Py_ssize_t __pyx_v_stride;
31359   PyObject *__pyx_r = NULL;
31360   __Pyx_RefNannyDeclarations
31361   int __pyx_t_1;
31362   PyObject *__pyx_t_2 = NULL;
31363   Py_ssize_t *__pyx_t_3;
31364   Py_ssize_t *__pyx_t_4;
31365   Py_ssize_t *__pyx_t_5;
31366   PyObject *__pyx_t_6 = NULL;
31367   int __pyx_lineno = 0;
31368   const char *__pyx_filename = NULL;
31369   int __pyx_clineno = 0;
31370   __Pyx_RefNannySetupContext("__get__", 0);
31371 
31372   /* "View.MemoryView":568
31373  *     @property
31374  *     def strides(self):
31375  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
31376  *
31377  *             raise ValueError("Buffer view does not expose strides")
31378  */
31379   __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
31380   if (unlikely(__pyx_t_1)) {
31381 
31382     /* "View.MemoryView":570
31383  *         if self.view.strides == NULL:
31384  *
31385  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
31386  *
31387  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
31388  */
31389     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 570, __pyx_L1_error)
31390     __Pyx_GOTREF(__pyx_t_2);
31391     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
31392     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31393     __PYX_ERR(1, 570, __pyx_L1_error)
31394 
31395     /* "View.MemoryView":568
31396  *     @property
31397  *     def strides(self):
31398  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
31399  *
31400  *             raise ValueError("Buffer view does not expose strides")
31401  */
31402   }
31403 
31404   /* "View.MemoryView":572
31405  *             raise ValueError("Buffer view does not expose strides")
31406  *
31407  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
31408  *
31409  *     @property
31410  */
31411   __Pyx_XDECREF(__pyx_r);
31412   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 572, __pyx_L1_error)
31413   __Pyx_GOTREF(__pyx_t_2);
31414   __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
31415   for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
31416     __pyx_t_3 = __pyx_t_5;
31417     __pyx_v_stride = (__pyx_t_3[0]);
31418     __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
31419     __Pyx_GOTREF(__pyx_t_6);
31420     if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 572, __pyx_L1_error)
31421     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
31422   }
31423   __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
31424   __Pyx_GOTREF(__pyx_t_6);
31425   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31426   __pyx_r = __pyx_t_6;
31427   __pyx_t_6 = 0;
31428   goto __pyx_L0;
31429 
31430   /* "View.MemoryView":567
31431  *
31432  *     @property
31433  *     def strides(self):             # <<<<<<<<<<<<<<
31434  *         if self.view.strides == NULL:
31435  *
31436  */
31437 
31438   /* function exit code */
31439   __pyx_L1_error:;
31440   __Pyx_XDECREF(__pyx_t_2);
31441   __Pyx_XDECREF(__pyx_t_6);
31442   __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31443   __pyx_r = NULL;
31444   __pyx_L0:;
31445   __Pyx_XGIVEREF(__pyx_r);
31446   __Pyx_RefNannyFinishContext();
31447   return __pyx_r;
31448 }
31449 
31450 /* "View.MemoryView":575
31451  *
31452  *     @property
31453  *     def suboffsets(self):             # <<<<<<<<<<<<<<
31454  *         if self.view.suboffsets == NULL:
31455  *             return (-1,) * self.view.ndim
31456  */
31457 
31458 /* Python wrapper */
31459 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject * __pyx_v_self)31460 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
31461   PyObject *__pyx_r = 0;
31462   __Pyx_RefNannyDeclarations
31463   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31464   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31465 
31466   /* function exit code */
31467   __Pyx_RefNannyFinishContext();
31468   return __pyx_r;
31469 }
31470 
__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj * __pyx_v_self)31471 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
31472   Py_ssize_t __pyx_v_suboffset;
31473   PyObject *__pyx_r = NULL;
31474   __Pyx_RefNannyDeclarations
31475   int __pyx_t_1;
31476   PyObject *__pyx_t_2 = NULL;
31477   PyObject *__pyx_t_3 = NULL;
31478   Py_ssize_t *__pyx_t_4;
31479   Py_ssize_t *__pyx_t_5;
31480   Py_ssize_t *__pyx_t_6;
31481   int __pyx_lineno = 0;
31482   const char *__pyx_filename = NULL;
31483   int __pyx_clineno = 0;
31484   __Pyx_RefNannySetupContext("__get__", 0);
31485 
31486   /* "View.MemoryView":576
31487  *     @property
31488  *     def suboffsets(self):
31489  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
31490  *             return (-1,) * self.view.ndim
31491  *
31492  */
31493   __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
31494   if (__pyx_t_1) {
31495 
31496     /* "View.MemoryView":577
31497  *     def suboffsets(self):
31498  *         if self.view.suboffsets == NULL:
31499  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
31500  *
31501  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
31502  */
31503     __Pyx_XDECREF(__pyx_r);
31504     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error)
31505     __Pyx_GOTREF(__pyx_t_2);
31506     __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__30, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 577, __pyx_L1_error)
31507     __Pyx_GOTREF(__pyx_t_3);
31508     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31509     __pyx_r = __pyx_t_3;
31510     __pyx_t_3 = 0;
31511     goto __pyx_L0;
31512 
31513     /* "View.MemoryView":576
31514  *     @property
31515  *     def suboffsets(self):
31516  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
31517  *             return (-1,) * self.view.ndim
31518  *
31519  */
31520   }
31521 
31522   /* "View.MemoryView":579
31523  *             return (-1,) * self.view.ndim
31524  *
31525  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
31526  *
31527  *     @property
31528  */
31529   __Pyx_XDECREF(__pyx_r);
31530   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 579, __pyx_L1_error)
31531   __Pyx_GOTREF(__pyx_t_3);
31532   __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
31533   for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
31534     __pyx_t_4 = __pyx_t_6;
31535     __pyx_v_suboffset = (__pyx_t_4[0]);
31536     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
31537     __Pyx_GOTREF(__pyx_t_2);
31538     if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(1, 579, __pyx_L1_error)
31539     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31540   }
31541   __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
31542   __Pyx_GOTREF(__pyx_t_2);
31543   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31544   __pyx_r = __pyx_t_2;
31545   __pyx_t_2 = 0;
31546   goto __pyx_L0;
31547 
31548   /* "View.MemoryView":575
31549  *
31550  *     @property
31551  *     def suboffsets(self):             # <<<<<<<<<<<<<<
31552  *         if self.view.suboffsets == NULL:
31553  *             return (-1,) * self.view.ndim
31554  */
31555 
31556   /* function exit code */
31557   __pyx_L1_error:;
31558   __Pyx_XDECREF(__pyx_t_2);
31559   __Pyx_XDECREF(__pyx_t_3);
31560   __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31561   __pyx_r = NULL;
31562   __pyx_L0:;
31563   __Pyx_XGIVEREF(__pyx_r);
31564   __Pyx_RefNannyFinishContext();
31565   return __pyx_r;
31566 }
31567 
31568 /* "View.MemoryView":582
31569  *
31570  *     @property
31571  *     def ndim(self):             # <<<<<<<<<<<<<<
31572  *         return self.view.ndim
31573  *
31574  */
31575 
31576 /* Python wrapper */
31577 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject * __pyx_v_self)31578 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
31579   PyObject *__pyx_r = 0;
31580   __Pyx_RefNannyDeclarations
31581   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31582   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31583 
31584   /* function exit code */
31585   __Pyx_RefNannyFinishContext();
31586   return __pyx_r;
31587 }
31588 
__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj * __pyx_v_self)31589 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
31590   PyObject *__pyx_r = NULL;
31591   __Pyx_RefNannyDeclarations
31592   PyObject *__pyx_t_1 = NULL;
31593   int __pyx_lineno = 0;
31594   const char *__pyx_filename = NULL;
31595   int __pyx_clineno = 0;
31596   __Pyx_RefNannySetupContext("__get__", 0);
31597 
31598   /* "View.MemoryView":583
31599  *     @property
31600  *     def ndim(self):
31601  *         return self.view.ndim             # <<<<<<<<<<<<<<
31602  *
31603  *     @property
31604  */
31605   __Pyx_XDECREF(__pyx_r);
31606   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 583, __pyx_L1_error)
31607   __Pyx_GOTREF(__pyx_t_1);
31608   __pyx_r = __pyx_t_1;
31609   __pyx_t_1 = 0;
31610   goto __pyx_L0;
31611 
31612   /* "View.MemoryView":582
31613  *
31614  *     @property
31615  *     def ndim(self):             # <<<<<<<<<<<<<<
31616  *         return self.view.ndim
31617  *
31618  */
31619 
31620   /* function exit code */
31621   __pyx_L1_error:;
31622   __Pyx_XDECREF(__pyx_t_1);
31623   __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31624   __pyx_r = NULL;
31625   __pyx_L0:;
31626   __Pyx_XGIVEREF(__pyx_r);
31627   __Pyx_RefNannyFinishContext();
31628   return __pyx_r;
31629 }
31630 
31631 /* "View.MemoryView":586
31632  *
31633  *     @property
31634  *     def itemsize(self):             # <<<<<<<<<<<<<<
31635  *         return self.view.itemsize
31636  *
31637  */
31638 
31639 /* Python wrapper */
31640 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject * __pyx_v_self)31641 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
31642   PyObject *__pyx_r = 0;
31643   __Pyx_RefNannyDeclarations
31644   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31645   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31646 
31647   /* function exit code */
31648   __Pyx_RefNannyFinishContext();
31649   return __pyx_r;
31650 }
31651 
__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj * __pyx_v_self)31652 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
31653   PyObject *__pyx_r = NULL;
31654   __Pyx_RefNannyDeclarations
31655   PyObject *__pyx_t_1 = NULL;
31656   int __pyx_lineno = 0;
31657   const char *__pyx_filename = NULL;
31658   int __pyx_clineno = 0;
31659   __Pyx_RefNannySetupContext("__get__", 0);
31660 
31661   /* "View.MemoryView":587
31662  *     @property
31663  *     def itemsize(self):
31664  *         return self.view.itemsize             # <<<<<<<<<<<<<<
31665  *
31666  *     @property
31667  */
31668   __Pyx_XDECREF(__pyx_r);
31669   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 587, __pyx_L1_error)
31670   __Pyx_GOTREF(__pyx_t_1);
31671   __pyx_r = __pyx_t_1;
31672   __pyx_t_1 = 0;
31673   goto __pyx_L0;
31674 
31675   /* "View.MemoryView":586
31676  *
31677  *     @property
31678  *     def itemsize(self):             # <<<<<<<<<<<<<<
31679  *         return self.view.itemsize
31680  *
31681  */
31682 
31683   /* function exit code */
31684   __pyx_L1_error:;
31685   __Pyx_XDECREF(__pyx_t_1);
31686   __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31687   __pyx_r = NULL;
31688   __pyx_L0:;
31689   __Pyx_XGIVEREF(__pyx_r);
31690   __Pyx_RefNannyFinishContext();
31691   return __pyx_r;
31692 }
31693 
31694 /* "View.MemoryView":590
31695  *
31696  *     @property
31697  *     def nbytes(self):             # <<<<<<<<<<<<<<
31698  *         return self.size * self.view.itemsize
31699  *
31700  */
31701 
31702 /* Python wrapper */
31703 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject * __pyx_v_self)31704 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
31705   PyObject *__pyx_r = 0;
31706   __Pyx_RefNannyDeclarations
31707   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31708   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31709 
31710   /* function exit code */
31711   __Pyx_RefNannyFinishContext();
31712   return __pyx_r;
31713 }
31714 
__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj * __pyx_v_self)31715 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
31716   PyObject *__pyx_r = NULL;
31717   __Pyx_RefNannyDeclarations
31718   PyObject *__pyx_t_1 = NULL;
31719   PyObject *__pyx_t_2 = NULL;
31720   PyObject *__pyx_t_3 = NULL;
31721   int __pyx_lineno = 0;
31722   const char *__pyx_filename = NULL;
31723   int __pyx_clineno = 0;
31724   __Pyx_RefNannySetupContext("__get__", 0);
31725 
31726   /* "View.MemoryView":591
31727  *     @property
31728  *     def nbytes(self):
31729  *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
31730  *
31731  *     @property
31732  */
31733   __Pyx_XDECREF(__pyx_r);
31734   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 591, __pyx_L1_error)
31735   __Pyx_GOTREF(__pyx_t_1);
31736   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 591, __pyx_L1_error)
31737   __Pyx_GOTREF(__pyx_t_2);
31738   __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 591, __pyx_L1_error)
31739   __Pyx_GOTREF(__pyx_t_3);
31740   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31741   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31742   __pyx_r = __pyx_t_3;
31743   __pyx_t_3 = 0;
31744   goto __pyx_L0;
31745 
31746   /* "View.MemoryView":590
31747  *
31748  *     @property
31749  *     def nbytes(self):             # <<<<<<<<<<<<<<
31750  *         return self.size * self.view.itemsize
31751  *
31752  */
31753 
31754   /* function exit code */
31755   __pyx_L1_error:;
31756   __Pyx_XDECREF(__pyx_t_1);
31757   __Pyx_XDECREF(__pyx_t_2);
31758   __Pyx_XDECREF(__pyx_t_3);
31759   __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31760   __pyx_r = NULL;
31761   __pyx_L0:;
31762   __Pyx_XGIVEREF(__pyx_r);
31763   __Pyx_RefNannyFinishContext();
31764   return __pyx_r;
31765 }
31766 
31767 /* "View.MemoryView":594
31768  *
31769  *     @property
31770  *     def size(self):             # <<<<<<<<<<<<<<
31771  *         if self._size is None:
31772  *             result = 1
31773  */
31774 
31775 /* Python wrapper */
31776 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject * __pyx_v_self)31777 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
31778   PyObject *__pyx_r = 0;
31779   __Pyx_RefNannyDeclarations
31780   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31781   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31782 
31783   /* function exit code */
31784   __Pyx_RefNannyFinishContext();
31785   return __pyx_r;
31786 }
31787 
__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj * __pyx_v_self)31788 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
31789   PyObject *__pyx_v_result = NULL;
31790   PyObject *__pyx_v_length = NULL;
31791   PyObject *__pyx_r = NULL;
31792   __Pyx_RefNannyDeclarations
31793   int __pyx_t_1;
31794   int __pyx_t_2;
31795   Py_ssize_t *__pyx_t_3;
31796   Py_ssize_t *__pyx_t_4;
31797   Py_ssize_t *__pyx_t_5;
31798   PyObject *__pyx_t_6 = NULL;
31799   int __pyx_lineno = 0;
31800   const char *__pyx_filename = NULL;
31801   int __pyx_clineno = 0;
31802   __Pyx_RefNannySetupContext("__get__", 0);
31803 
31804   /* "View.MemoryView":595
31805  *     @property
31806  *     def size(self):
31807  *         if self._size is None:             # <<<<<<<<<<<<<<
31808  *             result = 1
31809  *
31810  */
31811   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
31812   __pyx_t_2 = (__pyx_t_1 != 0);
31813   if (__pyx_t_2) {
31814 
31815     /* "View.MemoryView":596
31816  *     def size(self):
31817  *         if self._size is None:
31818  *             result = 1             # <<<<<<<<<<<<<<
31819  *
31820  *             for length in self.view.shape[:self.view.ndim]:
31821  */
31822     __Pyx_INCREF(__pyx_int_1);
31823     __pyx_v_result = __pyx_int_1;
31824 
31825     /* "View.MemoryView":598
31826  *             result = 1
31827  *
31828  *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
31829  *                 result *= length
31830  *
31831  */
31832     __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
31833     for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
31834       __pyx_t_3 = __pyx_t_5;
31835       __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 598, __pyx_L1_error)
31836       __Pyx_GOTREF(__pyx_t_6);
31837       __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
31838       __pyx_t_6 = 0;
31839 
31840       /* "View.MemoryView":599
31841  *
31842  *             for length in self.view.shape[:self.view.ndim]:
31843  *                 result *= length             # <<<<<<<<<<<<<<
31844  *
31845  *             self._size = result
31846  */
31847       __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 599, __pyx_L1_error)
31848       __Pyx_GOTREF(__pyx_t_6);
31849       __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
31850       __pyx_t_6 = 0;
31851     }
31852 
31853     /* "View.MemoryView":601
31854  *                 result *= length
31855  *
31856  *             self._size = result             # <<<<<<<<<<<<<<
31857  *
31858  *         return self._size
31859  */
31860     __Pyx_INCREF(__pyx_v_result);
31861     __Pyx_GIVEREF(__pyx_v_result);
31862     __Pyx_GOTREF(__pyx_v_self->_size);
31863     __Pyx_DECREF(__pyx_v_self->_size);
31864     __pyx_v_self->_size = __pyx_v_result;
31865 
31866     /* "View.MemoryView":595
31867  *     @property
31868  *     def size(self):
31869  *         if self._size is None:             # <<<<<<<<<<<<<<
31870  *             result = 1
31871  *
31872  */
31873   }
31874 
31875   /* "View.MemoryView":603
31876  *             self._size = result
31877  *
31878  *         return self._size             # <<<<<<<<<<<<<<
31879  *
31880  *     def __len__(self):
31881  */
31882   __Pyx_XDECREF(__pyx_r);
31883   __Pyx_INCREF(__pyx_v_self->_size);
31884   __pyx_r = __pyx_v_self->_size;
31885   goto __pyx_L0;
31886 
31887   /* "View.MemoryView":594
31888  *
31889  *     @property
31890  *     def size(self):             # <<<<<<<<<<<<<<
31891  *         if self._size is None:
31892  *             result = 1
31893  */
31894 
31895   /* function exit code */
31896   __pyx_L1_error:;
31897   __Pyx_XDECREF(__pyx_t_6);
31898   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31899   __pyx_r = NULL;
31900   __pyx_L0:;
31901   __Pyx_XDECREF(__pyx_v_result);
31902   __Pyx_XDECREF(__pyx_v_length);
31903   __Pyx_XGIVEREF(__pyx_r);
31904   __Pyx_RefNannyFinishContext();
31905   return __pyx_r;
31906 }
31907 
31908 /* "View.MemoryView":605
31909  *         return self._size
31910  *
31911  *     def __len__(self):             # <<<<<<<<<<<<<<
31912  *         if self.view.ndim >= 1:
31913  *             return self.view.shape[0]
31914  */
31915 
31916 /* Python wrapper */
31917 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___len__(PyObject * __pyx_v_self)31918 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
31919   Py_ssize_t __pyx_r;
31920   __Pyx_RefNannyDeclarations
31921   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
31922   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31923 
31924   /* function exit code */
31925   __Pyx_RefNannyFinishContext();
31926   return __pyx_r;
31927 }
31928 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj * __pyx_v_self)31929 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
31930   Py_ssize_t __pyx_r;
31931   __Pyx_RefNannyDeclarations
31932   int __pyx_t_1;
31933   __Pyx_RefNannySetupContext("__len__", 0);
31934 
31935   /* "View.MemoryView":606
31936  *
31937  *     def __len__(self):
31938  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
31939  *             return self.view.shape[0]
31940  *
31941  */
31942   __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
31943   if (__pyx_t_1) {
31944 
31945     /* "View.MemoryView":607
31946  *     def __len__(self):
31947  *         if self.view.ndim >= 1:
31948  *             return self.view.shape[0]             # <<<<<<<<<<<<<<
31949  *
31950  *         return 0
31951  */
31952     __pyx_r = (__pyx_v_self->view.shape[0]);
31953     goto __pyx_L0;
31954 
31955     /* "View.MemoryView":606
31956  *
31957  *     def __len__(self):
31958  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
31959  *             return self.view.shape[0]
31960  *
31961  */
31962   }
31963 
31964   /* "View.MemoryView":609
31965  *             return self.view.shape[0]
31966  *
31967  *         return 0             # <<<<<<<<<<<<<<
31968  *
31969  *     def __repr__(self):
31970  */
31971   __pyx_r = 0;
31972   goto __pyx_L0;
31973 
31974   /* "View.MemoryView":605
31975  *         return self._size
31976  *
31977  *     def __len__(self):             # <<<<<<<<<<<<<<
31978  *         if self.view.ndim >= 1:
31979  *             return self.view.shape[0]
31980  */
31981 
31982   /* function exit code */
31983   __pyx_L0:;
31984   __Pyx_RefNannyFinishContext();
31985   return __pyx_r;
31986 }
31987 
31988 /* "View.MemoryView":611
31989  *         return 0
31990  *
31991  *     def __repr__(self):             # <<<<<<<<<<<<<<
31992  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
31993  *                                                id(self))
31994  */
31995 
31996 /* Python wrapper */
31997 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___repr__(PyObject * __pyx_v_self)31998 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
31999   PyObject *__pyx_r = 0;
32000   __Pyx_RefNannyDeclarations
32001   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
32002   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
32003 
32004   /* function exit code */
32005   __Pyx_RefNannyFinishContext();
32006   return __pyx_r;
32007 }
32008 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj * __pyx_v_self)32009 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
32010   PyObject *__pyx_r = NULL;
32011   __Pyx_RefNannyDeclarations
32012   PyObject *__pyx_t_1 = NULL;
32013   PyObject *__pyx_t_2 = NULL;
32014   PyObject *__pyx_t_3 = NULL;
32015   int __pyx_lineno = 0;
32016   const char *__pyx_filename = NULL;
32017   int __pyx_clineno = 0;
32018   __Pyx_RefNannySetupContext("__repr__", 0);
32019 
32020   /* "View.MemoryView":612
32021  *
32022  *     def __repr__(self):
32023  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
32024  *                                                id(self))
32025  *
32026  */
32027   __Pyx_XDECREF(__pyx_r);
32028   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
32029   __Pyx_GOTREF(__pyx_t_1);
32030   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
32031   __Pyx_GOTREF(__pyx_t_2);
32032   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32033   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
32034   __Pyx_GOTREF(__pyx_t_1);
32035   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32036 
32037   /* "View.MemoryView":613
32038  *     def __repr__(self):
32039  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
32040  *                                                id(self))             # <<<<<<<<<<<<<<
32041  *
32042  *     def __str__(self):
32043  */
32044   __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 613, __pyx_L1_error)
32045   __Pyx_GOTREF(__pyx_t_2);
32046 
32047   /* "View.MemoryView":612
32048  *
32049  *     def __repr__(self):
32050  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
32051  *                                                id(self))
32052  *
32053  */
32054   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 612, __pyx_L1_error)
32055   __Pyx_GOTREF(__pyx_t_3);
32056   __Pyx_GIVEREF(__pyx_t_1);
32057   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
32058   __Pyx_GIVEREF(__pyx_t_2);
32059   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
32060   __pyx_t_1 = 0;
32061   __pyx_t_2 = 0;
32062   __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
32063   __Pyx_GOTREF(__pyx_t_2);
32064   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32065   __pyx_r = __pyx_t_2;
32066   __pyx_t_2 = 0;
32067   goto __pyx_L0;
32068 
32069   /* "View.MemoryView":611
32070  *         return 0
32071  *
32072  *     def __repr__(self):             # <<<<<<<<<<<<<<
32073  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
32074  *                                                id(self))
32075  */
32076 
32077   /* function exit code */
32078   __pyx_L1_error:;
32079   __Pyx_XDECREF(__pyx_t_1);
32080   __Pyx_XDECREF(__pyx_t_2);
32081   __Pyx_XDECREF(__pyx_t_3);
32082   __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
32083   __pyx_r = NULL;
32084   __pyx_L0:;
32085   __Pyx_XGIVEREF(__pyx_r);
32086   __Pyx_RefNannyFinishContext();
32087   return __pyx_r;
32088 }
32089 
32090 /* "View.MemoryView":615
32091  *                                                id(self))
32092  *
32093  *     def __str__(self):             # <<<<<<<<<<<<<<
32094  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
32095  *
32096  */
32097 
32098 /* Python wrapper */
32099 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___str__(PyObject * __pyx_v_self)32100 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
32101   PyObject *__pyx_r = 0;
32102   __Pyx_RefNannyDeclarations
32103   __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
32104   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
32105 
32106   /* function exit code */
32107   __Pyx_RefNannyFinishContext();
32108   return __pyx_r;
32109 }
32110 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj * __pyx_v_self)32111 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
32112   PyObject *__pyx_r = NULL;
32113   __Pyx_RefNannyDeclarations
32114   PyObject *__pyx_t_1 = NULL;
32115   PyObject *__pyx_t_2 = NULL;
32116   int __pyx_lineno = 0;
32117   const char *__pyx_filename = NULL;
32118   int __pyx_clineno = 0;
32119   __Pyx_RefNannySetupContext("__str__", 0);
32120 
32121   /* "View.MemoryView":616
32122  *
32123  *     def __str__(self):
32124  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
32125  *
32126  *
32127  */
32128   __Pyx_XDECREF(__pyx_r);
32129   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
32130   __Pyx_GOTREF(__pyx_t_1);
32131   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
32132   __Pyx_GOTREF(__pyx_t_2);
32133   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32134   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
32135   __Pyx_GOTREF(__pyx_t_1);
32136   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32137   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
32138   __Pyx_GOTREF(__pyx_t_2);
32139   __Pyx_GIVEREF(__pyx_t_1);
32140   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
32141   __pyx_t_1 = 0;
32142   __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
32143   __Pyx_GOTREF(__pyx_t_1);
32144   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32145   __pyx_r = __pyx_t_1;
32146   __pyx_t_1 = 0;
32147   goto __pyx_L0;
32148 
32149   /* "View.MemoryView":615
32150  *                                                id(self))
32151  *
32152  *     def __str__(self):             # <<<<<<<<<<<<<<
32153  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
32154  *
32155  */
32156 
32157   /* function exit code */
32158   __pyx_L1_error:;
32159   __Pyx_XDECREF(__pyx_t_1);
32160   __Pyx_XDECREF(__pyx_t_2);
32161   __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
32162   __pyx_r = NULL;
32163   __pyx_L0:;
32164   __Pyx_XGIVEREF(__pyx_r);
32165   __Pyx_RefNannyFinishContext();
32166   return __pyx_r;
32167 }
32168 
32169 /* "View.MemoryView":619
32170  *
32171  *
32172  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
32173  *         cdef __Pyx_memviewslice *mslice
32174  *         cdef __Pyx_memviewslice tmp
32175  */
32176 
32177 /* Python wrapper */
32178 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_is_c_contig(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)32179 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
32180   PyObject *__pyx_r = 0;
32181   __Pyx_RefNannyDeclarations
32182   __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
32183   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
32184 
32185   /* function exit code */
32186   __Pyx_RefNannyFinishContext();
32187   return __pyx_r;
32188 }
32189 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj * __pyx_v_self)32190 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
32191   __Pyx_memviewslice *__pyx_v_mslice;
32192   __Pyx_memviewslice __pyx_v_tmp;
32193   PyObject *__pyx_r = NULL;
32194   __Pyx_RefNannyDeclarations
32195   __Pyx_memviewslice *__pyx_t_1;
32196   PyObject *__pyx_t_2 = NULL;
32197   int __pyx_lineno = 0;
32198   const char *__pyx_filename = NULL;
32199   int __pyx_clineno = 0;
32200   __Pyx_RefNannySetupContext("is_c_contig", 0);
32201 
32202   /* "View.MemoryView":622
32203  *         cdef __Pyx_memviewslice *mslice
32204  *         cdef __Pyx_memviewslice tmp
32205  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
32206  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
32207  *
32208  */
32209   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 622, __pyx_L1_error)
32210   __pyx_v_mslice = __pyx_t_1;
32211 
32212   /* "View.MemoryView":623
32213  *         cdef __Pyx_memviewslice tmp
32214  *         mslice = get_slice_from_memview(self, &tmp)
32215  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
32216  *
32217  *     def is_f_contig(self):
32218  */
32219   __Pyx_XDECREF(__pyx_r);
32220   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 623, __pyx_L1_error)
32221   __Pyx_GOTREF(__pyx_t_2);
32222   __pyx_r = __pyx_t_2;
32223   __pyx_t_2 = 0;
32224   goto __pyx_L0;
32225 
32226   /* "View.MemoryView":619
32227  *
32228  *
32229  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
32230  *         cdef __Pyx_memviewslice *mslice
32231  *         cdef __Pyx_memviewslice tmp
32232  */
32233 
32234   /* function exit code */
32235   __pyx_L1_error:;
32236   __Pyx_XDECREF(__pyx_t_2);
32237   __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
32238   __pyx_r = NULL;
32239   __pyx_L0:;
32240   __Pyx_XGIVEREF(__pyx_r);
32241   __Pyx_RefNannyFinishContext();
32242   return __pyx_r;
32243 }
32244 
32245 /* "View.MemoryView":625
32246  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
32247  *
32248  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
32249  *         cdef __Pyx_memviewslice *mslice
32250  *         cdef __Pyx_memviewslice tmp
32251  */
32252 
32253 /* Python wrapper */
32254 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_is_f_contig(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)32255 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
32256   PyObject *__pyx_r = 0;
32257   __Pyx_RefNannyDeclarations
32258   __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
32259   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
32260 
32261   /* function exit code */
32262   __Pyx_RefNannyFinishContext();
32263   return __pyx_r;
32264 }
32265 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj * __pyx_v_self)32266 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
32267   __Pyx_memviewslice *__pyx_v_mslice;
32268   __Pyx_memviewslice __pyx_v_tmp;
32269   PyObject *__pyx_r = NULL;
32270   __Pyx_RefNannyDeclarations
32271   __Pyx_memviewslice *__pyx_t_1;
32272   PyObject *__pyx_t_2 = NULL;
32273   int __pyx_lineno = 0;
32274   const char *__pyx_filename = NULL;
32275   int __pyx_clineno = 0;
32276   __Pyx_RefNannySetupContext("is_f_contig", 0);
32277 
32278   /* "View.MemoryView":628
32279  *         cdef __Pyx_memviewslice *mslice
32280  *         cdef __Pyx_memviewslice tmp
32281  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
32282  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
32283  *
32284  */
32285   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error)
32286   __pyx_v_mslice = __pyx_t_1;
32287 
32288   /* "View.MemoryView":629
32289  *         cdef __Pyx_memviewslice tmp
32290  *         mslice = get_slice_from_memview(self, &tmp)
32291  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
32292  *
32293  *     def copy(self):
32294  */
32295   __Pyx_XDECREF(__pyx_r);
32296   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error)
32297   __Pyx_GOTREF(__pyx_t_2);
32298   __pyx_r = __pyx_t_2;
32299   __pyx_t_2 = 0;
32300   goto __pyx_L0;
32301 
32302   /* "View.MemoryView":625
32303  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
32304  *
32305  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
32306  *         cdef __Pyx_memviewslice *mslice
32307  *         cdef __Pyx_memviewslice tmp
32308  */
32309 
32310   /* function exit code */
32311   __pyx_L1_error:;
32312   __Pyx_XDECREF(__pyx_t_2);
32313   __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
32314   __pyx_r = NULL;
32315   __pyx_L0:;
32316   __Pyx_XGIVEREF(__pyx_r);
32317   __Pyx_RefNannyFinishContext();
32318   return __pyx_r;
32319 }
32320 
32321 /* "View.MemoryView":631
32322  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
32323  *
32324  *     def copy(self):             # <<<<<<<<<<<<<<
32325  *         cdef __Pyx_memviewslice mslice
32326  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
32327  */
32328 
32329 /* Python wrapper */
32330 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_copy(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)32331 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
32332   PyObject *__pyx_r = 0;
32333   __Pyx_RefNannyDeclarations
32334   __Pyx_RefNannySetupContext("copy (wrapper)", 0);
32335   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
32336 
32337   /* function exit code */
32338   __Pyx_RefNannyFinishContext();
32339   return __pyx_r;
32340 }
32341 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj * __pyx_v_self)32342 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
32343   __Pyx_memviewslice __pyx_v_mslice;
32344   int __pyx_v_flags;
32345   PyObject *__pyx_r = NULL;
32346   __Pyx_RefNannyDeclarations
32347   __Pyx_memviewslice __pyx_t_1;
32348   PyObject *__pyx_t_2 = NULL;
32349   int __pyx_lineno = 0;
32350   const char *__pyx_filename = NULL;
32351   int __pyx_clineno = 0;
32352   __Pyx_RefNannySetupContext("copy", 0);
32353 
32354   /* "View.MemoryView":633
32355  *     def copy(self):
32356  *         cdef __Pyx_memviewslice mslice
32357  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
32358  *
32359  *         slice_copy(self, &mslice)
32360  */
32361   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
32362 
32363   /* "View.MemoryView":635
32364  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
32365  *
32366  *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
32367  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
32368  *                                    self.view.itemsize,
32369  */
32370   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
32371 
32372   /* "View.MemoryView":636
32373  *
32374  *         slice_copy(self, &mslice)
32375  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
32376  *                                    self.view.itemsize,
32377  *                                    flags|PyBUF_C_CONTIGUOUS,
32378  */
32379   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 636, __pyx_L1_error)
32380   __pyx_v_mslice = __pyx_t_1;
32381 
32382   /* "View.MemoryView":641
32383  *                                    self.dtype_is_object)
32384  *
32385  *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
32386  *
32387  *     def copy_fortran(self):
32388  */
32389   __Pyx_XDECREF(__pyx_r);
32390   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 641, __pyx_L1_error)
32391   __Pyx_GOTREF(__pyx_t_2);
32392   __pyx_r = __pyx_t_2;
32393   __pyx_t_2 = 0;
32394   goto __pyx_L0;
32395 
32396   /* "View.MemoryView":631
32397  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
32398  *
32399  *     def copy(self):             # <<<<<<<<<<<<<<
32400  *         cdef __Pyx_memviewslice mslice
32401  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
32402  */
32403 
32404   /* function exit code */
32405   __pyx_L1_error:;
32406   __Pyx_XDECREF(__pyx_t_2);
32407   __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
32408   __pyx_r = NULL;
32409   __pyx_L0:;
32410   __Pyx_XGIVEREF(__pyx_r);
32411   __Pyx_RefNannyFinishContext();
32412   return __pyx_r;
32413 }
32414 
32415 /* "View.MemoryView":643
32416  *         return memoryview_copy_from_slice(self, &mslice)
32417  *
32418  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
32419  *         cdef __Pyx_memviewslice src, dst
32420  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
32421  */
32422 
32423 /* Python wrapper */
32424 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_copy_fortran(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)32425 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
32426   PyObject *__pyx_r = 0;
32427   __Pyx_RefNannyDeclarations
32428   __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
32429   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
32430 
32431   /* function exit code */
32432   __Pyx_RefNannyFinishContext();
32433   return __pyx_r;
32434 }
32435 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj * __pyx_v_self)32436 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
32437   __Pyx_memviewslice __pyx_v_src;
32438   __Pyx_memviewslice __pyx_v_dst;
32439   int __pyx_v_flags;
32440   PyObject *__pyx_r = NULL;
32441   __Pyx_RefNannyDeclarations
32442   __Pyx_memviewslice __pyx_t_1;
32443   PyObject *__pyx_t_2 = NULL;
32444   int __pyx_lineno = 0;
32445   const char *__pyx_filename = NULL;
32446   int __pyx_clineno = 0;
32447   __Pyx_RefNannySetupContext("copy_fortran", 0);
32448 
32449   /* "View.MemoryView":645
32450  *     def copy_fortran(self):
32451  *         cdef __Pyx_memviewslice src, dst
32452  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
32453  *
32454  *         slice_copy(self, &src)
32455  */
32456   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
32457 
32458   /* "View.MemoryView":647
32459  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
32460  *
32461  *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
32462  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
32463  *                                 self.view.itemsize,
32464  */
32465   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
32466 
32467   /* "View.MemoryView":648
32468  *
32469  *         slice_copy(self, &src)
32470  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
32471  *                                 self.view.itemsize,
32472  *                                 flags|PyBUF_F_CONTIGUOUS,
32473  */
32474   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 648, __pyx_L1_error)
32475   __pyx_v_dst = __pyx_t_1;
32476 
32477   /* "View.MemoryView":653
32478  *                                 self.dtype_is_object)
32479  *
32480  *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
32481  *
32482  *
32483  */
32484   __Pyx_XDECREF(__pyx_r);
32485   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 653, __pyx_L1_error)
32486   __Pyx_GOTREF(__pyx_t_2);
32487   __pyx_r = __pyx_t_2;
32488   __pyx_t_2 = 0;
32489   goto __pyx_L0;
32490 
32491   /* "View.MemoryView":643
32492  *         return memoryview_copy_from_slice(self, &mslice)
32493  *
32494  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
32495  *         cdef __Pyx_memviewslice src, dst
32496  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
32497  */
32498 
32499   /* function exit code */
32500   __pyx_L1_error:;
32501   __Pyx_XDECREF(__pyx_t_2);
32502   __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
32503   __pyx_r = NULL;
32504   __pyx_L0:;
32505   __Pyx_XGIVEREF(__pyx_r);
32506   __Pyx_RefNannyFinishContext();
32507   return __pyx_r;
32508 }
32509 
32510 /* "(tree fragment)":1
32511  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
32512  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
32513  * def __setstate_cython__(self, __pyx_state):
32514  */
32515 
32516 /* Python wrapper */
32517 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)32518 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
32519   PyObject *__pyx_r = 0;
32520   __Pyx_RefNannyDeclarations
32521   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
32522   __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
32523 
32524   /* function exit code */
32525   __Pyx_RefNannyFinishContext();
32526   return __pyx_r;
32527 }
32528 
__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self)32529 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
32530   PyObject *__pyx_r = NULL;
32531   __Pyx_RefNannyDeclarations
32532   PyObject *__pyx_t_1 = NULL;
32533   int __pyx_lineno = 0;
32534   const char *__pyx_filename = NULL;
32535   int __pyx_clineno = 0;
32536   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
32537 
32538   /* "(tree fragment)":2
32539  * def __reduce_cython__(self):
32540  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
32541  * def __setstate_cython__(self, __pyx_state):
32542  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
32543  */
32544   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
32545   __Pyx_GOTREF(__pyx_t_1);
32546   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
32547   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32548   __PYX_ERR(1, 2, __pyx_L1_error)
32549 
32550   /* "(tree fragment)":1
32551  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
32552  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
32553  * def __setstate_cython__(self, __pyx_state):
32554  */
32555 
32556   /* function exit code */
32557   __pyx_L1_error:;
32558   __Pyx_XDECREF(__pyx_t_1);
32559   __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
32560   __pyx_r = NULL;
32561   __Pyx_XGIVEREF(__pyx_r);
32562   __Pyx_RefNannyFinishContext();
32563   return __pyx_r;
32564 }
32565 
32566 /* "(tree fragment)":3
32567  * def __reduce_cython__(self):
32568  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
32569  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
32570  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
32571  */
32572 
32573 /* Python wrapper */
32574 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)32575 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
32576   PyObject *__pyx_r = 0;
32577   __Pyx_RefNannyDeclarations
32578   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
32579   __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
32580 
32581   /* function exit code */
32582   __Pyx_RefNannyFinishContext();
32583   return __pyx_r;
32584 }
32585 
__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)32586 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
32587   PyObject *__pyx_r = NULL;
32588   __Pyx_RefNannyDeclarations
32589   PyObject *__pyx_t_1 = NULL;
32590   int __pyx_lineno = 0;
32591   const char *__pyx_filename = NULL;
32592   int __pyx_clineno = 0;
32593   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
32594 
32595   /* "(tree fragment)":4
32596  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
32597  * def __setstate_cython__(self, __pyx_state):
32598  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
32599  */
32600   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
32601   __Pyx_GOTREF(__pyx_t_1);
32602   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
32603   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32604   __PYX_ERR(1, 4, __pyx_L1_error)
32605 
32606   /* "(tree fragment)":3
32607  * def __reduce_cython__(self):
32608  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
32609  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
32610  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
32611  */
32612 
32613   /* function exit code */
32614   __pyx_L1_error:;
32615   __Pyx_XDECREF(__pyx_t_1);
32616   __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
32617   __pyx_r = NULL;
32618   __Pyx_XGIVEREF(__pyx_r);
32619   __Pyx_RefNannyFinishContext();
32620   return __pyx_r;
32621 }
32622 
32623 /* "View.MemoryView":657
32624  *
32625  * @cname('__pyx_memoryview_new')
32626  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
32627  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
32628  *     result.typeinfo = typeinfo
32629  */
32630 
__pyx_memoryview_new(PyObject * __pyx_v_o,int __pyx_v_flags,int __pyx_v_dtype_is_object,__Pyx_TypeInfo * __pyx_v_typeinfo)32631 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
32632   struct __pyx_memoryview_obj *__pyx_v_result = 0;
32633   PyObject *__pyx_r = NULL;
32634   __Pyx_RefNannyDeclarations
32635   PyObject *__pyx_t_1 = NULL;
32636   PyObject *__pyx_t_2 = NULL;
32637   PyObject *__pyx_t_3 = NULL;
32638   int __pyx_lineno = 0;
32639   const char *__pyx_filename = NULL;
32640   int __pyx_clineno = 0;
32641   __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
32642 
32643   /* "View.MemoryView":658
32644  * @cname('__pyx_memoryview_new')
32645  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
32646  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
32647  *     result.typeinfo = typeinfo
32648  *     return result
32649  */
32650   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 658, __pyx_L1_error)
32651   __Pyx_GOTREF(__pyx_t_1);
32652   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
32653   __Pyx_GOTREF(__pyx_t_2);
32654   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 658, __pyx_L1_error)
32655   __Pyx_GOTREF(__pyx_t_3);
32656   __Pyx_INCREF(__pyx_v_o);
32657   __Pyx_GIVEREF(__pyx_v_o);
32658   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
32659   __Pyx_GIVEREF(__pyx_t_1);
32660   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
32661   __Pyx_GIVEREF(__pyx_t_2);
32662   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
32663   __pyx_t_1 = 0;
32664   __pyx_t_2 = 0;
32665   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
32666   __Pyx_GOTREF(__pyx_t_2);
32667   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32668   __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
32669   __pyx_t_2 = 0;
32670 
32671   /* "View.MemoryView":659
32672  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
32673  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
32674  *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
32675  *     return result
32676  *
32677  */
32678   __pyx_v_result->typeinfo = __pyx_v_typeinfo;
32679 
32680   /* "View.MemoryView":660
32681  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
32682  *     result.typeinfo = typeinfo
32683  *     return result             # <<<<<<<<<<<<<<
32684  *
32685  * @cname('__pyx_memoryview_check')
32686  */
32687   __Pyx_XDECREF(__pyx_r);
32688   __Pyx_INCREF(((PyObject *)__pyx_v_result));
32689   __pyx_r = ((PyObject *)__pyx_v_result);
32690   goto __pyx_L0;
32691 
32692   /* "View.MemoryView":657
32693  *
32694  * @cname('__pyx_memoryview_new')
32695  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
32696  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
32697  *     result.typeinfo = typeinfo
32698  */
32699 
32700   /* function exit code */
32701   __pyx_L1_error:;
32702   __Pyx_XDECREF(__pyx_t_1);
32703   __Pyx_XDECREF(__pyx_t_2);
32704   __Pyx_XDECREF(__pyx_t_3);
32705   __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
32706   __pyx_r = 0;
32707   __pyx_L0:;
32708   __Pyx_XDECREF((PyObject *)__pyx_v_result);
32709   __Pyx_XGIVEREF(__pyx_r);
32710   __Pyx_RefNannyFinishContext();
32711   return __pyx_r;
32712 }
32713 
32714 /* "View.MemoryView":663
32715  *
32716  * @cname('__pyx_memoryview_check')
32717  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
32718  *     return isinstance(o, memoryview)
32719  *
32720  */
32721 
__pyx_memoryview_check(PyObject * __pyx_v_o)32722 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
32723   int __pyx_r;
32724   __Pyx_RefNannyDeclarations
32725   int __pyx_t_1;
32726   __Pyx_RefNannySetupContext("memoryview_check", 0);
32727 
32728   /* "View.MemoryView":664
32729  * @cname('__pyx_memoryview_check')
32730  * cdef inline bint memoryview_check(object o):
32731  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
32732  *
32733  * cdef tuple _unellipsify(object index, int ndim):
32734  */
32735   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
32736   __pyx_r = __pyx_t_1;
32737   goto __pyx_L0;
32738 
32739   /* "View.MemoryView":663
32740  *
32741  * @cname('__pyx_memoryview_check')
32742  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
32743  *     return isinstance(o, memoryview)
32744  *
32745  */
32746 
32747   /* function exit code */
32748   __pyx_L0:;
32749   __Pyx_RefNannyFinishContext();
32750   return __pyx_r;
32751 }
32752 
32753 /* "View.MemoryView":666
32754  *     return isinstance(o, memoryview)
32755  *
32756  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
32757  *     """
32758  *     Replace all ellipses with full slices and fill incomplete indices with
32759  */
32760 
_unellipsify(PyObject * __pyx_v_index,int __pyx_v_ndim)32761 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
32762   PyObject *__pyx_v_tup = NULL;
32763   PyObject *__pyx_v_result = NULL;
32764   int __pyx_v_have_slices;
32765   int __pyx_v_seen_ellipsis;
32766   CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
32767   PyObject *__pyx_v_item = NULL;
32768   Py_ssize_t __pyx_v_nslices;
32769   PyObject *__pyx_r = NULL;
32770   __Pyx_RefNannyDeclarations
32771   int __pyx_t_1;
32772   int __pyx_t_2;
32773   PyObject *__pyx_t_3 = NULL;
32774   PyObject *__pyx_t_4 = NULL;
32775   Py_ssize_t __pyx_t_5;
32776   PyObject *(*__pyx_t_6)(PyObject *);
32777   PyObject *__pyx_t_7 = NULL;
32778   Py_ssize_t __pyx_t_8;
32779   int __pyx_t_9;
32780   int __pyx_t_10;
32781   PyObject *__pyx_t_11 = NULL;
32782   int __pyx_lineno = 0;
32783   const char *__pyx_filename = NULL;
32784   int __pyx_clineno = 0;
32785   __Pyx_RefNannySetupContext("_unellipsify", 0);
32786 
32787   /* "View.MemoryView":671
32788  *     full slices.
32789  *     """
32790  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
32791  *         tup = (index,)
32792  *     else:
32793  */
32794   __pyx_t_1 = PyTuple_Check(__pyx_v_index);
32795   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
32796   if (__pyx_t_2) {
32797 
32798     /* "View.MemoryView":672
32799  *     """
32800  *     if not isinstance(index, tuple):
32801  *         tup = (index,)             # <<<<<<<<<<<<<<
32802  *     else:
32803  *         tup = index
32804  */
32805     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 672, __pyx_L1_error)
32806     __Pyx_GOTREF(__pyx_t_3);
32807     __Pyx_INCREF(__pyx_v_index);
32808     __Pyx_GIVEREF(__pyx_v_index);
32809     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
32810     __pyx_v_tup = __pyx_t_3;
32811     __pyx_t_3 = 0;
32812 
32813     /* "View.MemoryView":671
32814  *     full slices.
32815  *     """
32816  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
32817  *         tup = (index,)
32818  *     else:
32819  */
32820     goto __pyx_L3;
32821   }
32822 
32823   /* "View.MemoryView":674
32824  *         tup = (index,)
32825  *     else:
32826  *         tup = index             # <<<<<<<<<<<<<<
32827  *
32828  *     result = []
32829  */
32830   /*else*/ {
32831     __Pyx_INCREF(__pyx_v_index);
32832     __pyx_v_tup = __pyx_v_index;
32833   }
32834   __pyx_L3:;
32835 
32836   /* "View.MemoryView":676
32837  *         tup = index
32838  *
32839  *     result = []             # <<<<<<<<<<<<<<
32840  *     have_slices = False
32841  *     seen_ellipsis = False
32842  */
32843   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 676, __pyx_L1_error)
32844   __Pyx_GOTREF(__pyx_t_3);
32845   __pyx_v_result = ((PyObject*)__pyx_t_3);
32846   __pyx_t_3 = 0;
32847 
32848   /* "View.MemoryView":677
32849  *
32850  *     result = []
32851  *     have_slices = False             # <<<<<<<<<<<<<<
32852  *     seen_ellipsis = False
32853  *     for idx, item in enumerate(tup):
32854  */
32855   __pyx_v_have_slices = 0;
32856 
32857   /* "View.MemoryView":678
32858  *     result = []
32859  *     have_slices = False
32860  *     seen_ellipsis = False             # <<<<<<<<<<<<<<
32861  *     for idx, item in enumerate(tup):
32862  *         if item is Ellipsis:
32863  */
32864   __pyx_v_seen_ellipsis = 0;
32865 
32866   /* "View.MemoryView":679
32867  *     have_slices = False
32868  *     seen_ellipsis = False
32869  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
32870  *         if item is Ellipsis:
32871  *             if not seen_ellipsis:
32872  */
32873   __Pyx_INCREF(__pyx_int_0);
32874   __pyx_t_3 = __pyx_int_0;
32875   if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
32876     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
32877     __pyx_t_6 = NULL;
32878   } else {
32879     __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 679, __pyx_L1_error)
32880     __Pyx_GOTREF(__pyx_t_4);
32881     __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 679, __pyx_L1_error)
32882   }
32883   for (;;) {
32884     if (likely(!__pyx_t_6)) {
32885       if (likely(PyList_CheckExact(__pyx_t_4))) {
32886         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
32887         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
32888         __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(1, 679, __pyx_L1_error)
32889         #else
32890         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
32891         __Pyx_GOTREF(__pyx_t_7);
32892         #endif
32893       } else {
32894         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
32895         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
32896         __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(1, 679, __pyx_L1_error)
32897         #else
32898         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
32899         __Pyx_GOTREF(__pyx_t_7);
32900         #endif
32901       }
32902     } else {
32903       __pyx_t_7 = __pyx_t_6(__pyx_t_4);
32904       if (unlikely(!__pyx_t_7)) {
32905         PyObject* exc_type = PyErr_Occurred();
32906         if (exc_type) {
32907           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
32908           else __PYX_ERR(1, 679, __pyx_L1_error)
32909         }
32910         break;
32911       }
32912       __Pyx_GOTREF(__pyx_t_7);
32913     }
32914     __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
32915     __pyx_t_7 = 0;
32916     __Pyx_INCREF(__pyx_t_3);
32917     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
32918     __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
32919     __Pyx_GOTREF(__pyx_t_7);
32920     __Pyx_DECREF(__pyx_t_3);
32921     __pyx_t_3 = __pyx_t_7;
32922     __pyx_t_7 = 0;
32923 
32924     /* "View.MemoryView":680
32925  *     seen_ellipsis = False
32926  *     for idx, item in enumerate(tup):
32927  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
32928  *             if not seen_ellipsis:
32929  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
32930  */
32931     __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
32932     __pyx_t_1 = (__pyx_t_2 != 0);
32933     if (__pyx_t_1) {
32934 
32935       /* "View.MemoryView":681
32936  *     for idx, item in enumerate(tup):
32937  *         if item is Ellipsis:
32938  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
32939  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
32940  *                 seen_ellipsis = True
32941  */
32942       __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
32943       if (__pyx_t_1) {
32944 
32945         /* "View.MemoryView":682
32946  *         if item is Ellipsis:
32947  *             if not seen_ellipsis:
32948  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
32949  *                 seen_ellipsis = True
32950  *             else:
32951  */
32952         __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
32953         __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 682, __pyx_L1_error)
32954         __Pyx_GOTREF(__pyx_t_7);
32955         { Py_ssize_t __pyx_temp;
32956           for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
32957             __Pyx_INCREF(__pyx_slice__33);
32958             __Pyx_GIVEREF(__pyx_slice__33);
32959             PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__33);
32960           }
32961         }
32962         __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
32963         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
32964 
32965         /* "View.MemoryView":683
32966  *             if not seen_ellipsis:
32967  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
32968  *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
32969  *             else:
32970  *                 result.append(slice(None))
32971  */
32972         __pyx_v_seen_ellipsis = 1;
32973 
32974         /* "View.MemoryView":681
32975  *     for idx, item in enumerate(tup):
32976  *         if item is Ellipsis:
32977  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
32978  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
32979  *                 seen_ellipsis = True
32980  */
32981         goto __pyx_L7;
32982       }
32983 
32984       /* "View.MemoryView":685
32985  *                 seen_ellipsis = True
32986  *             else:
32987  *                 result.append(slice(None))             # <<<<<<<<<<<<<<
32988  *             have_slices = True
32989  *         else:
32990  */
32991       /*else*/ {
32992         __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__33); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 685, __pyx_L1_error)
32993       }
32994       __pyx_L7:;
32995 
32996       /* "View.MemoryView":686
32997  *             else:
32998  *                 result.append(slice(None))
32999  *             have_slices = True             # <<<<<<<<<<<<<<
33000  *         else:
33001  *             if not isinstance(item, slice) and not PyIndex_Check(item):
33002  */
33003       __pyx_v_have_slices = 1;
33004 
33005       /* "View.MemoryView":680
33006  *     seen_ellipsis = False
33007  *     for idx, item in enumerate(tup):
33008  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
33009  *             if not seen_ellipsis:
33010  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
33011  */
33012       goto __pyx_L6;
33013     }
33014 
33015     /* "View.MemoryView":688
33016  *             have_slices = True
33017  *         else:
33018  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
33019  *                 raise TypeError("Cannot index with type '%s'" % type(item))
33020  *
33021  */
33022     /*else*/ {
33023       __pyx_t_2 = PySlice_Check(__pyx_v_item);
33024       __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
33025       if (__pyx_t_10) {
33026       } else {
33027         __pyx_t_1 = __pyx_t_10;
33028         goto __pyx_L9_bool_binop_done;
33029       }
33030       __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
33031       __pyx_t_1 = __pyx_t_10;
33032       __pyx_L9_bool_binop_done:;
33033       if (unlikely(__pyx_t_1)) {
33034 
33035         /* "View.MemoryView":689
33036  *         else:
33037  *             if not isinstance(item, slice) and not PyIndex_Check(item):
33038  *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
33039  *
33040  *             have_slices = have_slices or isinstance(item, slice)
33041  */
33042         __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 689, __pyx_L1_error)
33043         __Pyx_GOTREF(__pyx_t_7);
33044         __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 689, __pyx_L1_error)
33045         __Pyx_GOTREF(__pyx_t_11);
33046         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
33047         __Pyx_Raise(__pyx_t_11, 0, 0, 0);
33048         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
33049         __PYX_ERR(1, 689, __pyx_L1_error)
33050 
33051         /* "View.MemoryView":688
33052  *             have_slices = True
33053  *         else:
33054  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
33055  *                 raise TypeError("Cannot index with type '%s'" % type(item))
33056  *
33057  */
33058       }
33059 
33060       /* "View.MemoryView":691
33061  *                 raise TypeError("Cannot index with type '%s'" % type(item))
33062  *
33063  *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
33064  *             result.append(item)
33065  *
33066  */
33067       __pyx_t_10 = (__pyx_v_have_slices != 0);
33068       if (!__pyx_t_10) {
33069       } else {
33070         __pyx_t_1 = __pyx_t_10;
33071         goto __pyx_L11_bool_binop_done;
33072       }
33073       __pyx_t_10 = PySlice_Check(__pyx_v_item);
33074       __pyx_t_2 = (__pyx_t_10 != 0);
33075       __pyx_t_1 = __pyx_t_2;
33076       __pyx_L11_bool_binop_done:;
33077       __pyx_v_have_slices = __pyx_t_1;
33078 
33079       /* "View.MemoryView":692
33080  *
33081  *             have_slices = have_slices or isinstance(item, slice)
33082  *             result.append(item)             # <<<<<<<<<<<<<<
33083  *
33084  *     nslices = ndim - len(result)
33085  */
33086       __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 692, __pyx_L1_error)
33087     }
33088     __pyx_L6:;
33089 
33090     /* "View.MemoryView":679
33091  *     have_slices = False
33092  *     seen_ellipsis = False
33093  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
33094  *         if item is Ellipsis:
33095  *             if not seen_ellipsis:
33096  */
33097   }
33098   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
33099   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33100 
33101   /* "View.MemoryView":694
33102  *             result.append(item)
33103  *
33104  *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
33105  *     if nslices:
33106  *         result.extend([slice(None)] * nslices)
33107  */
33108   __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 694, __pyx_L1_error)
33109   __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
33110 
33111   /* "View.MemoryView":695
33112  *
33113  *     nslices = ndim - len(result)
33114  *     if nslices:             # <<<<<<<<<<<<<<
33115  *         result.extend([slice(None)] * nslices)
33116  *
33117  */
33118   __pyx_t_1 = (__pyx_v_nslices != 0);
33119   if (__pyx_t_1) {
33120 
33121     /* "View.MemoryView":696
33122  *     nslices = ndim - len(result)
33123  *     if nslices:
33124  *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
33125  *
33126  *     return have_slices or nslices, tuple(result)
33127  */
33128     __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 696, __pyx_L1_error)
33129     __Pyx_GOTREF(__pyx_t_3);
33130     { Py_ssize_t __pyx_temp;
33131       for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
33132         __Pyx_INCREF(__pyx_slice__33);
33133         __Pyx_GIVEREF(__pyx_slice__33);
33134         PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__33);
33135       }
33136     }
33137     __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 696, __pyx_L1_error)
33138     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33139 
33140     /* "View.MemoryView":695
33141  *
33142  *     nslices = ndim - len(result)
33143  *     if nslices:             # <<<<<<<<<<<<<<
33144  *         result.extend([slice(None)] * nslices)
33145  *
33146  */
33147   }
33148 
33149   /* "View.MemoryView":698
33150  *         result.extend([slice(None)] * nslices)
33151  *
33152  *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
33153  *
33154  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
33155  */
33156   __Pyx_XDECREF(__pyx_r);
33157   if (!__pyx_v_have_slices) {
33158   } else {
33159     __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
33160     __Pyx_GOTREF(__pyx_t_4);
33161     __pyx_t_3 = __pyx_t_4;
33162     __pyx_t_4 = 0;
33163     goto __pyx_L14_bool_binop_done;
33164   }
33165   __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
33166   __Pyx_GOTREF(__pyx_t_4);
33167   __pyx_t_3 = __pyx_t_4;
33168   __pyx_t_4 = 0;
33169   __pyx_L14_bool_binop_done:;
33170   __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
33171   __Pyx_GOTREF(__pyx_t_4);
33172   __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 698, __pyx_L1_error)
33173   __Pyx_GOTREF(__pyx_t_11);
33174   __Pyx_GIVEREF(__pyx_t_3);
33175   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
33176   __Pyx_GIVEREF(__pyx_t_4);
33177   PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
33178   __pyx_t_3 = 0;
33179   __pyx_t_4 = 0;
33180   __pyx_r = ((PyObject*)__pyx_t_11);
33181   __pyx_t_11 = 0;
33182   goto __pyx_L0;
33183 
33184   /* "View.MemoryView":666
33185  *     return isinstance(o, memoryview)
33186  *
33187  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
33188  *     """
33189  *     Replace all ellipses with full slices and fill incomplete indices with
33190  */
33191 
33192   /* function exit code */
33193   __pyx_L1_error:;
33194   __Pyx_XDECREF(__pyx_t_3);
33195   __Pyx_XDECREF(__pyx_t_4);
33196   __Pyx_XDECREF(__pyx_t_7);
33197   __Pyx_XDECREF(__pyx_t_11);
33198   __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
33199   __pyx_r = 0;
33200   __pyx_L0:;
33201   __Pyx_XDECREF(__pyx_v_tup);
33202   __Pyx_XDECREF(__pyx_v_result);
33203   __Pyx_XDECREF(__pyx_v_idx);
33204   __Pyx_XDECREF(__pyx_v_item);
33205   __Pyx_XGIVEREF(__pyx_r);
33206   __Pyx_RefNannyFinishContext();
33207   return __pyx_r;
33208 }
33209 
33210 /* "View.MemoryView":700
33211  *     return have_slices or nslices, tuple(result)
33212  *
33213  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
33214  *     for suboffset in suboffsets[:ndim]:
33215  *         if suboffset >= 0:
33216  */
33217 
assert_direct_dimensions(Py_ssize_t * __pyx_v_suboffsets,int __pyx_v_ndim)33218 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
33219   Py_ssize_t __pyx_v_suboffset;
33220   PyObject *__pyx_r = NULL;
33221   __Pyx_RefNannyDeclarations
33222   Py_ssize_t *__pyx_t_1;
33223   Py_ssize_t *__pyx_t_2;
33224   Py_ssize_t *__pyx_t_3;
33225   int __pyx_t_4;
33226   PyObject *__pyx_t_5 = NULL;
33227   int __pyx_lineno = 0;
33228   const char *__pyx_filename = NULL;
33229   int __pyx_clineno = 0;
33230   __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
33231 
33232   /* "View.MemoryView":701
33233  *
33234  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
33235  *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
33236  *         if suboffset >= 0:
33237  *             raise ValueError("Indirect dimensions not supported")
33238  */
33239   __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
33240   for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
33241     __pyx_t_1 = __pyx_t_3;
33242     __pyx_v_suboffset = (__pyx_t_1[0]);
33243 
33244     /* "View.MemoryView":702
33245  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
33246  *     for suboffset in suboffsets[:ndim]:
33247  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
33248  *             raise ValueError("Indirect dimensions not supported")
33249  *
33250  */
33251     __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
33252     if (unlikely(__pyx_t_4)) {
33253 
33254       /* "View.MemoryView":703
33255  *     for suboffset in suboffsets[:ndim]:
33256  *         if suboffset >= 0:
33257  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
33258  *
33259  *
33260  */
33261       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 703, __pyx_L1_error)
33262       __Pyx_GOTREF(__pyx_t_5);
33263       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
33264       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
33265       __PYX_ERR(1, 703, __pyx_L1_error)
33266 
33267       /* "View.MemoryView":702
33268  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
33269  *     for suboffset in suboffsets[:ndim]:
33270  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
33271  *             raise ValueError("Indirect dimensions not supported")
33272  *
33273  */
33274     }
33275   }
33276 
33277   /* "View.MemoryView":700
33278  *     return have_slices or nslices, tuple(result)
33279  *
33280  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
33281  *     for suboffset in suboffsets[:ndim]:
33282  *         if suboffset >= 0:
33283  */
33284 
33285   /* function exit code */
33286   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
33287   goto __pyx_L0;
33288   __pyx_L1_error:;
33289   __Pyx_XDECREF(__pyx_t_5);
33290   __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
33291   __pyx_r = 0;
33292   __pyx_L0:;
33293   __Pyx_XGIVEREF(__pyx_r);
33294   __Pyx_RefNannyFinishContext();
33295   return __pyx_r;
33296 }
33297 
33298 /* "View.MemoryView":710
33299  *
33300  * @cname('__pyx_memview_slice')
33301  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
33302  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
33303  *     cdef bint negative_step
33304  */
33305 
__pyx_memview_slice(struct __pyx_memoryview_obj * __pyx_v_memview,PyObject * __pyx_v_indices)33306 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
33307   int __pyx_v_new_ndim;
33308   int __pyx_v_suboffset_dim;
33309   int __pyx_v_dim;
33310   __Pyx_memviewslice __pyx_v_src;
33311   __Pyx_memviewslice __pyx_v_dst;
33312   __Pyx_memviewslice *__pyx_v_p_src;
33313   struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
33314   __Pyx_memviewslice *__pyx_v_p_dst;
33315   int *__pyx_v_p_suboffset_dim;
33316   Py_ssize_t __pyx_v_start;
33317   Py_ssize_t __pyx_v_stop;
33318   Py_ssize_t __pyx_v_step;
33319   int __pyx_v_have_start;
33320   int __pyx_v_have_stop;
33321   int __pyx_v_have_step;
33322   PyObject *__pyx_v_index = NULL;
33323   struct __pyx_memoryview_obj *__pyx_r = NULL;
33324   __Pyx_RefNannyDeclarations
33325   int __pyx_t_1;
33326   int __pyx_t_2;
33327   PyObject *__pyx_t_3 = NULL;
33328   struct __pyx_memoryview_obj *__pyx_t_4;
33329   char *__pyx_t_5;
33330   int __pyx_t_6;
33331   Py_ssize_t __pyx_t_7;
33332   PyObject *(*__pyx_t_8)(PyObject *);
33333   PyObject *__pyx_t_9 = NULL;
33334   Py_ssize_t __pyx_t_10;
33335   int __pyx_t_11;
33336   Py_ssize_t __pyx_t_12;
33337   int __pyx_lineno = 0;
33338   const char *__pyx_filename = NULL;
33339   int __pyx_clineno = 0;
33340   __Pyx_RefNannySetupContext("memview_slice", 0);
33341 
33342   /* "View.MemoryView":711
33343  * @cname('__pyx_memview_slice')
33344  * cdef memoryview memview_slice(memoryview memview, object indices):
33345  *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
33346  *     cdef bint negative_step
33347  *     cdef __Pyx_memviewslice src, dst
33348  */
33349   __pyx_v_new_ndim = 0;
33350   __pyx_v_suboffset_dim = -1;
33351 
33352   /* "View.MemoryView":718
33353  *
33354  *
33355  *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
33356  *
33357  *     cdef _memoryviewslice memviewsliceobj
33358  */
33359   (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
33360 
33361   /* "View.MemoryView":722
33362  *     cdef _memoryviewslice memviewsliceobj
33363  *
33364  *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
33365  *
33366  *     if isinstance(memview, _memoryviewslice):
33367  */
33368   #ifndef CYTHON_WITHOUT_ASSERTIONS
33369   if (unlikely(!Py_OptimizeFlag)) {
33370     if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
33371       PyErr_SetNone(PyExc_AssertionError);
33372       __PYX_ERR(1, 722, __pyx_L1_error)
33373     }
33374   }
33375   #endif
33376 
33377   /* "View.MemoryView":724
33378  *     assert memview.view.ndim > 0
33379  *
33380  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
33381  *         memviewsliceobj = memview
33382  *         p_src = &memviewsliceobj.from_slice
33383  */
33384   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
33385   __pyx_t_2 = (__pyx_t_1 != 0);
33386   if (__pyx_t_2) {
33387 
33388     /* "View.MemoryView":725
33389  *
33390  *     if isinstance(memview, _memoryviewslice):
33391  *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
33392  *         p_src = &memviewsliceobj.from_slice
33393  *     else:
33394  */
33395     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 725, __pyx_L1_error)
33396     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
33397     __Pyx_INCREF(__pyx_t_3);
33398     __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
33399     __pyx_t_3 = 0;
33400 
33401     /* "View.MemoryView":726
33402  *     if isinstance(memview, _memoryviewslice):
33403  *         memviewsliceobj = memview
33404  *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
33405  *     else:
33406  *         slice_copy(memview, &src)
33407  */
33408     __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
33409 
33410     /* "View.MemoryView":724
33411  *     assert memview.view.ndim > 0
33412  *
33413  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
33414  *         memviewsliceobj = memview
33415  *         p_src = &memviewsliceobj.from_slice
33416  */
33417     goto __pyx_L3;
33418   }
33419 
33420   /* "View.MemoryView":728
33421  *         p_src = &memviewsliceobj.from_slice
33422  *     else:
33423  *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
33424  *         p_src = &src
33425  *
33426  */
33427   /*else*/ {
33428     __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
33429 
33430     /* "View.MemoryView":729
33431  *     else:
33432  *         slice_copy(memview, &src)
33433  *         p_src = &src             # <<<<<<<<<<<<<<
33434  *
33435  *
33436  */
33437     __pyx_v_p_src = (&__pyx_v_src);
33438   }
33439   __pyx_L3:;
33440 
33441   /* "View.MemoryView":735
33442  *
33443  *
33444  *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
33445  *     dst.data = p_src.data
33446  *
33447  */
33448   __pyx_t_4 = __pyx_v_p_src->memview;
33449   __pyx_v_dst.memview = __pyx_t_4;
33450 
33451   /* "View.MemoryView":736
33452  *
33453  *     dst.memview = p_src.memview
33454  *     dst.data = p_src.data             # <<<<<<<<<<<<<<
33455  *
33456  *
33457  */
33458   __pyx_t_5 = __pyx_v_p_src->data;
33459   __pyx_v_dst.data = __pyx_t_5;
33460 
33461   /* "View.MemoryView":741
33462  *
33463  *
33464  *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
33465  *     cdef int *p_suboffset_dim = &suboffset_dim
33466  *     cdef Py_ssize_t start, stop, step
33467  */
33468   __pyx_v_p_dst = (&__pyx_v_dst);
33469 
33470   /* "View.MemoryView":742
33471  *
33472  *     cdef __Pyx_memviewslice *p_dst = &dst
33473  *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
33474  *     cdef Py_ssize_t start, stop, step
33475  *     cdef bint have_start, have_stop, have_step
33476  */
33477   __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
33478 
33479   /* "View.MemoryView":746
33480  *     cdef bint have_start, have_stop, have_step
33481  *
33482  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
33483  *         if PyIndex_Check(index):
33484  *             slice_memviewslice(
33485  */
33486   __pyx_t_6 = 0;
33487   if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
33488     __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
33489     __pyx_t_8 = NULL;
33490   } else {
33491     __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 746, __pyx_L1_error)
33492     __Pyx_GOTREF(__pyx_t_3);
33493     __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 746, __pyx_L1_error)
33494   }
33495   for (;;) {
33496     if (likely(!__pyx_t_8)) {
33497       if (likely(PyList_CheckExact(__pyx_t_3))) {
33498         if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
33499         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
33500         __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 746, __pyx_L1_error)
33501         #else
33502         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
33503         __Pyx_GOTREF(__pyx_t_9);
33504         #endif
33505       } else {
33506         if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
33507         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
33508         __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 746, __pyx_L1_error)
33509         #else
33510         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
33511         __Pyx_GOTREF(__pyx_t_9);
33512         #endif
33513       }
33514     } else {
33515       __pyx_t_9 = __pyx_t_8(__pyx_t_3);
33516       if (unlikely(!__pyx_t_9)) {
33517         PyObject* exc_type = PyErr_Occurred();
33518         if (exc_type) {
33519           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
33520           else __PYX_ERR(1, 746, __pyx_L1_error)
33521         }
33522         break;
33523       }
33524       __Pyx_GOTREF(__pyx_t_9);
33525     }
33526     __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
33527     __pyx_t_9 = 0;
33528     __pyx_v_dim = __pyx_t_6;
33529     __pyx_t_6 = (__pyx_t_6 + 1);
33530 
33531     /* "View.MemoryView":747
33532  *
33533  *     for dim, index in enumerate(indices):
33534  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
33535  *             slice_memviewslice(
33536  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
33537  */
33538     __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
33539     if (__pyx_t_2) {
33540 
33541       /* "View.MemoryView":751
33542  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
33543  *                 dim, new_ndim, p_suboffset_dim,
33544  *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
33545  *                 0, 0, 0, # have_{start,stop,step}
33546  *                 False)
33547  */
33548       __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 751, __pyx_L1_error)
33549 
33550       /* "View.MemoryView":748
33551  *     for dim, index in enumerate(indices):
33552  *         if PyIndex_Check(index):
33553  *             slice_memviewslice(             # <<<<<<<<<<<<<<
33554  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
33555  *                 dim, new_ndim, p_suboffset_dim,
33556  */
33557       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(1, 748, __pyx_L1_error)
33558 
33559       /* "View.MemoryView":747
33560  *
33561  *     for dim, index in enumerate(indices):
33562  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
33563  *             slice_memviewslice(
33564  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
33565  */
33566       goto __pyx_L6;
33567     }
33568 
33569     /* "View.MemoryView":754
33570  *                 0, 0, 0, # have_{start,stop,step}
33571  *                 False)
33572  *         elif index is None:             # <<<<<<<<<<<<<<
33573  *             p_dst.shape[new_ndim] = 1
33574  *             p_dst.strides[new_ndim] = 0
33575  */
33576     __pyx_t_2 = (__pyx_v_index == Py_None);
33577     __pyx_t_1 = (__pyx_t_2 != 0);
33578     if (__pyx_t_1) {
33579 
33580       /* "View.MemoryView":755
33581  *                 False)
33582  *         elif index is None:
33583  *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
33584  *             p_dst.strides[new_ndim] = 0
33585  *             p_dst.suboffsets[new_ndim] = -1
33586  */
33587       (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
33588 
33589       /* "View.MemoryView":756
33590  *         elif index is None:
33591  *             p_dst.shape[new_ndim] = 1
33592  *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
33593  *             p_dst.suboffsets[new_ndim] = -1
33594  *             new_ndim += 1
33595  */
33596       (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
33597 
33598       /* "View.MemoryView":757
33599  *             p_dst.shape[new_ndim] = 1
33600  *             p_dst.strides[new_ndim] = 0
33601  *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
33602  *             new_ndim += 1
33603  *         else:
33604  */
33605       (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
33606 
33607       /* "View.MemoryView":758
33608  *             p_dst.strides[new_ndim] = 0
33609  *             p_dst.suboffsets[new_ndim] = -1
33610  *             new_ndim += 1             # <<<<<<<<<<<<<<
33611  *         else:
33612  *             start = index.start or 0
33613  */
33614       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
33615 
33616       /* "View.MemoryView":754
33617  *                 0, 0, 0, # have_{start,stop,step}
33618  *                 False)
33619  *         elif index is None:             # <<<<<<<<<<<<<<
33620  *             p_dst.shape[new_ndim] = 1
33621  *             p_dst.strides[new_ndim] = 0
33622  */
33623       goto __pyx_L6;
33624     }
33625 
33626     /* "View.MemoryView":760
33627  *             new_ndim += 1
33628  *         else:
33629  *             start = index.start or 0             # <<<<<<<<<<<<<<
33630  *             stop = index.stop or 0
33631  *             step = index.step or 0
33632  */
33633     /*else*/ {
33634       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 760, __pyx_L1_error)
33635       __Pyx_GOTREF(__pyx_t_9);
33636       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 760, __pyx_L1_error)
33637       if (!__pyx_t_1) {
33638         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33639       } else {
33640         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 760, __pyx_L1_error)
33641         __pyx_t_10 = __pyx_t_12;
33642         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33643         goto __pyx_L7_bool_binop_done;
33644       }
33645       __pyx_t_10 = 0;
33646       __pyx_L7_bool_binop_done:;
33647       __pyx_v_start = __pyx_t_10;
33648 
33649       /* "View.MemoryView":761
33650  *         else:
33651  *             start = index.start or 0
33652  *             stop = index.stop or 0             # <<<<<<<<<<<<<<
33653  *             step = index.step or 0
33654  *
33655  */
33656       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 761, __pyx_L1_error)
33657       __Pyx_GOTREF(__pyx_t_9);
33658       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 761, __pyx_L1_error)
33659       if (!__pyx_t_1) {
33660         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33661       } else {
33662         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 761, __pyx_L1_error)
33663         __pyx_t_10 = __pyx_t_12;
33664         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33665         goto __pyx_L9_bool_binop_done;
33666       }
33667       __pyx_t_10 = 0;
33668       __pyx_L9_bool_binop_done:;
33669       __pyx_v_stop = __pyx_t_10;
33670 
33671       /* "View.MemoryView":762
33672  *             start = index.start or 0
33673  *             stop = index.stop or 0
33674  *             step = index.step or 0             # <<<<<<<<<<<<<<
33675  *
33676  *             have_start = index.start is not None
33677  */
33678       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 762, __pyx_L1_error)
33679       __Pyx_GOTREF(__pyx_t_9);
33680       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 762, __pyx_L1_error)
33681       if (!__pyx_t_1) {
33682         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33683       } else {
33684         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error)
33685         __pyx_t_10 = __pyx_t_12;
33686         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33687         goto __pyx_L11_bool_binop_done;
33688       }
33689       __pyx_t_10 = 0;
33690       __pyx_L11_bool_binop_done:;
33691       __pyx_v_step = __pyx_t_10;
33692 
33693       /* "View.MemoryView":764
33694  *             step = index.step or 0
33695  *
33696  *             have_start = index.start is not None             # <<<<<<<<<<<<<<
33697  *             have_stop = index.stop is not None
33698  *             have_step = index.step is not None
33699  */
33700       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 764, __pyx_L1_error)
33701       __Pyx_GOTREF(__pyx_t_9);
33702       __pyx_t_1 = (__pyx_t_9 != Py_None);
33703       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33704       __pyx_v_have_start = __pyx_t_1;
33705 
33706       /* "View.MemoryView":765
33707  *
33708  *             have_start = index.start is not None
33709  *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
33710  *             have_step = index.step is not None
33711  *
33712  */
33713       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 765, __pyx_L1_error)
33714       __Pyx_GOTREF(__pyx_t_9);
33715       __pyx_t_1 = (__pyx_t_9 != Py_None);
33716       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33717       __pyx_v_have_stop = __pyx_t_1;
33718 
33719       /* "View.MemoryView":766
33720  *             have_start = index.start is not None
33721  *             have_stop = index.stop is not None
33722  *             have_step = index.step is not None             # <<<<<<<<<<<<<<
33723  *
33724  *             slice_memviewslice(
33725  */
33726       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 766, __pyx_L1_error)
33727       __Pyx_GOTREF(__pyx_t_9);
33728       __pyx_t_1 = (__pyx_t_9 != Py_None);
33729       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33730       __pyx_v_have_step = __pyx_t_1;
33731 
33732       /* "View.MemoryView":768
33733  *             have_step = index.step is not None
33734  *
33735  *             slice_memviewslice(             # <<<<<<<<<<<<<<
33736  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
33737  *                 dim, new_ndim, p_suboffset_dim,
33738  */
33739       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(1, 768, __pyx_L1_error)
33740 
33741       /* "View.MemoryView":774
33742  *                 have_start, have_stop, have_step,
33743  *                 True)
33744  *             new_ndim += 1             # <<<<<<<<<<<<<<
33745  *
33746  *     if isinstance(memview, _memoryviewslice):
33747  */
33748       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
33749     }
33750     __pyx_L6:;
33751 
33752     /* "View.MemoryView":746
33753  *     cdef bint have_start, have_stop, have_step
33754  *
33755  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
33756  *         if PyIndex_Check(index):
33757  *             slice_memviewslice(
33758  */
33759   }
33760   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33761 
33762   /* "View.MemoryView":776
33763  *             new_ndim += 1
33764  *
33765  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
33766  *         return memoryview_fromslice(dst, new_ndim,
33767  *                                     memviewsliceobj.to_object_func,
33768  */
33769   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
33770   __pyx_t_2 = (__pyx_t_1 != 0);
33771   if (__pyx_t_2) {
33772 
33773     /* "View.MemoryView":777
33774  *
33775  *     if isinstance(memview, _memoryviewslice):
33776  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
33777  *                                     memviewsliceobj.to_object_func,
33778  *                                     memviewsliceobj.to_dtype_func,
33779  */
33780     __Pyx_XDECREF(((PyObject *)__pyx_r));
33781 
33782     /* "View.MemoryView":778
33783  *     if isinstance(memview, _memoryviewslice):
33784  *         return memoryview_fromslice(dst, new_ndim,
33785  *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
33786  *                                     memviewsliceobj.to_dtype_func,
33787  *                                     memview.dtype_is_object)
33788  */
33789     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 778, __pyx_L1_error) }
33790 
33791     /* "View.MemoryView":779
33792  *         return memoryview_fromslice(dst, new_ndim,
33793  *                                     memviewsliceobj.to_object_func,
33794  *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
33795  *                                     memview.dtype_is_object)
33796  *     else:
33797  */
33798     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 779, __pyx_L1_error) }
33799 
33800     /* "View.MemoryView":777
33801  *
33802  *     if isinstance(memview, _memoryviewslice):
33803  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
33804  *                                     memviewsliceobj.to_object_func,
33805  *                                     memviewsliceobj.to_dtype_func,
33806  */
33807     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 777, __pyx_L1_error)
33808     __Pyx_GOTREF(__pyx_t_3);
33809     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 777, __pyx_L1_error)
33810     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
33811     __pyx_t_3 = 0;
33812     goto __pyx_L0;
33813 
33814     /* "View.MemoryView":776
33815  *             new_ndim += 1
33816  *
33817  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
33818  *         return memoryview_fromslice(dst, new_ndim,
33819  *                                     memviewsliceobj.to_object_func,
33820  */
33821   }
33822 
33823   /* "View.MemoryView":782
33824  *                                     memview.dtype_is_object)
33825  *     else:
33826  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
33827  *                                     memview.dtype_is_object)
33828  *
33829  */
33830   /*else*/ {
33831     __Pyx_XDECREF(((PyObject *)__pyx_r));
33832 
33833     /* "View.MemoryView":783
33834  *     else:
33835  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
33836  *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
33837  *
33838  *
33839  */
33840     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 782, __pyx_L1_error)
33841     __Pyx_GOTREF(__pyx_t_3);
33842 
33843     /* "View.MemoryView":782
33844  *                                     memview.dtype_is_object)
33845  *     else:
33846  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
33847  *                                     memview.dtype_is_object)
33848  *
33849  */
33850     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 782, __pyx_L1_error)
33851     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
33852     __pyx_t_3 = 0;
33853     goto __pyx_L0;
33854   }
33855 
33856   /* "View.MemoryView":710
33857  *
33858  * @cname('__pyx_memview_slice')
33859  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
33860  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
33861  *     cdef bint negative_step
33862  */
33863 
33864   /* function exit code */
33865   __pyx_L1_error:;
33866   __Pyx_XDECREF(__pyx_t_3);
33867   __Pyx_XDECREF(__pyx_t_9);
33868   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
33869   __pyx_r = 0;
33870   __pyx_L0:;
33871   __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
33872   __Pyx_XDECREF(__pyx_v_index);
33873   __Pyx_XGIVEREF((PyObject *)__pyx_r);
33874   __Pyx_RefNannyFinishContext();
33875   return __pyx_r;
33876 }
33877 
33878 /* "View.MemoryView":807
33879  *
33880  * @cname('__pyx_memoryview_slice_memviewslice')
33881  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
33882  *         __Pyx_memviewslice *dst,
33883  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
33884  */
33885 
__pyx_memoryview_slice_memviewslice(__Pyx_memviewslice * __pyx_v_dst,Py_ssize_t __pyx_v_shape,Py_ssize_t __pyx_v_stride,Py_ssize_t __pyx_v_suboffset,int __pyx_v_dim,int __pyx_v_new_ndim,int * __pyx_v_suboffset_dim,Py_ssize_t __pyx_v_start,Py_ssize_t __pyx_v_stop,Py_ssize_t __pyx_v_step,int __pyx_v_have_start,int __pyx_v_have_stop,int __pyx_v_have_step,int __pyx_v_is_slice)33886 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
33887   Py_ssize_t __pyx_v_new_shape;
33888   int __pyx_v_negative_step;
33889   int __pyx_r;
33890   int __pyx_t_1;
33891   int __pyx_t_2;
33892   int __pyx_t_3;
33893   int __pyx_lineno = 0;
33894   const char *__pyx_filename = NULL;
33895   int __pyx_clineno = 0;
33896 
33897   /* "View.MemoryView":827
33898  *     cdef bint negative_step
33899  *
33900  *     if not is_slice:             # <<<<<<<<<<<<<<
33901  *
33902  *         if start < 0:
33903  */
33904   __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
33905   if (__pyx_t_1) {
33906 
33907     /* "View.MemoryView":829
33908  *     if not is_slice:
33909  *
33910  *         if start < 0:             # <<<<<<<<<<<<<<
33911  *             start += shape
33912  *         if not 0 <= start < shape:
33913  */
33914     __pyx_t_1 = ((__pyx_v_start < 0) != 0);
33915     if (__pyx_t_1) {
33916 
33917       /* "View.MemoryView":830
33918  *
33919  *         if start < 0:
33920  *             start += shape             # <<<<<<<<<<<<<<
33921  *         if not 0 <= start < shape:
33922  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
33923  */
33924       __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
33925 
33926       /* "View.MemoryView":829
33927  *     if not is_slice:
33928  *
33929  *         if start < 0:             # <<<<<<<<<<<<<<
33930  *             start += shape
33931  *         if not 0 <= start < shape:
33932  */
33933     }
33934 
33935     /* "View.MemoryView":831
33936  *         if start < 0:
33937  *             start += shape
33938  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
33939  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
33940  *     else:
33941  */
33942     __pyx_t_1 = (0 <= __pyx_v_start);
33943     if (__pyx_t_1) {
33944       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
33945     }
33946     __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
33947     if (__pyx_t_2) {
33948 
33949       /* "View.MemoryView":832
33950  *             start += shape
33951  *         if not 0 <= start < shape:
33952  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
33953  *     else:
33954  *
33955  */
33956       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 832, __pyx_L1_error)
33957 
33958       /* "View.MemoryView":831
33959  *         if start < 0:
33960  *             start += shape
33961  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
33962  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
33963  *     else:
33964  */
33965     }
33966 
33967     /* "View.MemoryView":827
33968  *     cdef bint negative_step
33969  *
33970  *     if not is_slice:             # <<<<<<<<<<<<<<
33971  *
33972  *         if start < 0:
33973  */
33974     goto __pyx_L3;
33975   }
33976 
33977   /* "View.MemoryView":835
33978  *     else:
33979  *
33980  *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
33981  *
33982  *         if have_step and step == 0:
33983  */
33984   /*else*/ {
33985     __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
33986     if (__pyx_t_1) {
33987     } else {
33988       __pyx_t_2 = __pyx_t_1;
33989       goto __pyx_L6_bool_binop_done;
33990     }
33991     __pyx_t_1 = ((__pyx_v_step < 0) != 0);
33992     __pyx_t_2 = __pyx_t_1;
33993     __pyx_L6_bool_binop_done:;
33994     __pyx_v_negative_step = __pyx_t_2;
33995 
33996     /* "View.MemoryView":837
33997  *         negative_step = have_step != 0 and step < 0
33998  *
33999  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
34000  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
34001  *
34002  */
34003     __pyx_t_1 = (__pyx_v_have_step != 0);
34004     if (__pyx_t_1) {
34005     } else {
34006       __pyx_t_2 = __pyx_t_1;
34007       goto __pyx_L9_bool_binop_done;
34008     }
34009     __pyx_t_1 = ((__pyx_v_step == 0) != 0);
34010     __pyx_t_2 = __pyx_t_1;
34011     __pyx_L9_bool_binop_done:;
34012     if (__pyx_t_2) {
34013 
34014       /* "View.MemoryView":838
34015  *
34016  *         if have_step and step == 0:
34017  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
34018  *
34019  *
34020  */
34021       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 838, __pyx_L1_error)
34022 
34023       /* "View.MemoryView":837
34024  *         negative_step = have_step != 0 and step < 0
34025  *
34026  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
34027  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
34028  *
34029  */
34030     }
34031 
34032     /* "View.MemoryView":841
34033  *
34034  *
34035  *         if have_start:             # <<<<<<<<<<<<<<
34036  *             if start < 0:
34037  *                 start += shape
34038  */
34039     __pyx_t_2 = (__pyx_v_have_start != 0);
34040     if (__pyx_t_2) {
34041 
34042       /* "View.MemoryView":842
34043  *
34044  *         if have_start:
34045  *             if start < 0:             # <<<<<<<<<<<<<<
34046  *                 start += shape
34047  *                 if start < 0:
34048  */
34049       __pyx_t_2 = ((__pyx_v_start < 0) != 0);
34050       if (__pyx_t_2) {
34051 
34052         /* "View.MemoryView":843
34053  *         if have_start:
34054  *             if start < 0:
34055  *                 start += shape             # <<<<<<<<<<<<<<
34056  *                 if start < 0:
34057  *                     start = 0
34058  */
34059         __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
34060 
34061         /* "View.MemoryView":844
34062  *             if start < 0:
34063  *                 start += shape
34064  *                 if start < 0:             # <<<<<<<<<<<<<<
34065  *                     start = 0
34066  *             elif start >= shape:
34067  */
34068         __pyx_t_2 = ((__pyx_v_start < 0) != 0);
34069         if (__pyx_t_2) {
34070 
34071           /* "View.MemoryView":845
34072  *                 start += shape
34073  *                 if start < 0:
34074  *                     start = 0             # <<<<<<<<<<<<<<
34075  *             elif start >= shape:
34076  *                 if negative_step:
34077  */
34078           __pyx_v_start = 0;
34079 
34080           /* "View.MemoryView":844
34081  *             if start < 0:
34082  *                 start += shape
34083  *                 if start < 0:             # <<<<<<<<<<<<<<
34084  *                     start = 0
34085  *             elif start >= shape:
34086  */
34087         }
34088 
34089         /* "View.MemoryView":842
34090  *
34091  *         if have_start:
34092  *             if start < 0:             # <<<<<<<<<<<<<<
34093  *                 start += shape
34094  *                 if start < 0:
34095  */
34096         goto __pyx_L12;
34097       }
34098 
34099       /* "View.MemoryView":846
34100  *                 if start < 0:
34101  *                     start = 0
34102  *             elif start >= shape:             # <<<<<<<<<<<<<<
34103  *                 if negative_step:
34104  *                     start = shape - 1
34105  */
34106       __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
34107       if (__pyx_t_2) {
34108 
34109         /* "View.MemoryView":847
34110  *                     start = 0
34111  *             elif start >= shape:
34112  *                 if negative_step:             # <<<<<<<<<<<<<<
34113  *                     start = shape - 1
34114  *                 else:
34115  */
34116         __pyx_t_2 = (__pyx_v_negative_step != 0);
34117         if (__pyx_t_2) {
34118 
34119           /* "View.MemoryView":848
34120  *             elif start >= shape:
34121  *                 if negative_step:
34122  *                     start = shape - 1             # <<<<<<<<<<<<<<
34123  *                 else:
34124  *                     start = shape
34125  */
34126           __pyx_v_start = (__pyx_v_shape - 1);
34127 
34128           /* "View.MemoryView":847
34129  *                     start = 0
34130  *             elif start >= shape:
34131  *                 if negative_step:             # <<<<<<<<<<<<<<
34132  *                     start = shape - 1
34133  *                 else:
34134  */
34135           goto __pyx_L14;
34136         }
34137 
34138         /* "View.MemoryView":850
34139  *                     start = shape - 1
34140  *                 else:
34141  *                     start = shape             # <<<<<<<<<<<<<<
34142  *         else:
34143  *             if negative_step:
34144  */
34145         /*else*/ {
34146           __pyx_v_start = __pyx_v_shape;
34147         }
34148         __pyx_L14:;
34149 
34150         /* "View.MemoryView":846
34151  *                 if start < 0:
34152  *                     start = 0
34153  *             elif start >= shape:             # <<<<<<<<<<<<<<
34154  *                 if negative_step:
34155  *                     start = shape - 1
34156  */
34157       }
34158       __pyx_L12:;
34159 
34160       /* "View.MemoryView":841
34161  *
34162  *
34163  *         if have_start:             # <<<<<<<<<<<<<<
34164  *             if start < 0:
34165  *                 start += shape
34166  */
34167       goto __pyx_L11;
34168     }
34169 
34170     /* "View.MemoryView":852
34171  *                     start = shape
34172  *         else:
34173  *             if negative_step:             # <<<<<<<<<<<<<<
34174  *                 start = shape - 1
34175  *             else:
34176  */
34177     /*else*/ {
34178       __pyx_t_2 = (__pyx_v_negative_step != 0);
34179       if (__pyx_t_2) {
34180 
34181         /* "View.MemoryView":853
34182  *         else:
34183  *             if negative_step:
34184  *                 start = shape - 1             # <<<<<<<<<<<<<<
34185  *             else:
34186  *                 start = 0
34187  */
34188         __pyx_v_start = (__pyx_v_shape - 1);
34189 
34190         /* "View.MemoryView":852
34191  *                     start = shape
34192  *         else:
34193  *             if negative_step:             # <<<<<<<<<<<<<<
34194  *                 start = shape - 1
34195  *             else:
34196  */
34197         goto __pyx_L15;
34198       }
34199 
34200       /* "View.MemoryView":855
34201  *                 start = shape - 1
34202  *             else:
34203  *                 start = 0             # <<<<<<<<<<<<<<
34204  *
34205  *         if have_stop:
34206  */
34207       /*else*/ {
34208         __pyx_v_start = 0;
34209       }
34210       __pyx_L15:;
34211     }
34212     __pyx_L11:;
34213 
34214     /* "View.MemoryView":857
34215  *                 start = 0
34216  *
34217  *         if have_stop:             # <<<<<<<<<<<<<<
34218  *             if stop < 0:
34219  *                 stop += shape
34220  */
34221     __pyx_t_2 = (__pyx_v_have_stop != 0);
34222     if (__pyx_t_2) {
34223 
34224       /* "View.MemoryView":858
34225  *
34226  *         if have_stop:
34227  *             if stop < 0:             # <<<<<<<<<<<<<<
34228  *                 stop += shape
34229  *                 if stop < 0:
34230  */
34231       __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
34232       if (__pyx_t_2) {
34233 
34234         /* "View.MemoryView":859
34235  *         if have_stop:
34236  *             if stop < 0:
34237  *                 stop += shape             # <<<<<<<<<<<<<<
34238  *                 if stop < 0:
34239  *                     stop = 0
34240  */
34241         __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
34242 
34243         /* "View.MemoryView":860
34244  *             if stop < 0:
34245  *                 stop += shape
34246  *                 if stop < 0:             # <<<<<<<<<<<<<<
34247  *                     stop = 0
34248  *             elif stop > shape:
34249  */
34250         __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
34251         if (__pyx_t_2) {
34252 
34253           /* "View.MemoryView":861
34254  *                 stop += shape
34255  *                 if stop < 0:
34256  *                     stop = 0             # <<<<<<<<<<<<<<
34257  *             elif stop > shape:
34258  *                 stop = shape
34259  */
34260           __pyx_v_stop = 0;
34261 
34262           /* "View.MemoryView":860
34263  *             if stop < 0:
34264  *                 stop += shape
34265  *                 if stop < 0:             # <<<<<<<<<<<<<<
34266  *                     stop = 0
34267  *             elif stop > shape:
34268  */
34269         }
34270 
34271         /* "View.MemoryView":858
34272  *
34273  *         if have_stop:
34274  *             if stop < 0:             # <<<<<<<<<<<<<<
34275  *                 stop += shape
34276  *                 if stop < 0:
34277  */
34278         goto __pyx_L17;
34279       }
34280 
34281       /* "View.MemoryView":862
34282  *                 if stop < 0:
34283  *                     stop = 0
34284  *             elif stop > shape:             # <<<<<<<<<<<<<<
34285  *                 stop = shape
34286  *         else:
34287  */
34288       __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
34289       if (__pyx_t_2) {
34290 
34291         /* "View.MemoryView":863
34292  *                     stop = 0
34293  *             elif stop > shape:
34294  *                 stop = shape             # <<<<<<<<<<<<<<
34295  *         else:
34296  *             if negative_step:
34297  */
34298         __pyx_v_stop = __pyx_v_shape;
34299 
34300         /* "View.MemoryView":862
34301  *                 if stop < 0:
34302  *                     stop = 0
34303  *             elif stop > shape:             # <<<<<<<<<<<<<<
34304  *                 stop = shape
34305  *         else:
34306  */
34307       }
34308       __pyx_L17:;
34309 
34310       /* "View.MemoryView":857
34311  *                 start = 0
34312  *
34313  *         if have_stop:             # <<<<<<<<<<<<<<
34314  *             if stop < 0:
34315  *                 stop += shape
34316  */
34317       goto __pyx_L16;
34318     }
34319 
34320     /* "View.MemoryView":865
34321  *                 stop = shape
34322  *         else:
34323  *             if negative_step:             # <<<<<<<<<<<<<<
34324  *                 stop = -1
34325  *             else:
34326  */
34327     /*else*/ {
34328       __pyx_t_2 = (__pyx_v_negative_step != 0);
34329       if (__pyx_t_2) {
34330 
34331         /* "View.MemoryView":866
34332  *         else:
34333  *             if negative_step:
34334  *                 stop = -1             # <<<<<<<<<<<<<<
34335  *             else:
34336  *                 stop = shape
34337  */
34338         __pyx_v_stop = -1L;
34339 
34340         /* "View.MemoryView":865
34341  *                 stop = shape
34342  *         else:
34343  *             if negative_step:             # <<<<<<<<<<<<<<
34344  *                 stop = -1
34345  *             else:
34346  */
34347         goto __pyx_L19;
34348       }
34349 
34350       /* "View.MemoryView":868
34351  *                 stop = -1
34352  *             else:
34353  *                 stop = shape             # <<<<<<<<<<<<<<
34354  *
34355  *         if not have_step:
34356  */
34357       /*else*/ {
34358         __pyx_v_stop = __pyx_v_shape;
34359       }
34360       __pyx_L19:;
34361     }
34362     __pyx_L16:;
34363 
34364     /* "View.MemoryView":870
34365  *                 stop = shape
34366  *
34367  *         if not have_step:             # <<<<<<<<<<<<<<
34368  *             step = 1
34369  *
34370  */
34371     __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
34372     if (__pyx_t_2) {
34373 
34374       /* "View.MemoryView":871
34375  *
34376  *         if not have_step:
34377  *             step = 1             # <<<<<<<<<<<<<<
34378  *
34379  *
34380  */
34381       __pyx_v_step = 1;
34382 
34383       /* "View.MemoryView":870
34384  *                 stop = shape
34385  *
34386  *         if not have_step:             # <<<<<<<<<<<<<<
34387  *             step = 1
34388  *
34389  */
34390     }
34391 
34392     /* "View.MemoryView":875
34393  *
34394  *         with cython.cdivision(True):
34395  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
34396  *
34397  *             if (stop - start) - step * new_shape:
34398  */
34399     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
34400 
34401     /* "View.MemoryView":877
34402  *             new_shape = (stop - start) // step
34403  *
34404  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
34405  *                 new_shape += 1
34406  *
34407  */
34408     __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
34409     if (__pyx_t_2) {
34410 
34411       /* "View.MemoryView":878
34412  *
34413  *             if (stop - start) - step * new_shape:
34414  *                 new_shape += 1             # <<<<<<<<<<<<<<
34415  *
34416  *         if new_shape < 0:
34417  */
34418       __pyx_v_new_shape = (__pyx_v_new_shape + 1);
34419 
34420       /* "View.MemoryView":877
34421  *             new_shape = (stop - start) // step
34422  *
34423  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
34424  *                 new_shape += 1
34425  *
34426  */
34427     }
34428 
34429     /* "View.MemoryView":880
34430  *                 new_shape += 1
34431  *
34432  *         if new_shape < 0:             # <<<<<<<<<<<<<<
34433  *             new_shape = 0
34434  *
34435  */
34436     __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
34437     if (__pyx_t_2) {
34438 
34439       /* "View.MemoryView":881
34440  *
34441  *         if new_shape < 0:
34442  *             new_shape = 0             # <<<<<<<<<<<<<<
34443  *
34444  *
34445  */
34446       __pyx_v_new_shape = 0;
34447 
34448       /* "View.MemoryView":880
34449  *                 new_shape += 1
34450  *
34451  *         if new_shape < 0:             # <<<<<<<<<<<<<<
34452  *             new_shape = 0
34453  *
34454  */
34455     }
34456 
34457     /* "View.MemoryView":884
34458  *
34459  *
34460  *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
34461  *         dst.shape[new_ndim] = new_shape
34462  *         dst.suboffsets[new_ndim] = suboffset
34463  */
34464     (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
34465 
34466     /* "View.MemoryView":885
34467  *
34468  *         dst.strides[new_ndim] = stride * step
34469  *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
34470  *         dst.suboffsets[new_ndim] = suboffset
34471  *
34472  */
34473     (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
34474 
34475     /* "View.MemoryView":886
34476  *         dst.strides[new_ndim] = stride * step
34477  *         dst.shape[new_ndim] = new_shape
34478  *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
34479  *
34480  *
34481  */
34482     (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
34483   }
34484   __pyx_L3:;
34485 
34486   /* "View.MemoryView":889
34487  *
34488  *
34489  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
34490  *         dst.data += start * stride
34491  *     else:
34492  */
34493   __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
34494   if (__pyx_t_2) {
34495 
34496     /* "View.MemoryView":890
34497  *
34498  *     if suboffset_dim[0] < 0:
34499  *         dst.data += start * stride             # <<<<<<<<<<<<<<
34500  *     else:
34501  *         dst.suboffsets[suboffset_dim[0]] += start * stride
34502  */
34503     __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
34504 
34505     /* "View.MemoryView":889
34506  *
34507  *
34508  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
34509  *         dst.data += start * stride
34510  *     else:
34511  */
34512     goto __pyx_L23;
34513   }
34514 
34515   /* "View.MemoryView":892
34516  *         dst.data += start * stride
34517  *     else:
34518  *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
34519  *
34520  *     if suboffset >= 0:
34521  */
34522   /*else*/ {
34523     __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
34524     (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
34525   }
34526   __pyx_L23:;
34527 
34528   /* "View.MemoryView":894
34529  *         dst.suboffsets[suboffset_dim[0]] += start * stride
34530  *
34531  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
34532  *         if not is_slice:
34533  *             if new_ndim == 0:
34534  */
34535   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
34536   if (__pyx_t_2) {
34537 
34538     /* "View.MemoryView":895
34539  *
34540  *     if suboffset >= 0:
34541  *         if not is_slice:             # <<<<<<<<<<<<<<
34542  *             if new_ndim == 0:
34543  *                 dst.data = (<char **> dst.data)[0] + suboffset
34544  */
34545     __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
34546     if (__pyx_t_2) {
34547 
34548       /* "View.MemoryView":896
34549  *     if suboffset >= 0:
34550  *         if not is_slice:
34551  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
34552  *                 dst.data = (<char **> dst.data)[0] + suboffset
34553  *             else:
34554  */
34555       __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
34556       if (__pyx_t_2) {
34557 
34558         /* "View.MemoryView":897
34559  *         if not is_slice:
34560  *             if new_ndim == 0:
34561  *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
34562  *             else:
34563  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
34564  */
34565         __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
34566 
34567         /* "View.MemoryView":896
34568  *     if suboffset >= 0:
34569  *         if not is_slice:
34570  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
34571  *                 dst.data = (<char **> dst.data)[0] + suboffset
34572  *             else:
34573  */
34574         goto __pyx_L26;
34575       }
34576 
34577       /* "View.MemoryView":899
34578  *                 dst.data = (<char **> dst.data)[0] + suboffset
34579  *             else:
34580  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
34581  *                                      "must be indexed and not sliced", dim)
34582  *         else:
34583  */
34584       /*else*/ {
34585 
34586         /* "View.MemoryView":900
34587  *             else:
34588  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
34589  *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
34590  *         else:
34591  *             suboffset_dim[0] = new_ndim
34592  */
34593         __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 899, __pyx_L1_error)
34594       }
34595       __pyx_L26:;
34596 
34597       /* "View.MemoryView":895
34598  *
34599  *     if suboffset >= 0:
34600  *         if not is_slice:             # <<<<<<<<<<<<<<
34601  *             if new_ndim == 0:
34602  *                 dst.data = (<char **> dst.data)[0] + suboffset
34603  */
34604       goto __pyx_L25;
34605     }
34606 
34607     /* "View.MemoryView":902
34608  *                                      "must be indexed and not sliced", dim)
34609  *         else:
34610  *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
34611  *
34612  *     return 0
34613  */
34614     /*else*/ {
34615       (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
34616     }
34617     __pyx_L25:;
34618 
34619     /* "View.MemoryView":894
34620  *         dst.suboffsets[suboffset_dim[0]] += start * stride
34621  *
34622  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
34623  *         if not is_slice:
34624  *             if new_ndim == 0:
34625  */
34626   }
34627 
34628   /* "View.MemoryView":904
34629  *             suboffset_dim[0] = new_ndim
34630  *
34631  *     return 0             # <<<<<<<<<<<<<<
34632  *
34633  *
34634  */
34635   __pyx_r = 0;
34636   goto __pyx_L0;
34637 
34638   /* "View.MemoryView":807
34639  *
34640  * @cname('__pyx_memoryview_slice_memviewslice')
34641  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
34642  *         __Pyx_memviewslice *dst,
34643  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
34644  */
34645 
34646   /* function exit code */
34647   __pyx_L1_error:;
34648   {
34649     #ifdef WITH_THREAD
34650     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
34651     #endif
34652     __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
34653     #ifdef WITH_THREAD
34654     __Pyx_PyGILState_Release(__pyx_gilstate_save);
34655     #endif
34656   }
34657   __pyx_r = -1;
34658   __pyx_L0:;
34659   return __pyx_r;
34660 }
34661 
34662 /* "View.MemoryView":910
34663  *
34664  * @cname('__pyx_pybuffer_index')
34665  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
34666  *                           Py_ssize_t dim) except NULL:
34667  *     cdef Py_ssize_t shape, stride, suboffset = -1
34668  */
34669 
__pyx_pybuffer_index(Py_buffer * __pyx_v_view,char * __pyx_v_bufp,Py_ssize_t __pyx_v_index,Py_ssize_t __pyx_v_dim)34670 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
34671   Py_ssize_t __pyx_v_shape;
34672   Py_ssize_t __pyx_v_stride;
34673   Py_ssize_t __pyx_v_suboffset;
34674   Py_ssize_t __pyx_v_itemsize;
34675   char *__pyx_v_resultp;
34676   char *__pyx_r;
34677   __Pyx_RefNannyDeclarations
34678   Py_ssize_t __pyx_t_1;
34679   int __pyx_t_2;
34680   PyObject *__pyx_t_3 = NULL;
34681   PyObject *__pyx_t_4 = NULL;
34682   int __pyx_lineno = 0;
34683   const char *__pyx_filename = NULL;
34684   int __pyx_clineno = 0;
34685   __Pyx_RefNannySetupContext("pybuffer_index", 0);
34686 
34687   /* "View.MemoryView":912
34688  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
34689  *                           Py_ssize_t dim) except NULL:
34690  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
34691  *     cdef Py_ssize_t itemsize = view.itemsize
34692  *     cdef char *resultp
34693  */
34694   __pyx_v_suboffset = -1L;
34695 
34696   /* "View.MemoryView":913
34697  *                           Py_ssize_t dim) except NULL:
34698  *     cdef Py_ssize_t shape, stride, suboffset = -1
34699  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
34700  *     cdef char *resultp
34701  *
34702  */
34703   __pyx_t_1 = __pyx_v_view->itemsize;
34704   __pyx_v_itemsize = __pyx_t_1;
34705 
34706   /* "View.MemoryView":916
34707  *     cdef char *resultp
34708  *
34709  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
34710  *         shape = view.len / itemsize
34711  *         stride = itemsize
34712  */
34713   __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
34714   if (__pyx_t_2) {
34715 
34716     /* "View.MemoryView":917
34717  *
34718  *     if view.ndim == 0:
34719  *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
34720  *         stride = itemsize
34721  *     else:
34722  */
34723     if (unlikely(__pyx_v_itemsize == 0)) {
34724       PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
34725       __PYX_ERR(1, 917, __pyx_L1_error)
34726     }
34727     else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
34728       PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
34729       __PYX_ERR(1, 917, __pyx_L1_error)
34730     }
34731     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
34732 
34733     /* "View.MemoryView":918
34734  *     if view.ndim == 0:
34735  *         shape = view.len / itemsize
34736  *         stride = itemsize             # <<<<<<<<<<<<<<
34737  *     else:
34738  *         shape = view.shape[dim]
34739  */
34740     __pyx_v_stride = __pyx_v_itemsize;
34741 
34742     /* "View.MemoryView":916
34743  *     cdef char *resultp
34744  *
34745  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
34746  *         shape = view.len / itemsize
34747  *         stride = itemsize
34748  */
34749     goto __pyx_L3;
34750   }
34751 
34752   /* "View.MemoryView":920
34753  *         stride = itemsize
34754  *     else:
34755  *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
34756  *         stride = view.strides[dim]
34757  *         if view.suboffsets != NULL:
34758  */
34759   /*else*/ {
34760     __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
34761 
34762     /* "View.MemoryView":921
34763  *     else:
34764  *         shape = view.shape[dim]
34765  *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
34766  *         if view.suboffsets != NULL:
34767  *             suboffset = view.suboffsets[dim]
34768  */
34769     __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
34770 
34771     /* "View.MemoryView":922
34772  *         shape = view.shape[dim]
34773  *         stride = view.strides[dim]
34774  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
34775  *             suboffset = view.suboffsets[dim]
34776  *
34777  */
34778     __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
34779     if (__pyx_t_2) {
34780 
34781       /* "View.MemoryView":923
34782  *         stride = view.strides[dim]
34783  *         if view.suboffsets != NULL:
34784  *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
34785  *
34786  *     if index < 0:
34787  */
34788       __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
34789 
34790       /* "View.MemoryView":922
34791  *         shape = view.shape[dim]
34792  *         stride = view.strides[dim]
34793  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
34794  *             suboffset = view.suboffsets[dim]
34795  *
34796  */
34797     }
34798   }
34799   __pyx_L3:;
34800 
34801   /* "View.MemoryView":925
34802  *             suboffset = view.suboffsets[dim]
34803  *
34804  *     if index < 0:             # <<<<<<<<<<<<<<
34805  *         index += view.shape[dim]
34806  *         if index < 0:
34807  */
34808   __pyx_t_2 = ((__pyx_v_index < 0) != 0);
34809   if (__pyx_t_2) {
34810 
34811     /* "View.MemoryView":926
34812  *
34813  *     if index < 0:
34814  *         index += view.shape[dim]             # <<<<<<<<<<<<<<
34815  *         if index < 0:
34816  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34817  */
34818     __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
34819 
34820     /* "View.MemoryView":927
34821  *     if index < 0:
34822  *         index += view.shape[dim]
34823  *         if index < 0:             # <<<<<<<<<<<<<<
34824  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34825  *
34826  */
34827     __pyx_t_2 = ((__pyx_v_index < 0) != 0);
34828     if (unlikely(__pyx_t_2)) {
34829 
34830       /* "View.MemoryView":928
34831  *         index += view.shape[dim]
34832  *         if index < 0:
34833  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
34834  *
34835  *     if index >= shape:
34836  */
34837       __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
34838       __Pyx_GOTREF(__pyx_t_3);
34839       __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 928, __pyx_L1_error)
34840       __Pyx_GOTREF(__pyx_t_4);
34841       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34842       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
34843       __Pyx_GOTREF(__pyx_t_3);
34844       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34845       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
34846       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34847       __PYX_ERR(1, 928, __pyx_L1_error)
34848 
34849       /* "View.MemoryView":927
34850  *     if index < 0:
34851  *         index += view.shape[dim]
34852  *         if index < 0:             # <<<<<<<<<<<<<<
34853  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34854  *
34855  */
34856     }
34857 
34858     /* "View.MemoryView":925
34859  *             suboffset = view.suboffsets[dim]
34860  *
34861  *     if index < 0:             # <<<<<<<<<<<<<<
34862  *         index += view.shape[dim]
34863  *         if index < 0:
34864  */
34865   }
34866 
34867   /* "View.MemoryView":930
34868  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34869  *
34870  *     if index >= shape:             # <<<<<<<<<<<<<<
34871  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34872  *
34873  */
34874   __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
34875   if (unlikely(__pyx_t_2)) {
34876 
34877     /* "View.MemoryView":931
34878  *
34879  *     if index >= shape:
34880  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
34881  *
34882  *     resultp = bufp + index * stride
34883  */
34884     __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
34885     __Pyx_GOTREF(__pyx_t_3);
34886     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 931, __pyx_L1_error)
34887     __Pyx_GOTREF(__pyx_t_4);
34888     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34889     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
34890     __Pyx_GOTREF(__pyx_t_3);
34891     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34892     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
34893     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34894     __PYX_ERR(1, 931, __pyx_L1_error)
34895 
34896     /* "View.MemoryView":930
34897  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34898  *
34899  *     if index >= shape:             # <<<<<<<<<<<<<<
34900  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34901  *
34902  */
34903   }
34904 
34905   /* "View.MemoryView":933
34906  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34907  *
34908  *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
34909  *     if suboffset >= 0:
34910  *         resultp = (<char **> resultp)[0] + suboffset
34911  */
34912   __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
34913 
34914   /* "View.MemoryView":934
34915  *
34916  *     resultp = bufp + index * stride
34917  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
34918  *         resultp = (<char **> resultp)[0] + suboffset
34919  *
34920  */
34921   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
34922   if (__pyx_t_2) {
34923 
34924     /* "View.MemoryView":935
34925  *     resultp = bufp + index * stride
34926  *     if suboffset >= 0:
34927  *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
34928  *
34929  *     return resultp
34930  */
34931     __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
34932 
34933     /* "View.MemoryView":934
34934  *
34935  *     resultp = bufp + index * stride
34936  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
34937  *         resultp = (<char **> resultp)[0] + suboffset
34938  *
34939  */
34940   }
34941 
34942   /* "View.MemoryView":937
34943  *         resultp = (<char **> resultp)[0] + suboffset
34944  *
34945  *     return resultp             # <<<<<<<<<<<<<<
34946  *
34947  *
34948  */
34949   __pyx_r = __pyx_v_resultp;
34950   goto __pyx_L0;
34951 
34952   /* "View.MemoryView":910
34953  *
34954  * @cname('__pyx_pybuffer_index')
34955  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
34956  *                           Py_ssize_t dim) except NULL:
34957  *     cdef Py_ssize_t shape, stride, suboffset = -1
34958  */
34959 
34960   /* function exit code */
34961   __pyx_L1_error:;
34962   __Pyx_XDECREF(__pyx_t_3);
34963   __Pyx_XDECREF(__pyx_t_4);
34964   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
34965   __pyx_r = NULL;
34966   __pyx_L0:;
34967   __Pyx_RefNannyFinishContext();
34968   return __pyx_r;
34969 }
34970 
34971 /* "View.MemoryView":943
34972  *
34973  * @cname('__pyx_memslice_transpose')
34974  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
34975  *     cdef int ndim = memslice.memview.view.ndim
34976  *
34977  */
34978 
__pyx_memslice_transpose(__Pyx_memviewslice * __pyx_v_memslice)34979 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
34980   int __pyx_v_ndim;
34981   Py_ssize_t *__pyx_v_shape;
34982   Py_ssize_t *__pyx_v_strides;
34983   int __pyx_v_i;
34984   int __pyx_v_j;
34985   int __pyx_r;
34986   int __pyx_t_1;
34987   Py_ssize_t *__pyx_t_2;
34988   long __pyx_t_3;
34989   long __pyx_t_4;
34990   Py_ssize_t __pyx_t_5;
34991   Py_ssize_t __pyx_t_6;
34992   int __pyx_t_7;
34993   int __pyx_t_8;
34994   int __pyx_t_9;
34995   int __pyx_lineno = 0;
34996   const char *__pyx_filename = NULL;
34997   int __pyx_clineno = 0;
34998 
34999   /* "View.MemoryView":944
35000  * @cname('__pyx_memslice_transpose')
35001  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
35002  *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
35003  *
35004  *     cdef Py_ssize_t *shape = memslice.shape
35005  */
35006   __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
35007   __pyx_v_ndim = __pyx_t_1;
35008 
35009   /* "View.MemoryView":946
35010  *     cdef int ndim = memslice.memview.view.ndim
35011  *
35012  *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
35013  *     cdef Py_ssize_t *strides = memslice.strides
35014  *
35015  */
35016   __pyx_t_2 = __pyx_v_memslice->shape;
35017   __pyx_v_shape = __pyx_t_2;
35018 
35019   /* "View.MemoryView":947
35020  *
35021  *     cdef Py_ssize_t *shape = memslice.shape
35022  *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
35023  *
35024  *
35025  */
35026   __pyx_t_2 = __pyx_v_memslice->strides;
35027   __pyx_v_strides = __pyx_t_2;
35028 
35029   /* "View.MemoryView":951
35030  *
35031  *     cdef int i, j
35032  *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
35033  *         j = ndim - 1 - i
35034  *         strides[i], strides[j] = strides[j], strides[i]
35035  */
35036   __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
35037   __pyx_t_4 = __pyx_t_3;
35038   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
35039     __pyx_v_i = __pyx_t_1;
35040 
35041     /* "View.MemoryView":952
35042  *     cdef int i, j
35043  *     for i in range(ndim / 2):
35044  *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
35045  *         strides[i], strides[j] = strides[j], strides[i]
35046  *         shape[i], shape[j] = shape[j], shape[i]
35047  */
35048     __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
35049 
35050     /* "View.MemoryView":953
35051  *     for i in range(ndim / 2):
35052  *         j = ndim - 1 - i
35053  *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
35054  *         shape[i], shape[j] = shape[j], shape[i]
35055  *
35056  */
35057     __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
35058     __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
35059     (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
35060     (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
35061 
35062     /* "View.MemoryView":954
35063  *         j = ndim - 1 - i
35064  *         strides[i], strides[j] = strides[j], strides[i]
35065  *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
35066  *
35067  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
35068  */
35069     __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
35070     __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
35071     (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
35072     (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
35073 
35074     /* "View.MemoryView":956
35075  *         shape[i], shape[j] = shape[j], shape[i]
35076  *
35077  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
35078  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
35079  *
35080  */
35081     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
35082     if (!__pyx_t_8) {
35083     } else {
35084       __pyx_t_7 = __pyx_t_8;
35085       goto __pyx_L6_bool_binop_done;
35086     }
35087     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
35088     __pyx_t_7 = __pyx_t_8;
35089     __pyx_L6_bool_binop_done:;
35090     if (__pyx_t_7) {
35091 
35092       /* "View.MemoryView":957
35093  *
35094  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
35095  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
35096  *
35097  *     return 1
35098  */
35099       __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 957, __pyx_L1_error)
35100 
35101       /* "View.MemoryView":956
35102  *         shape[i], shape[j] = shape[j], shape[i]
35103  *
35104  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
35105  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
35106  *
35107  */
35108     }
35109   }
35110 
35111   /* "View.MemoryView":959
35112  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
35113  *
35114  *     return 1             # <<<<<<<<<<<<<<
35115  *
35116  *
35117  */
35118   __pyx_r = 1;
35119   goto __pyx_L0;
35120 
35121   /* "View.MemoryView":943
35122  *
35123  * @cname('__pyx_memslice_transpose')
35124  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
35125  *     cdef int ndim = memslice.memview.view.ndim
35126  *
35127  */
35128 
35129   /* function exit code */
35130   __pyx_L1_error:;
35131   {
35132     #ifdef WITH_THREAD
35133     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
35134     #endif
35135     __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
35136     #ifdef WITH_THREAD
35137     __Pyx_PyGILState_Release(__pyx_gilstate_save);
35138     #endif
35139   }
35140   __pyx_r = 0;
35141   __pyx_L0:;
35142   return __pyx_r;
35143 }
35144 
35145 /* "View.MemoryView":976
35146  *     cdef int (*to_dtype_func)(char *, object) except 0
35147  *
35148  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
35149  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
35150  *
35151  */
35152 
35153 /* Python wrapper */
35154 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryviewslice___dealloc__(PyObject * __pyx_v_self)35155 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
35156   __Pyx_RefNannyDeclarations
35157   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
35158   __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
35159 
35160   /* function exit code */
35161   __Pyx_RefNannyFinishContext();
35162 }
35163 
__pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj * __pyx_v_self)35164 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
35165   __Pyx_RefNannyDeclarations
35166   __Pyx_RefNannySetupContext("__dealloc__", 0);
35167 
35168   /* "View.MemoryView":977
35169  *
35170  *     def __dealloc__(self):
35171  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
35172  *
35173  *     cdef convert_item_to_object(self, char *itemp):
35174  */
35175   __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
35176 
35177   /* "View.MemoryView":976
35178  *     cdef int (*to_dtype_func)(char *, object) except 0
35179  *
35180  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
35181  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
35182  *
35183  */
35184 
35185   /* function exit code */
35186   __Pyx_RefNannyFinishContext();
35187 }
35188 
35189 /* "View.MemoryView":979
35190  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
35191  *
35192  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
35193  *         if self.to_object_func != NULL:
35194  *             return self.to_object_func(itemp)
35195  */
35196 
__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp)35197 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
35198   PyObject *__pyx_r = NULL;
35199   __Pyx_RefNannyDeclarations
35200   int __pyx_t_1;
35201   PyObject *__pyx_t_2 = NULL;
35202   int __pyx_lineno = 0;
35203   const char *__pyx_filename = NULL;
35204   int __pyx_clineno = 0;
35205   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
35206 
35207   /* "View.MemoryView":980
35208  *
35209  *     cdef convert_item_to_object(self, char *itemp):
35210  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
35211  *             return self.to_object_func(itemp)
35212  *         else:
35213  */
35214   __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
35215   if (__pyx_t_1) {
35216 
35217     /* "View.MemoryView":981
35218  *     cdef convert_item_to_object(self, char *itemp):
35219  *         if self.to_object_func != NULL:
35220  *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
35221  *         else:
35222  *             return memoryview.convert_item_to_object(self, itemp)
35223  */
35224     __Pyx_XDECREF(__pyx_r);
35225     __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 981, __pyx_L1_error)
35226     __Pyx_GOTREF(__pyx_t_2);
35227     __pyx_r = __pyx_t_2;
35228     __pyx_t_2 = 0;
35229     goto __pyx_L0;
35230 
35231     /* "View.MemoryView":980
35232  *
35233  *     cdef convert_item_to_object(self, char *itemp):
35234  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
35235  *             return self.to_object_func(itemp)
35236  *         else:
35237  */
35238   }
35239 
35240   /* "View.MemoryView":983
35241  *             return self.to_object_func(itemp)
35242  *         else:
35243  *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
35244  *
35245  *     cdef assign_item_from_object(self, char *itemp, object value):
35246  */
35247   /*else*/ {
35248     __Pyx_XDECREF(__pyx_r);
35249     __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 983, __pyx_L1_error)
35250     __Pyx_GOTREF(__pyx_t_2);
35251     __pyx_r = __pyx_t_2;
35252     __pyx_t_2 = 0;
35253     goto __pyx_L0;
35254   }
35255 
35256   /* "View.MemoryView":979
35257  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
35258  *
35259  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
35260  *         if self.to_object_func != NULL:
35261  *             return self.to_object_func(itemp)
35262  */
35263 
35264   /* function exit code */
35265   __pyx_L1_error:;
35266   __Pyx_XDECREF(__pyx_t_2);
35267   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
35268   __pyx_r = 0;
35269   __pyx_L0:;
35270   __Pyx_XGIVEREF(__pyx_r);
35271   __Pyx_RefNannyFinishContext();
35272   return __pyx_r;
35273 }
35274 
35275 /* "View.MemoryView":985
35276  *             return memoryview.convert_item_to_object(self, itemp)
35277  *
35278  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
35279  *         if self.to_dtype_func != NULL:
35280  *             self.to_dtype_func(itemp, value)
35281  */
35282 
__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)35283 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
35284   PyObject *__pyx_r = NULL;
35285   __Pyx_RefNannyDeclarations
35286   int __pyx_t_1;
35287   int __pyx_t_2;
35288   PyObject *__pyx_t_3 = NULL;
35289   int __pyx_lineno = 0;
35290   const char *__pyx_filename = NULL;
35291   int __pyx_clineno = 0;
35292   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
35293 
35294   /* "View.MemoryView":986
35295  *
35296  *     cdef assign_item_from_object(self, char *itemp, object value):
35297  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
35298  *             self.to_dtype_func(itemp, value)
35299  *         else:
35300  */
35301   __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
35302   if (__pyx_t_1) {
35303 
35304     /* "View.MemoryView":987
35305  *     cdef assign_item_from_object(self, char *itemp, object value):
35306  *         if self.to_dtype_func != NULL:
35307  *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
35308  *         else:
35309  *             memoryview.assign_item_from_object(self, itemp, value)
35310  */
35311     __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 987, __pyx_L1_error)
35312 
35313     /* "View.MemoryView":986
35314  *
35315  *     cdef assign_item_from_object(self, char *itemp, object value):
35316  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
35317  *             self.to_dtype_func(itemp, value)
35318  *         else:
35319  */
35320     goto __pyx_L3;
35321   }
35322 
35323   /* "View.MemoryView":989
35324  *             self.to_dtype_func(itemp, value)
35325  *         else:
35326  *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
35327  *
35328  *     @property
35329  */
35330   /*else*/ {
35331     __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 989, __pyx_L1_error)
35332     __Pyx_GOTREF(__pyx_t_3);
35333     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
35334   }
35335   __pyx_L3:;
35336 
35337   /* "View.MemoryView":985
35338  *             return memoryview.convert_item_to_object(self, itemp)
35339  *
35340  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
35341  *         if self.to_dtype_func != NULL:
35342  *             self.to_dtype_func(itemp, value)
35343  */
35344 
35345   /* function exit code */
35346   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
35347   goto __pyx_L0;
35348   __pyx_L1_error:;
35349   __Pyx_XDECREF(__pyx_t_3);
35350   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
35351   __pyx_r = 0;
35352   __pyx_L0:;
35353   __Pyx_XGIVEREF(__pyx_r);
35354   __Pyx_RefNannyFinishContext();
35355   return __pyx_r;
35356 }
35357 
35358 /* "View.MemoryView":992
35359  *
35360  *     @property
35361  *     def base(self):             # <<<<<<<<<<<<<<
35362  *         return self.from_object
35363  *
35364  */
35365 
35366 /* Python wrapper */
35367 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject * __pyx_v_self)35368 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
35369   PyObject *__pyx_r = 0;
35370   __Pyx_RefNannyDeclarations
35371   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
35372   __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
35373 
35374   /* function exit code */
35375   __Pyx_RefNannyFinishContext();
35376   return __pyx_r;
35377 }
35378 
__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj * __pyx_v_self)35379 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
35380   PyObject *__pyx_r = NULL;
35381   __Pyx_RefNannyDeclarations
35382   __Pyx_RefNannySetupContext("__get__", 0);
35383 
35384   /* "View.MemoryView":993
35385  *     @property
35386  *     def base(self):
35387  *         return self.from_object             # <<<<<<<<<<<<<<
35388  *
35389  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
35390  */
35391   __Pyx_XDECREF(__pyx_r);
35392   __Pyx_INCREF(__pyx_v_self->from_object);
35393   __pyx_r = __pyx_v_self->from_object;
35394   goto __pyx_L0;
35395 
35396   /* "View.MemoryView":992
35397  *
35398  *     @property
35399  *     def base(self):             # <<<<<<<<<<<<<<
35400  *         return self.from_object
35401  *
35402  */
35403 
35404   /* function exit code */
35405   __pyx_L0:;
35406   __Pyx_XGIVEREF(__pyx_r);
35407   __Pyx_RefNannyFinishContext();
35408   return __pyx_r;
35409 }
35410 
35411 /* "(tree fragment)":1
35412  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
35413  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
35414  * def __setstate_cython__(self, __pyx_state):
35415  */
35416 
35417 /* Python wrapper */
35418 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)35419 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
35420   PyObject *__pyx_r = 0;
35421   __Pyx_RefNannyDeclarations
35422   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
35423   __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
35424 
35425   /* function exit code */
35426   __Pyx_RefNannyFinishContext();
35427   return __pyx_r;
35428 }
35429 
__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self)35430 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
35431   PyObject *__pyx_r = NULL;
35432   __Pyx_RefNannyDeclarations
35433   PyObject *__pyx_t_1 = NULL;
35434   int __pyx_lineno = 0;
35435   const char *__pyx_filename = NULL;
35436   int __pyx_clineno = 0;
35437   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
35438 
35439   /* "(tree fragment)":2
35440  * def __reduce_cython__(self):
35441  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
35442  * def __setstate_cython__(self, __pyx_state):
35443  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
35444  */
35445   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
35446   __Pyx_GOTREF(__pyx_t_1);
35447   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
35448   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
35449   __PYX_ERR(1, 2, __pyx_L1_error)
35450 
35451   /* "(tree fragment)":1
35452  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
35453  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
35454  * def __setstate_cython__(self, __pyx_state):
35455  */
35456 
35457   /* function exit code */
35458   __pyx_L1_error:;
35459   __Pyx_XDECREF(__pyx_t_1);
35460   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
35461   __pyx_r = NULL;
35462   __Pyx_XGIVEREF(__pyx_r);
35463   __Pyx_RefNannyFinishContext();
35464   return __pyx_r;
35465 }
35466 
35467 /* "(tree fragment)":3
35468  * def __reduce_cython__(self):
35469  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
35470  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
35471  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
35472  */
35473 
35474 /* Python wrapper */
35475 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)35476 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
35477   PyObject *__pyx_r = 0;
35478   __Pyx_RefNannyDeclarations
35479   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
35480   __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
35481 
35482   /* function exit code */
35483   __Pyx_RefNannyFinishContext();
35484   return __pyx_r;
35485 }
35486 
__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)35487 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
35488   PyObject *__pyx_r = NULL;
35489   __Pyx_RefNannyDeclarations
35490   PyObject *__pyx_t_1 = NULL;
35491   int __pyx_lineno = 0;
35492   const char *__pyx_filename = NULL;
35493   int __pyx_clineno = 0;
35494   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
35495 
35496   /* "(tree fragment)":4
35497  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
35498  * def __setstate_cython__(self, __pyx_state):
35499  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
35500  */
35501   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
35502   __Pyx_GOTREF(__pyx_t_1);
35503   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
35504   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
35505   __PYX_ERR(1, 4, __pyx_L1_error)
35506 
35507   /* "(tree fragment)":3
35508  * def __reduce_cython__(self):
35509  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
35510  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
35511  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
35512  */
35513 
35514   /* function exit code */
35515   __pyx_L1_error:;
35516   __Pyx_XDECREF(__pyx_t_1);
35517   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
35518   __pyx_r = NULL;
35519   __Pyx_XGIVEREF(__pyx_r);
35520   __Pyx_RefNannyFinishContext();
35521   return __pyx_r;
35522 }
35523 
35524 /* "View.MemoryView":999
35525  *
35526  * @cname('__pyx_memoryview_fromslice')
35527  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
35528  *                           int ndim,
35529  *                           object (*to_object_func)(char *),
35530  */
35531 
__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice,int __pyx_v_ndim,PyObject * (* __pyx_v_to_object_func)(char *),int (* __pyx_v_to_dtype_func)(char *,PyObject *),int __pyx_v_dtype_is_object)35532 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
35533   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
35534   Py_ssize_t __pyx_v_suboffset;
35535   PyObject *__pyx_v_length = NULL;
35536   PyObject *__pyx_r = NULL;
35537   __Pyx_RefNannyDeclarations
35538   int __pyx_t_1;
35539   PyObject *__pyx_t_2 = NULL;
35540   PyObject *__pyx_t_3 = NULL;
35541   __Pyx_TypeInfo *__pyx_t_4;
35542   Py_buffer __pyx_t_5;
35543   Py_ssize_t *__pyx_t_6;
35544   Py_ssize_t *__pyx_t_7;
35545   Py_ssize_t *__pyx_t_8;
35546   Py_ssize_t __pyx_t_9;
35547   int __pyx_lineno = 0;
35548   const char *__pyx_filename = NULL;
35549   int __pyx_clineno = 0;
35550   __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
35551 
35552   /* "View.MemoryView":1007
35553  *     cdef _memoryviewslice result
35554  *
35555  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
35556  *         return None
35557  *
35558  */
35559   __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
35560   if (__pyx_t_1) {
35561 
35562     /* "View.MemoryView":1008
35563  *
35564  *     if <PyObject *> memviewslice.memview == Py_None:
35565  *         return None             # <<<<<<<<<<<<<<
35566  *
35567  *
35568  */
35569     __Pyx_XDECREF(__pyx_r);
35570     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
35571     goto __pyx_L0;
35572 
35573     /* "View.MemoryView":1007
35574  *     cdef _memoryviewslice result
35575  *
35576  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
35577  *         return None
35578  *
35579  */
35580   }
35581 
35582   /* "View.MemoryView":1013
35583  *
35584  *
35585  *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
35586  *
35587  *     result.from_slice = memviewslice
35588  */
35589   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
35590   __Pyx_GOTREF(__pyx_t_2);
35591   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error)
35592   __Pyx_GOTREF(__pyx_t_3);
35593   __Pyx_INCREF(Py_None);
35594   __Pyx_GIVEREF(Py_None);
35595   PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
35596   __Pyx_INCREF(__pyx_int_0);
35597   __Pyx_GIVEREF(__pyx_int_0);
35598   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
35599   __Pyx_GIVEREF(__pyx_t_2);
35600   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
35601   __pyx_t_2 = 0;
35602   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
35603   __Pyx_GOTREF(__pyx_t_2);
35604   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
35605   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
35606   __pyx_t_2 = 0;
35607 
35608   /* "View.MemoryView":1015
35609  *     result = _memoryviewslice(None, 0, dtype_is_object)
35610  *
35611  *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
35612  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
35613  *
35614  */
35615   __pyx_v_result->from_slice = __pyx_v_memviewslice;
35616 
35617   /* "View.MemoryView":1016
35618  *
35619  *     result.from_slice = memviewslice
35620  *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
35621  *
35622  *     result.from_object = (<memoryview> memviewslice.memview).base
35623  */
35624   __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
35625 
35626   /* "View.MemoryView":1018
35627  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
35628  *
35629  *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
35630  *     result.typeinfo = memviewslice.memview.typeinfo
35631  *
35632  */
35633   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error)
35634   __Pyx_GOTREF(__pyx_t_2);
35635   __Pyx_GIVEREF(__pyx_t_2);
35636   __Pyx_GOTREF(__pyx_v_result->from_object);
35637   __Pyx_DECREF(__pyx_v_result->from_object);
35638   __pyx_v_result->from_object = __pyx_t_2;
35639   __pyx_t_2 = 0;
35640 
35641   /* "View.MemoryView":1019
35642  *
35643  *     result.from_object = (<memoryview> memviewslice.memview).base
35644  *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
35645  *
35646  *     result.view = memviewslice.memview.view
35647  */
35648   __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
35649   __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
35650 
35651   /* "View.MemoryView":1021
35652  *     result.typeinfo = memviewslice.memview.typeinfo
35653  *
35654  *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
35655  *     result.view.buf = <void *> memviewslice.data
35656  *     result.view.ndim = ndim
35657  */
35658   __pyx_t_5 = __pyx_v_memviewslice.memview->view;
35659   __pyx_v_result->__pyx_base.view = __pyx_t_5;
35660 
35661   /* "View.MemoryView":1022
35662  *
35663  *     result.view = memviewslice.memview.view
35664  *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
35665  *     result.view.ndim = ndim
35666  *     (<__pyx_buffer *> &result.view).obj = Py_None
35667  */
35668   __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
35669 
35670   /* "View.MemoryView":1023
35671  *     result.view = memviewslice.memview.view
35672  *     result.view.buf = <void *> memviewslice.data
35673  *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
35674  *     (<__pyx_buffer *> &result.view).obj = Py_None
35675  *     Py_INCREF(Py_None)
35676  */
35677   __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
35678 
35679   /* "View.MemoryView":1024
35680  *     result.view.buf = <void *> memviewslice.data
35681  *     result.view.ndim = ndim
35682  *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
35683  *     Py_INCREF(Py_None)
35684  *
35685  */
35686   ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
35687 
35688   /* "View.MemoryView":1025
35689  *     result.view.ndim = ndim
35690  *     (<__pyx_buffer *> &result.view).obj = Py_None
35691  *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
35692  *
35693  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
35694  */
35695   Py_INCREF(Py_None);
35696 
35697   /* "View.MemoryView":1027
35698  *     Py_INCREF(Py_None)
35699  *
35700  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
35701  *         result.flags = PyBUF_RECORDS
35702  *     else:
35703  */
35704   __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
35705   if (__pyx_t_1) {
35706 
35707     /* "View.MemoryView":1028
35708  *
35709  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
35710  *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
35711  *     else:
35712  *         result.flags = PyBUF_RECORDS_RO
35713  */
35714     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
35715 
35716     /* "View.MemoryView":1027
35717  *     Py_INCREF(Py_None)
35718  *
35719  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
35720  *         result.flags = PyBUF_RECORDS
35721  *     else:
35722  */
35723     goto __pyx_L4;
35724   }
35725 
35726   /* "View.MemoryView":1030
35727  *         result.flags = PyBUF_RECORDS
35728  *     else:
35729  *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
35730  *
35731  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
35732  */
35733   /*else*/ {
35734     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
35735   }
35736   __pyx_L4:;
35737 
35738   /* "View.MemoryView":1032
35739  *         result.flags = PyBUF_RECORDS_RO
35740  *
35741  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
35742  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
35743  *
35744  */
35745   __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
35746 
35747   /* "View.MemoryView":1033
35748  *
35749  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
35750  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
35751  *
35752  *
35753  */
35754   __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
35755 
35756   /* "View.MemoryView":1036
35757  *
35758  *
35759  *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
35760  *     for suboffset in result.from_slice.suboffsets[:ndim]:
35761  *         if suboffset >= 0:
35762  */
35763   __pyx_v_result->__pyx_base.view.suboffsets = NULL;
35764 
35765   /* "View.MemoryView":1037
35766  *
35767  *     result.view.suboffsets = NULL
35768  *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
35769  *         if suboffset >= 0:
35770  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
35771  */
35772   __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
35773   for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
35774     __pyx_t_6 = __pyx_t_8;
35775     __pyx_v_suboffset = (__pyx_t_6[0]);
35776 
35777     /* "View.MemoryView":1038
35778  *     result.view.suboffsets = NULL
35779  *     for suboffset in result.from_slice.suboffsets[:ndim]:
35780  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
35781  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
35782  *             break
35783  */
35784     __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
35785     if (__pyx_t_1) {
35786 
35787       /* "View.MemoryView":1039
35788  *     for suboffset in result.from_slice.suboffsets[:ndim]:
35789  *         if suboffset >= 0:
35790  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
35791  *             break
35792  *
35793  */
35794       __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
35795 
35796       /* "View.MemoryView":1040
35797  *         if suboffset >= 0:
35798  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
35799  *             break             # <<<<<<<<<<<<<<
35800  *
35801  *     result.view.len = result.view.itemsize
35802  */
35803       goto __pyx_L6_break;
35804 
35805       /* "View.MemoryView":1038
35806  *     result.view.suboffsets = NULL
35807  *     for suboffset in result.from_slice.suboffsets[:ndim]:
35808  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
35809  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
35810  *             break
35811  */
35812     }
35813   }
35814   __pyx_L6_break:;
35815 
35816   /* "View.MemoryView":1042
35817  *             break
35818  *
35819  *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
35820  *     for length in result.view.shape[:ndim]:
35821  *         result.view.len *= length
35822  */
35823   __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
35824   __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
35825 
35826   /* "View.MemoryView":1043
35827  *
35828  *     result.view.len = result.view.itemsize
35829  *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
35830  *         result.view.len *= length
35831  *
35832  */
35833   __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
35834   for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
35835     __pyx_t_6 = __pyx_t_8;
35836     __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error)
35837     __Pyx_GOTREF(__pyx_t_2);
35838     __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
35839     __pyx_t_2 = 0;
35840 
35841     /* "View.MemoryView":1044
35842  *     result.view.len = result.view.itemsize
35843  *     for length in result.view.shape[:ndim]:
35844  *         result.view.len *= length             # <<<<<<<<<<<<<<
35845  *
35846  *     result.to_object_func = to_object_func
35847  */
35848     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error)
35849     __Pyx_GOTREF(__pyx_t_2);
35850     __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error)
35851     __Pyx_GOTREF(__pyx_t_3);
35852     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
35853     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error)
35854     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
35855     __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
35856   }
35857 
35858   /* "View.MemoryView":1046
35859  *         result.view.len *= length
35860  *
35861  *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
35862  *     result.to_dtype_func = to_dtype_func
35863  *
35864  */
35865   __pyx_v_result->to_object_func = __pyx_v_to_object_func;
35866 
35867   /* "View.MemoryView":1047
35868  *
35869  *     result.to_object_func = to_object_func
35870  *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
35871  *
35872  *     return result
35873  */
35874   __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
35875 
35876   /* "View.MemoryView":1049
35877  *     result.to_dtype_func = to_dtype_func
35878  *
35879  *     return result             # <<<<<<<<<<<<<<
35880  *
35881  * @cname('__pyx_memoryview_get_slice_from_memoryview')
35882  */
35883   __Pyx_XDECREF(__pyx_r);
35884   __Pyx_INCREF(((PyObject *)__pyx_v_result));
35885   __pyx_r = ((PyObject *)__pyx_v_result);
35886   goto __pyx_L0;
35887 
35888   /* "View.MemoryView":999
35889  *
35890  * @cname('__pyx_memoryview_fromslice')
35891  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
35892  *                           int ndim,
35893  *                           object (*to_object_func)(char *),
35894  */
35895 
35896   /* function exit code */
35897   __pyx_L1_error:;
35898   __Pyx_XDECREF(__pyx_t_2);
35899   __Pyx_XDECREF(__pyx_t_3);
35900   __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
35901   __pyx_r = 0;
35902   __pyx_L0:;
35903   __Pyx_XDECREF((PyObject *)__pyx_v_result);
35904   __Pyx_XDECREF(__pyx_v_length);
35905   __Pyx_XGIVEREF(__pyx_r);
35906   __Pyx_RefNannyFinishContext();
35907   return __pyx_r;
35908 }
35909 
35910 /* "View.MemoryView":1052
35911  *
35912  * @cname('__pyx_memoryview_get_slice_from_memoryview')
35913  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
35914  *                                                    __Pyx_memviewslice *mslice) except NULL:
35915  *     cdef _memoryviewslice obj
35916  */
35917 
__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_mslice)35918 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
35919   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
35920   __Pyx_memviewslice *__pyx_r;
35921   __Pyx_RefNannyDeclarations
35922   int __pyx_t_1;
35923   int __pyx_t_2;
35924   PyObject *__pyx_t_3 = NULL;
35925   int __pyx_lineno = 0;
35926   const char *__pyx_filename = NULL;
35927   int __pyx_clineno = 0;
35928   __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
35929 
35930   /* "View.MemoryView":1055
35931  *                                                    __Pyx_memviewslice *mslice) except NULL:
35932  *     cdef _memoryviewslice obj
35933  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
35934  *         obj = memview
35935  *         return &obj.from_slice
35936  */
35937   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
35938   __pyx_t_2 = (__pyx_t_1 != 0);
35939   if (__pyx_t_2) {
35940 
35941     /* "View.MemoryView":1056
35942  *     cdef _memoryviewslice obj
35943  *     if isinstance(memview, _memoryviewslice):
35944  *         obj = memview             # <<<<<<<<<<<<<<
35945  *         return &obj.from_slice
35946  *     else:
35947  */
35948     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error)
35949     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
35950     __Pyx_INCREF(__pyx_t_3);
35951     __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
35952     __pyx_t_3 = 0;
35953 
35954     /* "View.MemoryView":1057
35955  *     if isinstance(memview, _memoryviewslice):
35956  *         obj = memview
35957  *         return &obj.from_slice             # <<<<<<<<<<<<<<
35958  *     else:
35959  *         slice_copy(memview, mslice)
35960  */
35961     __pyx_r = (&__pyx_v_obj->from_slice);
35962     goto __pyx_L0;
35963 
35964     /* "View.MemoryView":1055
35965  *                                                    __Pyx_memviewslice *mslice) except NULL:
35966  *     cdef _memoryviewslice obj
35967  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
35968  *         obj = memview
35969  *         return &obj.from_slice
35970  */
35971   }
35972 
35973   /* "View.MemoryView":1059
35974  *         return &obj.from_slice
35975  *     else:
35976  *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
35977  *         return mslice
35978  *
35979  */
35980   /*else*/ {
35981     __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
35982 
35983     /* "View.MemoryView":1060
35984  *     else:
35985  *         slice_copy(memview, mslice)
35986  *         return mslice             # <<<<<<<<<<<<<<
35987  *
35988  * @cname('__pyx_memoryview_slice_copy')
35989  */
35990     __pyx_r = __pyx_v_mslice;
35991     goto __pyx_L0;
35992   }
35993 
35994   /* "View.MemoryView":1052
35995  *
35996  * @cname('__pyx_memoryview_get_slice_from_memoryview')
35997  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
35998  *                                                    __Pyx_memviewslice *mslice) except NULL:
35999  *     cdef _memoryviewslice obj
36000  */
36001 
36002   /* function exit code */
36003   __pyx_L1_error:;
36004   __Pyx_XDECREF(__pyx_t_3);
36005   __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
36006   __pyx_r = NULL;
36007   __pyx_L0:;
36008   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
36009   __Pyx_RefNannyFinishContext();
36010   return __pyx_r;
36011 }
36012 
36013 /* "View.MemoryView":1063
36014  *
36015  * @cname('__pyx_memoryview_slice_copy')
36016  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
36017  *     cdef int dim
36018  *     cdef (Py_ssize_t*) shape, strides, suboffsets
36019  */
36020 
__pyx_memoryview_slice_copy(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_dst)36021 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
36022   int __pyx_v_dim;
36023   Py_ssize_t *__pyx_v_shape;
36024   Py_ssize_t *__pyx_v_strides;
36025   Py_ssize_t *__pyx_v_suboffsets;
36026   __Pyx_RefNannyDeclarations
36027   Py_ssize_t *__pyx_t_1;
36028   int __pyx_t_2;
36029   int __pyx_t_3;
36030   int __pyx_t_4;
36031   Py_ssize_t __pyx_t_5;
36032   __Pyx_RefNannySetupContext("slice_copy", 0);
36033 
36034   /* "View.MemoryView":1067
36035  *     cdef (Py_ssize_t*) shape, strides, suboffsets
36036  *
36037  *     shape = memview.view.shape             # <<<<<<<<<<<<<<
36038  *     strides = memview.view.strides
36039  *     suboffsets = memview.view.suboffsets
36040  */
36041   __pyx_t_1 = __pyx_v_memview->view.shape;
36042   __pyx_v_shape = __pyx_t_1;
36043 
36044   /* "View.MemoryView":1068
36045  *
36046  *     shape = memview.view.shape
36047  *     strides = memview.view.strides             # <<<<<<<<<<<<<<
36048  *     suboffsets = memview.view.suboffsets
36049  *
36050  */
36051   __pyx_t_1 = __pyx_v_memview->view.strides;
36052   __pyx_v_strides = __pyx_t_1;
36053 
36054   /* "View.MemoryView":1069
36055  *     shape = memview.view.shape
36056  *     strides = memview.view.strides
36057  *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
36058  *
36059  *     dst.memview = <__pyx_memoryview *> memview
36060  */
36061   __pyx_t_1 = __pyx_v_memview->view.suboffsets;
36062   __pyx_v_suboffsets = __pyx_t_1;
36063 
36064   /* "View.MemoryView":1071
36065  *     suboffsets = memview.view.suboffsets
36066  *
36067  *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
36068  *     dst.data = <char *> memview.view.buf
36069  *
36070  */
36071   __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
36072 
36073   /* "View.MemoryView":1072
36074  *
36075  *     dst.memview = <__pyx_memoryview *> memview
36076  *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
36077  *
36078  *     for dim in range(memview.view.ndim):
36079  */
36080   __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
36081 
36082   /* "View.MemoryView":1074
36083  *     dst.data = <char *> memview.view.buf
36084  *
36085  *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
36086  *         dst.shape[dim] = shape[dim]
36087  *         dst.strides[dim] = strides[dim]
36088  */
36089   __pyx_t_2 = __pyx_v_memview->view.ndim;
36090   __pyx_t_3 = __pyx_t_2;
36091   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
36092     __pyx_v_dim = __pyx_t_4;
36093 
36094     /* "View.MemoryView":1075
36095  *
36096  *     for dim in range(memview.view.ndim):
36097  *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
36098  *         dst.strides[dim] = strides[dim]
36099  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
36100  */
36101     (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
36102 
36103     /* "View.MemoryView":1076
36104  *     for dim in range(memview.view.ndim):
36105  *         dst.shape[dim] = shape[dim]
36106  *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
36107  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
36108  *
36109  */
36110     (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
36111 
36112     /* "View.MemoryView":1077
36113  *         dst.shape[dim] = shape[dim]
36114  *         dst.strides[dim] = strides[dim]
36115  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
36116  *
36117  * @cname('__pyx_memoryview_copy_object')
36118  */
36119     if ((__pyx_v_suboffsets != 0)) {
36120       __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
36121     } else {
36122       __pyx_t_5 = -1L;
36123     }
36124     (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
36125   }
36126 
36127   /* "View.MemoryView":1063
36128  *
36129  * @cname('__pyx_memoryview_slice_copy')
36130  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
36131  *     cdef int dim
36132  *     cdef (Py_ssize_t*) shape, strides, suboffsets
36133  */
36134 
36135   /* function exit code */
36136   __Pyx_RefNannyFinishContext();
36137 }
36138 
36139 /* "View.MemoryView":1080
36140  *
36141  * @cname('__pyx_memoryview_copy_object')
36142  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
36143  *     "Create a new memoryview object"
36144  *     cdef __Pyx_memviewslice memviewslice
36145  */
36146 
__pyx_memoryview_copy_object(struct __pyx_memoryview_obj * __pyx_v_memview)36147 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
36148   __Pyx_memviewslice __pyx_v_memviewslice;
36149   PyObject *__pyx_r = NULL;
36150   __Pyx_RefNannyDeclarations
36151   PyObject *__pyx_t_1 = NULL;
36152   int __pyx_lineno = 0;
36153   const char *__pyx_filename = NULL;
36154   int __pyx_clineno = 0;
36155   __Pyx_RefNannySetupContext("memoryview_copy", 0);
36156 
36157   /* "View.MemoryView":1083
36158  *     "Create a new memoryview object"
36159  *     cdef __Pyx_memviewslice memviewslice
36160  *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
36161  *     return memoryview_copy_from_slice(memview, &memviewslice)
36162  *
36163  */
36164   __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
36165 
36166   /* "View.MemoryView":1084
36167  *     cdef __Pyx_memviewslice memviewslice
36168  *     slice_copy(memview, &memviewslice)
36169  *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
36170  *
36171  * @cname('__pyx_memoryview_copy_object_from_slice')
36172  */
36173   __Pyx_XDECREF(__pyx_r);
36174   __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error)
36175   __Pyx_GOTREF(__pyx_t_1);
36176   __pyx_r = __pyx_t_1;
36177   __pyx_t_1 = 0;
36178   goto __pyx_L0;
36179 
36180   /* "View.MemoryView":1080
36181  *
36182  * @cname('__pyx_memoryview_copy_object')
36183  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
36184  *     "Create a new memoryview object"
36185  *     cdef __Pyx_memviewslice memviewslice
36186  */
36187 
36188   /* function exit code */
36189   __pyx_L1_error:;
36190   __Pyx_XDECREF(__pyx_t_1);
36191   __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
36192   __pyx_r = 0;
36193   __pyx_L0:;
36194   __Pyx_XGIVEREF(__pyx_r);
36195   __Pyx_RefNannyFinishContext();
36196   return __pyx_r;
36197 }
36198 
36199 /* "View.MemoryView":1087
36200  *
36201  * @cname('__pyx_memoryview_copy_object_from_slice')
36202  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
36203  *     """
36204  *     Create a new memoryview object from a given memoryview object and slice.
36205  */
36206 
__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_memviewslice)36207 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
36208   PyObject *(*__pyx_v_to_object_func)(char *);
36209   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
36210   PyObject *__pyx_r = NULL;
36211   __Pyx_RefNannyDeclarations
36212   int __pyx_t_1;
36213   int __pyx_t_2;
36214   PyObject *(*__pyx_t_3)(char *);
36215   int (*__pyx_t_4)(char *, PyObject *);
36216   PyObject *__pyx_t_5 = NULL;
36217   int __pyx_lineno = 0;
36218   const char *__pyx_filename = NULL;
36219   int __pyx_clineno = 0;
36220   __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
36221 
36222   /* "View.MemoryView":1094
36223  *     cdef int (*to_dtype_func)(char *, object) except 0
36224  *
36225  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
36226  *         to_object_func = (<_memoryviewslice> memview).to_object_func
36227  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
36228  */
36229   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
36230   __pyx_t_2 = (__pyx_t_1 != 0);
36231   if (__pyx_t_2) {
36232 
36233     /* "View.MemoryView":1095
36234  *
36235  *     if isinstance(memview, _memoryviewslice):
36236  *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
36237  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
36238  *     else:
36239  */
36240     __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
36241     __pyx_v_to_object_func = __pyx_t_3;
36242 
36243     /* "View.MemoryView":1096
36244  *     if isinstance(memview, _memoryviewslice):
36245  *         to_object_func = (<_memoryviewslice> memview).to_object_func
36246  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
36247  *     else:
36248  *         to_object_func = NULL
36249  */
36250     __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
36251     __pyx_v_to_dtype_func = __pyx_t_4;
36252 
36253     /* "View.MemoryView":1094
36254  *     cdef int (*to_dtype_func)(char *, object) except 0
36255  *
36256  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
36257  *         to_object_func = (<_memoryviewslice> memview).to_object_func
36258  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
36259  */
36260     goto __pyx_L3;
36261   }
36262 
36263   /* "View.MemoryView":1098
36264  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
36265  *     else:
36266  *         to_object_func = NULL             # <<<<<<<<<<<<<<
36267  *         to_dtype_func = NULL
36268  *
36269  */
36270   /*else*/ {
36271     __pyx_v_to_object_func = NULL;
36272 
36273     /* "View.MemoryView":1099
36274  *     else:
36275  *         to_object_func = NULL
36276  *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
36277  *
36278  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
36279  */
36280     __pyx_v_to_dtype_func = NULL;
36281   }
36282   __pyx_L3:;
36283 
36284   /* "View.MemoryView":1101
36285  *         to_dtype_func = NULL
36286  *
36287  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
36288  *                                 to_object_func, to_dtype_func,
36289  *                                 memview.dtype_is_object)
36290  */
36291   __Pyx_XDECREF(__pyx_r);
36292 
36293   /* "View.MemoryView":1103
36294  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
36295  *                                 to_object_func, to_dtype_func,
36296  *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
36297  *
36298  *
36299  */
36300   __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1101, __pyx_L1_error)
36301   __Pyx_GOTREF(__pyx_t_5);
36302   __pyx_r = __pyx_t_5;
36303   __pyx_t_5 = 0;
36304   goto __pyx_L0;
36305 
36306   /* "View.MemoryView":1087
36307  *
36308  * @cname('__pyx_memoryview_copy_object_from_slice')
36309  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
36310  *     """
36311  *     Create a new memoryview object from a given memoryview object and slice.
36312  */
36313 
36314   /* function exit code */
36315   __pyx_L1_error:;
36316   __Pyx_XDECREF(__pyx_t_5);
36317   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
36318   __pyx_r = 0;
36319   __pyx_L0:;
36320   __Pyx_XGIVEREF(__pyx_r);
36321   __Pyx_RefNannyFinishContext();
36322   return __pyx_r;
36323 }
36324 
36325 /* "View.MemoryView":1109
36326  *
36327  *
36328  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
36329  *     if arg < 0:
36330  *         return -arg
36331  */
36332 
abs_py_ssize_t(Py_ssize_t __pyx_v_arg)36333 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
36334   Py_ssize_t __pyx_r;
36335   int __pyx_t_1;
36336 
36337   /* "View.MemoryView":1110
36338  *
36339  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
36340  *     if arg < 0:             # <<<<<<<<<<<<<<
36341  *         return -arg
36342  *     else:
36343  */
36344   __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
36345   if (__pyx_t_1) {
36346 
36347     /* "View.MemoryView":1111
36348  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
36349  *     if arg < 0:
36350  *         return -arg             # <<<<<<<<<<<<<<
36351  *     else:
36352  *         return arg
36353  */
36354     __pyx_r = (-__pyx_v_arg);
36355     goto __pyx_L0;
36356 
36357     /* "View.MemoryView":1110
36358  *
36359  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
36360  *     if arg < 0:             # <<<<<<<<<<<<<<
36361  *         return -arg
36362  *     else:
36363  */
36364   }
36365 
36366   /* "View.MemoryView":1113
36367  *         return -arg
36368  *     else:
36369  *         return arg             # <<<<<<<<<<<<<<
36370  *
36371  * @cname('__pyx_get_best_slice_order')
36372  */
36373   /*else*/ {
36374     __pyx_r = __pyx_v_arg;
36375     goto __pyx_L0;
36376   }
36377 
36378   /* "View.MemoryView":1109
36379  *
36380  *
36381  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
36382  *     if arg < 0:
36383  *         return -arg
36384  */
36385 
36386   /* function exit code */
36387   __pyx_L0:;
36388   return __pyx_r;
36389 }
36390 
36391 /* "View.MemoryView":1116
36392  *
36393  * @cname('__pyx_get_best_slice_order')
36394  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
36395  *     """
36396  *     Figure out the best memory access order for a given slice.
36397  */
36398 
__pyx_get_best_slice_order(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim)36399 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
36400   int __pyx_v_i;
36401   Py_ssize_t __pyx_v_c_stride;
36402   Py_ssize_t __pyx_v_f_stride;
36403   char __pyx_r;
36404   int __pyx_t_1;
36405   int __pyx_t_2;
36406   int __pyx_t_3;
36407   int __pyx_t_4;
36408 
36409   /* "View.MemoryView":1121
36410  *     """
36411  *     cdef int i
36412  *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
36413  *     cdef Py_ssize_t f_stride = 0
36414  *
36415  */
36416   __pyx_v_c_stride = 0;
36417 
36418   /* "View.MemoryView":1122
36419  *     cdef int i
36420  *     cdef Py_ssize_t c_stride = 0
36421  *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
36422  *
36423  *     for i in range(ndim - 1, -1, -1):
36424  */
36425   __pyx_v_f_stride = 0;
36426 
36427   /* "View.MemoryView":1124
36428  *     cdef Py_ssize_t f_stride = 0
36429  *
36430  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
36431  *         if mslice.shape[i] > 1:
36432  *             c_stride = mslice.strides[i]
36433  */
36434   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
36435     __pyx_v_i = __pyx_t_1;
36436 
36437     /* "View.MemoryView":1125
36438  *
36439  *     for i in range(ndim - 1, -1, -1):
36440  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
36441  *             c_stride = mslice.strides[i]
36442  *             break
36443  */
36444     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
36445     if (__pyx_t_2) {
36446 
36447       /* "View.MemoryView":1126
36448  *     for i in range(ndim - 1, -1, -1):
36449  *         if mslice.shape[i] > 1:
36450  *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
36451  *             break
36452  *
36453  */
36454       __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
36455 
36456       /* "View.MemoryView":1127
36457  *         if mslice.shape[i] > 1:
36458  *             c_stride = mslice.strides[i]
36459  *             break             # <<<<<<<<<<<<<<
36460  *
36461  *     for i in range(ndim):
36462  */
36463       goto __pyx_L4_break;
36464 
36465       /* "View.MemoryView":1125
36466  *
36467  *     for i in range(ndim - 1, -1, -1):
36468  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
36469  *             c_stride = mslice.strides[i]
36470  *             break
36471  */
36472     }
36473   }
36474   __pyx_L4_break:;
36475 
36476   /* "View.MemoryView":1129
36477  *             break
36478  *
36479  *     for i in range(ndim):             # <<<<<<<<<<<<<<
36480  *         if mslice.shape[i] > 1:
36481  *             f_stride = mslice.strides[i]
36482  */
36483   __pyx_t_1 = __pyx_v_ndim;
36484   __pyx_t_3 = __pyx_t_1;
36485   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
36486     __pyx_v_i = __pyx_t_4;
36487 
36488     /* "View.MemoryView":1130
36489  *
36490  *     for i in range(ndim):
36491  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
36492  *             f_stride = mslice.strides[i]
36493  *             break
36494  */
36495     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
36496     if (__pyx_t_2) {
36497 
36498       /* "View.MemoryView":1131
36499  *     for i in range(ndim):
36500  *         if mslice.shape[i] > 1:
36501  *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
36502  *             break
36503  *
36504  */
36505       __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
36506 
36507       /* "View.MemoryView":1132
36508  *         if mslice.shape[i] > 1:
36509  *             f_stride = mslice.strides[i]
36510  *             break             # <<<<<<<<<<<<<<
36511  *
36512  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
36513  */
36514       goto __pyx_L7_break;
36515 
36516       /* "View.MemoryView":1130
36517  *
36518  *     for i in range(ndim):
36519  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
36520  *             f_stride = mslice.strides[i]
36521  *             break
36522  */
36523     }
36524   }
36525   __pyx_L7_break:;
36526 
36527   /* "View.MemoryView":1134
36528  *             break
36529  *
36530  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
36531  *         return 'C'
36532  *     else:
36533  */
36534   __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
36535   if (__pyx_t_2) {
36536 
36537     /* "View.MemoryView":1135
36538  *
36539  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
36540  *         return 'C'             # <<<<<<<<<<<<<<
36541  *     else:
36542  *         return 'F'
36543  */
36544     __pyx_r = 'C';
36545     goto __pyx_L0;
36546 
36547     /* "View.MemoryView":1134
36548  *             break
36549  *
36550  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
36551  *         return 'C'
36552  *     else:
36553  */
36554   }
36555 
36556   /* "View.MemoryView":1137
36557  *         return 'C'
36558  *     else:
36559  *         return 'F'             # <<<<<<<<<<<<<<
36560  *
36561  * @cython.cdivision(True)
36562  */
36563   /*else*/ {
36564     __pyx_r = 'F';
36565     goto __pyx_L0;
36566   }
36567 
36568   /* "View.MemoryView":1116
36569  *
36570  * @cname('__pyx_get_best_slice_order')
36571  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
36572  *     """
36573  *     Figure out the best memory access order for a given slice.
36574  */
36575 
36576   /* function exit code */
36577   __pyx_L0:;
36578   return __pyx_r;
36579 }
36580 
36581 /* "View.MemoryView":1140
36582  *
36583  * @cython.cdivision(True)
36584  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
36585  *                                    char *dst_data, Py_ssize_t *dst_strides,
36586  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
36587  */
36588 
_copy_strided_to_strided(char * __pyx_v_src_data,Py_ssize_t * __pyx_v_src_strides,char * __pyx_v_dst_data,Py_ssize_t * __pyx_v_dst_strides,Py_ssize_t * __pyx_v_src_shape,Py_ssize_t * __pyx_v_dst_shape,int __pyx_v_ndim,size_t __pyx_v_itemsize)36589 static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
36590   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
36591   CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
36592   Py_ssize_t __pyx_v_dst_extent;
36593   Py_ssize_t __pyx_v_src_stride;
36594   Py_ssize_t __pyx_v_dst_stride;
36595   int __pyx_t_1;
36596   int __pyx_t_2;
36597   int __pyx_t_3;
36598   Py_ssize_t __pyx_t_4;
36599   Py_ssize_t __pyx_t_5;
36600   Py_ssize_t __pyx_t_6;
36601 
36602   /* "View.MemoryView":1147
36603  *
36604  *     cdef Py_ssize_t i
36605  *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
36606  *     cdef Py_ssize_t dst_extent = dst_shape[0]
36607  *     cdef Py_ssize_t src_stride = src_strides[0]
36608  */
36609   __pyx_v_src_extent = (__pyx_v_src_shape[0]);
36610 
36611   /* "View.MemoryView":1148
36612  *     cdef Py_ssize_t i
36613  *     cdef Py_ssize_t src_extent = src_shape[0]
36614  *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
36615  *     cdef Py_ssize_t src_stride = src_strides[0]
36616  *     cdef Py_ssize_t dst_stride = dst_strides[0]
36617  */
36618   __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
36619 
36620   /* "View.MemoryView":1149
36621  *     cdef Py_ssize_t src_extent = src_shape[0]
36622  *     cdef Py_ssize_t dst_extent = dst_shape[0]
36623  *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
36624  *     cdef Py_ssize_t dst_stride = dst_strides[0]
36625  *
36626  */
36627   __pyx_v_src_stride = (__pyx_v_src_strides[0]);
36628 
36629   /* "View.MemoryView":1150
36630  *     cdef Py_ssize_t dst_extent = dst_shape[0]
36631  *     cdef Py_ssize_t src_stride = src_strides[0]
36632  *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
36633  *
36634  *     if ndim == 1:
36635  */
36636   __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
36637 
36638   /* "View.MemoryView":1152
36639  *     cdef Py_ssize_t dst_stride = dst_strides[0]
36640  *
36641  *     if ndim == 1:             # <<<<<<<<<<<<<<
36642  *        if (src_stride > 0 and dst_stride > 0 and
36643  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
36644  */
36645   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
36646   if (__pyx_t_1) {
36647 
36648     /* "View.MemoryView":1153
36649  *
36650  *     if ndim == 1:
36651  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
36652  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
36653  *            memcpy(dst_data, src_data, itemsize * dst_extent)
36654  */
36655     __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
36656     if (__pyx_t_2) {
36657     } else {
36658       __pyx_t_1 = __pyx_t_2;
36659       goto __pyx_L5_bool_binop_done;
36660     }
36661     __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
36662     if (__pyx_t_2) {
36663     } else {
36664       __pyx_t_1 = __pyx_t_2;
36665       goto __pyx_L5_bool_binop_done;
36666     }
36667 
36668     /* "View.MemoryView":1154
36669  *     if ndim == 1:
36670  *        if (src_stride > 0 and dst_stride > 0 and
36671  *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
36672  *            memcpy(dst_data, src_data, itemsize * dst_extent)
36673  *        else:
36674  */
36675     __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
36676     if (__pyx_t_2) {
36677       __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
36678     }
36679     __pyx_t_3 = (__pyx_t_2 != 0);
36680     __pyx_t_1 = __pyx_t_3;
36681     __pyx_L5_bool_binop_done:;
36682 
36683     /* "View.MemoryView":1153
36684  *
36685  *     if ndim == 1:
36686  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
36687  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
36688  *            memcpy(dst_data, src_data, itemsize * dst_extent)
36689  */
36690     if (__pyx_t_1) {
36691 
36692       /* "View.MemoryView":1155
36693  *        if (src_stride > 0 and dst_stride > 0 and
36694  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
36695  *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
36696  *        else:
36697  *            for i in range(dst_extent):
36698  */
36699       (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
36700 
36701       /* "View.MemoryView":1153
36702  *
36703  *     if ndim == 1:
36704  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
36705  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
36706  *            memcpy(dst_data, src_data, itemsize * dst_extent)
36707  */
36708       goto __pyx_L4;
36709     }
36710 
36711     /* "View.MemoryView":1157
36712  *            memcpy(dst_data, src_data, itemsize * dst_extent)
36713  *        else:
36714  *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
36715  *                memcpy(dst_data, src_data, itemsize)
36716  *                src_data += src_stride
36717  */
36718     /*else*/ {
36719       __pyx_t_4 = __pyx_v_dst_extent;
36720       __pyx_t_5 = __pyx_t_4;
36721       for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
36722         __pyx_v_i = __pyx_t_6;
36723 
36724         /* "View.MemoryView":1158
36725  *        else:
36726  *            for i in range(dst_extent):
36727  *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
36728  *                src_data += src_stride
36729  *                dst_data += dst_stride
36730  */
36731         (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
36732 
36733         /* "View.MemoryView":1159
36734  *            for i in range(dst_extent):
36735  *                memcpy(dst_data, src_data, itemsize)
36736  *                src_data += src_stride             # <<<<<<<<<<<<<<
36737  *                dst_data += dst_stride
36738  *     else:
36739  */
36740         __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
36741 
36742         /* "View.MemoryView":1160
36743  *                memcpy(dst_data, src_data, itemsize)
36744  *                src_data += src_stride
36745  *                dst_data += dst_stride             # <<<<<<<<<<<<<<
36746  *     else:
36747  *         for i in range(dst_extent):
36748  */
36749         __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
36750       }
36751     }
36752     __pyx_L4:;
36753 
36754     /* "View.MemoryView":1152
36755  *     cdef Py_ssize_t dst_stride = dst_strides[0]
36756  *
36757  *     if ndim == 1:             # <<<<<<<<<<<<<<
36758  *        if (src_stride > 0 and dst_stride > 0 and
36759  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
36760  */
36761     goto __pyx_L3;
36762   }
36763 
36764   /* "View.MemoryView":1162
36765  *                dst_data += dst_stride
36766  *     else:
36767  *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
36768  *             _copy_strided_to_strided(src_data, src_strides + 1,
36769  *                                      dst_data, dst_strides + 1,
36770  */
36771   /*else*/ {
36772     __pyx_t_4 = __pyx_v_dst_extent;
36773     __pyx_t_5 = __pyx_t_4;
36774     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
36775       __pyx_v_i = __pyx_t_6;
36776 
36777       /* "View.MemoryView":1163
36778  *     else:
36779  *         for i in range(dst_extent):
36780  *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
36781  *                                      dst_data, dst_strides + 1,
36782  *                                      src_shape + 1, dst_shape + 1,
36783  */
36784       _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
36785 
36786       /* "View.MemoryView":1167
36787  *                                      src_shape + 1, dst_shape + 1,
36788  *                                      ndim - 1, itemsize)
36789  *             src_data += src_stride             # <<<<<<<<<<<<<<
36790  *             dst_data += dst_stride
36791  *
36792  */
36793       __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
36794 
36795       /* "View.MemoryView":1168
36796  *                                      ndim - 1, itemsize)
36797  *             src_data += src_stride
36798  *             dst_data += dst_stride             # <<<<<<<<<<<<<<
36799  *
36800  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
36801  */
36802       __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
36803     }
36804   }
36805   __pyx_L3:;
36806 
36807   /* "View.MemoryView":1140
36808  *
36809  * @cython.cdivision(True)
36810  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
36811  *                                    char *dst_data, Py_ssize_t *dst_strides,
36812  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
36813  */
36814 
36815   /* function exit code */
36816 }
36817 
36818 /* "View.MemoryView":1170
36819  *             dst_data += dst_stride
36820  *
36821  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
36822  *                                   __Pyx_memviewslice *dst,
36823  *                                   int ndim, size_t itemsize) nogil:
36824  */
36825 
copy_strided_to_strided(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize)36826 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
36827 
36828   /* "View.MemoryView":1173
36829  *                                   __Pyx_memviewslice *dst,
36830  *                                   int ndim, size_t itemsize) nogil:
36831  *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
36832  *                              src.shape, dst.shape, ndim, itemsize)
36833  *
36834  */
36835   _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
36836 
36837   /* "View.MemoryView":1170
36838  *             dst_data += dst_stride
36839  *
36840  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
36841  *                                   __Pyx_memviewslice *dst,
36842  *                                   int ndim, size_t itemsize) nogil:
36843  */
36844 
36845   /* function exit code */
36846 }
36847 
36848 /* "View.MemoryView":1177
36849  *
36850  * @cname('__pyx_memoryview_slice_get_size')
36851  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
36852  *     "Return the size of the memory occupied by the slice in number of bytes"
36853  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
36854  */
36855 
__pyx_memoryview_slice_get_size(__Pyx_memviewslice * __pyx_v_src,int __pyx_v_ndim)36856 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
36857   Py_ssize_t __pyx_v_shape;
36858   Py_ssize_t __pyx_v_size;
36859   Py_ssize_t __pyx_r;
36860   Py_ssize_t __pyx_t_1;
36861   Py_ssize_t *__pyx_t_2;
36862   Py_ssize_t *__pyx_t_3;
36863   Py_ssize_t *__pyx_t_4;
36864 
36865   /* "View.MemoryView":1179
36866  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
36867  *     "Return the size of the memory occupied by the slice in number of bytes"
36868  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
36869  *
36870  *     for shape in src.shape[:ndim]:
36871  */
36872   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
36873   __pyx_v_size = __pyx_t_1;
36874 
36875   /* "View.MemoryView":1181
36876  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
36877  *
36878  *     for shape in src.shape[:ndim]:             # <<<<<<<<<<<<<<
36879  *         size *= shape
36880  *
36881  */
36882   __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
36883   for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
36884     __pyx_t_2 = __pyx_t_4;
36885     __pyx_v_shape = (__pyx_t_2[0]);
36886 
36887     /* "View.MemoryView":1182
36888  *
36889  *     for shape in src.shape[:ndim]:
36890  *         size *= shape             # <<<<<<<<<<<<<<
36891  *
36892  *     return size
36893  */
36894     __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
36895   }
36896 
36897   /* "View.MemoryView":1184
36898  *         size *= shape
36899  *
36900  *     return size             # <<<<<<<<<<<<<<
36901  *
36902  * @cname('__pyx_fill_contig_strides_array')
36903  */
36904   __pyx_r = __pyx_v_size;
36905   goto __pyx_L0;
36906 
36907   /* "View.MemoryView":1177
36908  *
36909  * @cname('__pyx_memoryview_slice_get_size')
36910  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
36911  *     "Return the size of the memory occupied by the slice in number of bytes"
36912  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
36913  */
36914 
36915   /* function exit code */
36916   __pyx_L0:;
36917   return __pyx_r;
36918 }
36919 
36920 /* "View.MemoryView":1187
36921  *
36922  * @cname('__pyx_fill_contig_strides_array')
36923  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
36924  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
36925  *                 int ndim, char order) nogil:
36926  */
36927 
__pyx_fill_contig_strides_array(Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,Py_ssize_t __pyx_v_stride,int __pyx_v_ndim,char __pyx_v_order)36928 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
36929   int __pyx_v_idx;
36930   Py_ssize_t __pyx_r;
36931   int __pyx_t_1;
36932   int __pyx_t_2;
36933   int __pyx_t_3;
36934   int __pyx_t_4;
36935 
36936   /* "View.MemoryView":1196
36937  *     cdef int idx
36938  *
36939  *     if order == 'F':             # <<<<<<<<<<<<<<
36940  *         for idx in range(ndim):
36941  *             strides[idx] = stride
36942  */
36943   __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
36944   if (__pyx_t_1) {
36945 
36946     /* "View.MemoryView":1197
36947  *
36948  *     if order == 'F':
36949  *         for idx in range(ndim):             # <<<<<<<<<<<<<<
36950  *             strides[idx] = stride
36951  *             stride *= shape[idx]
36952  */
36953     __pyx_t_2 = __pyx_v_ndim;
36954     __pyx_t_3 = __pyx_t_2;
36955     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
36956       __pyx_v_idx = __pyx_t_4;
36957 
36958       /* "View.MemoryView":1198
36959  *     if order == 'F':
36960  *         for idx in range(ndim):
36961  *             strides[idx] = stride             # <<<<<<<<<<<<<<
36962  *             stride *= shape[idx]
36963  *     else:
36964  */
36965       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
36966 
36967       /* "View.MemoryView":1199
36968  *         for idx in range(ndim):
36969  *             strides[idx] = stride
36970  *             stride *= shape[idx]             # <<<<<<<<<<<<<<
36971  *     else:
36972  *         for idx in range(ndim - 1, -1, -1):
36973  */
36974       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
36975     }
36976 
36977     /* "View.MemoryView":1196
36978  *     cdef int idx
36979  *
36980  *     if order == 'F':             # <<<<<<<<<<<<<<
36981  *         for idx in range(ndim):
36982  *             strides[idx] = stride
36983  */
36984     goto __pyx_L3;
36985   }
36986 
36987   /* "View.MemoryView":1201
36988  *             stride *= shape[idx]
36989  *     else:
36990  *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
36991  *             strides[idx] = stride
36992  *             stride *= shape[idx]
36993  */
36994   /*else*/ {
36995     for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
36996       __pyx_v_idx = __pyx_t_2;
36997 
36998       /* "View.MemoryView":1202
36999  *     else:
37000  *         for idx in range(ndim - 1, -1, -1):
37001  *             strides[idx] = stride             # <<<<<<<<<<<<<<
37002  *             stride *= shape[idx]
37003  *
37004  */
37005       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
37006 
37007       /* "View.MemoryView":1203
37008  *         for idx in range(ndim - 1, -1, -1):
37009  *             strides[idx] = stride
37010  *             stride *= shape[idx]             # <<<<<<<<<<<<<<
37011  *
37012  *     return stride
37013  */
37014       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
37015     }
37016   }
37017   __pyx_L3:;
37018 
37019   /* "View.MemoryView":1205
37020  *             stride *= shape[idx]
37021  *
37022  *     return stride             # <<<<<<<<<<<<<<
37023  *
37024  * @cname('__pyx_memoryview_copy_data_to_temp')
37025  */
37026   __pyx_r = __pyx_v_stride;
37027   goto __pyx_L0;
37028 
37029   /* "View.MemoryView":1187
37030  *
37031  * @cname('__pyx_fill_contig_strides_array')
37032  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
37033  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
37034  *                 int ndim, char order) nogil:
37035  */
37036 
37037   /* function exit code */
37038   __pyx_L0:;
37039   return __pyx_r;
37040 }
37041 
37042 /* "View.MemoryView":1208
37043  *
37044  * @cname('__pyx_memoryview_copy_data_to_temp')
37045  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
37046  *                              __Pyx_memviewslice *tmpslice,
37047  *                              char order,
37048  */
37049 
__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_tmpslice,char __pyx_v_order,int __pyx_v_ndim)37050 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
37051   int __pyx_v_i;
37052   void *__pyx_v_result;
37053   size_t __pyx_v_itemsize;
37054   size_t __pyx_v_size;
37055   void *__pyx_r;
37056   Py_ssize_t __pyx_t_1;
37057   int __pyx_t_2;
37058   int __pyx_t_3;
37059   struct __pyx_memoryview_obj *__pyx_t_4;
37060   int __pyx_t_5;
37061   int __pyx_t_6;
37062   int __pyx_lineno = 0;
37063   const char *__pyx_filename = NULL;
37064   int __pyx_clineno = 0;
37065 
37066   /* "View.MemoryView":1219
37067  *     cdef void *result
37068  *
37069  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
37070  *     cdef size_t size = slice_get_size(src, ndim)
37071  *
37072  */
37073   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
37074   __pyx_v_itemsize = __pyx_t_1;
37075 
37076   /* "View.MemoryView":1220
37077  *
37078  *     cdef size_t itemsize = src.memview.view.itemsize
37079  *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
37080  *
37081  *     result = malloc(size)
37082  */
37083   __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
37084 
37085   /* "View.MemoryView":1222
37086  *     cdef size_t size = slice_get_size(src, ndim)
37087  *
37088  *     result = malloc(size)             # <<<<<<<<<<<<<<
37089  *     if not result:
37090  *         _err(MemoryError, NULL)
37091  */
37092   __pyx_v_result = malloc(__pyx_v_size);
37093 
37094   /* "View.MemoryView":1223
37095  *
37096  *     result = malloc(size)
37097  *     if not result:             # <<<<<<<<<<<<<<
37098  *         _err(MemoryError, NULL)
37099  *
37100  */
37101   __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
37102   if (__pyx_t_2) {
37103 
37104     /* "View.MemoryView":1224
37105  *     result = malloc(size)
37106  *     if not result:
37107  *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
37108  *
37109  *
37110  */
37111     __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1224, __pyx_L1_error)
37112 
37113     /* "View.MemoryView":1223
37114  *
37115  *     result = malloc(size)
37116  *     if not result:             # <<<<<<<<<<<<<<
37117  *         _err(MemoryError, NULL)
37118  *
37119  */
37120   }
37121 
37122   /* "View.MemoryView":1227
37123  *
37124  *
37125  *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
37126  *     tmpslice.memview = src.memview
37127  *     for i in range(ndim):
37128  */
37129   __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
37130 
37131   /* "View.MemoryView":1228
37132  *
37133  *     tmpslice.data = <char *> result
37134  *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
37135  *     for i in range(ndim):
37136  *         tmpslice.shape[i] = src.shape[i]
37137  */
37138   __pyx_t_4 = __pyx_v_src->memview;
37139   __pyx_v_tmpslice->memview = __pyx_t_4;
37140 
37141   /* "View.MemoryView":1229
37142  *     tmpslice.data = <char *> result
37143  *     tmpslice.memview = src.memview
37144  *     for i in range(ndim):             # <<<<<<<<<<<<<<
37145  *         tmpslice.shape[i] = src.shape[i]
37146  *         tmpslice.suboffsets[i] = -1
37147  */
37148   __pyx_t_3 = __pyx_v_ndim;
37149   __pyx_t_5 = __pyx_t_3;
37150   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
37151     __pyx_v_i = __pyx_t_6;
37152 
37153     /* "View.MemoryView":1230
37154  *     tmpslice.memview = src.memview
37155  *     for i in range(ndim):
37156  *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
37157  *         tmpslice.suboffsets[i] = -1
37158  *
37159  */
37160     (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
37161 
37162     /* "View.MemoryView":1231
37163  *     for i in range(ndim):
37164  *         tmpslice.shape[i] = src.shape[i]
37165  *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
37166  *
37167  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
37168  */
37169     (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
37170   }
37171 
37172   /* "View.MemoryView":1233
37173  *         tmpslice.suboffsets[i] = -1
37174  *
37175  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
37176  *                               ndim, order)
37177  *
37178  */
37179   (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
37180 
37181   /* "View.MemoryView":1237
37182  *
37183  *
37184  *     for i in range(ndim):             # <<<<<<<<<<<<<<
37185  *         if tmpslice.shape[i] == 1:
37186  *             tmpslice.strides[i] = 0
37187  */
37188   __pyx_t_3 = __pyx_v_ndim;
37189   __pyx_t_5 = __pyx_t_3;
37190   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
37191     __pyx_v_i = __pyx_t_6;
37192 
37193     /* "View.MemoryView":1238
37194  *
37195  *     for i in range(ndim):
37196  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
37197  *             tmpslice.strides[i] = 0
37198  *
37199  */
37200     __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
37201     if (__pyx_t_2) {
37202 
37203       /* "View.MemoryView":1239
37204  *     for i in range(ndim):
37205  *         if tmpslice.shape[i] == 1:
37206  *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
37207  *
37208  *     if slice_is_contig(src[0], order, ndim):
37209  */
37210       (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
37211 
37212       /* "View.MemoryView":1238
37213  *
37214  *     for i in range(ndim):
37215  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
37216  *             tmpslice.strides[i] = 0
37217  *
37218  */
37219     }
37220   }
37221 
37222   /* "View.MemoryView":1241
37223  *             tmpslice.strides[i] = 0
37224  *
37225  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
37226  *         memcpy(result, src.data, size)
37227  *     else:
37228  */
37229   __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
37230   if (__pyx_t_2) {
37231 
37232     /* "View.MemoryView":1242
37233  *
37234  *     if slice_is_contig(src[0], order, ndim):
37235  *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
37236  *     else:
37237  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
37238  */
37239     (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
37240 
37241     /* "View.MemoryView":1241
37242  *             tmpslice.strides[i] = 0
37243  *
37244  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
37245  *         memcpy(result, src.data, size)
37246  *     else:
37247  */
37248     goto __pyx_L9;
37249   }
37250 
37251   /* "View.MemoryView":1244
37252  *         memcpy(result, src.data, size)
37253  *     else:
37254  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
37255  *
37256  *     return result
37257  */
37258   /*else*/ {
37259     copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
37260   }
37261   __pyx_L9:;
37262 
37263   /* "View.MemoryView":1246
37264  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
37265  *
37266  *     return result             # <<<<<<<<<<<<<<
37267  *
37268  *
37269  */
37270   __pyx_r = __pyx_v_result;
37271   goto __pyx_L0;
37272 
37273   /* "View.MemoryView":1208
37274  *
37275  * @cname('__pyx_memoryview_copy_data_to_temp')
37276  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
37277  *                              __Pyx_memviewslice *tmpslice,
37278  *                              char order,
37279  */
37280 
37281   /* function exit code */
37282   __pyx_L1_error:;
37283   {
37284     #ifdef WITH_THREAD
37285     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
37286     #endif
37287     __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
37288     #ifdef WITH_THREAD
37289     __Pyx_PyGILState_Release(__pyx_gilstate_save);
37290     #endif
37291   }
37292   __pyx_r = NULL;
37293   __pyx_L0:;
37294   return __pyx_r;
37295 }
37296 
37297 /* "View.MemoryView":1251
37298  *
37299  * @cname('__pyx_memoryview_err_extents')
37300  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
37301  *                              Py_ssize_t extent2) except -1 with gil:
37302  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
37303  */
37304 
__pyx_memoryview_err_extents(int __pyx_v_i,Py_ssize_t __pyx_v_extent1,Py_ssize_t __pyx_v_extent2)37305 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
37306   int __pyx_r;
37307   __Pyx_RefNannyDeclarations
37308   PyObject *__pyx_t_1 = NULL;
37309   PyObject *__pyx_t_2 = NULL;
37310   PyObject *__pyx_t_3 = NULL;
37311   PyObject *__pyx_t_4 = NULL;
37312   int __pyx_lineno = 0;
37313   const char *__pyx_filename = NULL;
37314   int __pyx_clineno = 0;
37315   #ifdef WITH_THREAD
37316   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
37317   #endif
37318   __Pyx_RefNannySetupContext("_err_extents", 0);
37319 
37320   /* "View.MemoryView":1254
37321  *                              Py_ssize_t extent2) except -1 with gil:
37322  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
37323  *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
37324  *
37325  * @cname('__pyx_memoryview_err_dim')
37326  */
37327   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error)
37328   __Pyx_GOTREF(__pyx_t_1);
37329   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error)
37330   __Pyx_GOTREF(__pyx_t_2);
37331   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1254, __pyx_L1_error)
37332   __Pyx_GOTREF(__pyx_t_3);
37333   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1254, __pyx_L1_error)
37334   __Pyx_GOTREF(__pyx_t_4);
37335   __Pyx_GIVEREF(__pyx_t_1);
37336   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
37337   __Pyx_GIVEREF(__pyx_t_2);
37338   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
37339   __Pyx_GIVEREF(__pyx_t_3);
37340   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
37341   __pyx_t_1 = 0;
37342   __pyx_t_2 = 0;
37343   __pyx_t_3 = 0;
37344 
37345   /* "View.MemoryView":1253
37346  * cdef int _err_extents(int i, Py_ssize_t extent1,
37347  *                              Py_ssize_t extent2) except -1 with gil:
37348  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
37349  *                                                         (i, extent1, extent2))
37350  *
37351  */
37352   __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1253, __pyx_L1_error)
37353   __Pyx_GOTREF(__pyx_t_3);
37354   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
37355   __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1253, __pyx_L1_error)
37356   __Pyx_GOTREF(__pyx_t_4);
37357   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
37358   __Pyx_Raise(__pyx_t_4, 0, 0, 0);
37359   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
37360   __PYX_ERR(1, 1253, __pyx_L1_error)
37361 
37362   /* "View.MemoryView":1251
37363  *
37364  * @cname('__pyx_memoryview_err_extents')
37365  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
37366  *                              Py_ssize_t extent2) except -1 with gil:
37367  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
37368  */
37369 
37370   /* function exit code */
37371   __pyx_L1_error:;
37372   __Pyx_XDECREF(__pyx_t_1);
37373   __Pyx_XDECREF(__pyx_t_2);
37374   __Pyx_XDECREF(__pyx_t_3);
37375   __Pyx_XDECREF(__pyx_t_4);
37376   __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
37377   __pyx_r = -1;
37378   __Pyx_RefNannyFinishContext();
37379   #ifdef WITH_THREAD
37380   __Pyx_PyGILState_Release(__pyx_gilstate_save);
37381   #endif
37382   return __pyx_r;
37383 }
37384 
37385 /* "View.MemoryView":1257
37386  *
37387  * @cname('__pyx_memoryview_err_dim')
37388  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
37389  *     raise error(msg.decode('ascii') % dim)
37390  *
37391  */
37392 
__pyx_memoryview_err_dim(PyObject * __pyx_v_error,char * __pyx_v_msg,int __pyx_v_dim)37393 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
37394   int __pyx_r;
37395   __Pyx_RefNannyDeclarations
37396   PyObject *__pyx_t_1 = NULL;
37397   PyObject *__pyx_t_2 = NULL;
37398   PyObject *__pyx_t_3 = NULL;
37399   PyObject *__pyx_t_4 = NULL;
37400   int __pyx_lineno = 0;
37401   const char *__pyx_filename = NULL;
37402   int __pyx_clineno = 0;
37403   #ifdef WITH_THREAD
37404   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
37405   #endif
37406   __Pyx_RefNannySetupContext("_err_dim", 0);
37407   __Pyx_INCREF(__pyx_v_error);
37408 
37409   /* "View.MemoryView":1258
37410  * @cname('__pyx_memoryview_err_dim')
37411  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
37412  *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
37413  *
37414  * @cname('__pyx_memoryview_err')
37415  */
37416   __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1258, __pyx_L1_error)
37417   __Pyx_GOTREF(__pyx_t_2);
37418   __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1258, __pyx_L1_error)
37419   __Pyx_GOTREF(__pyx_t_3);
37420   __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1258, __pyx_L1_error)
37421   __Pyx_GOTREF(__pyx_t_4);
37422   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
37423   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
37424   __Pyx_INCREF(__pyx_v_error);
37425   __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
37426   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
37427     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
37428     if (likely(__pyx_t_2)) {
37429       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
37430       __Pyx_INCREF(__pyx_t_2);
37431       __Pyx_INCREF(function);
37432       __Pyx_DECREF_SET(__pyx_t_3, function);
37433     }
37434   }
37435   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
37436   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
37437   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
37438   if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1258, __pyx_L1_error)
37439   __Pyx_GOTREF(__pyx_t_1);
37440   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
37441   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
37442   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
37443   __PYX_ERR(1, 1258, __pyx_L1_error)
37444 
37445   /* "View.MemoryView":1257
37446  *
37447  * @cname('__pyx_memoryview_err_dim')
37448  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
37449  *     raise error(msg.decode('ascii') % dim)
37450  *
37451  */
37452 
37453   /* function exit code */
37454   __pyx_L1_error:;
37455   __Pyx_XDECREF(__pyx_t_1);
37456   __Pyx_XDECREF(__pyx_t_2);
37457   __Pyx_XDECREF(__pyx_t_3);
37458   __Pyx_XDECREF(__pyx_t_4);
37459   __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
37460   __pyx_r = -1;
37461   __Pyx_XDECREF(__pyx_v_error);
37462   __Pyx_RefNannyFinishContext();
37463   #ifdef WITH_THREAD
37464   __Pyx_PyGILState_Release(__pyx_gilstate_save);
37465   #endif
37466   return __pyx_r;
37467 }
37468 
37469 /* "View.MemoryView":1261
37470  *
37471  * @cname('__pyx_memoryview_err')
37472  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
37473  *     if msg != NULL:
37474  *         raise error(msg.decode('ascii'))
37475  */
37476 
__pyx_memoryview_err(PyObject * __pyx_v_error,char * __pyx_v_msg)37477 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
37478   int __pyx_r;
37479   __Pyx_RefNannyDeclarations
37480   int __pyx_t_1;
37481   PyObject *__pyx_t_2 = NULL;
37482   PyObject *__pyx_t_3 = NULL;
37483   PyObject *__pyx_t_4 = NULL;
37484   PyObject *__pyx_t_5 = NULL;
37485   int __pyx_lineno = 0;
37486   const char *__pyx_filename = NULL;
37487   int __pyx_clineno = 0;
37488   #ifdef WITH_THREAD
37489   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
37490   #endif
37491   __Pyx_RefNannySetupContext("_err", 0);
37492   __Pyx_INCREF(__pyx_v_error);
37493 
37494   /* "View.MemoryView":1262
37495  * @cname('__pyx_memoryview_err')
37496  * cdef int _err(object error, char *msg) except -1 with gil:
37497  *     if msg != NULL:             # <<<<<<<<<<<<<<
37498  *         raise error(msg.decode('ascii'))
37499  *     else:
37500  */
37501   __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
37502   if (unlikely(__pyx_t_1)) {
37503 
37504     /* "View.MemoryView":1263
37505  * cdef int _err(object error, char *msg) except -1 with gil:
37506  *     if msg != NULL:
37507  *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
37508  *     else:
37509  *         raise error
37510  */
37511     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1263, __pyx_L1_error)
37512     __Pyx_GOTREF(__pyx_t_3);
37513     __Pyx_INCREF(__pyx_v_error);
37514     __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
37515     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
37516       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
37517       if (likely(__pyx_t_5)) {
37518         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
37519         __Pyx_INCREF(__pyx_t_5);
37520         __Pyx_INCREF(function);
37521         __Pyx_DECREF_SET(__pyx_t_4, function);
37522       }
37523     }
37524     __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
37525     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
37526     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
37527     if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1263, __pyx_L1_error)
37528     __Pyx_GOTREF(__pyx_t_2);
37529     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
37530     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
37531     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
37532     __PYX_ERR(1, 1263, __pyx_L1_error)
37533 
37534     /* "View.MemoryView":1262
37535  * @cname('__pyx_memoryview_err')
37536  * cdef int _err(object error, char *msg) except -1 with gil:
37537  *     if msg != NULL:             # <<<<<<<<<<<<<<
37538  *         raise error(msg.decode('ascii'))
37539  *     else:
37540  */
37541   }
37542 
37543   /* "View.MemoryView":1265
37544  *         raise error(msg.decode('ascii'))
37545  *     else:
37546  *         raise error             # <<<<<<<<<<<<<<
37547  *
37548  * @cname('__pyx_memoryview_copy_contents')
37549  */
37550   /*else*/ {
37551     __Pyx_Raise(__pyx_v_error, 0, 0, 0);
37552     __PYX_ERR(1, 1265, __pyx_L1_error)
37553   }
37554 
37555   /* "View.MemoryView":1261
37556  *
37557  * @cname('__pyx_memoryview_err')
37558  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
37559  *     if msg != NULL:
37560  *         raise error(msg.decode('ascii'))
37561  */
37562 
37563   /* function exit code */
37564   __pyx_L1_error:;
37565   __Pyx_XDECREF(__pyx_t_2);
37566   __Pyx_XDECREF(__pyx_t_3);
37567   __Pyx_XDECREF(__pyx_t_4);
37568   __Pyx_XDECREF(__pyx_t_5);
37569   __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
37570   __pyx_r = -1;
37571   __Pyx_XDECREF(__pyx_v_error);
37572   __Pyx_RefNannyFinishContext();
37573   #ifdef WITH_THREAD
37574   __Pyx_PyGILState_Release(__pyx_gilstate_save);
37575   #endif
37576   return __pyx_r;
37577 }
37578 
37579 /* "View.MemoryView":1268
37580  *
37581  * @cname('__pyx_memoryview_copy_contents')
37582  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
37583  *                                   __Pyx_memviewslice dst,
37584  *                                   int src_ndim, int dst_ndim,
37585  */
37586 
__pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src,__Pyx_memviewslice __pyx_v_dst,int __pyx_v_src_ndim,int __pyx_v_dst_ndim,int __pyx_v_dtype_is_object)37587 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
37588   void *__pyx_v_tmpdata;
37589   size_t __pyx_v_itemsize;
37590   int __pyx_v_i;
37591   char __pyx_v_order;
37592   int __pyx_v_broadcasting;
37593   int __pyx_v_direct_copy;
37594   __Pyx_memviewslice __pyx_v_tmp;
37595   int __pyx_v_ndim;
37596   int __pyx_r;
37597   Py_ssize_t __pyx_t_1;
37598   int __pyx_t_2;
37599   int __pyx_t_3;
37600   int __pyx_t_4;
37601   int __pyx_t_5;
37602   int __pyx_t_6;
37603   void *__pyx_t_7;
37604   int __pyx_t_8;
37605   int __pyx_lineno = 0;
37606   const char *__pyx_filename = NULL;
37607   int __pyx_clineno = 0;
37608 
37609   /* "View.MemoryView":1276
37610  *     Check for overlapping memory and verify the shapes.
37611  *     """
37612  *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
37613  *     cdef size_t itemsize = src.memview.view.itemsize
37614  *     cdef int i
37615  */
37616   __pyx_v_tmpdata = NULL;
37617 
37618   /* "View.MemoryView":1277
37619  *     """
37620  *     cdef void *tmpdata = NULL
37621  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
37622  *     cdef int i
37623  *     cdef char order = get_best_order(&src, src_ndim)
37624  */
37625   __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
37626   __pyx_v_itemsize = __pyx_t_1;
37627 
37628   /* "View.MemoryView":1279
37629  *     cdef size_t itemsize = src.memview.view.itemsize
37630  *     cdef int i
37631  *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
37632  *     cdef bint broadcasting = False
37633  *     cdef bint direct_copy = False
37634  */
37635   __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
37636 
37637   /* "View.MemoryView":1280
37638  *     cdef int i
37639  *     cdef char order = get_best_order(&src, src_ndim)
37640  *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
37641  *     cdef bint direct_copy = False
37642  *     cdef __Pyx_memviewslice tmp
37643  */
37644   __pyx_v_broadcasting = 0;
37645 
37646   /* "View.MemoryView":1281
37647  *     cdef char order = get_best_order(&src, src_ndim)
37648  *     cdef bint broadcasting = False
37649  *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
37650  *     cdef __Pyx_memviewslice tmp
37651  *
37652  */
37653   __pyx_v_direct_copy = 0;
37654 
37655   /* "View.MemoryView":1284
37656  *     cdef __Pyx_memviewslice tmp
37657  *
37658  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
37659  *         broadcast_leading(&src, src_ndim, dst_ndim)
37660  *     elif dst_ndim < src_ndim:
37661  */
37662   __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
37663   if (__pyx_t_2) {
37664 
37665     /* "View.MemoryView":1285
37666  *
37667  *     if src_ndim < dst_ndim:
37668  *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
37669  *     elif dst_ndim < src_ndim:
37670  *         broadcast_leading(&dst, dst_ndim, src_ndim)
37671  */
37672     __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
37673 
37674     /* "View.MemoryView":1284
37675  *     cdef __Pyx_memviewslice tmp
37676  *
37677  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
37678  *         broadcast_leading(&src, src_ndim, dst_ndim)
37679  *     elif dst_ndim < src_ndim:
37680  */
37681     goto __pyx_L3;
37682   }
37683 
37684   /* "View.MemoryView":1286
37685  *     if src_ndim < dst_ndim:
37686  *         broadcast_leading(&src, src_ndim, dst_ndim)
37687  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
37688  *         broadcast_leading(&dst, dst_ndim, src_ndim)
37689  *
37690  */
37691   __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
37692   if (__pyx_t_2) {
37693 
37694     /* "View.MemoryView":1287
37695  *         broadcast_leading(&src, src_ndim, dst_ndim)
37696  *     elif dst_ndim < src_ndim:
37697  *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
37698  *
37699  *     cdef int ndim = max(src_ndim, dst_ndim)
37700  */
37701     __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
37702 
37703     /* "View.MemoryView":1286
37704  *     if src_ndim < dst_ndim:
37705  *         broadcast_leading(&src, src_ndim, dst_ndim)
37706  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
37707  *         broadcast_leading(&dst, dst_ndim, src_ndim)
37708  *
37709  */
37710   }
37711   __pyx_L3:;
37712 
37713   /* "View.MemoryView":1289
37714  *         broadcast_leading(&dst, dst_ndim, src_ndim)
37715  *
37716  *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
37717  *
37718  *     for i in range(ndim):
37719  */
37720   __pyx_t_3 = __pyx_v_dst_ndim;
37721   __pyx_t_4 = __pyx_v_src_ndim;
37722   if (((__pyx_t_3 > __pyx_t_4) != 0)) {
37723     __pyx_t_5 = __pyx_t_3;
37724   } else {
37725     __pyx_t_5 = __pyx_t_4;
37726   }
37727   __pyx_v_ndim = __pyx_t_5;
37728 
37729   /* "View.MemoryView":1291
37730  *     cdef int ndim = max(src_ndim, dst_ndim)
37731  *
37732  *     for i in range(ndim):             # <<<<<<<<<<<<<<
37733  *         if src.shape[i] != dst.shape[i]:
37734  *             if src.shape[i] == 1:
37735  */
37736   __pyx_t_5 = __pyx_v_ndim;
37737   __pyx_t_3 = __pyx_t_5;
37738   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
37739     __pyx_v_i = __pyx_t_4;
37740 
37741     /* "View.MemoryView":1292
37742  *
37743  *     for i in range(ndim):
37744  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
37745  *             if src.shape[i] == 1:
37746  *                 broadcasting = True
37747  */
37748     __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
37749     if (__pyx_t_2) {
37750 
37751       /* "View.MemoryView":1293
37752  *     for i in range(ndim):
37753  *         if src.shape[i] != dst.shape[i]:
37754  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
37755  *                 broadcasting = True
37756  *                 src.strides[i] = 0
37757  */
37758       __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
37759       if (__pyx_t_2) {
37760 
37761         /* "View.MemoryView":1294
37762  *         if src.shape[i] != dst.shape[i]:
37763  *             if src.shape[i] == 1:
37764  *                 broadcasting = True             # <<<<<<<<<<<<<<
37765  *                 src.strides[i] = 0
37766  *             else:
37767  */
37768         __pyx_v_broadcasting = 1;
37769 
37770         /* "View.MemoryView":1295
37771  *             if src.shape[i] == 1:
37772  *                 broadcasting = True
37773  *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
37774  *             else:
37775  *                 _err_extents(i, dst.shape[i], src.shape[i])
37776  */
37777         (__pyx_v_src.strides[__pyx_v_i]) = 0;
37778 
37779         /* "View.MemoryView":1293
37780  *     for i in range(ndim):
37781  *         if src.shape[i] != dst.shape[i]:
37782  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
37783  *                 broadcasting = True
37784  *                 src.strides[i] = 0
37785  */
37786         goto __pyx_L7;
37787       }
37788 
37789       /* "View.MemoryView":1297
37790  *                 src.strides[i] = 0
37791  *             else:
37792  *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
37793  *
37794  *         if src.suboffsets[i] >= 0:
37795  */
37796       /*else*/ {
37797         __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error)
37798       }
37799       __pyx_L7:;
37800 
37801       /* "View.MemoryView":1292
37802  *
37803  *     for i in range(ndim):
37804  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
37805  *             if src.shape[i] == 1:
37806  *                 broadcasting = True
37807  */
37808     }
37809 
37810     /* "View.MemoryView":1299
37811  *                 _err_extents(i, dst.shape[i], src.shape[i])
37812  *
37813  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
37814  *             _err_dim(ValueError, "Dimension %d is not direct", i)
37815  *
37816  */
37817     __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
37818     if (__pyx_t_2) {
37819 
37820       /* "View.MemoryView":1300
37821  *
37822  *         if src.suboffsets[i] >= 0:
37823  *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
37824  *
37825  *     if slices_overlap(&src, &dst, ndim, itemsize):
37826  */
37827       __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1300, __pyx_L1_error)
37828 
37829       /* "View.MemoryView":1299
37830  *                 _err_extents(i, dst.shape[i], src.shape[i])
37831  *
37832  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
37833  *             _err_dim(ValueError, "Dimension %d is not direct", i)
37834  *
37835  */
37836     }
37837   }
37838 
37839   /* "View.MemoryView":1302
37840  *             _err_dim(ValueError, "Dimension %d is not direct", i)
37841  *
37842  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
37843  *
37844  *         if not slice_is_contig(src, order, ndim):
37845  */
37846   __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
37847   if (__pyx_t_2) {
37848 
37849     /* "View.MemoryView":1304
37850  *     if slices_overlap(&src, &dst, ndim, itemsize):
37851  *
37852  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
37853  *             order = get_best_order(&dst, ndim)
37854  *
37855  */
37856     __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
37857     if (__pyx_t_2) {
37858 
37859       /* "View.MemoryView":1305
37860  *
37861  *         if not slice_is_contig(src, order, ndim):
37862  *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
37863  *
37864  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
37865  */
37866       __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
37867 
37868       /* "View.MemoryView":1304
37869  *     if slices_overlap(&src, &dst, ndim, itemsize):
37870  *
37871  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
37872  *             order = get_best_order(&dst, ndim)
37873  *
37874  */
37875     }
37876 
37877     /* "View.MemoryView":1307
37878  *             order = get_best_order(&dst, ndim)
37879  *
37880  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
37881  *         src = tmp
37882  *
37883  */
37884     __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1307, __pyx_L1_error)
37885     __pyx_v_tmpdata = __pyx_t_7;
37886 
37887     /* "View.MemoryView":1308
37888  *
37889  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
37890  *         src = tmp             # <<<<<<<<<<<<<<
37891  *
37892  *     if not broadcasting:
37893  */
37894     __pyx_v_src = __pyx_v_tmp;
37895 
37896     /* "View.MemoryView":1302
37897  *             _err_dim(ValueError, "Dimension %d is not direct", i)
37898  *
37899  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
37900  *
37901  *         if not slice_is_contig(src, order, ndim):
37902  */
37903   }
37904 
37905   /* "View.MemoryView":1310
37906  *         src = tmp
37907  *
37908  *     if not broadcasting:             # <<<<<<<<<<<<<<
37909  *
37910  *
37911  */
37912   __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
37913   if (__pyx_t_2) {
37914 
37915     /* "View.MemoryView":1313
37916  *
37917  *
37918  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
37919  *             direct_copy = slice_is_contig(dst, 'C', ndim)
37920  *         elif slice_is_contig(src, 'F', ndim):
37921  */
37922     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
37923     if (__pyx_t_2) {
37924 
37925       /* "View.MemoryView":1314
37926  *
37927  *         if slice_is_contig(src, 'C', ndim):
37928  *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
37929  *         elif slice_is_contig(src, 'F', ndim):
37930  *             direct_copy = slice_is_contig(dst, 'F', ndim)
37931  */
37932       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
37933 
37934       /* "View.MemoryView":1313
37935  *
37936  *
37937  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
37938  *             direct_copy = slice_is_contig(dst, 'C', ndim)
37939  *         elif slice_is_contig(src, 'F', ndim):
37940  */
37941       goto __pyx_L12;
37942     }
37943 
37944     /* "View.MemoryView":1315
37945  *         if slice_is_contig(src, 'C', ndim):
37946  *             direct_copy = slice_is_contig(dst, 'C', ndim)
37947  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
37948  *             direct_copy = slice_is_contig(dst, 'F', ndim)
37949  *
37950  */
37951     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
37952     if (__pyx_t_2) {
37953 
37954       /* "View.MemoryView":1316
37955  *             direct_copy = slice_is_contig(dst, 'C', ndim)
37956  *         elif slice_is_contig(src, 'F', ndim):
37957  *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
37958  *
37959  *         if direct_copy:
37960  */
37961       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
37962 
37963       /* "View.MemoryView":1315
37964  *         if slice_is_contig(src, 'C', ndim):
37965  *             direct_copy = slice_is_contig(dst, 'C', ndim)
37966  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
37967  *             direct_copy = slice_is_contig(dst, 'F', ndim)
37968  *
37969  */
37970     }
37971     __pyx_L12:;
37972 
37973     /* "View.MemoryView":1318
37974  *             direct_copy = slice_is_contig(dst, 'F', ndim)
37975  *
37976  *         if direct_copy:             # <<<<<<<<<<<<<<
37977  *
37978  *             refcount_copying(&dst, dtype_is_object, ndim, False)
37979  */
37980     __pyx_t_2 = (__pyx_v_direct_copy != 0);
37981     if (__pyx_t_2) {
37982 
37983       /* "View.MemoryView":1320
37984  *         if direct_copy:
37985  *
37986  *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
37987  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
37988  *             refcount_copying(&dst, dtype_is_object, ndim, True)
37989  */
37990       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
37991 
37992       /* "View.MemoryView":1321
37993  *
37994  *             refcount_copying(&dst, dtype_is_object, ndim, False)
37995  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
37996  *             refcount_copying(&dst, dtype_is_object, ndim, True)
37997  *             free(tmpdata)
37998  */
37999       (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
38000 
38001       /* "View.MemoryView":1322
38002  *             refcount_copying(&dst, dtype_is_object, ndim, False)
38003  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
38004  *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
38005  *             free(tmpdata)
38006  *             return 0
38007  */
38008       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
38009 
38010       /* "View.MemoryView":1323
38011  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
38012  *             refcount_copying(&dst, dtype_is_object, ndim, True)
38013  *             free(tmpdata)             # <<<<<<<<<<<<<<
38014  *             return 0
38015  *
38016  */
38017       free(__pyx_v_tmpdata);
38018 
38019       /* "View.MemoryView":1324
38020  *             refcount_copying(&dst, dtype_is_object, ndim, True)
38021  *             free(tmpdata)
38022  *             return 0             # <<<<<<<<<<<<<<
38023  *
38024  *     if order == 'F' == get_best_order(&dst, ndim):
38025  */
38026       __pyx_r = 0;
38027       goto __pyx_L0;
38028 
38029       /* "View.MemoryView":1318
38030  *             direct_copy = slice_is_contig(dst, 'F', ndim)
38031  *
38032  *         if direct_copy:             # <<<<<<<<<<<<<<
38033  *
38034  *             refcount_copying(&dst, dtype_is_object, ndim, False)
38035  */
38036     }
38037 
38038     /* "View.MemoryView":1310
38039  *         src = tmp
38040  *
38041  *     if not broadcasting:             # <<<<<<<<<<<<<<
38042  *
38043  *
38044  */
38045   }
38046 
38047   /* "View.MemoryView":1326
38048  *             return 0
38049  *
38050  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
38051  *
38052  *
38053  */
38054   __pyx_t_2 = (__pyx_v_order == 'F');
38055   if (__pyx_t_2) {
38056     __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
38057   }
38058   __pyx_t_8 = (__pyx_t_2 != 0);
38059   if (__pyx_t_8) {
38060 
38061     /* "View.MemoryView":1329
38062  *
38063  *
38064  *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
38065  *         transpose_memslice(&dst)
38066  *
38067  */
38068     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1329, __pyx_L1_error)
38069 
38070     /* "View.MemoryView":1330
38071  *
38072  *         transpose_memslice(&src)
38073  *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
38074  *
38075  *     refcount_copying(&dst, dtype_is_object, ndim, False)
38076  */
38077     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1330, __pyx_L1_error)
38078 
38079     /* "View.MemoryView":1326
38080  *             return 0
38081  *
38082  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
38083  *
38084  *
38085  */
38086   }
38087 
38088   /* "View.MemoryView":1332
38089  *         transpose_memslice(&dst)
38090  *
38091  *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
38092  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
38093  *     refcount_copying(&dst, dtype_is_object, ndim, True)
38094  */
38095   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
38096 
38097   /* "View.MemoryView":1333
38098  *
38099  *     refcount_copying(&dst, dtype_is_object, ndim, False)
38100  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
38101  *     refcount_copying(&dst, dtype_is_object, ndim, True)
38102  *
38103  */
38104   copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
38105 
38106   /* "View.MemoryView":1334
38107  *     refcount_copying(&dst, dtype_is_object, ndim, False)
38108  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
38109  *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
38110  *
38111  *     free(tmpdata)
38112  */
38113   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
38114 
38115   /* "View.MemoryView":1336
38116  *     refcount_copying(&dst, dtype_is_object, ndim, True)
38117  *
38118  *     free(tmpdata)             # <<<<<<<<<<<<<<
38119  *     return 0
38120  *
38121  */
38122   free(__pyx_v_tmpdata);
38123 
38124   /* "View.MemoryView":1337
38125  *
38126  *     free(tmpdata)
38127  *     return 0             # <<<<<<<<<<<<<<
38128  *
38129  * @cname('__pyx_memoryview_broadcast_leading')
38130  */
38131   __pyx_r = 0;
38132   goto __pyx_L0;
38133 
38134   /* "View.MemoryView":1268
38135  *
38136  * @cname('__pyx_memoryview_copy_contents')
38137  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
38138  *                                   __Pyx_memviewslice dst,
38139  *                                   int src_ndim, int dst_ndim,
38140  */
38141 
38142   /* function exit code */
38143   __pyx_L1_error:;
38144   {
38145     #ifdef WITH_THREAD
38146     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
38147     #endif
38148     __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
38149     #ifdef WITH_THREAD
38150     __Pyx_PyGILState_Release(__pyx_gilstate_save);
38151     #endif
38152   }
38153   __pyx_r = -1;
38154   __pyx_L0:;
38155   return __pyx_r;
38156 }
38157 
38158 /* "View.MemoryView":1340
38159  *
38160  * @cname('__pyx_memoryview_broadcast_leading')
38161  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
38162  *                             int ndim,
38163  *                             int ndim_other) nogil:
38164  */
38165 
__pyx_memoryview_broadcast_leading(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim,int __pyx_v_ndim_other)38166 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
38167   int __pyx_v_i;
38168   int __pyx_v_offset;
38169   int __pyx_t_1;
38170   int __pyx_t_2;
38171   int __pyx_t_3;
38172 
38173   /* "View.MemoryView":1344
38174  *                             int ndim_other) nogil:
38175  *     cdef int i
38176  *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
38177  *
38178  *     for i in range(ndim - 1, -1, -1):
38179  */
38180   __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
38181 
38182   /* "View.MemoryView":1346
38183  *     cdef int offset = ndim_other - ndim
38184  *
38185  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
38186  *         mslice.shape[i + offset] = mslice.shape[i]
38187  *         mslice.strides[i + offset] = mslice.strides[i]
38188  */
38189   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
38190     __pyx_v_i = __pyx_t_1;
38191 
38192     /* "View.MemoryView":1347
38193  *
38194  *     for i in range(ndim - 1, -1, -1):
38195  *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
38196  *         mslice.strides[i + offset] = mslice.strides[i]
38197  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
38198  */
38199     (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
38200 
38201     /* "View.MemoryView":1348
38202  *     for i in range(ndim - 1, -1, -1):
38203  *         mslice.shape[i + offset] = mslice.shape[i]
38204  *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
38205  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
38206  *
38207  */
38208     (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
38209 
38210     /* "View.MemoryView":1349
38211  *         mslice.shape[i + offset] = mslice.shape[i]
38212  *         mslice.strides[i + offset] = mslice.strides[i]
38213  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
38214  *
38215  *     for i in range(offset):
38216  */
38217     (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
38218   }
38219 
38220   /* "View.MemoryView":1351
38221  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
38222  *
38223  *     for i in range(offset):             # <<<<<<<<<<<<<<
38224  *         mslice.shape[i] = 1
38225  *         mslice.strides[i] = mslice.strides[0]
38226  */
38227   __pyx_t_1 = __pyx_v_offset;
38228   __pyx_t_2 = __pyx_t_1;
38229   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
38230     __pyx_v_i = __pyx_t_3;
38231 
38232     /* "View.MemoryView":1352
38233  *
38234  *     for i in range(offset):
38235  *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
38236  *         mslice.strides[i] = mslice.strides[0]
38237  *         mslice.suboffsets[i] = -1
38238  */
38239     (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
38240 
38241     /* "View.MemoryView":1353
38242  *     for i in range(offset):
38243  *         mslice.shape[i] = 1
38244  *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
38245  *         mslice.suboffsets[i] = -1
38246  *
38247  */
38248     (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
38249 
38250     /* "View.MemoryView":1354
38251  *         mslice.shape[i] = 1
38252  *         mslice.strides[i] = mslice.strides[0]
38253  *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
38254  *
38255  *
38256  */
38257     (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
38258   }
38259 
38260   /* "View.MemoryView":1340
38261  *
38262  * @cname('__pyx_memoryview_broadcast_leading')
38263  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
38264  *                             int ndim,
38265  *                             int ndim_other) nogil:
38266  */
38267 
38268   /* function exit code */
38269 }
38270 
38271 /* "View.MemoryView":1362
38272  *
38273  * @cname('__pyx_memoryview_refcount_copying')
38274  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
38275  *                            int ndim, bint inc) nogil:
38276  *
38277  */
38278 
__pyx_memoryview_refcount_copying(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_dtype_is_object,int __pyx_v_ndim,int __pyx_v_inc)38279 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
38280   int __pyx_t_1;
38281 
38282   /* "View.MemoryView":1366
38283  *
38284  *
38285  *     if dtype_is_object:             # <<<<<<<<<<<<<<
38286  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
38287  *                                            dst.strides, ndim, inc)
38288  */
38289   __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
38290   if (__pyx_t_1) {
38291 
38292     /* "View.MemoryView":1367
38293  *
38294  *     if dtype_is_object:
38295  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
38296  *                                            dst.strides, ndim, inc)
38297  *
38298  */
38299     __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
38300 
38301     /* "View.MemoryView":1366
38302  *
38303  *
38304  *     if dtype_is_object:             # <<<<<<<<<<<<<<
38305  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
38306  *                                            dst.strides, ndim, inc)
38307  */
38308   }
38309 
38310   /* "View.MemoryView":1362
38311  *
38312  * @cname('__pyx_memoryview_refcount_copying')
38313  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
38314  *                            int ndim, bint inc) nogil:
38315  *
38316  */
38317 
38318   /* function exit code */
38319 }
38320 
38321 /* "View.MemoryView":1371
38322  *
38323  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
38324  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
38325  *                                              Py_ssize_t *strides, int ndim,
38326  *                                              bint inc) with gil:
38327  */
38328 
__pyx_memoryview_refcount_objects_in_slice_with_gil(char * __pyx_v_data,Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,int __pyx_v_ndim,int __pyx_v_inc)38329 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
38330   __Pyx_RefNannyDeclarations
38331   #ifdef WITH_THREAD
38332   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
38333   #endif
38334   __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
38335 
38336   /* "View.MemoryView":1374
38337  *                                              Py_ssize_t *strides, int ndim,
38338  *                                              bint inc) with gil:
38339  *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
38340  *
38341  * @cname('__pyx_memoryview_refcount_objects_in_slice')
38342  */
38343   __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
38344 
38345   /* "View.MemoryView":1371
38346  *
38347  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
38348  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
38349  *                                              Py_ssize_t *strides, int ndim,
38350  *                                              bint inc) with gil:
38351  */
38352 
38353   /* function exit code */
38354   __Pyx_RefNannyFinishContext();
38355   #ifdef WITH_THREAD
38356   __Pyx_PyGILState_Release(__pyx_gilstate_save);
38357   #endif
38358 }
38359 
38360 /* "View.MemoryView":1377
38361  *
38362  * @cname('__pyx_memoryview_refcount_objects_in_slice')
38363  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
38364  *                                     Py_ssize_t *strides, int ndim, bint inc):
38365  *     cdef Py_ssize_t i
38366  */
38367 
__pyx_memoryview_refcount_objects_in_slice(char * __pyx_v_data,Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,int __pyx_v_ndim,int __pyx_v_inc)38368 static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
38369   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
38370   __Pyx_RefNannyDeclarations
38371   Py_ssize_t __pyx_t_1;
38372   Py_ssize_t __pyx_t_2;
38373   Py_ssize_t __pyx_t_3;
38374   int __pyx_t_4;
38375   __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
38376 
38377   /* "View.MemoryView":1381
38378  *     cdef Py_ssize_t i
38379  *
38380  *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
38381  *         if ndim == 1:
38382  *             if inc:
38383  */
38384   __pyx_t_1 = (__pyx_v_shape[0]);
38385   __pyx_t_2 = __pyx_t_1;
38386   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
38387     __pyx_v_i = __pyx_t_3;
38388 
38389     /* "View.MemoryView":1382
38390  *
38391  *     for i in range(shape[0]):
38392  *         if ndim == 1:             # <<<<<<<<<<<<<<
38393  *             if inc:
38394  *                 Py_INCREF((<PyObject **> data)[0])
38395  */
38396     __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
38397     if (__pyx_t_4) {
38398 
38399       /* "View.MemoryView":1383
38400  *     for i in range(shape[0]):
38401  *         if ndim == 1:
38402  *             if inc:             # <<<<<<<<<<<<<<
38403  *                 Py_INCREF((<PyObject **> data)[0])
38404  *             else:
38405  */
38406       __pyx_t_4 = (__pyx_v_inc != 0);
38407       if (__pyx_t_4) {
38408 
38409         /* "View.MemoryView":1384
38410  *         if ndim == 1:
38411  *             if inc:
38412  *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
38413  *             else:
38414  *                 Py_DECREF((<PyObject **> data)[0])
38415  */
38416         Py_INCREF((((PyObject **)__pyx_v_data)[0]));
38417 
38418         /* "View.MemoryView":1383
38419  *     for i in range(shape[0]):
38420  *         if ndim == 1:
38421  *             if inc:             # <<<<<<<<<<<<<<
38422  *                 Py_INCREF((<PyObject **> data)[0])
38423  *             else:
38424  */
38425         goto __pyx_L6;
38426       }
38427 
38428       /* "View.MemoryView":1386
38429  *                 Py_INCREF((<PyObject **> data)[0])
38430  *             else:
38431  *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
38432  *         else:
38433  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
38434  */
38435       /*else*/ {
38436         Py_DECREF((((PyObject **)__pyx_v_data)[0]));
38437       }
38438       __pyx_L6:;
38439 
38440       /* "View.MemoryView":1382
38441  *
38442  *     for i in range(shape[0]):
38443  *         if ndim == 1:             # <<<<<<<<<<<<<<
38444  *             if inc:
38445  *                 Py_INCREF((<PyObject **> data)[0])
38446  */
38447       goto __pyx_L5;
38448     }
38449 
38450     /* "View.MemoryView":1388
38451  *                 Py_DECREF((<PyObject **> data)[0])
38452  *         else:
38453  *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
38454  *                                       ndim - 1, inc)
38455  *
38456  */
38457     /*else*/ {
38458 
38459       /* "View.MemoryView":1389
38460  *         else:
38461  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
38462  *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
38463  *
38464  *         data += strides[0]
38465  */
38466       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
38467     }
38468     __pyx_L5:;
38469 
38470     /* "View.MemoryView":1391
38471  *                                       ndim - 1, inc)
38472  *
38473  *         data += strides[0]             # <<<<<<<<<<<<<<
38474  *
38475  *
38476  */
38477     __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
38478   }
38479 
38480   /* "View.MemoryView":1377
38481  *
38482  * @cname('__pyx_memoryview_refcount_objects_in_slice')
38483  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
38484  *                                     Py_ssize_t *strides, int ndim, bint inc):
38485  *     cdef Py_ssize_t i
38486  */
38487 
38488   /* function exit code */
38489   __Pyx_RefNannyFinishContext();
38490 }
38491 
38492 /* "View.MemoryView":1397
38493  *
38494  * @cname('__pyx_memoryview_slice_assign_scalar')
38495  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
38496  *                               size_t itemsize, void *item,
38497  *                               bint dtype_is_object) nogil:
38498  */
38499 
__pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize,void * __pyx_v_item,int __pyx_v_dtype_is_object)38500 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {
38501 
38502   /* "View.MemoryView":1400
38503  *                               size_t itemsize, void *item,
38504  *                               bint dtype_is_object) nogil:
38505  *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
38506  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
38507  *                          itemsize, item)
38508  */
38509   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
38510 
38511   /* "View.MemoryView":1401
38512  *                               bint dtype_is_object) nogil:
38513  *     refcount_copying(dst, dtype_is_object, ndim, False)
38514  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
38515  *                          itemsize, item)
38516  *     refcount_copying(dst, dtype_is_object, ndim, True)
38517  */
38518   __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
38519 
38520   /* "View.MemoryView":1403
38521  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
38522  *                          itemsize, item)
38523  *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
38524  *
38525  *
38526  */
38527   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
38528 
38529   /* "View.MemoryView":1397
38530  *
38531  * @cname('__pyx_memoryview_slice_assign_scalar')
38532  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
38533  *                               size_t itemsize, void *item,
38534  *                               bint dtype_is_object) nogil:
38535  */
38536 
38537   /* function exit code */
38538 }
38539 
38540 /* "View.MemoryView":1407
38541  *
38542  * @cname('__pyx_memoryview__slice_assign_scalar')
38543  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
38544  *                               Py_ssize_t *strides, int ndim,
38545  *                               size_t itemsize, void *item) nogil:
38546  */
38547 
__pyx_memoryview__slice_assign_scalar(char * __pyx_v_data,Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,int __pyx_v_ndim,size_t __pyx_v_itemsize,void * __pyx_v_item)38548 static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
38549   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
38550   Py_ssize_t __pyx_v_stride;
38551   Py_ssize_t __pyx_v_extent;
38552   int __pyx_t_1;
38553   Py_ssize_t __pyx_t_2;
38554   Py_ssize_t __pyx_t_3;
38555   Py_ssize_t __pyx_t_4;
38556 
38557   /* "View.MemoryView":1411
38558  *                               size_t itemsize, void *item) nogil:
38559  *     cdef Py_ssize_t i
38560  *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
38561  *     cdef Py_ssize_t extent = shape[0]
38562  *
38563  */
38564   __pyx_v_stride = (__pyx_v_strides[0]);
38565 
38566   /* "View.MemoryView":1412
38567  *     cdef Py_ssize_t i
38568  *     cdef Py_ssize_t stride = strides[0]
38569  *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
38570  *
38571  *     if ndim == 1:
38572  */
38573   __pyx_v_extent = (__pyx_v_shape[0]);
38574 
38575   /* "View.MemoryView":1414
38576  *     cdef Py_ssize_t extent = shape[0]
38577  *
38578  *     if ndim == 1:             # <<<<<<<<<<<<<<
38579  *         for i in range(extent):
38580  *             memcpy(data, item, itemsize)
38581  */
38582   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
38583   if (__pyx_t_1) {
38584 
38585     /* "View.MemoryView":1415
38586  *
38587  *     if ndim == 1:
38588  *         for i in range(extent):             # <<<<<<<<<<<<<<
38589  *             memcpy(data, item, itemsize)
38590  *             data += stride
38591  */
38592     __pyx_t_2 = __pyx_v_extent;
38593     __pyx_t_3 = __pyx_t_2;
38594     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
38595       __pyx_v_i = __pyx_t_4;
38596 
38597       /* "View.MemoryView":1416
38598  *     if ndim == 1:
38599  *         for i in range(extent):
38600  *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
38601  *             data += stride
38602  *     else:
38603  */
38604       (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
38605 
38606       /* "View.MemoryView":1417
38607  *         for i in range(extent):
38608  *             memcpy(data, item, itemsize)
38609  *             data += stride             # <<<<<<<<<<<<<<
38610  *     else:
38611  *         for i in range(extent):
38612  */
38613       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
38614     }
38615 
38616     /* "View.MemoryView":1414
38617  *     cdef Py_ssize_t extent = shape[0]
38618  *
38619  *     if ndim == 1:             # <<<<<<<<<<<<<<
38620  *         for i in range(extent):
38621  *             memcpy(data, item, itemsize)
38622  */
38623     goto __pyx_L3;
38624   }
38625 
38626   /* "View.MemoryView":1419
38627  *             data += stride
38628  *     else:
38629  *         for i in range(extent):             # <<<<<<<<<<<<<<
38630  *             _slice_assign_scalar(data, shape + 1, strides + 1,
38631  *                                 ndim - 1, itemsize, item)
38632  */
38633   /*else*/ {
38634     __pyx_t_2 = __pyx_v_extent;
38635     __pyx_t_3 = __pyx_t_2;
38636     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
38637       __pyx_v_i = __pyx_t_4;
38638 
38639       /* "View.MemoryView":1420
38640  *     else:
38641  *         for i in range(extent):
38642  *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
38643  *                                 ndim - 1, itemsize, item)
38644  *             data += stride
38645  */
38646       __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
38647 
38648       /* "View.MemoryView":1422
38649  *             _slice_assign_scalar(data, shape + 1, strides + 1,
38650  *                                 ndim - 1, itemsize, item)
38651  *             data += stride             # <<<<<<<<<<<<<<
38652  *
38653  *
38654  */
38655       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
38656     }
38657   }
38658   __pyx_L3:;
38659 
38660   /* "View.MemoryView":1407
38661  *
38662  * @cname('__pyx_memoryview__slice_assign_scalar')
38663  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
38664  *                               Py_ssize_t *strides, int ndim,
38665  *                               size_t itemsize, void *item) nogil:
38666  */
38667 
38668   /* function exit code */
38669 }
38670 
38671 /* "(tree fragment)":1
38672  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
38673  *     cdef object __pyx_PickleError
38674  *     cdef object __pyx_result
38675  */
38676 
38677 /* Python wrapper */
38678 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
38679 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)38680 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
38681   PyObject *__pyx_v___pyx_type = 0;
38682   long __pyx_v___pyx_checksum;
38683   PyObject *__pyx_v___pyx_state = 0;
38684   int __pyx_lineno = 0;
38685   const char *__pyx_filename = NULL;
38686   int __pyx_clineno = 0;
38687   PyObject *__pyx_r = 0;
38688   __Pyx_RefNannyDeclarations
38689   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
38690   {
38691     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
38692     PyObject* values[3] = {0,0,0};
38693     if (unlikely(__pyx_kwds)) {
38694       Py_ssize_t kw_args;
38695       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
38696       switch (pos_args) {
38697         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
38698         CYTHON_FALLTHROUGH;
38699         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
38700         CYTHON_FALLTHROUGH;
38701         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
38702         CYTHON_FALLTHROUGH;
38703         case  0: break;
38704         default: goto __pyx_L5_argtuple_error;
38705       }
38706       kw_args = PyDict_Size(__pyx_kwds);
38707       switch (pos_args) {
38708         case  0:
38709         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
38710         else goto __pyx_L5_argtuple_error;
38711         CYTHON_FALLTHROUGH;
38712         case  1:
38713         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
38714         else {
38715           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
38716         }
38717         CYTHON_FALLTHROUGH;
38718         case  2:
38719         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
38720         else {
38721           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
38722         }
38723       }
38724       if (unlikely(kw_args > 0)) {
38725         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
38726       }
38727     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
38728       goto __pyx_L5_argtuple_error;
38729     } else {
38730       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
38731       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
38732       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
38733     }
38734     __pyx_v___pyx_type = values[0];
38735     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
38736     __pyx_v___pyx_state = values[2];
38737   }
38738   goto __pyx_L4_argument_unpacking_done;
38739   __pyx_L5_argtuple_error:;
38740   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
38741   __pyx_L3_error:;
38742   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
38743   __Pyx_RefNannyFinishContext();
38744   return NULL;
38745   __pyx_L4_argument_unpacking_done:;
38746   __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
38747 
38748   /* function exit code */
38749   __Pyx_RefNannyFinishContext();
38750   return __pyx_r;
38751 }
38752 
__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)38753 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
38754   PyObject *__pyx_v___pyx_PickleError = 0;
38755   PyObject *__pyx_v___pyx_result = 0;
38756   PyObject *__pyx_r = NULL;
38757   __Pyx_RefNannyDeclarations
38758   int __pyx_t_1;
38759   PyObject *__pyx_t_2 = NULL;
38760   PyObject *__pyx_t_3 = NULL;
38761   PyObject *__pyx_t_4 = NULL;
38762   PyObject *__pyx_t_5 = NULL;
38763   int __pyx_t_6;
38764   int __pyx_lineno = 0;
38765   const char *__pyx_filename = NULL;
38766   int __pyx_clineno = 0;
38767   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
38768 
38769   /* "(tree fragment)":4
38770  *     cdef object __pyx_PickleError
38771  *     cdef object __pyx_result
38772  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
38773  *         from pickle import PickleError as __pyx_PickleError
38774  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
38775  */
38776   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
38777   if (__pyx_t_1) {
38778 
38779     /* "(tree fragment)":5
38780  *     cdef object __pyx_result
38781  *     if __pyx_checksum != 0xb068931:
38782  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
38783  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
38784  *     __pyx_result = Enum.__new__(__pyx_type)
38785  */
38786     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
38787     __Pyx_GOTREF(__pyx_t_2);
38788     __Pyx_INCREF(__pyx_n_s_PickleError);
38789     __Pyx_GIVEREF(__pyx_n_s_PickleError);
38790     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
38791     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
38792     __Pyx_GOTREF(__pyx_t_3);
38793     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
38794     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
38795     __Pyx_GOTREF(__pyx_t_2);
38796     __Pyx_INCREF(__pyx_t_2);
38797     __pyx_v___pyx_PickleError = __pyx_t_2;
38798     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
38799     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
38800 
38801     /* "(tree fragment)":6
38802  *     if __pyx_checksum != 0xb068931:
38803  *         from pickle import PickleError as __pyx_PickleError
38804  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
38805  *     __pyx_result = Enum.__new__(__pyx_type)
38806  *     if __pyx_state is not None:
38807  */
38808     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
38809     __Pyx_GOTREF(__pyx_t_2);
38810     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
38811     __Pyx_GOTREF(__pyx_t_4);
38812     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
38813     __Pyx_INCREF(__pyx_v___pyx_PickleError);
38814     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
38815     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
38816       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
38817       if (likely(__pyx_t_5)) {
38818         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
38819         __Pyx_INCREF(__pyx_t_5);
38820         __Pyx_INCREF(function);
38821         __Pyx_DECREF_SET(__pyx_t_2, function);
38822       }
38823     }
38824     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
38825     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
38826     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
38827     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
38828     __Pyx_GOTREF(__pyx_t_3);
38829     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
38830     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
38831     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
38832     __PYX_ERR(1, 6, __pyx_L1_error)
38833 
38834     /* "(tree fragment)":4
38835  *     cdef object __pyx_PickleError
38836  *     cdef object __pyx_result
38837  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
38838  *         from pickle import PickleError as __pyx_PickleError
38839  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
38840  */
38841   }
38842 
38843   /* "(tree fragment)":7
38844  *         from pickle import PickleError as __pyx_PickleError
38845  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
38846  *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
38847  *     if __pyx_state is not None:
38848  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
38849  */
38850   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
38851   __Pyx_GOTREF(__pyx_t_2);
38852   __pyx_t_4 = NULL;
38853   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
38854     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
38855     if (likely(__pyx_t_4)) {
38856       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
38857       __Pyx_INCREF(__pyx_t_4);
38858       __Pyx_INCREF(function);
38859       __Pyx_DECREF_SET(__pyx_t_2, function);
38860     }
38861   }
38862   __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
38863   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
38864   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
38865   __Pyx_GOTREF(__pyx_t_3);
38866   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
38867   __pyx_v___pyx_result = __pyx_t_3;
38868   __pyx_t_3 = 0;
38869 
38870   /* "(tree fragment)":8
38871  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
38872  *     __pyx_result = Enum.__new__(__pyx_type)
38873  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
38874  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
38875  *     return __pyx_result
38876  */
38877   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
38878   __pyx_t_6 = (__pyx_t_1 != 0);
38879   if (__pyx_t_6) {
38880 
38881     /* "(tree fragment)":9
38882  *     __pyx_result = Enum.__new__(__pyx_type)
38883  *     if __pyx_state is not None:
38884  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
38885  *     return __pyx_result
38886  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
38887  */
38888     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
38889     __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
38890     __Pyx_GOTREF(__pyx_t_3);
38891     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
38892 
38893     /* "(tree fragment)":8
38894  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
38895  *     __pyx_result = Enum.__new__(__pyx_type)
38896  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
38897  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
38898  *     return __pyx_result
38899  */
38900   }
38901 
38902   /* "(tree fragment)":10
38903  *     if __pyx_state is not None:
38904  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
38905  *     return __pyx_result             # <<<<<<<<<<<<<<
38906  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
38907  *     __pyx_result.name = __pyx_state[0]
38908  */
38909   __Pyx_XDECREF(__pyx_r);
38910   __Pyx_INCREF(__pyx_v___pyx_result);
38911   __pyx_r = __pyx_v___pyx_result;
38912   goto __pyx_L0;
38913 
38914   /* "(tree fragment)":1
38915  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
38916  *     cdef object __pyx_PickleError
38917  *     cdef object __pyx_result
38918  */
38919 
38920   /* function exit code */
38921   __pyx_L1_error:;
38922   __Pyx_XDECREF(__pyx_t_2);
38923   __Pyx_XDECREF(__pyx_t_3);
38924   __Pyx_XDECREF(__pyx_t_4);
38925   __Pyx_XDECREF(__pyx_t_5);
38926   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
38927   __pyx_r = NULL;
38928   __pyx_L0:;
38929   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
38930   __Pyx_XDECREF(__pyx_v___pyx_result);
38931   __Pyx_XGIVEREF(__pyx_r);
38932   __Pyx_RefNannyFinishContext();
38933   return __pyx_r;
38934 }
38935 
38936 /* "(tree fragment)":11
38937  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
38938  *     return __pyx_result
38939  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
38940  *     __pyx_result.name = __pyx_state[0]
38941  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
38942  */
38943 
__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)38944 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
38945   PyObject *__pyx_r = NULL;
38946   __Pyx_RefNannyDeclarations
38947   PyObject *__pyx_t_1 = NULL;
38948   int __pyx_t_2;
38949   Py_ssize_t __pyx_t_3;
38950   int __pyx_t_4;
38951   int __pyx_t_5;
38952   PyObject *__pyx_t_6 = NULL;
38953   PyObject *__pyx_t_7 = NULL;
38954   PyObject *__pyx_t_8 = NULL;
38955   int __pyx_lineno = 0;
38956   const char *__pyx_filename = NULL;
38957   int __pyx_clineno = 0;
38958   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
38959 
38960   /* "(tree fragment)":12
38961  *     return __pyx_result
38962  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
38963  *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
38964  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
38965  *         __pyx_result.__dict__.update(__pyx_state[1])
38966  */
38967   if (unlikely(__pyx_v___pyx_state == Py_None)) {
38968     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
38969     __PYX_ERR(1, 12, __pyx_L1_error)
38970   }
38971   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
38972   __Pyx_GOTREF(__pyx_t_1);
38973   __Pyx_GIVEREF(__pyx_t_1);
38974   __Pyx_GOTREF(__pyx_v___pyx_result->name);
38975   __Pyx_DECREF(__pyx_v___pyx_result->name);
38976   __pyx_v___pyx_result->name = __pyx_t_1;
38977   __pyx_t_1 = 0;
38978 
38979   /* "(tree fragment)":13
38980  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
38981  *     __pyx_result.name = __pyx_state[0]
38982  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
38983  *         __pyx_result.__dict__.update(__pyx_state[1])
38984  */
38985   if (unlikely(__pyx_v___pyx_state == Py_None)) {
38986     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
38987     __PYX_ERR(1, 13, __pyx_L1_error)
38988   }
38989   __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
38990   __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
38991   if (__pyx_t_4) {
38992   } else {
38993     __pyx_t_2 = __pyx_t_4;
38994     goto __pyx_L4_bool_binop_done;
38995   }
38996   __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
38997   __pyx_t_5 = (__pyx_t_4 != 0);
38998   __pyx_t_2 = __pyx_t_5;
38999   __pyx_L4_bool_binop_done:;
39000   if (__pyx_t_2) {
39001 
39002     /* "(tree fragment)":14
39003  *     __pyx_result.name = __pyx_state[0]
39004  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
39005  *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
39006  */
39007     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
39008     __Pyx_GOTREF(__pyx_t_6);
39009     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
39010     __Pyx_GOTREF(__pyx_t_7);
39011     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
39012     if (unlikely(__pyx_v___pyx_state == Py_None)) {
39013       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
39014       __PYX_ERR(1, 14, __pyx_L1_error)
39015     }
39016     __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
39017     __Pyx_GOTREF(__pyx_t_6);
39018     __pyx_t_8 = NULL;
39019     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
39020       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
39021       if (likely(__pyx_t_8)) {
39022         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
39023         __Pyx_INCREF(__pyx_t_8);
39024         __Pyx_INCREF(function);
39025         __Pyx_DECREF_SET(__pyx_t_7, function);
39026       }
39027     }
39028     __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
39029     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
39030     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
39031     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
39032     __Pyx_GOTREF(__pyx_t_1);
39033     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
39034     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
39035 
39036     /* "(tree fragment)":13
39037  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
39038  *     __pyx_result.name = __pyx_state[0]
39039  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
39040  *         __pyx_result.__dict__.update(__pyx_state[1])
39041  */
39042   }
39043 
39044   /* "(tree fragment)":11
39045  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
39046  *     return __pyx_result
39047  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
39048  *     __pyx_result.name = __pyx_state[0]
39049  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
39050  */
39051 
39052   /* function exit code */
39053   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
39054   goto __pyx_L0;
39055   __pyx_L1_error:;
39056   __Pyx_XDECREF(__pyx_t_1);
39057   __Pyx_XDECREF(__pyx_t_6);
39058   __Pyx_XDECREF(__pyx_t_7);
39059   __Pyx_XDECREF(__pyx_t_8);
39060   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
39061   __pyx_r = 0;
39062   __pyx_L0:;
39063   __Pyx_XGIVEREF(__pyx_r);
39064   __Pyx_RefNannyFinishContext();
39065   return __pyx_r;
39066 }
39067 static struct __pyx_vtabstruct_8rasterio_5_base_DatasetBase __pyx_vtable_8rasterio_5_base_DatasetBase;
39068 
__pyx_tp_new_8rasterio_5_base_DatasetBase(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)39069 static PyObject *__pyx_tp_new_8rasterio_5_base_DatasetBase(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
39070   struct __pyx_obj_8rasterio_5_base_DatasetBase *p;
39071   PyObject *o;
39072   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
39073     o = (*t->tp_alloc)(t, 0);
39074   } else {
39075     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
39076   }
39077   if (unlikely(!o)) return 0;
39078   p = ((struct __pyx_obj_8rasterio_5_base_DatasetBase *)o);
39079   p->__pyx_vtab = __pyx_vtabptr_8rasterio_5_base_DatasetBase;
39080   p->name = Py_None; Py_INCREF(Py_None);
39081   p->mode = Py_None; Py_INCREF(Py_None);
39082   p->options = Py_None; Py_INCREF(Py_None);
39083   p->width = Py_None; Py_INCREF(Py_None);
39084   p->height = Py_None; Py_INCREF(Py_None);
39085   p->shape = Py_None; Py_INCREF(Py_None);
39086   p->driver = Py_None; Py_INCREF(Py_None);
39087   p->_count = Py_None; Py_INCREF(Py_None);
39088   p->_dtypes = Py_None; Py_INCREF(Py_None);
39089   p->_closed = Py_None; Py_INCREF(Py_None);
39090   p->_crs = Py_None; Py_INCREF(Py_None);
39091   p->_crs_wkt = Py_None; Py_INCREF(Py_None);
39092   p->_transform = Py_None; Py_INCREF(Py_None);
39093   p->_block_shapes = Py_None; Py_INCREF(Py_None);
39094   p->_nodatavals = Py_None; Py_INCREF(Py_None);
39095   p->_units = Py_None; Py_INCREF(Py_None);
39096   p->_descriptions = Py_None; Py_INCREF(Py_None);
39097   p->_scales = Py_None; Py_INCREF(Py_None);
39098   p->_offsets = Py_None; Py_INCREF(Py_None);
39099   p->_read = Py_None; Py_INCREF(Py_None);
39100   p->_gcps = Py_None; Py_INCREF(Py_None);
39101   p->_rpcs = Py_None; Py_INCREF(Py_None);
39102   p->_env = Py_None; Py_INCREF(Py_None);
39103   return o;
39104 }
39105 
__pyx_tp_dealloc_8rasterio_5_base_DatasetBase(PyObject * o)39106 static void __pyx_tp_dealloc_8rasterio_5_base_DatasetBase(PyObject *o) {
39107   struct __pyx_obj_8rasterio_5_base_DatasetBase *p = (struct __pyx_obj_8rasterio_5_base_DatasetBase *)o;
39108   #if CYTHON_USE_TP_FINALIZE
39109   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
39110     if (PyObject_CallFinalizerFromDealloc(o)) return;
39111   }
39112   #endif
39113   PyObject_GC_UnTrack(o);
39114   {
39115     PyObject *etype, *eval, *etb;
39116     PyErr_Fetch(&etype, &eval, &etb);
39117     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
39118     __pyx_pw_8rasterio_5_base_11DatasetBase_27__dealloc__(o);
39119     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
39120     PyErr_Restore(etype, eval, etb);
39121   }
39122   Py_CLEAR(p->name);
39123   Py_CLEAR(p->mode);
39124   Py_CLEAR(p->options);
39125   Py_CLEAR(p->width);
39126   Py_CLEAR(p->height);
39127   Py_CLEAR(p->shape);
39128   Py_CLEAR(p->driver);
39129   Py_CLEAR(p->_count);
39130   Py_CLEAR(p->_dtypes);
39131   Py_CLEAR(p->_closed);
39132   Py_CLEAR(p->_crs);
39133   Py_CLEAR(p->_crs_wkt);
39134   Py_CLEAR(p->_transform);
39135   Py_CLEAR(p->_block_shapes);
39136   Py_CLEAR(p->_nodatavals);
39137   Py_CLEAR(p->_units);
39138   Py_CLEAR(p->_descriptions);
39139   Py_CLEAR(p->_scales);
39140   Py_CLEAR(p->_offsets);
39141   Py_CLEAR(p->_read);
39142   Py_CLEAR(p->_gcps);
39143   Py_CLEAR(p->_rpcs);
39144   Py_CLEAR(p->_env);
39145   (*Py_TYPE(o)->tp_free)(o);
39146 }
39147 
__pyx_tp_traverse_8rasterio_5_base_DatasetBase(PyObject * o,visitproc v,void * a)39148 static int __pyx_tp_traverse_8rasterio_5_base_DatasetBase(PyObject *o, visitproc v, void *a) {
39149   int e;
39150   struct __pyx_obj_8rasterio_5_base_DatasetBase *p = (struct __pyx_obj_8rasterio_5_base_DatasetBase *)o;
39151   if (p->name) {
39152     e = (*v)(p->name, a); if (e) return e;
39153   }
39154   if (p->mode) {
39155     e = (*v)(p->mode, a); if (e) return e;
39156   }
39157   if (p->options) {
39158     e = (*v)(p->options, a); if (e) return e;
39159   }
39160   if (p->width) {
39161     e = (*v)(p->width, a); if (e) return e;
39162   }
39163   if (p->height) {
39164     e = (*v)(p->height, a); if (e) return e;
39165   }
39166   if (p->shape) {
39167     e = (*v)(p->shape, a); if (e) return e;
39168   }
39169   if (p->driver) {
39170     e = (*v)(p->driver, a); if (e) return e;
39171   }
39172   if (p->_count) {
39173     e = (*v)(p->_count, a); if (e) return e;
39174   }
39175   if (p->_dtypes) {
39176     e = (*v)(p->_dtypes, a); if (e) return e;
39177   }
39178   if (p->_closed) {
39179     e = (*v)(p->_closed, a); if (e) return e;
39180   }
39181   if (p->_crs) {
39182     e = (*v)(p->_crs, a); if (e) return e;
39183   }
39184   if (p->_crs_wkt) {
39185     e = (*v)(p->_crs_wkt, a); if (e) return e;
39186   }
39187   if (p->_transform) {
39188     e = (*v)(p->_transform, a); if (e) return e;
39189   }
39190   if (p->_block_shapes) {
39191     e = (*v)(p->_block_shapes, a); if (e) return e;
39192   }
39193   if (p->_nodatavals) {
39194     e = (*v)(p->_nodatavals, a); if (e) return e;
39195   }
39196   if (p->_units) {
39197     e = (*v)(p->_units, a); if (e) return e;
39198   }
39199   if (p->_descriptions) {
39200     e = (*v)(p->_descriptions, a); if (e) return e;
39201   }
39202   if (p->_scales) {
39203     e = (*v)(p->_scales, a); if (e) return e;
39204   }
39205   if (p->_offsets) {
39206     e = (*v)(p->_offsets, a); if (e) return e;
39207   }
39208   if (p->_read) {
39209     e = (*v)(p->_read, a); if (e) return e;
39210   }
39211   if (p->_gcps) {
39212     e = (*v)(p->_gcps, a); if (e) return e;
39213   }
39214   if (p->_rpcs) {
39215     e = (*v)(p->_rpcs, a); if (e) return e;
39216   }
39217   if (p->_env) {
39218     e = (*v)(p->_env, a); if (e) return e;
39219   }
39220   return 0;
39221 }
39222 
__pyx_tp_clear_8rasterio_5_base_DatasetBase(PyObject * o)39223 static int __pyx_tp_clear_8rasterio_5_base_DatasetBase(PyObject *o) {
39224   PyObject* tmp;
39225   struct __pyx_obj_8rasterio_5_base_DatasetBase *p = (struct __pyx_obj_8rasterio_5_base_DatasetBase *)o;
39226   tmp = ((PyObject*)p->name);
39227   p->name = Py_None; Py_INCREF(Py_None);
39228   Py_XDECREF(tmp);
39229   tmp = ((PyObject*)p->mode);
39230   p->mode = Py_None; Py_INCREF(Py_None);
39231   Py_XDECREF(tmp);
39232   tmp = ((PyObject*)p->options);
39233   p->options = Py_None; Py_INCREF(Py_None);
39234   Py_XDECREF(tmp);
39235   tmp = ((PyObject*)p->width);
39236   p->width = Py_None; Py_INCREF(Py_None);
39237   Py_XDECREF(tmp);
39238   tmp = ((PyObject*)p->height);
39239   p->height = Py_None; Py_INCREF(Py_None);
39240   Py_XDECREF(tmp);
39241   tmp = ((PyObject*)p->shape);
39242   p->shape = Py_None; Py_INCREF(Py_None);
39243   Py_XDECREF(tmp);
39244   tmp = ((PyObject*)p->driver);
39245   p->driver = Py_None; Py_INCREF(Py_None);
39246   Py_XDECREF(tmp);
39247   tmp = ((PyObject*)p->_count);
39248   p->_count = Py_None; Py_INCREF(Py_None);
39249   Py_XDECREF(tmp);
39250   tmp = ((PyObject*)p->_dtypes);
39251   p->_dtypes = Py_None; Py_INCREF(Py_None);
39252   Py_XDECREF(tmp);
39253   tmp = ((PyObject*)p->_closed);
39254   p->_closed = Py_None; Py_INCREF(Py_None);
39255   Py_XDECREF(tmp);
39256   tmp = ((PyObject*)p->_crs);
39257   p->_crs = Py_None; Py_INCREF(Py_None);
39258   Py_XDECREF(tmp);
39259   tmp = ((PyObject*)p->_crs_wkt);
39260   p->_crs_wkt = Py_None; Py_INCREF(Py_None);
39261   Py_XDECREF(tmp);
39262   tmp = ((PyObject*)p->_transform);
39263   p->_transform = Py_None; Py_INCREF(Py_None);
39264   Py_XDECREF(tmp);
39265   tmp = ((PyObject*)p->_block_shapes);
39266   p->_block_shapes = Py_None; Py_INCREF(Py_None);
39267   Py_XDECREF(tmp);
39268   tmp = ((PyObject*)p->_nodatavals);
39269   p->_nodatavals = Py_None; Py_INCREF(Py_None);
39270   Py_XDECREF(tmp);
39271   tmp = ((PyObject*)p->_units);
39272   p->_units = Py_None; Py_INCREF(Py_None);
39273   Py_XDECREF(tmp);
39274   tmp = ((PyObject*)p->_descriptions);
39275   p->_descriptions = Py_None; Py_INCREF(Py_None);
39276   Py_XDECREF(tmp);
39277   tmp = ((PyObject*)p->_scales);
39278   p->_scales = Py_None; Py_INCREF(Py_None);
39279   Py_XDECREF(tmp);
39280   tmp = ((PyObject*)p->_offsets);
39281   p->_offsets = Py_None; Py_INCREF(Py_None);
39282   Py_XDECREF(tmp);
39283   tmp = ((PyObject*)p->_read);
39284   p->_read = Py_None; Py_INCREF(Py_None);
39285   Py_XDECREF(tmp);
39286   tmp = ((PyObject*)p->_gcps);
39287   p->_gcps = Py_None; Py_INCREF(Py_None);
39288   Py_XDECREF(tmp);
39289   tmp = ((PyObject*)p->_rpcs);
39290   p->_rpcs = Py_None; Py_INCREF(Py_None);
39291   Py_XDECREF(tmp);
39292   tmp = ((PyObject*)p->_env);
39293   p->_env = Py_None; Py_INCREF(Py_None);
39294   Py_XDECREF(tmp);
39295   return 0;
39296 }
39297 
__pyx_getprop_8rasterio_5_base_11DatasetBase_closed(PyObject * o,CYTHON_UNUSED void * x)39298 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_closed(PyObject *o, CYTHON_UNUSED void *x) {
39299   return __pyx_pw_8rasterio_5_base_11DatasetBase_6closed_1__get__(o);
39300 }
39301 
__pyx_getprop_8rasterio_5_base_11DatasetBase_count(PyObject * o,CYTHON_UNUSED void * x)39302 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_count(PyObject *o, CYTHON_UNUSED void *x) {
39303   return __pyx_pw_8rasterio_5_base_11DatasetBase_5count_1__get__(o);
39304 }
39305 
__pyx_getprop_8rasterio_5_base_11DatasetBase_indexes(PyObject * o,CYTHON_UNUSED void * x)39306 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_indexes(PyObject *o, CYTHON_UNUSED void *x) {
39307   return __pyx_pw_8rasterio_5_base_11DatasetBase_7indexes_1__get__(o);
39308 }
39309 
__pyx_getprop_8rasterio_5_base_11DatasetBase_dtypes(PyObject * o,CYTHON_UNUSED void * x)39310 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_dtypes(PyObject *o, CYTHON_UNUSED void *x) {
39311   return __pyx_pw_8rasterio_5_base_11DatasetBase_6dtypes_1__get__(o);
39312 }
39313 
__pyx_getprop_8rasterio_5_base_11DatasetBase_block_shapes(PyObject * o,CYTHON_UNUSED void * x)39314 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_block_shapes(PyObject *o, CYTHON_UNUSED void *x) {
39315   return __pyx_pw_8rasterio_5_base_11DatasetBase_12block_shapes_1__get__(o);
39316 }
39317 
__pyx_getprop_8rasterio_5_base_11DatasetBase_nodatavals(PyObject * o,CYTHON_UNUSED void * x)39318 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_nodatavals(PyObject *o, CYTHON_UNUSED void *x) {
39319   return __pyx_pw_8rasterio_5_base_11DatasetBase_10nodatavals_1__get__(o);
39320 }
39321 
__pyx_getprop_8rasterio_5_base_11DatasetBase_nodata(PyObject * o,CYTHON_UNUSED void * x)39322 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_nodata(PyObject *o, CYTHON_UNUSED void *x) {
39323   return __pyx_pw_8rasterio_5_base_11DatasetBase_6nodata_1__get__(o);
39324 }
39325 
__pyx_setprop_8rasterio_5_base_11DatasetBase_nodata(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39326 static int __pyx_setprop_8rasterio_5_base_11DatasetBase_nodata(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39327   if (v) {
39328     return __pyx_pw_8rasterio_5_base_11DatasetBase_6nodata_3__set__(o, v);
39329   }
39330   else {
39331     PyErr_SetString(PyExc_NotImplementedError, "__del__");
39332     return -1;
39333   }
39334 }
39335 
__pyx_getprop_8rasterio_5_base_11DatasetBase_mask_flag_enums(PyObject * o,CYTHON_UNUSED void * x)39336 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_mask_flag_enums(PyObject *o, CYTHON_UNUSED void *x) {
39337   return __pyx_pw_8rasterio_5_base_11DatasetBase_15mask_flag_enums_1__get__(o);
39338 }
39339 
__pyx_getprop_8rasterio_5_base_11DatasetBase_crs(PyObject * o,CYTHON_UNUSED void * x)39340 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_crs(PyObject *o, CYTHON_UNUSED void *x) {
39341   return __pyx_pw_8rasterio_5_base_11DatasetBase_3crs_1__get__(o);
39342 }
39343 
__pyx_setprop_8rasterio_5_base_11DatasetBase_crs(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39344 static int __pyx_setprop_8rasterio_5_base_11DatasetBase_crs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39345   if (v) {
39346     return __pyx_pw_8rasterio_5_base_11DatasetBase_3crs_3__set__(o, v);
39347   }
39348   else {
39349     PyErr_SetString(PyExc_NotImplementedError, "__del__");
39350     return -1;
39351   }
39352 }
39353 
__pyx_getprop_8rasterio_5_base_11DatasetBase_descriptions(PyObject * o,CYTHON_UNUSED void * x)39354 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_descriptions(PyObject *o, CYTHON_UNUSED void *x) {
39355   return __pyx_pw_8rasterio_5_base_11DatasetBase_12descriptions_1__get__(o);
39356 }
39357 
__pyx_setprop_8rasterio_5_base_11DatasetBase_descriptions(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39358 static int __pyx_setprop_8rasterio_5_base_11DatasetBase_descriptions(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39359   if (v) {
39360     return __pyx_pw_8rasterio_5_base_11DatasetBase_12descriptions_3__set__(o, v);
39361   }
39362   else {
39363     PyErr_SetString(PyExc_NotImplementedError, "__del__");
39364     return -1;
39365   }
39366 }
39367 
__pyx_getprop_8rasterio_5_base_11DatasetBase_transform(PyObject * o,CYTHON_UNUSED void * x)39368 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_transform(PyObject *o, CYTHON_UNUSED void *x) {
39369   return __pyx_pw_8rasterio_5_base_11DatasetBase_9transform_1__get__(o);
39370 }
39371 
__pyx_setprop_8rasterio_5_base_11DatasetBase_transform(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39372 static int __pyx_setprop_8rasterio_5_base_11DatasetBase_transform(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39373   if (v) {
39374     return __pyx_pw_8rasterio_5_base_11DatasetBase_9transform_3__set__(o, v);
39375   }
39376   else {
39377     PyErr_SetString(PyExc_NotImplementedError, "__del__");
39378     return -1;
39379   }
39380 }
39381 
__pyx_getprop_8rasterio_5_base_11DatasetBase_offsets(PyObject * o,CYTHON_UNUSED void * x)39382 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_offsets(PyObject *o, CYTHON_UNUSED void *x) {
39383   return __pyx_pw_8rasterio_5_base_11DatasetBase_7offsets_1__get__(o);
39384 }
39385 
__pyx_setprop_8rasterio_5_base_11DatasetBase_offsets(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39386 static int __pyx_setprop_8rasterio_5_base_11DatasetBase_offsets(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39387   if (v) {
39388     return __pyx_pw_8rasterio_5_base_11DatasetBase_7offsets_3__set__(o, v);
39389   }
39390   else {
39391     PyErr_SetString(PyExc_NotImplementedError, "__del__");
39392     return -1;
39393   }
39394 }
39395 
__pyx_getprop_8rasterio_5_base_11DatasetBase_scales(PyObject * o,CYTHON_UNUSED void * x)39396 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_scales(PyObject *o, CYTHON_UNUSED void *x) {
39397   return __pyx_pw_8rasterio_5_base_11DatasetBase_6scales_1__get__(o);
39398 }
39399 
__pyx_setprop_8rasterio_5_base_11DatasetBase_scales(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39400 static int __pyx_setprop_8rasterio_5_base_11DatasetBase_scales(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39401   if (v) {
39402     return __pyx_pw_8rasterio_5_base_11DatasetBase_6scales_3__set__(o, v);
39403   }
39404   else {
39405     PyErr_SetString(PyExc_NotImplementedError, "__del__");
39406     return -1;
39407   }
39408 }
39409 
__pyx_getprop_8rasterio_5_base_11DatasetBase_units(PyObject * o,CYTHON_UNUSED void * x)39410 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_units(PyObject *o, CYTHON_UNUSED void *x) {
39411   return __pyx_pw_8rasterio_5_base_11DatasetBase_5units_1__get__(o);
39412 }
39413 
__pyx_setprop_8rasterio_5_base_11DatasetBase_units(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39414 static int __pyx_setprop_8rasterio_5_base_11DatasetBase_units(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39415   if (v) {
39416     return __pyx_pw_8rasterio_5_base_11DatasetBase_5units_3__set__(o, v);
39417   }
39418   else {
39419     PyErr_SetString(PyExc_NotImplementedError, "__del__");
39420     return -1;
39421   }
39422 }
39423 
__pyx_getprop_8rasterio_5_base_11DatasetBase_bounds(PyObject * o,CYTHON_UNUSED void * x)39424 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_bounds(PyObject *o, CYTHON_UNUSED void *x) {
39425   return __pyx_pw_8rasterio_5_base_11DatasetBase_6bounds_1__get__(o);
39426 }
39427 
__pyx_getprop_8rasterio_5_base_11DatasetBase_res(PyObject * o,CYTHON_UNUSED void * x)39428 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_res(PyObject *o, CYTHON_UNUSED void *x) {
39429   return __pyx_pw_8rasterio_5_base_11DatasetBase_3res_1__get__(o);
39430 }
39431 
__pyx_getprop_8rasterio_5_base_11DatasetBase_meta(PyObject * o,CYTHON_UNUSED void * x)39432 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_meta(PyObject *o, CYTHON_UNUSED void *x) {
39433   return __pyx_pw_8rasterio_5_base_11DatasetBase_4meta_1__get__(o);
39434 }
39435 
__pyx_getprop_8rasterio_5_base_11DatasetBase_compression(PyObject * o,CYTHON_UNUSED void * x)39436 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_compression(PyObject *o, CYTHON_UNUSED void *x) {
39437   return __pyx_pw_8rasterio_5_base_11DatasetBase_11compression_1__get__(o);
39438 }
39439 
__pyx_getprop_8rasterio_5_base_11DatasetBase_interleaving(PyObject * o,CYTHON_UNUSED void * x)39440 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_interleaving(PyObject *o, CYTHON_UNUSED void *x) {
39441   return __pyx_pw_8rasterio_5_base_11DatasetBase_12interleaving_1__get__(o);
39442 }
39443 
__pyx_getprop_8rasterio_5_base_11DatasetBase_photometric(PyObject * o,CYTHON_UNUSED void * x)39444 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_photometric(PyObject *o, CYTHON_UNUSED void *x) {
39445   return __pyx_pw_8rasterio_5_base_11DatasetBase_11photometric_1__get__(o);
39446 }
39447 
__pyx_getprop_8rasterio_5_base_11DatasetBase_is_tiled(PyObject * o,CYTHON_UNUSED void * x)39448 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_is_tiled(PyObject *o, CYTHON_UNUSED void *x) {
39449   return __pyx_pw_8rasterio_5_base_11DatasetBase_8is_tiled_1__get__(o);
39450 }
39451 
__pyx_getprop_8rasterio_5_base_11DatasetBase_profile(PyObject * o,CYTHON_UNUSED void * x)39452 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_profile(PyObject *o, CYTHON_UNUSED void *x) {
39453   return __pyx_pw_8rasterio_5_base_11DatasetBase_7profile_1__get__(o);
39454 }
39455 
__pyx_getprop_8rasterio_5_base_11DatasetBase_subdatasets(PyObject * o,CYTHON_UNUSED void * x)39456 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_subdatasets(PyObject *o, CYTHON_UNUSED void *x) {
39457   return __pyx_pw_8rasterio_5_base_11DatasetBase_11subdatasets_1__get__(o);
39458 }
39459 
__pyx_getprop_8rasterio_5_base_11DatasetBase_colorinterp(PyObject * o,CYTHON_UNUSED void * x)39460 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_colorinterp(PyObject *o, CYTHON_UNUSED void *x) {
39461   return __pyx_pw_8rasterio_5_base_11DatasetBase_11colorinterp_1__get__(o);
39462 }
39463 
__pyx_setprop_8rasterio_5_base_11DatasetBase_colorinterp(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39464 static int __pyx_setprop_8rasterio_5_base_11DatasetBase_colorinterp(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39465   if (v) {
39466     return __pyx_pw_8rasterio_5_base_11DatasetBase_11colorinterp_3__set__(o, v);
39467   }
39468   else {
39469     PyErr_SetString(PyExc_NotImplementedError, "__del__");
39470     return -1;
39471   }
39472 }
39473 
__pyx_getprop_8rasterio_5_base_11DatasetBase_gcps(PyObject * o,CYTHON_UNUSED void * x)39474 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_gcps(PyObject *o, CYTHON_UNUSED void *x) {
39475   return __pyx_pw_8rasterio_5_base_11DatasetBase_4gcps_1__get__(o);
39476 }
39477 
__pyx_setprop_8rasterio_5_base_11DatasetBase_gcps(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39478 static int __pyx_setprop_8rasterio_5_base_11DatasetBase_gcps(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39479   if (v) {
39480     return __pyx_pw_8rasterio_5_base_11DatasetBase_4gcps_3__set__(o, v);
39481   }
39482   else {
39483     PyErr_SetString(PyExc_NotImplementedError, "__del__");
39484     return -1;
39485   }
39486 }
39487 
__pyx_getprop_8rasterio_5_base_11DatasetBase_rpcs(PyObject * o,CYTHON_UNUSED void * x)39488 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_rpcs(PyObject *o, CYTHON_UNUSED void *x) {
39489   return __pyx_pw_8rasterio_5_base_11DatasetBase_4rpcs_1__get__(o);
39490 }
39491 
__pyx_setprop_8rasterio_5_base_11DatasetBase_rpcs(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39492 static int __pyx_setprop_8rasterio_5_base_11DatasetBase_rpcs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39493   if (v) {
39494     return __pyx_pw_8rasterio_5_base_11DatasetBase_4rpcs_3__set__(o, v);
39495   }
39496   else {
39497     PyErr_SetString(PyExc_NotImplementedError, "__del__");
39498     return -1;
39499   }
39500 }
39501 
__pyx_getprop_8rasterio_5_base_11DatasetBase_files(PyObject * o,CYTHON_UNUSED void * x)39502 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_files(PyObject *o, CYTHON_UNUSED void *x) {
39503   return __pyx_pw_8rasterio_5_base_11DatasetBase_5files_1__get__(o);
39504 }
39505 
__pyx_getprop_8rasterio_5_base_11DatasetBase_name(PyObject * o,CYTHON_UNUSED void * x)39506 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_name(PyObject *o, CYTHON_UNUSED void *x) {
39507   return __pyx_pw_8rasterio_5_base_11DatasetBase_4name_1__get__(o);
39508 }
39509 
__pyx_getprop_8rasterio_5_base_11DatasetBase_mode(PyObject * o,CYTHON_UNUSED void * x)39510 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_mode(PyObject *o, CYTHON_UNUSED void *x) {
39511   return __pyx_pw_8rasterio_5_base_11DatasetBase_4mode_1__get__(o);
39512 }
39513 
__pyx_getprop_8rasterio_5_base_11DatasetBase_options(PyObject * o,CYTHON_UNUSED void * x)39514 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_options(PyObject *o, CYTHON_UNUSED void *x) {
39515   return __pyx_pw_8rasterio_5_base_11DatasetBase_7options_1__get__(o);
39516 }
39517 
__pyx_getprop_8rasterio_5_base_11DatasetBase_width(PyObject * o,CYTHON_UNUSED void * x)39518 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_width(PyObject *o, CYTHON_UNUSED void *x) {
39519   return __pyx_pw_8rasterio_5_base_11DatasetBase_5width_1__get__(o);
39520 }
39521 
__pyx_getprop_8rasterio_5_base_11DatasetBase_height(PyObject * o,CYTHON_UNUSED void * x)39522 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_height(PyObject *o, CYTHON_UNUSED void *x) {
39523   return __pyx_pw_8rasterio_5_base_11DatasetBase_6height_1__get__(o);
39524 }
39525 
__pyx_getprop_8rasterio_5_base_11DatasetBase_shape(PyObject * o,CYTHON_UNUSED void * x)39526 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_shape(PyObject *o, CYTHON_UNUSED void *x) {
39527   return __pyx_pw_8rasterio_5_base_11DatasetBase_5shape_1__get__(o);
39528 }
39529 
__pyx_getprop_8rasterio_5_base_11DatasetBase_driver(PyObject * o,CYTHON_UNUSED void * x)39530 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase_driver(PyObject *o, CYTHON_UNUSED void *x) {
39531   return __pyx_pw_8rasterio_5_base_11DatasetBase_6driver_1__get__(o);
39532 }
39533 
__pyx_setprop_8rasterio_5_base_11DatasetBase_driver(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39534 static int __pyx_setprop_8rasterio_5_base_11DatasetBase_driver(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39535   if (v) {
39536     return __pyx_pw_8rasterio_5_base_11DatasetBase_6driver_3__set__(o, v);
39537   }
39538   else {
39539     return __pyx_pw_8rasterio_5_base_11DatasetBase_6driver_5__del__(o);
39540   }
39541 }
39542 
__pyx_getprop_8rasterio_5_base_11DatasetBase__count(PyObject * o,CYTHON_UNUSED void * x)39543 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__count(PyObject *o, CYTHON_UNUSED void *x) {
39544   return __pyx_pw_8rasterio_5_base_11DatasetBase_6_count_1__get__(o);
39545 }
39546 
__pyx_setprop_8rasterio_5_base_11DatasetBase__count(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39547 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__count(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39548   if (v) {
39549     return __pyx_pw_8rasterio_5_base_11DatasetBase_6_count_3__set__(o, v);
39550   }
39551   else {
39552     return __pyx_pw_8rasterio_5_base_11DatasetBase_6_count_5__del__(o);
39553   }
39554 }
39555 
__pyx_getprop_8rasterio_5_base_11DatasetBase__dtypes(PyObject * o,CYTHON_UNUSED void * x)39556 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__dtypes(PyObject *o, CYTHON_UNUSED void *x) {
39557   return __pyx_pw_8rasterio_5_base_11DatasetBase_7_dtypes_1__get__(o);
39558 }
39559 
__pyx_setprop_8rasterio_5_base_11DatasetBase__dtypes(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39560 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__dtypes(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39561   if (v) {
39562     return __pyx_pw_8rasterio_5_base_11DatasetBase_7_dtypes_3__set__(o, v);
39563   }
39564   else {
39565     return __pyx_pw_8rasterio_5_base_11DatasetBase_7_dtypes_5__del__(o);
39566   }
39567 }
39568 
__pyx_getprop_8rasterio_5_base_11DatasetBase__closed(PyObject * o,CYTHON_UNUSED void * x)39569 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__closed(PyObject *o, CYTHON_UNUSED void *x) {
39570   return __pyx_pw_8rasterio_5_base_11DatasetBase_7_closed_1__get__(o);
39571 }
39572 
__pyx_setprop_8rasterio_5_base_11DatasetBase__closed(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39573 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__closed(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39574   if (v) {
39575     return __pyx_pw_8rasterio_5_base_11DatasetBase_7_closed_3__set__(o, v);
39576   }
39577   else {
39578     return __pyx_pw_8rasterio_5_base_11DatasetBase_7_closed_5__del__(o);
39579   }
39580 }
39581 
__pyx_getprop_8rasterio_5_base_11DatasetBase__crs(PyObject * o,CYTHON_UNUSED void * x)39582 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__crs(PyObject *o, CYTHON_UNUSED void *x) {
39583   return __pyx_pw_8rasterio_5_base_11DatasetBase_4_crs_1__get__(o);
39584 }
39585 
__pyx_setprop_8rasterio_5_base_11DatasetBase__crs(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39586 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__crs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39587   if (v) {
39588     return __pyx_pw_8rasterio_5_base_11DatasetBase_4_crs_3__set__(o, v);
39589   }
39590   else {
39591     return __pyx_pw_8rasterio_5_base_11DatasetBase_4_crs_5__del__(o);
39592   }
39593 }
39594 
__pyx_getprop_8rasterio_5_base_11DatasetBase__crs_wkt(PyObject * o,CYTHON_UNUSED void * x)39595 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__crs_wkt(PyObject *o, CYTHON_UNUSED void *x) {
39596   return __pyx_pw_8rasterio_5_base_11DatasetBase_8_crs_wkt_1__get__(o);
39597 }
39598 
__pyx_setprop_8rasterio_5_base_11DatasetBase__crs_wkt(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39599 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__crs_wkt(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39600   if (v) {
39601     return __pyx_pw_8rasterio_5_base_11DatasetBase_8_crs_wkt_3__set__(o, v);
39602   }
39603   else {
39604     return __pyx_pw_8rasterio_5_base_11DatasetBase_8_crs_wkt_5__del__(o);
39605   }
39606 }
39607 
__pyx_getprop_8rasterio_5_base_11DatasetBase__transform(PyObject * o,CYTHON_UNUSED void * x)39608 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__transform(PyObject *o, CYTHON_UNUSED void *x) {
39609   return __pyx_pw_8rasterio_5_base_11DatasetBase_10_transform_1__get__(o);
39610 }
39611 
__pyx_setprop_8rasterio_5_base_11DatasetBase__transform(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39612 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__transform(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39613   if (v) {
39614     return __pyx_pw_8rasterio_5_base_11DatasetBase_10_transform_3__set__(o, v);
39615   }
39616   else {
39617     return __pyx_pw_8rasterio_5_base_11DatasetBase_10_transform_5__del__(o);
39618   }
39619 }
39620 
__pyx_getprop_8rasterio_5_base_11DatasetBase__block_shapes(PyObject * o,CYTHON_UNUSED void * x)39621 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__block_shapes(PyObject *o, CYTHON_UNUSED void *x) {
39622   return __pyx_pw_8rasterio_5_base_11DatasetBase_13_block_shapes_1__get__(o);
39623 }
39624 
__pyx_setprop_8rasterio_5_base_11DatasetBase__block_shapes(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39625 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__block_shapes(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39626   if (v) {
39627     return __pyx_pw_8rasterio_5_base_11DatasetBase_13_block_shapes_3__set__(o, v);
39628   }
39629   else {
39630     return __pyx_pw_8rasterio_5_base_11DatasetBase_13_block_shapes_5__del__(o);
39631   }
39632 }
39633 
__pyx_getprop_8rasterio_5_base_11DatasetBase__nodatavals(PyObject * o,CYTHON_UNUSED void * x)39634 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__nodatavals(PyObject *o, CYTHON_UNUSED void *x) {
39635   return __pyx_pw_8rasterio_5_base_11DatasetBase_11_nodatavals_1__get__(o);
39636 }
39637 
__pyx_setprop_8rasterio_5_base_11DatasetBase__nodatavals(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39638 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__nodatavals(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39639   if (v) {
39640     return __pyx_pw_8rasterio_5_base_11DatasetBase_11_nodatavals_3__set__(o, v);
39641   }
39642   else {
39643     return __pyx_pw_8rasterio_5_base_11DatasetBase_11_nodatavals_5__del__(o);
39644   }
39645 }
39646 
__pyx_getprop_8rasterio_5_base_11DatasetBase__units(PyObject * o,CYTHON_UNUSED void * x)39647 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__units(PyObject *o, CYTHON_UNUSED void *x) {
39648   return __pyx_pw_8rasterio_5_base_11DatasetBase_6_units_1__get__(o);
39649 }
39650 
__pyx_setprop_8rasterio_5_base_11DatasetBase__units(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39651 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__units(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39652   if (v) {
39653     return __pyx_pw_8rasterio_5_base_11DatasetBase_6_units_3__set__(o, v);
39654   }
39655   else {
39656     return __pyx_pw_8rasterio_5_base_11DatasetBase_6_units_5__del__(o);
39657   }
39658 }
39659 
__pyx_getprop_8rasterio_5_base_11DatasetBase__descriptions(PyObject * o,CYTHON_UNUSED void * x)39660 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__descriptions(PyObject *o, CYTHON_UNUSED void *x) {
39661   return __pyx_pw_8rasterio_5_base_11DatasetBase_13_descriptions_1__get__(o);
39662 }
39663 
__pyx_setprop_8rasterio_5_base_11DatasetBase__descriptions(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39664 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__descriptions(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39665   if (v) {
39666     return __pyx_pw_8rasterio_5_base_11DatasetBase_13_descriptions_3__set__(o, v);
39667   }
39668   else {
39669     return __pyx_pw_8rasterio_5_base_11DatasetBase_13_descriptions_5__del__(o);
39670   }
39671 }
39672 
__pyx_getprop_8rasterio_5_base_11DatasetBase__scales(PyObject * o,CYTHON_UNUSED void * x)39673 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__scales(PyObject *o, CYTHON_UNUSED void *x) {
39674   return __pyx_pw_8rasterio_5_base_11DatasetBase_7_scales_1__get__(o);
39675 }
39676 
__pyx_setprop_8rasterio_5_base_11DatasetBase__scales(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39677 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__scales(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39678   if (v) {
39679     return __pyx_pw_8rasterio_5_base_11DatasetBase_7_scales_3__set__(o, v);
39680   }
39681   else {
39682     return __pyx_pw_8rasterio_5_base_11DatasetBase_7_scales_5__del__(o);
39683   }
39684 }
39685 
__pyx_getprop_8rasterio_5_base_11DatasetBase__offsets(PyObject * o,CYTHON_UNUSED void * x)39686 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__offsets(PyObject *o, CYTHON_UNUSED void *x) {
39687   return __pyx_pw_8rasterio_5_base_11DatasetBase_8_offsets_1__get__(o);
39688 }
39689 
__pyx_setprop_8rasterio_5_base_11DatasetBase__offsets(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39690 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__offsets(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39691   if (v) {
39692     return __pyx_pw_8rasterio_5_base_11DatasetBase_8_offsets_3__set__(o, v);
39693   }
39694   else {
39695     return __pyx_pw_8rasterio_5_base_11DatasetBase_8_offsets_5__del__(o);
39696   }
39697 }
39698 
__pyx_getprop_8rasterio_5_base_11DatasetBase__read(PyObject * o,CYTHON_UNUSED void * x)39699 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__read(PyObject *o, CYTHON_UNUSED void *x) {
39700   return __pyx_pw_8rasterio_5_base_11DatasetBase_5_read_1__get__(o);
39701 }
39702 
__pyx_setprop_8rasterio_5_base_11DatasetBase__read(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39703 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__read(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39704   if (v) {
39705     return __pyx_pw_8rasterio_5_base_11DatasetBase_5_read_3__set__(o, v);
39706   }
39707   else {
39708     return __pyx_pw_8rasterio_5_base_11DatasetBase_5_read_5__del__(o);
39709   }
39710 }
39711 
__pyx_getprop_8rasterio_5_base_11DatasetBase__gcps(PyObject * o,CYTHON_UNUSED void * x)39712 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__gcps(PyObject *o, CYTHON_UNUSED void *x) {
39713   return __pyx_pw_8rasterio_5_base_11DatasetBase_5_gcps_1__get__(o);
39714 }
39715 
__pyx_setprop_8rasterio_5_base_11DatasetBase__gcps(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39716 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__gcps(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39717   if (v) {
39718     return __pyx_pw_8rasterio_5_base_11DatasetBase_5_gcps_3__set__(o, v);
39719   }
39720   else {
39721     return __pyx_pw_8rasterio_5_base_11DatasetBase_5_gcps_5__del__(o);
39722   }
39723 }
39724 
__pyx_getprop_8rasterio_5_base_11DatasetBase__rpcs(PyObject * o,CYTHON_UNUSED void * x)39725 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__rpcs(PyObject *o, CYTHON_UNUSED void *x) {
39726   return __pyx_pw_8rasterio_5_base_11DatasetBase_5_rpcs_1__get__(o);
39727 }
39728 
__pyx_setprop_8rasterio_5_base_11DatasetBase__rpcs(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39729 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__rpcs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39730   if (v) {
39731     return __pyx_pw_8rasterio_5_base_11DatasetBase_5_rpcs_3__set__(o, v);
39732   }
39733   else {
39734     return __pyx_pw_8rasterio_5_base_11DatasetBase_5_rpcs_5__del__(o);
39735   }
39736 }
39737 
__pyx_getprop_8rasterio_5_base_11DatasetBase__env(PyObject * o,CYTHON_UNUSED void * x)39738 static PyObject *__pyx_getprop_8rasterio_5_base_11DatasetBase__env(PyObject *o, CYTHON_UNUSED void *x) {
39739   return __pyx_pw_8rasterio_5_base_11DatasetBase_4_env_1__get__(o);
39740 }
39741 
__pyx_setprop_8rasterio_5_base_11DatasetBase__env(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)39742 static int __pyx_setprop_8rasterio_5_base_11DatasetBase__env(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
39743   if (v) {
39744     return __pyx_pw_8rasterio_5_base_11DatasetBase_4_env_3__set__(o, v);
39745   }
39746   else {
39747     return __pyx_pw_8rasterio_5_base_11DatasetBase_4_env_5__del__(o);
39748   }
39749 }
39750 
39751 static PyMethodDef __pyx_methods_8rasterio_5_base_DatasetBase[] = {
39752   {"_set_attrs_from_dataset_handle", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_5_set_attrs_from_dataset_handle, METH_NOARGS, 0},
39753   {"_has_band", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_7_has_band, METH_O, 0},
39754   {"_handle_crswkt", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_9_handle_crswkt, METH_O, __pyx_doc_8rasterio_5_base_11DatasetBase_8_handle_crswkt},
39755   {"_has_gcps_or_rpcs", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_11_has_gcps_or_rpcs, METH_NOARGS, __pyx_doc_8rasterio_5_base_11DatasetBase_10_has_gcps_or_rpcs},
39756   {"read_crs", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_13read_crs, METH_NOARGS, __pyx_doc_8rasterio_5_base_11DatasetBase_12read_crs},
39757   {"read_transform", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_15read_transform, METH_NOARGS, __pyx_doc_8rasterio_5_base_11DatasetBase_14read_transform},
39758   {"start", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_17start, METH_NOARGS, __pyx_doc_8rasterio_5_base_11DatasetBase_16start},
39759   {"stop", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_19stop, METH_NOARGS, __pyx_doc_8rasterio_5_base_11DatasetBase_18stop},
39760   {"close", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_21close, METH_NOARGS, __pyx_doc_8rasterio_5_base_11DatasetBase_20close},
39761   {"__enter__", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_23__enter__, METH_NOARGS, 0},
39762   {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8rasterio_5_base_11DatasetBase_25__exit__, METH_VARARGS|METH_KEYWORDS, 0},
39763   {"get_nodatavals", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_29get_nodatavals, METH_NOARGS, 0},
39764   {"_set_nodatavals", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_31_set_nodatavals, METH_O, 0},
39765   {"_mask_flags", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_33_mask_flags, METH_NOARGS, __pyx_doc_8rasterio_5_base_11DatasetBase_32_mask_flags},
39766   {"_set_crs", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_35_set_crs, METH_O, 0},
39767   {"_set_all_descriptions", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_37_set_all_descriptions, METH_O, 0},
39768   {"_set_all_scales", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_39_set_all_scales, METH_O, 0},
39769   {"_set_all_offsets", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_41_set_all_offsets, METH_O, 0},
39770   {"_set_all_units", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_43_set_all_units, METH_O, 0},
39771   {"write_transform", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_45write_transform, METH_O, 0},
39772   {"block_window", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8rasterio_5_base_11DatasetBase_47block_window, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8rasterio_5_base_11DatasetBase_46block_window},
39773   {"block_size", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8rasterio_5_base_11DatasetBase_49block_size, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8rasterio_5_base_11DatasetBase_48block_size},
39774   {"block_windows", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8rasterio_5_base_11DatasetBase_51block_windows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8rasterio_5_base_11DatasetBase_50block_windows},
39775   {"lnglat", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_54lnglat, METH_NOARGS, 0},
39776   {"_get_crs", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_56_get_crs, METH_NOARGS, 0},
39777   {"get_transform", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_58get_transform, METH_NOARGS, __pyx_doc_8rasterio_5_base_11DatasetBase_57get_transform},
39778   {"tag_namespaces", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8rasterio_5_base_11DatasetBase_60tag_namespaces, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8rasterio_5_base_11DatasetBase_59tag_namespaces},
39779   {"tags", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8rasterio_5_base_11DatasetBase_62tags, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8rasterio_5_base_11DatasetBase_61tags},
39780   {"get_tag_item", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8rasterio_5_base_11DatasetBase_64get_tag_item, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8rasterio_5_base_11DatasetBase_63get_tag_item},
39781   {"colormap", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_66colormap, METH_O, __pyx_doc_8rasterio_5_base_11DatasetBase_65colormap},
39782   {"overviews", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_68overviews, METH_O, 0},
39783   {"checksum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8rasterio_5_base_11DatasetBase_70checksum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8rasterio_5_base_11DatasetBase_69checksum},
39784   {"get_gcps", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_72get_gcps, METH_NOARGS, __pyx_doc_8rasterio_5_base_11DatasetBase_71get_gcps},
39785   {"_set_gcps", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_74_set_gcps, METH_O, 0},
39786   {"_get_rpcs", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_76_get_rpcs, METH_NOARGS, __pyx_doc_8rasterio_5_base_11DatasetBase_75_get_rpcs},
39787   {"_set_rpcs", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_78_set_rpcs, METH_O, 0},
39788   {"__reduce_cython__", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_80__reduce_cython__, METH_NOARGS, 0},
39789   {"__setstate_cython__", (PyCFunction)__pyx_pw_8rasterio_5_base_11DatasetBase_82__setstate_cython__, METH_O, 0},
39790   {0, 0, 0, 0}
39791 };
39792 
39793 static struct PyGetSetDef __pyx_getsets_8rasterio_5_base_DatasetBase[] = {
39794   {(char *)"closed", __pyx_getprop_8rasterio_5_base_11DatasetBase_closed, 0, (char *)"Test if the dataset is closed\n\n        Returns\n        -------\n        bool\n        ", 0},
39795   {(char *)"count", __pyx_getprop_8rasterio_5_base_11DatasetBase_count, 0, (char *)"The number of raster bands in the dataset\n\n        Returns\n        -------\n        int\n        ", 0},
39796   {(char *)"indexes", __pyx_getprop_8rasterio_5_base_11DatasetBase_indexes, 0, (char *)"The 1-based indexes of each band in the dataset\n\n        For a 3-band dataset, this property will be ``[1, 2, 3]``.\n\n        Returns\n        -------\n        list of int\n        ", 0},
39797   {(char *)"dtypes", __pyx_getprop_8rasterio_5_base_11DatasetBase_dtypes, 0, (char *)"The data types of each band in index order\n\n        Returns\n        -------\n        list of str\n        ", 0},
39798   {(char *)"block_shapes", __pyx_getprop_8rasterio_5_base_11DatasetBase_block_shapes, 0, (char *)"An ordered list of block shapes for each bands\n\n        Shapes are tuples and have the same ordering as the dataset's\n        shape: (count of image rows, count of image columns).\n\n        Returns\n        -------\n        list\n        ", 0},
39799   {(char *)"nodatavals", __pyx_getprop_8rasterio_5_base_11DatasetBase_nodatavals, 0, (char *)"Nodata values for each band\n\n        Notes\n        -----\n        This may not be set.\n\n        Returns\n        -------\n        list of float\n        ", 0},
39800   {(char *)"nodata", __pyx_getprop_8rasterio_5_base_11DatasetBase_nodata, __pyx_setprop_8rasterio_5_base_11DatasetBase_nodata, (char *)"The dataset's single nodata value\n\n        Notes\n        -----\n        May be set.\n\n        Returns\n        -------\n        float\n        ", 0},
39801   {(char *)"mask_flag_enums", __pyx_getprop_8rasterio_5_base_11DatasetBase_mask_flag_enums, 0, (char *)"Sets of flags describing the sources of band masks.\n\n        all_valid: There are no invalid pixels, all mask values will be\n            255. When used this will normally be the only flag set.\n        per_dataset: The mask band is shared between all bands on the\n            dataset.\n        alpha: The mask band is actually an alpha band and may have\n            values other than 0 and 255.\n        nodata: Indicates the mask is actually being generated from\n            nodata values (mutually exclusive of \"alpha\").\n\n        Returns\n        -------\n        list [, list*]\n            One list of rasterio.enums.MaskFlags members per band.\n\n        Examples\n        --------\n\n        For a 3 band dataset that has masks derived from nodata values:\n\n        >>> dataset.mask_flag_enums\n        ([<MaskFlags.nodata: 8>], [<MaskFlags.nodata: 8>], [<MaskFlags.nodata: 8>])\n        >>> band1_flags = dataset.mask_flag_enums[0]\n        >>> rasterio.enums.MaskFlags.nodata in band1_flags\n        True\n        >>> rasterio.enums.MaskFlags.alpha in band1_flags\n        False\n        ", 0},
39802   {(char *)"crs", __pyx_getprop_8rasterio_5_base_11DatasetBase_crs, __pyx_setprop_8rasterio_5_base_11DatasetBase_crs, (char *)"The dataset's coordinate reference system\n\n        In setting this property, the value may be a CRS object or an\n        EPSG:nnnn or WKT string.\n\n        Returns\n        -------\n        CRS\n        ", 0},
39803   {(char *)"descriptions", __pyx_getprop_8rasterio_5_base_11DatasetBase_descriptions, __pyx_setprop_8rasterio_5_base_11DatasetBase_descriptions, (char *)"Descriptions for each dataset band\n\n        To set descriptions, one for each band is required.\n\n        Returns\n        -------\n        list of str\n        ", 0},
39804   {(char *)"transform", __pyx_getprop_8rasterio_5_base_11DatasetBase_transform, __pyx_setprop_8rasterio_5_base_11DatasetBase_transform, (char *)"The dataset's georeferencing transformation matrix\n\n        This transform maps pixel row/column coordinates to coordinates\n        in the dataset's coordinate reference system.\n\n        Returns\n        -------\n        Affine\n        ", 0},
39805   {(char *)"offsets", __pyx_getprop_8rasterio_5_base_11DatasetBase_offsets, __pyx_setprop_8rasterio_5_base_11DatasetBase_offsets, (char *)"Raster offset for each dataset band\n\n        To set offsets, one for each band is required.\n\n        Returns\n        -------\n        list of float\n        ", 0},
39806   {(char *)"scales", __pyx_getprop_8rasterio_5_base_11DatasetBase_scales, __pyx_setprop_8rasterio_5_base_11DatasetBase_scales, (char *)"Raster scale for each dataset band\n\n        To set scales, one for each band is required.\n\n        Returns\n        -------\n        list of float\n        ", 0},
39807   {(char *)"units", __pyx_getprop_8rasterio_5_base_11DatasetBase_units, __pyx_setprop_8rasterio_5_base_11DatasetBase_units, (char *)"A list of str: one units string for each dataset band\n\n        Possible values include 'meters' or 'degC'. See the Pint\n        project for a suggested list of units.\n\n        To set units, one for each band is required.\n\n        Returns\n        -------\n        list of str\n        ", 0},
39808   {(char *)"bounds", __pyx_getprop_8rasterio_5_base_11DatasetBase_bounds, 0, (char *)"Returns the lower left and upper right bounds of the dataset\n        in the units of its coordinate reference system.\n\n        The returned value is a tuple:\n        (lower left x, lower left y, upper right x, upper right y)\n        ", 0},
39809   {(char *)"res", __pyx_getprop_8rasterio_5_base_11DatasetBase_res, 0, (char *)"Returns the (width, height) of pixels in the units of its\n        coordinate reference system.", 0},
39810   {(char *)"meta", __pyx_getprop_8rasterio_5_base_11DatasetBase_meta, 0, (char *)"The basic metadata of this dataset.", 0},
39811   {(char *)"compression", __pyx_getprop_8rasterio_5_base_11DatasetBase_compression, 0, (char *)0, 0},
39812   {(char *)"interleaving", __pyx_getprop_8rasterio_5_base_11DatasetBase_interleaving, 0, (char *)0, 0},
39813   {(char *)"photometric", __pyx_getprop_8rasterio_5_base_11DatasetBase_photometric, 0, (char *)0, 0},
39814   {(char *)"is_tiled", __pyx_getprop_8rasterio_5_base_11DatasetBase_is_tiled, 0, (char *)0, 0},
39815   {(char *)"profile", __pyx_getprop_8rasterio_5_base_11DatasetBase_profile, 0, (char *)"Basic metadata and creation options of this dataset.\n\n        May be passed as keyword arguments to `rasterio.open()` to\n        create a clone of this dataset.\n        ", 0},
39816   {(char *)"subdatasets", __pyx_getprop_8rasterio_5_base_11DatasetBase_subdatasets, 0, (char *)"Sequence of subdatasets", 0},
39817   {(char *)"colorinterp", __pyx_getprop_8rasterio_5_base_11DatasetBase_colorinterp, __pyx_setprop_8rasterio_5_base_11DatasetBase_colorinterp, (char *)"Returns a sequence of ``ColorInterp.<enum>`` representing\n        color interpretation in band order.\n\n        To set color interpretation, provide a sequence of\n        ``ColorInterp.<enum>``:\n\n            import rasterio\n            from rasterio.enums import ColorInterp\n\n            with rasterio.open('rgba.tif', 'r+') as src:\n                src.colorinterp = (\n                    ColorInterp.red,\n                    ColorInterp.green,\n                    ColorInterp.blue,\n                    ColorInterp.alpha)\n\n        Returns\n        -------\n        tuple\n        ", 0},
39818   {(char *)"gcps", __pyx_getprop_8rasterio_5_base_11DatasetBase_gcps, __pyx_setprop_8rasterio_5_base_11DatasetBase_gcps, (char *)"ground control points and their coordinate reference system.\n\n        This property is a 2-tuple, or pair: (gcps, crs).\n\n        gcps : list of GroundControlPoint\n            Zero or more ground control points.\n        crs: CRS\n            The coordinate reference system of the ground control points.\n        ", 0},
39819   {(char *)"rpcs", __pyx_getprop_8rasterio_5_base_11DatasetBase_rpcs, __pyx_setprop_8rasterio_5_base_11DatasetBase_rpcs, (char *)"Rational polynomial coefficients mapping between pixel and geodetic coordinates.\n\n        This property is a dict-like object.\n\n        rpcs : RPC instance containing coefficients. Empty if dataset does not have any\n        metadata in the \"RPC\" domain.\n        ", 0},
39820   {(char *)"files", __pyx_getprop_8rasterio_5_base_11DatasetBase_files, 0, (char *)"Returns a sequence of files associated with the dataset.\n\n        Returns\n        -------\n        tuple\n        ", 0},
39821   {(char *)"name", __pyx_getprop_8rasterio_5_base_11DatasetBase_name, 0, (char *)0, 0},
39822   {(char *)"mode", __pyx_getprop_8rasterio_5_base_11DatasetBase_mode, 0, (char *)0, 0},
39823   {(char *)"options", __pyx_getprop_8rasterio_5_base_11DatasetBase_options, 0, (char *)0, 0},
39824   {(char *)"width", __pyx_getprop_8rasterio_5_base_11DatasetBase_width, 0, (char *)0, 0},
39825   {(char *)"height", __pyx_getprop_8rasterio_5_base_11DatasetBase_height, 0, (char *)0, 0},
39826   {(char *)"shape", __pyx_getprop_8rasterio_5_base_11DatasetBase_shape, 0, (char *)0, 0},
39827   {(char *)"driver", __pyx_getprop_8rasterio_5_base_11DatasetBase_driver, __pyx_setprop_8rasterio_5_base_11DatasetBase_driver, (char *)0, 0},
39828   {(char *)"_count", __pyx_getprop_8rasterio_5_base_11DatasetBase__count, __pyx_setprop_8rasterio_5_base_11DatasetBase__count, (char *)0, 0},
39829   {(char *)"_dtypes", __pyx_getprop_8rasterio_5_base_11DatasetBase__dtypes, __pyx_setprop_8rasterio_5_base_11DatasetBase__dtypes, (char *)0, 0},
39830   {(char *)"_closed", __pyx_getprop_8rasterio_5_base_11DatasetBase__closed, __pyx_setprop_8rasterio_5_base_11DatasetBase__closed, (char *)0, 0},
39831   {(char *)"_crs", __pyx_getprop_8rasterio_5_base_11DatasetBase__crs, __pyx_setprop_8rasterio_5_base_11DatasetBase__crs, (char *)0, 0},
39832   {(char *)"_crs_wkt", __pyx_getprop_8rasterio_5_base_11DatasetBase__crs_wkt, __pyx_setprop_8rasterio_5_base_11DatasetBase__crs_wkt, (char *)0, 0},
39833   {(char *)"_transform", __pyx_getprop_8rasterio_5_base_11DatasetBase__transform, __pyx_setprop_8rasterio_5_base_11DatasetBase__transform, (char *)0, 0},
39834   {(char *)"_block_shapes", __pyx_getprop_8rasterio_5_base_11DatasetBase__block_shapes, __pyx_setprop_8rasterio_5_base_11DatasetBase__block_shapes, (char *)0, 0},
39835   {(char *)"_nodatavals", __pyx_getprop_8rasterio_5_base_11DatasetBase__nodatavals, __pyx_setprop_8rasterio_5_base_11DatasetBase__nodatavals, (char *)0, 0},
39836   {(char *)"_units", __pyx_getprop_8rasterio_5_base_11DatasetBase__units, __pyx_setprop_8rasterio_5_base_11DatasetBase__units, (char *)0, 0},
39837   {(char *)"_descriptions", __pyx_getprop_8rasterio_5_base_11DatasetBase__descriptions, __pyx_setprop_8rasterio_5_base_11DatasetBase__descriptions, (char *)0, 0},
39838   {(char *)"_scales", __pyx_getprop_8rasterio_5_base_11DatasetBase__scales, __pyx_setprop_8rasterio_5_base_11DatasetBase__scales, (char *)0, 0},
39839   {(char *)"_offsets", __pyx_getprop_8rasterio_5_base_11DatasetBase__offsets, __pyx_setprop_8rasterio_5_base_11DatasetBase__offsets, (char *)0, 0},
39840   {(char *)"_read", __pyx_getprop_8rasterio_5_base_11DatasetBase__read, __pyx_setprop_8rasterio_5_base_11DatasetBase__read, (char *)0, 0},
39841   {(char *)"_gcps", __pyx_getprop_8rasterio_5_base_11DatasetBase__gcps, __pyx_setprop_8rasterio_5_base_11DatasetBase__gcps, (char *)0, 0},
39842   {(char *)"_rpcs", __pyx_getprop_8rasterio_5_base_11DatasetBase__rpcs, __pyx_setprop_8rasterio_5_base_11DatasetBase__rpcs, (char *)0, 0},
39843   {(char *)"_env", __pyx_getprop_8rasterio_5_base_11DatasetBase__env, __pyx_setprop_8rasterio_5_base_11DatasetBase__env, (char *)0, 0},
39844   {0, 0, 0, 0, 0}
39845 };
39846 
39847 static PyTypeObject __pyx_type_8rasterio_5_base_DatasetBase = {
39848   PyVarObject_HEAD_INIT(0, 0)
39849   "rasterio._base.DatasetBase", /*tp_name*/
39850   sizeof(struct __pyx_obj_8rasterio_5_base_DatasetBase), /*tp_basicsize*/
39851   0, /*tp_itemsize*/
39852   __pyx_tp_dealloc_8rasterio_5_base_DatasetBase, /*tp_dealloc*/
39853   #if PY_VERSION_HEX < 0x030800b4
39854   0, /*tp_print*/
39855   #endif
39856   #if PY_VERSION_HEX >= 0x030800b4
39857   0, /*tp_vectorcall_offset*/
39858   #endif
39859   0, /*tp_getattr*/
39860   0, /*tp_setattr*/
39861   #if PY_MAJOR_VERSION < 3
39862   0, /*tp_compare*/
39863   #endif
39864   #if PY_MAJOR_VERSION >= 3
39865   0, /*tp_as_async*/
39866   #endif
39867   __pyx_pw_8rasterio_5_base_11DatasetBase_3__repr__, /*tp_repr*/
39868   0, /*tp_as_number*/
39869   0, /*tp_as_sequence*/
39870   0, /*tp_as_mapping*/
39871   0, /*tp_hash*/
39872   0, /*tp_call*/
39873   0, /*tp_str*/
39874   0, /*tp_getattro*/
39875   0, /*tp_setattro*/
39876   0, /*tp_as_buffer*/
39877   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
39878   "Dataset base class\n\n    Attributes\n    ----------\n    block_shapes\n    bounds\n    closed\n    colorinterp\n    count\n    crs\n    descriptions\n    files\n    gcps\n    rpcs\n    indexes\n    mask_flag_enums\n    meta\n    nodata\n    nodatavals\n    profile\n    res\n    subdatasets\n    transform\n    units\n    compression : str\n        Compression algorithm's short name\n    driver : str\n        Format driver used to open the dataset\n    interleaving : str\n        'pixel' or 'band'\n    kwds : dict\n        Stored creation option tags\n    mode : str\n        Access mode\n    name : str\n        Remote or local dataset name\n    options : dict\n        Copy of opening options\n    photometric : str\n        Photometric interpretation's short name\n    ", /*tp_doc*/
39879   __pyx_tp_traverse_8rasterio_5_base_DatasetBase, /*tp_traverse*/
39880   __pyx_tp_clear_8rasterio_5_base_DatasetBase, /*tp_clear*/
39881   0, /*tp_richcompare*/
39882   0, /*tp_weaklistoffset*/
39883   0, /*tp_iter*/
39884   0, /*tp_iternext*/
39885   __pyx_methods_8rasterio_5_base_DatasetBase, /*tp_methods*/
39886   0, /*tp_members*/
39887   __pyx_getsets_8rasterio_5_base_DatasetBase, /*tp_getset*/
39888   0, /*tp_base*/
39889   0, /*tp_dict*/
39890   0, /*tp_descr_get*/
39891   0, /*tp_descr_set*/
39892   0, /*tp_dictoffset*/
39893   __pyx_pw_8rasterio_5_base_11DatasetBase_1__init__, /*tp_init*/
39894   0, /*tp_alloc*/
39895   __pyx_tp_new_8rasterio_5_base_DatasetBase, /*tp_new*/
39896   0, /*tp_free*/
39897   0, /*tp_is_gc*/
39898   0, /*tp_bases*/
39899   0, /*tp_mro*/
39900   0, /*tp_cache*/
39901   0, /*tp_subclasses*/
39902   0, /*tp_weaklist*/
39903   0, /*tp_del*/
39904   0, /*tp_version_tag*/
39905   #if PY_VERSION_HEX >= 0x030400a1
39906   0, /*tp_finalize*/
39907   #endif
39908   #if PY_VERSION_HEX >= 0x030800b1
39909   0, /*tp_vectorcall*/
39910   #endif
39911   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
39912   0, /*tp_print*/
39913   #endif
39914 };
39915 
39916 static struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags *__pyx_freelist_8rasterio_5_base___pyx_scope_struct___mask_flags[8];
39917 static int __pyx_freecount_8rasterio_5_base___pyx_scope_struct___mask_flags = 0;
39918 
__pyx_tp_new_8rasterio_5_base___pyx_scope_struct___mask_flags(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)39919 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct___mask_flags(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
39920   PyObject *o;
39921   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8rasterio_5_base___pyx_scope_struct___mask_flags > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags)))) {
39922     o = (PyObject*)__pyx_freelist_8rasterio_5_base___pyx_scope_struct___mask_flags[--__pyx_freecount_8rasterio_5_base___pyx_scope_struct___mask_flags];
39923     memset(o, 0, sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags));
39924     (void) PyObject_INIT(o, t);
39925     PyObject_GC_Track(o);
39926   } else {
39927     o = (*t->tp_alloc)(t, 0);
39928     if (unlikely(!o)) return 0;
39929   }
39930   return o;
39931 }
39932 
__pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct___mask_flags(PyObject * o)39933 static void __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct___mask_flags(PyObject *o) {
39934   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags *)o;
39935   PyObject_GC_UnTrack(o);
39936   Py_CLEAR(p->__pyx_v_self);
39937   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8rasterio_5_base___pyx_scope_struct___mask_flags < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags)))) {
39938     __pyx_freelist_8rasterio_5_base___pyx_scope_struct___mask_flags[__pyx_freecount_8rasterio_5_base___pyx_scope_struct___mask_flags++] = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags *)o);
39939   } else {
39940     (*Py_TYPE(o)->tp_free)(o);
39941   }
39942 }
39943 
__pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct___mask_flags(PyObject * o,visitproc v,void * a)39944 static int __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct___mask_flags(PyObject *o, visitproc v, void *a) {
39945   int e;
39946   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags *)o;
39947   if (p->__pyx_v_self) {
39948     e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
39949   }
39950   return 0;
39951 }
39952 
__pyx_tp_clear_8rasterio_5_base___pyx_scope_struct___mask_flags(PyObject * o)39953 static int __pyx_tp_clear_8rasterio_5_base___pyx_scope_struct___mask_flags(PyObject *o) {
39954   PyObject* tmp;
39955   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags *)o;
39956   tmp = ((PyObject*)p->__pyx_v_self);
39957   p->__pyx_v_self = ((struct __pyx_obj_8rasterio_5_base_DatasetBase *)Py_None); Py_INCREF(Py_None);
39958   Py_XDECREF(tmp);
39959   return 0;
39960 }
39961 
39962 static PyTypeObject __pyx_type_8rasterio_5_base___pyx_scope_struct___mask_flags = {
39963   PyVarObject_HEAD_INIT(0, 0)
39964   "rasterio._base.__pyx_scope_struct___mask_flags", /*tp_name*/
39965   sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct___mask_flags), /*tp_basicsize*/
39966   0, /*tp_itemsize*/
39967   __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct___mask_flags, /*tp_dealloc*/
39968   #if PY_VERSION_HEX < 0x030800b4
39969   0, /*tp_print*/
39970   #endif
39971   #if PY_VERSION_HEX >= 0x030800b4
39972   0, /*tp_vectorcall_offset*/
39973   #endif
39974   0, /*tp_getattr*/
39975   0, /*tp_setattr*/
39976   #if PY_MAJOR_VERSION < 3
39977   0, /*tp_compare*/
39978   #endif
39979   #if PY_MAJOR_VERSION >= 3
39980   0, /*tp_as_async*/
39981   #endif
39982   0, /*tp_repr*/
39983   0, /*tp_as_number*/
39984   0, /*tp_as_sequence*/
39985   0, /*tp_as_mapping*/
39986   0, /*tp_hash*/
39987   0, /*tp_call*/
39988   0, /*tp_str*/
39989   0, /*tp_getattro*/
39990   0, /*tp_setattro*/
39991   0, /*tp_as_buffer*/
39992   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
39993   0, /*tp_doc*/
39994   __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct___mask_flags, /*tp_traverse*/
39995   __pyx_tp_clear_8rasterio_5_base___pyx_scope_struct___mask_flags, /*tp_clear*/
39996   0, /*tp_richcompare*/
39997   0, /*tp_weaklistoffset*/
39998   0, /*tp_iter*/
39999   0, /*tp_iternext*/
40000   0, /*tp_methods*/
40001   0, /*tp_members*/
40002   0, /*tp_getset*/
40003   0, /*tp_base*/
40004   0, /*tp_dict*/
40005   0, /*tp_descr_get*/
40006   0, /*tp_descr_set*/
40007   0, /*tp_dictoffset*/
40008   0, /*tp_init*/
40009   0, /*tp_alloc*/
40010   __pyx_tp_new_8rasterio_5_base___pyx_scope_struct___mask_flags, /*tp_new*/
40011   0, /*tp_free*/
40012   0, /*tp_is_gc*/
40013   0, /*tp_bases*/
40014   0, /*tp_mro*/
40015   0, /*tp_cache*/
40016   0, /*tp_subclasses*/
40017   0, /*tp_weaklist*/
40018   0, /*tp_del*/
40019   0, /*tp_version_tag*/
40020   #if PY_VERSION_HEX >= 0x030400a1
40021   0, /*tp_finalize*/
40022   #endif
40023   #if PY_VERSION_HEX >= 0x030800b1
40024   0, /*tp_vectorcall*/
40025   #endif
40026   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
40027   0, /*tp_print*/
40028   #endif
40029 };
40030 
40031 static struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr *__pyx_freelist_8rasterio_5_base___pyx_scope_struct_1_genexpr[8];
40032 static int __pyx_freecount_8rasterio_5_base___pyx_scope_struct_1_genexpr = 0;
40033 
__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_1_genexpr(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)40034 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
40035   PyObject *o;
40036   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr)))) {
40037     o = (PyObject*)__pyx_freelist_8rasterio_5_base___pyx_scope_struct_1_genexpr[--__pyx_freecount_8rasterio_5_base___pyx_scope_struct_1_genexpr];
40038     memset(o, 0, sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr));
40039     (void) PyObject_INIT(o, t);
40040     PyObject_GC_Track(o);
40041   } else {
40042     o = (*t->tp_alloc)(t, 0);
40043     if (unlikely(!o)) return 0;
40044   }
40045   return o;
40046 }
40047 
__pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_1_genexpr(PyObject * o)40048 static void __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_1_genexpr(PyObject *o) {
40049   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr *)o;
40050   PyObject_GC_UnTrack(o);
40051   Py_CLEAR(p->__pyx_outer_scope);
40052   Py_CLEAR(p->__pyx_v_j);
40053   Py_CLEAR(p->__pyx_t_0);
40054   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr)))) {
40055     __pyx_freelist_8rasterio_5_base___pyx_scope_struct_1_genexpr[__pyx_freecount_8rasterio_5_base___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr *)o);
40056   } else {
40057     (*Py_TYPE(o)->tp_free)(o);
40058   }
40059 }
40060 
__pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_1_genexpr(PyObject * o,visitproc v,void * a)40061 static int __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
40062   int e;
40063   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr *)o;
40064   if (p->__pyx_outer_scope) {
40065     e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
40066   }
40067   if (p->__pyx_v_j) {
40068     e = (*v)(p->__pyx_v_j, a); if (e) return e;
40069   }
40070   if (p->__pyx_t_0) {
40071     e = (*v)(p->__pyx_t_0, a); if (e) return e;
40072   }
40073   return 0;
40074 }
40075 
40076 static PyTypeObject __pyx_type_8rasterio_5_base___pyx_scope_struct_1_genexpr = {
40077   PyVarObject_HEAD_INIT(0, 0)
40078   "rasterio._base.__pyx_scope_struct_1_genexpr", /*tp_name*/
40079   sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
40080   0, /*tp_itemsize*/
40081   __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
40082   #if PY_VERSION_HEX < 0x030800b4
40083   0, /*tp_print*/
40084   #endif
40085   #if PY_VERSION_HEX >= 0x030800b4
40086   0, /*tp_vectorcall_offset*/
40087   #endif
40088   0, /*tp_getattr*/
40089   0, /*tp_setattr*/
40090   #if PY_MAJOR_VERSION < 3
40091   0, /*tp_compare*/
40092   #endif
40093   #if PY_MAJOR_VERSION >= 3
40094   0, /*tp_as_async*/
40095   #endif
40096   0, /*tp_repr*/
40097   0, /*tp_as_number*/
40098   0, /*tp_as_sequence*/
40099   0, /*tp_as_mapping*/
40100   0, /*tp_hash*/
40101   0, /*tp_call*/
40102   0, /*tp_str*/
40103   0, /*tp_getattro*/
40104   0, /*tp_setattro*/
40105   0, /*tp_as_buffer*/
40106   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
40107   0, /*tp_doc*/
40108   __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_1_genexpr, /*tp_traverse*/
40109   0, /*tp_clear*/
40110   0, /*tp_richcompare*/
40111   0, /*tp_weaklistoffset*/
40112   0, /*tp_iter*/
40113   0, /*tp_iternext*/
40114   0, /*tp_methods*/
40115   0, /*tp_members*/
40116   0, /*tp_getset*/
40117   0, /*tp_base*/
40118   0, /*tp_dict*/
40119   0, /*tp_descr_get*/
40120   0, /*tp_descr_set*/
40121   0, /*tp_dictoffset*/
40122   0, /*tp_init*/
40123   0, /*tp_alloc*/
40124   __pyx_tp_new_8rasterio_5_base___pyx_scope_struct_1_genexpr, /*tp_new*/
40125   0, /*tp_free*/
40126   0, /*tp_is_gc*/
40127   0, /*tp_bases*/
40128   0, /*tp_mro*/
40129   0, /*tp_cache*/
40130   0, /*tp_subclasses*/
40131   0, /*tp_weaklist*/
40132   0, /*tp_del*/
40133   0, /*tp_version_tag*/
40134   #if PY_VERSION_HEX >= 0x030400a1
40135   0, /*tp_finalize*/
40136   #endif
40137   #if PY_VERSION_HEX >= 0x030800b1
40138   0, /*tp_vectorcall*/
40139   #endif
40140   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
40141   0, /*tp_print*/
40142   #endif
40143 };
40144 
40145 static struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__ *__pyx_freelist_8rasterio_5_base___pyx_scope_struct_2___get__[8];
40146 static int __pyx_freecount_8rasterio_5_base___pyx_scope_struct_2___get__ = 0;
40147 
__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_2___get__(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)40148 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_2___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
40149   PyObject *o;
40150   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_2___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__)))) {
40151     o = (PyObject*)__pyx_freelist_8rasterio_5_base___pyx_scope_struct_2___get__[--__pyx_freecount_8rasterio_5_base___pyx_scope_struct_2___get__];
40152     memset(o, 0, sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__));
40153     (void) PyObject_INIT(o, t);
40154     PyObject_GC_Track(o);
40155   } else {
40156     o = (*t->tp_alloc)(t, 0);
40157     if (unlikely(!o)) return 0;
40158   }
40159   return o;
40160 }
40161 
__pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_2___get__(PyObject * o)40162 static void __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_2___get__(PyObject *o) {
40163   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__ *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__ *)o;
40164   PyObject_GC_UnTrack(o);
40165   Py_CLEAR(p->__pyx_v_self);
40166   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_2___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__)))) {
40167     __pyx_freelist_8rasterio_5_base___pyx_scope_struct_2___get__[__pyx_freecount_8rasterio_5_base___pyx_scope_struct_2___get__++] = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__ *)o);
40168   } else {
40169     (*Py_TYPE(o)->tp_free)(o);
40170   }
40171 }
40172 
__pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_2___get__(PyObject * o,visitproc v,void * a)40173 static int __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_2___get__(PyObject *o, visitproc v, void *a) {
40174   int e;
40175   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__ *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__ *)o;
40176   if (p->__pyx_v_self) {
40177     e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
40178   }
40179   return 0;
40180 }
40181 
__pyx_tp_clear_8rasterio_5_base___pyx_scope_struct_2___get__(PyObject * o)40182 static int __pyx_tp_clear_8rasterio_5_base___pyx_scope_struct_2___get__(PyObject *o) {
40183   PyObject* tmp;
40184   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__ *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__ *)o;
40185   tmp = ((PyObject*)p->__pyx_v_self);
40186   p->__pyx_v_self = ((struct __pyx_obj_8rasterio_5_base_DatasetBase *)Py_None); Py_INCREF(Py_None);
40187   Py_XDECREF(tmp);
40188   return 0;
40189 }
40190 
40191 static PyTypeObject __pyx_type_8rasterio_5_base___pyx_scope_struct_2___get__ = {
40192   PyVarObject_HEAD_INIT(0, 0)
40193   "rasterio._base.__pyx_scope_struct_2___get__", /*tp_name*/
40194   sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_2___get__), /*tp_basicsize*/
40195   0, /*tp_itemsize*/
40196   __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_2___get__, /*tp_dealloc*/
40197   #if PY_VERSION_HEX < 0x030800b4
40198   0, /*tp_print*/
40199   #endif
40200   #if PY_VERSION_HEX >= 0x030800b4
40201   0, /*tp_vectorcall_offset*/
40202   #endif
40203   0, /*tp_getattr*/
40204   0, /*tp_setattr*/
40205   #if PY_MAJOR_VERSION < 3
40206   0, /*tp_compare*/
40207   #endif
40208   #if PY_MAJOR_VERSION >= 3
40209   0, /*tp_as_async*/
40210   #endif
40211   0, /*tp_repr*/
40212   0, /*tp_as_number*/
40213   0, /*tp_as_sequence*/
40214   0, /*tp_as_mapping*/
40215   0, /*tp_hash*/
40216   0, /*tp_call*/
40217   0, /*tp_str*/
40218   0, /*tp_getattro*/
40219   0, /*tp_setattro*/
40220   0, /*tp_as_buffer*/
40221   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
40222   0, /*tp_doc*/
40223   __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_2___get__, /*tp_traverse*/
40224   __pyx_tp_clear_8rasterio_5_base___pyx_scope_struct_2___get__, /*tp_clear*/
40225   0, /*tp_richcompare*/
40226   0, /*tp_weaklistoffset*/
40227   0, /*tp_iter*/
40228   0, /*tp_iternext*/
40229   0, /*tp_methods*/
40230   0, /*tp_members*/
40231   0, /*tp_getset*/
40232   0, /*tp_base*/
40233   0, /*tp_dict*/
40234   0, /*tp_descr_get*/
40235   0, /*tp_descr_set*/
40236   0, /*tp_dictoffset*/
40237   0, /*tp_init*/
40238   0, /*tp_alloc*/
40239   __pyx_tp_new_8rasterio_5_base___pyx_scope_struct_2___get__, /*tp_new*/
40240   0, /*tp_free*/
40241   0, /*tp_is_gc*/
40242   0, /*tp_bases*/
40243   0, /*tp_mro*/
40244   0, /*tp_cache*/
40245   0, /*tp_subclasses*/
40246   0, /*tp_weaklist*/
40247   0, /*tp_del*/
40248   0, /*tp_version_tag*/
40249   #if PY_VERSION_HEX >= 0x030400a1
40250   0, /*tp_finalize*/
40251   #endif
40252   #if PY_VERSION_HEX >= 0x030800b1
40253   0, /*tp_vectorcall*/
40254   #endif
40255   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
40256   0, /*tp_print*/
40257   #endif
40258 };
40259 
40260 static struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr *__pyx_freelist_8rasterio_5_base___pyx_scope_struct_3_genexpr[8];
40261 static int __pyx_freecount_8rasterio_5_base___pyx_scope_struct_3_genexpr = 0;
40262 
__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_3_genexpr(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)40263 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
40264   PyObject *o;
40265   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr)))) {
40266     o = (PyObject*)__pyx_freelist_8rasterio_5_base___pyx_scope_struct_3_genexpr[--__pyx_freecount_8rasterio_5_base___pyx_scope_struct_3_genexpr];
40267     memset(o, 0, sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr));
40268     (void) PyObject_INIT(o, t);
40269     PyObject_GC_Track(o);
40270   } else {
40271     o = (*t->tp_alloc)(t, 0);
40272     if (unlikely(!o)) return 0;
40273   }
40274   return o;
40275 }
40276 
__pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_3_genexpr(PyObject * o)40277 static void __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_3_genexpr(PyObject *o) {
40278   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr *)o;
40279   PyObject_GC_UnTrack(o);
40280   Py_CLEAR(p->__pyx_outer_scope);
40281   Py_CLEAR(p->__pyx_8genexpr4__pyx_v_flag);
40282   Py_CLEAR(p->__pyx_v_x);
40283   Py_CLEAR(p->__pyx_t_0);
40284   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr)))) {
40285     __pyx_freelist_8rasterio_5_base___pyx_scope_struct_3_genexpr[__pyx_freecount_8rasterio_5_base___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr *)o);
40286   } else {
40287     (*Py_TYPE(o)->tp_free)(o);
40288   }
40289 }
40290 
__pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_3_genexpr(PyObject * o,visitproc v,void * a)40291 static int __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
40292   int e;
40293   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr *)o;
40294   if (p->__pyx_outer_scope) {
40295     e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
40296   }
40297   if (p->__pyx_8genexpr4__pyx_v_flag) {
40298     e = (*v)(p->__pyx_8genexpr4__pyx_v_flag, a); if (e) return e;
40299   }
40300   if (p->__pyx_v_x) {
40301     e = (*v)(p->__pyx_v_x, a); if (e) return e;
40302   }
40303   if (p->__pyx_t_0) {
40304     e = (*v)(p->__pyx_t_0, a); if (e) return e;
40305   }
40306   return 0;
40307 }
40308 
40309 static PyTypeObject __pyx_type_8rasterio_5_base___pyx_scope_struct_3_genexpr = {
40310   PyVarObject_HEAD_INIT(0, 0)
40311   "rasterio._base.__pyx_scope_struct_3_genexpr", /*tp_name*/
40312   sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
40313   0, /*tp_itemsize*/
40314   __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
40315   #if PY_VERSION_HEX < 0x030800b4
40316   0, /*tp_print*/
40317   #endif
40318   #if PY_VERSION_HEX >= 0x030800b4
40319   0, /*tp_vectorcall_offset*/
40320   #endif
40321   0, /*tp_getattr*/
40322   0, /*tp_setattr*/
40323   #if PY_MAJOR_VERSION < 3
40324   0, /*tp_compare*/
40325   #endif
40326   #if PY_MAJOR_VERSION >= 3
40327   0, /*tp_as_async*/
40328   #endif
40329   0, /*tp_repr*/
40330   0, /*tp_as_number*/
40331   0, /*tp_as_sequence*/
40332   0, /*tp_as_mapping*/
40333   0, /*tp_hash*/
40334   0, /*tp_call*/
40335   0, /*tp_str*/
40336   0, /*tp_getattro*/
40337   0, /*tp_setattro*/
40338   0, /*tp_as_buffer*/
40339   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
40340   0, /*tp_doc*/
40341   __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_3_genexpr, /*tp_traverse*/
40342   0, /*tp_clear*/
40343   0, /*tp_richcompare*/
40344   0, /*tp_weaklistoffset*/
40345   0, /*tp_iter*/
40346   0, /*tp_iternext*/
40347   0, /*tp_methods*/
40348   0, /*tp_members*/
40349   0, /*tp_getset*/
40350   0, /*tp_base*/
40351   0, /*tp_dict*/
40352   0, /*tp_descr_get*/
40353   0, /*tp_descr_set*/
40354   0, /*tp_dictoffset*/
40355   0, /*tp_init*/
40356   0, /*tp_alloc*/
40357   __pyx_tp_new_8rasterio_5_base___pyx_scope_struct_3_genexpr, /*tp_new*/
40358   0, /*tp_free*/
40359   0, /*tp_is_gc*/
40360   0, /*tp_bases*/
40361   0, /*tp_mro*/
40362   0, /*tp_cache*/
40363   0, /*tp_subclasses*/
40364   0, /*tp_weaklist*/
40365   0, /*tp_del*/
40366   0, /*tp_version_tag*/
40367   #if PY_VERSION_HEX >= 0x030400a1
40368   0, /*tp_finalize*/
40369   #endif
40370   #if PY_VERSION_HEX >= 0x030800b1
40371   0, /*tp_vectorcall*/
40372   #endif
40373   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
40374   0, /*tp_print*/
40375   #endif
40376 };
40377 
40378 static struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__ *__pyx_freelist_8rasterio_5_base___pyx_scope_struct_4___get__[8];
40379 static int __pyx_freecount_8rasterio_5_base___pyx_scope_struct_4___get__ = 0;
40380 
__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_4___get__(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)40381 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_4___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
40382   PyObject *o;
40383   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_4___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__)))) {
40384     o = (PyObject*)__pyx_freelist_8rasterio_5_base___pyx_scope_struct_4___get__[--__pyx_freecount_8rasterio_5_base___pyx_scope_struct_4___get__];
40385     memset(o, 0, sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__));
40386     (void) PyObject_INIT(o, t);
40387     PyObject_GC_Track(o);
40388   } else {
40389     o = (*t->tp_alloc)(t, 0);
40390     if (unlikely(!o)) return 0;
40391   }
40392   return o;
40393 }
40394 
__pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_4___get__(PyObject * o)40395 static void __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_4___get__(PyObject *o) {
40396   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__ *)o;
40397   PyObject_GC_UnTrack(o);
40398   Py_CLEAR(p->__pyx_v_descr);
40399   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_4___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__)))) {
40400     __pyx_freelist_8rasterio_5_base___pyx_scope_struct_4___get__[__pyx_freecount_8rasterio_5_base___pyx_scope_struct_4___get__++] = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__ *)o);
40401   } else {
40402     (*Py_TYPE(o)->tp_free)(o);
40403   }
40404 }
40405 
__pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_4___get__(PyObject * o,visitproc v,void * a)40406 static int __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_4___get__(PyObject *o, visitproc v, void *a) {
40407   int e;
40408   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__ *)o;
40409   if (p->__pyx_v_descr) {
40410     e = (*v)(p->__pyx_v_descr, a); if (e) return e;
40411   }
40412   return 0;
40413 }
40414 
__pyx_tp_clear_8rasterio_5_base___pyx_scope_struct_4___get__(PyObject * o)40415 static int __pyx_tp_clear_8rasterio_5_base___pyx_scope_struct_4___get__(PyObject *o) {
40416   PyObject* tmp;
40417   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__ *)o;
40418   tmp = ((PyObject*)p->__pyx_v_descr);
40419   p->__pyx_v_descr = ((PyObject*)Py_None); Py_INCREF(Py_None);
40420   Py_XDECREF(tmp);
40421   return 0;
40422 }
40423 
40424 static PyTypeObject __pyx_type_8rasterio_5_base___pyx_scope_struct_4___get__ = {
40425   PyVarObject_HEAD_INIT(0, 0)
40426   "rasterio._base.__pyx_scope_struct_4___get__", /*tp_name*/
40427   sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_4___get__), /*tp_basicsize*/
40428   0, /*tp_itemsize*/
40429   __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_4___get__, /*tp_dealloc*/
40430   #if PY_VERSION_HEX < 0x030800b4
40431   0, /*tp_print*/
40432   #endif
40433   #if PY_VERSION_HEX >= 0x030800b4
40434   0, /*tp_vectorcall_offset*/
40435   #endif
40436   0, /*tp_getattr*/
40437   0, /*tp_setattr*/
40438   #if PY_MAJOR_VERSION < 3
40439   0, /*tp_compare*/
40440   #endif
40441   #if PY_MAJOR_VERSION >= 3
40442   0, /*tp_as_async*/
40443   #endif
40444   0, /*tp_repr*/
40445   0, /*tp_as_number*/
40446   0, /*tp_as_sequence*/
40447   0, /*tp_as_mapping*/
40448   0, /*tp_hash*/
40449   0, /*tp_call*/
40450   0, /*tp_str*/
40451   0, /*tp_getattro*/
40452   0, /*tp_setattro*/
40453   0, /*tp_as_buffer*/
40454   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
40455   0, /*tp_doc*/
40456   __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_4___get__, /*tp_traverse*/
40457   __pyx_tp_clear_8rasterio_5_base___pyx_scope_struct_4___get__, /*tp_clear*/
40458   0, /*tp_richcompare*/
40459   0, /*tp_weaklistoffset*/
40460   0, /*tp_iter*/
40461   0, /*tp_iternext*/
40462   0, /*tp_methods*/
40463   0, /*tp_members*/
40464   0, /*tp_getset*/
40465   0, /*tp_base*/
40466   0, /*tp_dict*/
40467   0, /*tp_descr_get*/
40468   0, /*tp_descr_set*/
40469   0, /*tp_dictoffset*/
40470   0, /*tp_init*/
40471   0, /*tp_alloc*/
40472   __pyx_tp_new_8rasterio_5_base___pyx_scope_struct_4___get__, /*tp_new*/
40473   0, /*tp_free*/
40474   0, /*tp_is_gc*/
40475   0, /*tp_bases*/
40476   0, /*tp_mro*/
40477   0, /*tp_cache*/
40478   0, /*tp_subclasses*/
40479   0, /*tp_weaklist*/
40480   0, /*tp_del*/
40481   0, /*tp_version_tag*/
40482   #if PY_VERSION_HEX >= 0x030400a1
40483   0, /*tp_finalize*/
40484   #endif
40485   #if PY_VERSION_HEX >= 0x030800b1
40486   0, /*tp_vectorcall*/
40487   #endif
40488   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
40489   0, /*tp_print*/
40490   #endif
40491 };
40492 
40493 static struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr *__pyx_freelist_8rasterio_5_base___pyx_scope_struct_5_genexpr[8];
40494 static int __pyx_freecount_8rasterio_5_base___pyx_scope_struct_5_genexpr = 0;
40495 
__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_5_genexpr(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)40496 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
40497   PyObject *o;
40498   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_5_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr)))) {
40499     o = (PyObject*)__pyx_freelist_8rasterio_5_base___pyx_scope_struct_5_genexpr[--__pyx_freecount_8rasterio_5_base___pyx_scope_struct_5_genexpr];
40500     memset(o, 0, sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr));
40501     (void) PyObject_INIT(o, t);
40502     PyObject_GC_Track(o);
40503   } else {
40504     o = (*t->tp_alloc)(t, 0);
40505     if (unlikely(!o)) return 0;
40506   }
40507   return o;
40508 }
40509 
__pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_5_genexpr(PyObject * o)40510 static void __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_5_genexpr(PyObject *o) {
40511   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr *)o;
40512   PyObject_GC_UnTrack(o);
40513   Py_CLEAR(p->__pyx_outer_scope);
40514   Py_CLEAR(p->__pyx_v_d);
40515   Py_CLEAR(p->__pyx_t_0);
40516   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_5_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr)))) {
40517     __pyx_freelist_8rasterio_5_base___pyx_scope_struct_5_genexpr[__pyx_freecount_8rasterio_5_base___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr *)o);
40518   } else {
40519     (*Py_TYPE(o)->tp_free)(o);
40520   }
40521 }
40522 
__pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_5_genexpr(PyObject * o,visitproc v,void * a)40523 static int __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) {
40524   int e;
40525   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr *)o;
40526   if (p->__pyx_outer_scope) {
40527     e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
40528   }
40529   if (p->__pyx_v_d) {
40530     e = (*v)(p->__pyx_v_d, a); if (e) return e;
40531   }
40532   if (p->__pyx_t_0) {
40533     e = (*v)(p->__pyx_t_0, a); if (e) return e;
40534   }
40535   return 0;
40536 }
40537 
40538 static PyTypeObject __pyx_type_8rasterio_5_base___pyx_scope_struct_5_genexpr = {
40539   PyVarObject_HEAD_INIT(0, 0)
40540   "rasterio._base.__pyx_scope_struct_5_genexpr", /*tp_name*/
40541   sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_5_genexpr), /*tp_basicsize*/
40542   0, /*tp_itemsize*/
40543   __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_5_genexpr, /*tp_dealloc*/
40544   #if PY_VERSION_HEX < 0x030800b4
40545   0, /*tp_print*/
40546   #endif
40547   #if PY_VERSION_HEX >= 0x030800b4
40548   0, /*tp_vectorcall_offset*/
40549   #endif
40550   0, /*tp_getattr*/
40551   0, /*tp_setattr*/
40552   #if PY_MAJOR_VERSION < 3
40553   0, /*tp_compare*/
40554   #endif
40555   #if PY_MAJOR_VERSION >= 3
40556   0, /*tp_as_async*/
40557   #endif
40558   0, /*tp_repr*/
40559   0, /*tp_as_number*/
40560   0, /*tp_as_sequence*/
40561   0, /*tp_as_mapping*/
40562   0, /*tp_hash*/
40563   0, /*tp_call*/
40564   0, /*tp_str*/
40565   0, /*tp_getattro*/
40566   0, /*tp_setattro*/
40567   0, /*tp_as_buffer*/
40568   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
40569   0, /*tp_doc*/
40570   __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_5_genexpr, /*tp_traverse*/
40571   0, /*tp_clear*/
40572   0, /*tp_richcompare*/
40573   0, /*tp_weaklistoffset*/
40574   0, /*tp_iter*/
40575   0, /*tp_iternext*/
40576   0, /*tp_methods*/
40577   0, /*tp_members*/
40578   0, /*tp_getset*/
40579   0, /*tp_base*/
40580   0, /*tp_dict*/
40581   0, /*tp_descr_get*/
40582   0, /*tp_descr_set*/
40583   0, /*tp_dictoffset*/
40584   0, /*tp_init*/
40585   0, /*tp_alloc*/
40586   __pyx_tp_new_8rasterio_5_base___pyx_scope_struct_5_genexpr, /*tp_new*/
40587   0, /*tp_free*/
40588   0, /*tp_is_gc*/
40589   0, /*tp_bases*/
40590   0, /*tp_mro*/
40591   0, /*tp_cache*/
40592   0, /*tp_subclasses*/
40593   0, /*tp_weaklist*/
40594   0, /*tp_del*/
40595   0, /*tp_version_tag*/
40596   #if PY_VERSION_HEX >= 0x030400a1
40597   0, /*tp_finalize*/
40598   #endif
40599   #if PY_VERSION_HEX >= 0x030800b1
40600   0, /*tp_vectorcall*/
40601   #endif
40602   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
40603   0, /*tp_print*/
40604   #endif
40605 };
40606 
40607 static struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__ *__pyx_freelist_8rasterio_5_base___pyx_scope_struct_6___get__[8];
40608 static int __pyx_freecount_8rasterio_5_base___pyx_scope_struct_6___get__ = 0;
40609 
__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_6___get__(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)40610 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_6___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
40611   PyObject *o;
40612   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_6___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__)))) {
40613     o = (PyObject*)__pyx_freelist_8rasterio_5_base___pyx_scope_struct_6___get__[--__pyx_freecount_8rasterio_5_base___pyx_scope_struct_6___get__];
40614     memset(o, 0, sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__));
40615     (void) PyObject_INIT(o, t);
40616     PyObject_GC_Track(o);
40617   } else {
40618     o = (*t->tp_alloc)(t, 0);
40619     if (unlikely(!o)) return 0;
40620   }
40621   return o;
40622 }
40623 
__pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_6___get__(PyObject * o)40624 static void __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_6___get__(PyObject *o) {
40625   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__ *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__ *)o;
40626   PyObject_GC_UnTrack(o);
40627   Py_CLEAR(p->__pyx_v_units);
40628   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_6___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__)))) {
40629     __pyx_freelist_8rasterio_5_base___pyx_scope_struct_6___get__[__pyx_freecount_8rasterio_5_base___pyx_scope_struct_6___get__++] = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__ *)o);
40630   } else {
40631     (*Py_TYPE(o)->tp_free)(o);
40632   }
40633 }
40634 
__pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_6___get__(PyObject * o,visitproc v,void * a)40635 static int __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_6___get__(PyObject *o, visitproc v, void *a) {
40636   int e;
40637   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__ *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__ *)o;
40638   if (p->__pyx_v_units) {
40639     e = (*v)(p->__pyx_v_units, a); if (e) return e;
40640   }
40641   return 0;
40642 }
40643 
__pyx_tp_clear_8rasterio_5_base___pyx_scope_struct_6___get__(PyObject * o)40644 static int __pyx_tp_clear_8rasterio_5_base___pyx_scope_struct_6___get__(PyObject *o) {
40645   PyObject* tmp;
40646   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__ *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__ *)o;
40647   tmp = ((PyObject*)p->__pyx_v_units);
40648   p->__pyx_v_units = ((PyObject*)Py_None); Py_INCREF(Py_None);
40649   Py_XDECREF(tmp);
40650   return 0;
40651 }
40652 
40653 static PyTypeObject __pyx_type_8rasterio_5_base___pyx_scope_struct_6___get__ = {
40654   PyVarObject_HEAD_INIT(0, 0)
40655   "rasterio._base.__pyx_scope_struct_6___get__", /*tp_name*/
40656   sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_6___get__), /*tp_basicsize*/
40657   0, /*tp_itemsize*/
40658   __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_6___get__, /*tp_dealloc*/
40659   #if PY_VERSION_HEX < 0x030800b4
40660   0, /*tp_print*/
40661   #endif
40662   #if PY_VERSION_HEX >= 0x030800b4
40663   0, /*tp_vectorcall_offset*/
40664   #endif
40665   0, /*tp_getattr*/
40666   0, /*tp_setattr*/
40667   #if PY_MAJOR_VERSION < 3
40668   0, /*tp_compare*/
40669   #endif
40670   #if PY_MAJOR_VERSION >= 3
40671   0, /*tp_as_async*/
40672   #endif
40673   0, /*tp_repr*/
40674   0, /*tp_as_number*/
40675   0, /*tp_as_sequence*/
40676   0, /*tp_as_mapping*/
40677   0, /*tp_hash*/
40678   0, /*tp_call*/
40679   0, /*tp_str*/
40680   0, /*tp_getattro*/
40681   0, /*tp_setattro*/
40682   0, /*tp_as_buffer*/
40683   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
40684   0, /*tp_doc*/
40685   __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_6___get__, /*tp_traverse*/
40686   __pyx_tp_clear_8rasterio_5_base___pyx_scope_struct_6___get__, /*tp_clear*/
40687   0, /*tp_richcompare*/
40688   0, /*tp_weaklistoffset*/
40689   0, /*tp_iter*/
40690   0, /*tp_iternext*/
40691   0, /*tp_methods*/
40692   0, /*tp_members*/
40693   0, /*tp_getset*/
40694   0, /*tp_base*/
40695   0, /*tp_dict*/
40696   0, /*tp_descr_get*/
40697   0, /*tp_descr_set*/
40698   0, /*tp_dictoffset*/
40699   0, /*tp_init*/
40700   0, /*tp_alloc*/
40701   __pyx_tp_new_8rasterio_5_base___pyx_scope_struct_6___get__, /*tp_new*/
40702   0, /*tp_free*/
40703   0, /*tp_is_gc*/
40704   0, /*tp_bases*/
40705   0, /*tp_mro*/
40706   0, /*tp_cache*/
40707   0, /*tp_subclasses*/
40708   0, /*tp_weaklist*/
40709   0, /*tp_del*/
40710   0, /*tp_version_tag*/
40711   #if PY_VERSION_HEX >= 0x030400a1
40712   0, /*tp_finalize*/
40713   #endif
40714   #if PY_VERSION_HEX >= 0x030800b1
40715   0, /*tp_vectorcall*/
40716   #endif
40717   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
40718   0, /*tp_print*/
40719   #endif
40720 };
40721 
40722 static struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr *__pyx_freelist_8rasterio_5_base___pyx_scope_struct_7_genexpr[8];
40723 static int __pyx_freecount_8rasterio_5_base___pyx_scope_struct_7_genexpr = 0;
40724 
__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_7_genexpr(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)40725 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
40726   PyObject *o;
40727   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_7_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr)))) {
40728     o = (PyObject*)__pyx_freelist_8rasterio_5_base___pyx_scope_struct_7_genexpr[--__pyx_freecount_8rasterio_5_base___pyx_scope_struct_7_genexpr];
40729     memset(o, 0, sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr));
40730     (void) PyObject_INIT(o, t);
40731     PyObject_GC_Track(o);
40732   } else {
40733     o = (*t->tp_alloc)(t, 0);
40734     if (unlikely(!o)) return 0;
40735   }
40736   return o;
40737 }
40738 
__pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_7_genexpr(PyObject * o)40739 static void __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_7_genexpr(PyObject *o) {
40740   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr *)o;
40741   PyObject_GC_UnTrack(o);
40742   Py_CLEAR(p->__pyx_outer_scope);
40743   Py_CLEAR(p->__pyx_v_u);
40744   Py_CLEAR(p->__pyx_t_0);
40745   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_7_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr)))) {
40746     __pyx_freelist_8rasterio_5_base___pyx_scope_struct_7_genexpr[__pyx_freecount_8rasterio_5_base___pyx_scope_struct_7_genexpr++] = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr *)o);
40747   } else {
40748     (*Py_TYPE(o)->tp_free)(o);
40749   }
40750 }
40751 
__pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_7_genexpr(PyObject * o,visitproc v,void * a)40752 static int __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_7_genexpr(PyObject *o, visitproc v, void *a) {
40753   int e;
40754   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr *)o;
40755   if (p->__pyx_outer_scope) {
40756     e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
40757   }
40758   if (p->__pyx_v_u) {
40759     e = (*v)(p->__pyx_v_u, a); if (e) return e;
40760   }
40761   if (p->__pyx_t_0) {
40762     e = (*v)(p->__pyx_t_0, a); if (e) return e;
40763   }
40764   return 0;
40765 }
40766 
40767 static PyTypeObject __pyx_type_8rasterio_5_base___pyx_scope_struct_7_genexpr = {
40768   PyVarObject_HEAD_INIT(0, 0)
40769   "rasterio._base.__pyx_scope_struct_7_genexpr", /*tp_name*/
40770   sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_7_genexpr), /*tp_basicsize*/
40771   0, /*tp_itemsize*/
40772   __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_7_genexpr, /*tp_dealloc*/
40773   #if PY_VERSION_HEX < 0x030800b4
40774   0, /*tp_print*/
40775   #endif
40776   #if PY_VERSION_HEX >= 0x030800b4
40777   0, /*tp_vectorcall_offset*/
40778   #endif
40779   0, /*tp_getattr*/
40780   0, /*tp_setattr*/
40781   #if PY_MAJOR_VERSION < 3
40782   0, /*tp_compare*/
40783   #endif
40784   #if PY_MAJOR_VERSION >= 3
40785   0, /*tp_as_async*/
40786   #endif
40787   0, /*tp_repr*/
40788   0, /*tp_as_number*/
40789   0, /*tp_as_sequence*/
40790   0, /*tp_as_mapping*/
40791   0, /*tp_hash*/
40792   0, /*tp_call*/
40793   0, /*tp_str*/
40794   0, /*tp_getattro*/
40795   0, /*tp_setattro*/
40796   0, /*tp_as_buffer*/
40797   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
40798   0, /*tp_doc*/
40799   __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_7_genexpr, /*tp_traverse*/
40800   0, /*tp_clear*/
40801   0, /*tp_richcompare*/
40802   0, /*tp_weaklistoffset*/
40803   0, /*tp_iter*/
40804   0, /*tp_iternext*/
40805   0, /*tp_methods*/
40806   0, /*tp_members*/
40807   0, /*tp_getset*/
40808   0, /*tp_base*/
40809   0, /*tp_dict*/
40810   0, /*tp_descr_get*/
40811   0, /*tp_descr_set*/
40812   0, /*tp_dictoffset*/
40813   0, /*tp_init*/
40814   0, /*tp_alloc*/
40815   __pyx_tp_new_8rasterio_5_base___pyx_scope_struct_7_genexpr, /*tp_new*/
40816   0, /*tp_free*/
40817   0, /*tp_is_gc*/
40818   0, /*tp_bases*/
40819   0, /*tp_mro*/
40820   0, /*tp_cache*/
40821   0, /*tp_subclasses*/
40822   0, /*tp_weaklist*/
40823   0, /*tp_del*/
40824   0, /*tp_version_tag*/
40825   #if PY_VERSION_HEX >= 0x030400a1
40826   0, /*tp_finalize*/
40827   #endif
40828   #if PY_VERSION_HEX >= 0x030800b1
40829   0, /*tp_vectorcall*/
40830   #endif
40831   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
40832   0, /*tp_print*/
40833   #endif
40834 };
40835 
40836 static struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows *__pyx_freelist_8rasterio_5_base___pyx_scope_struct_8_block_windows[8];
40837 static int __pyx_freecount_8rasterio_5_base___pyx_scope_struct_8_block_windows = 0;
40838 
__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_8_block_windows(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)40839 static PyObject *__pyx_tp_new_8rasterio_5_base___pyx_scope_struct_8_block_windows(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
40840   PyObject *o;
40841   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_8_block_windows > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows)))) {
40842     o = (PyObject*)__pyx_freelist_8rasterio_5_base___pyx_scope_struct_8_block_windows[--__pyx_freecount_8rasterio_5_base___pyx_scope_struct_8_block_windows];
40843     memset(o, 0, sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows));
40844     (void) PyObject_INIT(o, t);
40845     PyObject_GC_Track(o);
40846   } else {
40847     o = (*t->tp_alloc)(t, 0);
40848     if (unlikely(!o)) return 0;
40849   }
40850   return o;
40851 }
40852 
__pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_8_block_windows(PyObject * o)40853 static void __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_8_block_windows(PyObject *o) {
40854   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows *)o;
40855   PyObject_GC_UnTrack(o);
40856   Py_CLEAR(p->__pyx_v_bidx);
40857   Py_CLEAR(p->__pyx_v_block_shapes);
40858   Py_CLEAR(p->__pyx_v_col);
40859   Py_CLEAR(p->__pyx_v_d);
40860   Py_CLEAR(p->__pyx_v_h);
40861   Py_CLEAR(p->__pyx_v_height);
40862   Py_CLEAR(p->__pyx_v_m);
40863   Py_CLEAR(p->__pyx_v_ncols);
40864   Py_CLEAR(p->__pyx_v_nrows);
40865   Py_CLEAR(p->__pyx_v_row);
40866   Py_CLEAR(p->__pyx_v_self);
40867   Py_CLEAR(p->__pyx_v_w);
40868   Py_CLEAR(p->__pyx_v_width);
40869   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8rasterio_5_base___pyx_scope_struct_8_block_windows < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows)))) {
40870     __pyx_freelist_8rasterio_5_base___pyx_scope_struct_8_block_windows[__pyx_freecount_8rasterio_5_base___pyx_scope_struct_8_block_windows++] = ((struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows *)o);
40871   } else {
40872     (*Py_TYPE(o)->tp_free)(o);
40873   }
40874 }
40875 
__pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_8_block_windows(PyObject * o,visitproc v,void * a)40876 static int __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_8_block_windows(PyObject *o, visitproc v, void *a) {
40877   int e;
40878   struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows *p = (struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows *)o;
40879   if (p->__pyx_v_bidx) {
40880     e = (*v)(p->__pyx_v_bidx, a); if (e) return e;
40881   }
40882   if (p->__pyx_v_block_shapes) {
40883     e = (*v)(p->__pyx_v_block_shapes, a); if (e) return e;
40884   }
40885   if (p->__pyx_v_col) {
40886     e = (*v)(p->__pyx_v_col, a); if (e) return e;
40887   }
40888   if (p->__pyx_v_d) {
40889     e = (*v)(p->__pyx_v_d, a); if (e) return e;
40890   }
40891   if (p->__pyx_v_h) {
40892     e = (*v)(p->__pyx_v_h, a); if (e) return e;
40893   }
40894   if (p->__pyx_v_height) {
40895     e = (*v)(p->__pyx_v_height, a); if (e) return e;
40896   }
40897   if (p->__pyx_v_m) {
40898     e = (*v)(p->__pyx_v_m, a); if (e) return e;
40899   }
40900   if (p->__pyx_v_ncols) {
40901     e = (*v)(p->__pyx_v_ncols, a); if (e) return e;
40902   }
40903   if (p->__pyx_v_nrows) {
40904     e = (*v)(p->__pyx_v_nrows, a); if (e) return e;
40905   }
40906   if (p->__pyx_v_row) {
40907     e = (*v)(p->__pyx_v_row, a); if (e) return e;
40908   }
40909   if (p->__pyx_v_self) {
40910     e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
40911   }
40912   if (p->__pyx_v_w) {
40913     e = (*v)(p->__pyx_v_w, a); if (e) return e;
40914   }
40915   if (p->__pyx_v_width) {
40916     e = (*v)(p->__pyx_v_width, a); if (e) return e;
40917   }
40918   return 0;
40919 }
40920 
40921 static PyTypeObject __pyx_type_8rasterio_5_base___pyx_scope_struct_8_block_windows = {
40922   PyVarObject_HEAD_INIT(0, 0)
40923   "rasterio._base.__pyx_scope_struct_8_block_windows", /*tp_name*/
40924   sizeof(struct __pyx_obj_8rasterio_5_base___pyx_scope_struct_8_block_windows), /*tp_basicsize*/
40925   0, /*tp_itemsize*/
40926   __pyx_tp_dealloc_8rasterio_5_base___pyx_scope_struct_8_block_windows, /*tp_dealloc*/
40927   #if PY_VERSION_HEX < 0x030800b4
40928   0, /*tp_print*/
40929   #endif
40930   #if PY_VERSION_HEX >= 0x030800b4
40931   0, /*tp_vectorcall_offset*/
40932   #endif
40933   0, /*tp_getattr*/
40934   0, /*tp_setattr*/
40935   #if PY_MAJOR_VERSION < 3
40936   0, /*tp_compare*/
40937   #endif
40938   #if PY_MAJOR_VERSION >= 3
40939   0, /*tp_as_async*/
40940   #endif
40941   0, /*tp_repr*/
40942   0, /*tp_as_number*/
40943   0, /*tp_as_sequence*/
40944   0, /*tp_as_mapping*/
40945   0, /*tp_hash*/
40946   0, /*tp_call*/
40947   0, /*tp_str*/
40948   0, /*tp_getattro*/
40949   0, /*tp_setattro*/
40950   0, /*tp_as_buffer*/
40951   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
40952   0, /*tp_doc*/
40953   __pyx_tp_traverse_8rasterio_5_base___pyx_scope_struct_8_block_windows, /*tp_traverse*/
40954   0, /*tp_clear*/
40955   0, /*tp_richcompare*/
40956   0, /*tp_weaklistoffset*/
40957   0, /*tp_iter*/
40958   0, /*tp_iternext*/
40959   0, /*tp_methods*/
40960   0, /*tp_members*/
40961   0, /*tp_getset*/
40962   0, /*tp_base*/
40963   0, /*tp_dict*/
40964   0, /*tp_descr_get*/
40965   0, /*tp_descr_set*/
40966   0, /*tp_dictoffset*/
40967   0, /*tp_init*/
40968   0, /*tp_alloc*/
40969   __pyx_tp_new_8rasterio_5_base___pyx_scope_struct_8_block_windows, /*tp_new*/
40970   0, /*tp_free*/
40971   0, /*tp_is_gc*/
40972   0, /*tp_bases*/
40973   0, /*tp_mro*/
40974   0, /*tp_cache*/
40975   0, /*tp_subclasses*/
40976   0, /*tp_weaklist*/
40977   0, /*tp_del*/
40978   0, /*tp_version_tag*/
40979   #if PY_VERSION_HEX >= 0x030400a1
40980   0, /*tp_finalize*/
40981   #endif
40982   #if PY_VERSION_HEX >= 0x030800b1
40983   0, /*tp_vectorcall*/
40984   #endif
40985   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
40986   0, /*tp_print*/
40987   #endif
40988 };
40989 static struct __pyx_vtabstruct_array __pyx_vtable_array;
40990 
__pyx_tp_new_array(PyTypeObject * t,PyObject * a,PyObject * k)40991 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
40992   struct __pyx_array_obj *p;
40993   PyObject *o;
40994   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
40995     o = (*t->tp_alloc)(t, 0);
40996   } else {
40997     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
40998   }
40999   if (unlikely(!o)) return 0;
41000   p = ((struct __pyx_array_obj *)o);
41001   p->__pyx_vtab = __pyx_vtabptr_array;
41002   p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
41003   p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
41004   if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
41005   return o;
41006   bad:
41007   Py_DECREF(o); o = 0;
41008   return NULL;
41009 }
41010 
__pyx_tp_dealloc_array(PyObject * o)41011 static void __pyx_tp_dealloc_array(PyObject *o) {
41012   struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
41013   #if CYTHON_USE_TP_FINALIZE
41014   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))) {
41015     if (PyObject_CallFinalizerFromDealloc(o)) return;
41016   }
41017   #endif
41018   {
41019     PyObject *etype, *eval, *etb;
41020     PyErr_Fetch(&etype, &eval, &etb);
41021     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
41022     __pyx_array___dealloc__(o);
41023     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
41024     PyErr_Restore(etype, eval, etb);
41025   }
41026   Py_CLEAR(p->mode);
41027   Py_CLEAR(p->_format);
41028   (*Py_TYPE(o)->tp_free)(o);
41029 }
__pyx_sq_item_array(PyObject * o,Py_ssize_t i)41030 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
41031   PyObject *r;
41032   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
41033   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
41034   Py_DECREF(x);
41035   return r;
41036 }
41037 
__pyx_mp_ass_subscript_array(PyObject * o,PyObject * i,PyObject * v)41038 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
41039   if (v) {
41040     return __pyx_array___setitem__(o, i, v);
41041   }
41042   else {
41043     PyErr_Format(PyExc_NotImplementedError,
41044       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
41045     return -1;
41046   }
41047 }
41048 
__pyx_tp_getattro_array(PyObject * o,PyObject * n)41049 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
41050   PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
41051   if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
41052     PyErr_Clear();
41053     v = __pyx_array___getattr__(o, n);
41054   }
41055   return v;
41056 }
41057 
__pyx_getprop___pyx_array_memview(PyObject * o,CYTHON_UNUSED void * x)41058 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
41059   return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
41060 }
41061 
41062 static PyMethodDef __pyx_methods_array[] = {
41063   {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
41064   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
41065   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
41066   {0, 0, 0, 0}
41067 };
41068 
41069 static struct PyGetSetDef __pyx_getsets_array[] = {
41070   {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
41071   {0, 0, 0, 0, 0}
41072 };
41073 
41074 static PySequenceMethods __pyx_tp_as_sequence_array = {
41075   __pyx_array___len__, /*sq_length*/
41076   0, /*sq_concat*/
41077   0, /*sq_repeat*/
41078   __pyx_sq_item_array, /*sq_item*/
41079   0, /*sq_slice*/
41080   0, /*sq_ass_item*/
41081   0, /*sq_ass_slice*/
41082   0, /*sq_contains*/
41083   0, /*sq_inplace_concat*/
41084   0, /*sq_inplace_repeat*/
41085 };
41086 
41087 static PyMappingMethods __pyx_tp_as_mapping_array = {
41088   __pyx_array___len__, /*mp_length*/
41089   __pyx_array___getitem__, /*mp_subscript*/
41090   __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
41091 };
41092 
41093 static PyBufferProcs __pyx_tp_as_buffer_array = {
41094   #if PY_MAJOR_VERSION < 3
41095   0, /*bf_getreadbuffer*/
41096   #endif
41097   #if PY_MAJOR_VERSION < 3
41098   0, /*bf_getwritebuffer*/
41099   #endif
41100   #if PY_MAJOR_VERSION < 3
41101   0, /*bf_getsegcount*/
41102   #endif
41103   #if PY_MAJOR_VERSION < 3
41104   0, /*bf_getcharbuffer*/
41105   #endif
41106   __pyx_array_getbuffer, /*bf_getbuffer*/
41107   0, /*bf_releasebuffer*/
41108 };
41109 
41110 static PyTypeObject __pyx_type___pyx_array = {
41111   PyVarObject_HEAD_INIT(0, 0)
41112   "rasterio._base.array", /*tp_name*/
41113   sizeof(struct __pyx_array_obj), /*tp_basicsize*/
41114   0, /*tp_itemsize*/
41115   __pyx_tp_dealloc_array, /*tp_dealloc*/
41116   #if PY_VERSION_HEX < 0x030800b4
41117   0, /*tp_print*/
41118   #endif
41119   #if PY_VERSION_HEX >= 0x030800b4
41120   0, /*tp_vectorcall_offset*/
41121   #endif
41122   0, /*tp_getattr*/
41123   0, /*tp_setattr*/
41124   #if PY_MAJOR_VERSION < 3
41125   0, /*tp_compare*/
41126   #endif
41127   #if PY_MAJOR_VERSION >= 3
41128   0, /*tp_as_async*/
41129   #endif
41130   0, /*tp_repr*/
41131   0, /*tp_as_number*/
41132   &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
41133   &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
41134   0, /*tp_hash*/
41135   0, /*tp_call*/
41136   0, /*tp_str*/
41137   __pyx_tp_getattro_array, /*tp_getattro*/
41138   0, /*tp_setattro*/
41139   &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
41140   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
41141   0, /*tp_doc*/
41142   0, /*tp_traverse*/
41143   0, /*tp_clear*/
41144   0, /*tp_richcompare*/
41145   0, /*tp_weaklistoffset*/
41146   0, /*tp_iter*/
41147   0, /*tp_iternext*/
41148   __pyx_methods_array, /*tp_methods*/
41149   0, /*tp_members*/
41150   __pyx_getsets_array, /*tp_getset*/
41151   0, /*tp_base*/
41152   0, /*tp_dict*/
41153   0, /*tp_descr_get*/
41154   0, /*tp_descr_set*/
41155   0, /*tp_dictoffset*/
41156   0, /*tp_init*/
41157   0, /*tp_alloc*/
41158   __pyx_tp_new_array, /*tp_new*/
41159   0, /*tp_free*/
41160   0, /*tp_is_gc*/
41161   0, /*tp_bases*/
41162   0, /*tp_mro*/
41163   0, /*tp_cache*/
41164   0, /*tp_subclasses*/
41165   0, /*tp_weaklist*/
41166   0, /*tp_del*/
41167   0, /*tp_version_tag*/
41168   #if PY_VERSION_HEX >= 0x030400a1
41169   0, /*tp_finalize*/
41170   #endif
41171   #if PY_VERSION_HEX >= 0x030800b1
41172   0, /*tp_vectorcall*/
41173   #endif
41174   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
41175   0, /*tp_print*/
41176   #endif
41177 };
41178 
__pyx_tp_new_Enum(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)41179 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
41180   struct __pyx_MemviewEnum_obj *p;
41181   PyObject *o;
41182   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
41183     o = (*t->tp_alloc)(t, 0);
41184   } else {
41185     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
41186   }
41187   if (unlikely(!o)) return 0;
41188   p = ((struct __pyx_MemviewEnum_obj *)o);
41189   p->name = Py_None; Py_INCREF(Py_None);
41190   return o;
41191 }
41192 
__pyx_tp_dealloc_Enum(PyObject * o)41193 static void __pyx_tp_dealloc_Enum(PyObject *o) {
41194   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
41195   #if CYTHON_USE_TP_FINALIZE
41196   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
41197     if (PyObject_CallFinalizerFromDealloc(o)) return;
41198   }
41199   #endif
41200   PyObject_GC_UnTrack(o);
41201   Py_CLEAR(p->name);
41202   (*Py_TYPE(o)->tp_free)(o);
41203 }
41204 
__pyx_tp_traverse_Enum(PyObject * o,visitproc v,void * a)41205 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
41206   int e;
41207   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
41208   if (p->name) {
41209     e = (*v)(p->name, a); if (e) return e;
41210   }
41211   return 0;
41212 }
41213 
__pyx_tp_clear_Enum(PyObject * o)41214 static int __pyx_tp_clear_Enum(PyObject *o) {
41215   PyObject* tmp;
41216   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
41217   tmp = ((PyObject*)p->name);
41218   p->name = Py_None; Py_INCREF(Py_None);
41219   Py_XDECREF(tmp);
41220   return 0;
41221 }
41222 
41223 static PyMethodDef __pyx_methods_Enum[] = {
41224   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
41225   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
41226   {0, 0, 0, 0}
41227 };
41228 
41229 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
41230   PyVarObject_HEAD_INIT(0, 0)
41231   "rasterio._base.Enum", /*tp_name*/
41232   sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
41233   0, /*tp_itemsize*/
41234   __pyx_tp_dealloc_Enum, /*tp_dealloc*/
41235   #if PY_VERSION_HEX < 0x030800b4
41236   0, /*tp_print*/
41237   #endif
41238   #if PY_VERSION_HEX >= 0x030800b4
41239   0, /*tp_vectorcall_offset*/
41240   #endif
41241   0, /*tp_getattr*/
41242   0, /*tp_setattr*/
41243   #if PY_MAJOR_VERSION < 3
41244   0, /*tp_compare*/
41245   #endif
41246   #if PY_MAJOR_VERSION >= 3
41247   0, /*tp_as_async*/
41248   #endif
41249   __pyx_MemviewEnum___repr__, /*tp_repr*/
41250   0, /*tp_as_number*/
41251   0, /*tp_as_sequence*/
41252   0, /*tp_as_mapping*/
41253   0, /*tp_hash*/
41254   0, /*tp_call*/
41255   0, /*tp_str*/
41256   0, /*tp_getattro*/
41257   0, /*tp_setattro*/
41258   0, /*tp_as_buffer*/
41259   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
41260   0, /*tp_doc*/
41261   __pyx_tp_traverse_Enum, /*tp_traverse*/
41262   __pyx_tp_clear_Enum, /*tp_clear*/
41263   0, /*tp_richcompare*/
41264   0, /*tp_weaklistoffset*/
41265   0, /*tp_iter*/
41266   0, /*tp_iternext*/
41267   __pyx_methods_Enum, /*tp_methods*/
41268   0, /*tp_members*/
41269   0, /*tp_getset*/
41270   0, /*tp_base*/
41271   0, /*tp_dict*/
41272   0, /*tp_descr_get*/
41273   0, /*tp_descr_set*/
41274   0, /*tp_dictoffset*/
41275   __pyx_MemviewEnum___init__, /*tp_init*/
41276   0, /*tp_alloc*/
41277   __pyx_tp_new_Enum, /*tp_new*/
41278   0, /*tp_free*/
41279   0, /*tp_is_gc*/
41280   0, /*tp_bases*/
41281   0, /*tp_mro*/
41282   0, /*tp_cache*/
41283   0, /*tp_subclasses*/
41284   0, /*tp_weaklist*/
41285   0, /*tp_del*/
41286   0, /*tp_version_tag*/
41287   #if PY_VERSION_HEX >= 0x030400a1
41288   0, /*tp_finalize*/
41289   #endif
41290   #if PY_VERSION_HEX >= 0x030800b1
41291   0, /*tp_vectorcall*/
41292   #endif
41293   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
41294   0, /*tp_print*/
41295   #endif
41296 };
41297 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
41298 
__pyx_tp_new_memoryview(PyTypeObject * t,PyObject * a,PyObject * k)41299 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
41300   struct __pyx_memoryview_obj *p;
41301   PyObject *o;
41302   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
41303     o = (*t->tp_alloc)(t, 0);
41304   } else {
41305     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
41306   }
41307   if (unlikely(!o)) return 0;
41308   p = ((struct __pyx_memoryview_obj *)o);
41309   p->__pyx_vtab = __pyx_vtabptr_memoryview;
41310   p->obj = Py_None; Py_INCREF(Py_None);
41311   p->_size = Py_None; Py_INCREF(Py_None);
41312   p->_array_interface = Py_None; Py_INCREF(Py_None);
41313   p->view.obj = NULL;
41314   if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
41315   return o;
41316   bad:
41317   Py_DECREF(o); o = 0;
41318   return NULL;
41319 }
41320 
__pyx_tp_dealloc_memoryview(PyObject * o)41321 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
41322   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
41323   #if CYTHON_USE_TP_FINALIZE
41324   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
41325     if (PyObject_CallFinalizerFromDealloc(o)) return;
41326   }
41327   #endif
41328   PyObject_GC_UnTrack(o);
41329   {
41330     PyObject *etype, *eval, *etb;
41331     PyErr_Fetch(&etype, &eval, &etb);
41332     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
41333     __pyx_memoryview___dealloc__(o);
41334     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
41335     PyErr_Restore(etype, eval, etb);
41336   }
41337   Py_CLEAR(p->obj);
41338   Py_CLEAR(p->_size);
41339   Py_CLEAR(p->_array_interface);
41340   (*Py_TYPE(o)->tp_free)(o);
41341 }
41342 
__pyx_tp_traverse_memoryview(PyObject * o,visitproc v,void * a)41343 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
41344   int e;
41345   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
41346   if (p->obj) {
41347     e = (*v)(p->obj, a); if (e) return e;
41348   }
41349   if (p->_size) {
41350     e = (*v)(p->_size, a); if (e) return e;
41351   }
41352   if (p->_array_interface) {
41353     e = (*v)(p->_array_interface, a); if (e) return e;
41354   }
41355   if (p->view.obj) {
41356     e = (*v)(p->view.obj, a); if (e) return e;
41357   }
41358   return 0;
41359 }
41360 
__pyx_tp_clear_memoryview(PyObject * o)41361 static int __pyx_tp_clear_memoryview(PyObject *o) {
41362   PyObject* tmp;
41363   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
41364   tmp = ((PyObject*)p->obj);
41365   p->obj = Py_None; Py_INCREF(Py_None);
41366   Py_XDECREF(tmp);
41367   tmp = ((PyObject*)p->_size);
41368   p->_size = Py_None; Py_INCREF(Py_None);
41369   Py_XDECREF(tmp);
41370   tmp = ((PyObject*)p->_array_interface);
41371   p->_array_interface = Py_None; Py_INCREF(Py_None);
41372   Py_XDECREF(tmp);
41373   Py_CLEAR(p->view.obj);
41374   return 0;
41375 }
__pyx_sq_item_memoryview(PyObject * o,Py_ssize_t i)41376 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
41377   PyObject *r;
41378   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
41379   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
41380   Py_DECREF(x);
41381   return r;
41382 }
41383 
__pyx_mp_ass_subscript_memoryview(PyObject * o,PyObject * i,PyObject * v)41384 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
41385   if (v) {
41386     return __pyx_memoryview___setitem__(o, i, v);
41387   }
41388   else {
41389     PyErr_Format(PyExc_NotImplementedError,
41390       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
41391     return -1;
41392   }
41393 }
41394 
__pyx_getprop___pyx_memoryview_T(PyObject * o,CYTHON_UNUSED void * x)41395 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
41396   return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
41397 }
41398 
__pyx_getprop___pyx_memoryview_base(PyObject * o,CYTHON_UNUSED void * x)41399 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
41400   return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
41401 }
41402 
__pyx_getprop___pyx_memoryview_shape(PyObject * o,CYTHON_UNUSED void * x)41403 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
41404   return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
41405 }
41406 
__pyx_getprop___pyx_memoryview_strides(PyObject * o,CYTHON_UNUSED void * x)41407 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
41408   return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
41409 }
41410 
__pyx_getprop___pyx_memoryview_suboffsets(PyObject * o,CYTHON_UNUSED void * x)41411 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
41412   return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
41413 }
41414 
__pyx_getprop___pyx_memoryview_ndim(PyObject * o,CYTHON_UNUSED void * x)41415 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
41416   return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
41417 }
41418 
__pyx_getprop___pyx_memoryview_itemsize(PyObject * o,CYTHON_UNUSED void * x)41419 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
41420   return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
41421 }
41422 
__pyx_getprop___pyx_memoryview_nbytes(PyObject * o,CYTHON_UNUSED void * x)41423 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
41424   return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
41425 }
41426 
__pyx_getprop___pyx_memoryview_size(PyObject * o,CYTHON_UNUSED void * x)41427 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
41428   return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
41429 }
41430 
41431 static PyMethodDef __pyx_methods_memoryview[] = {
41432   {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
41433   {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
41434   {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
41435   {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
41436   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
41437   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
41438   {0, 0, 0, 0}
41439 };
41440 
41441 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
41442   {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
41443   {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
41444   {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
41445   {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
41446   {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
41447   {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
41448   {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
41449   {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
41450   {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
41451   {0, 0, 0, 0, 0}
41452 };
41453 
41454 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
41455   __pyx_memoryview___len__, /*sq_length*/
41456   0, /*sq_concat*/
41457   0, /*sq_repeat*/
41458   __pyx_sq_item_memoryview, /*sq_item*/
41459   0, /*sq_slice*/
41460   0, /*sq_ass_item*/
41461   0, /*sq_ass_slice*/
41462   0, /*sq_contains*/
41463   0, /*sq_inplace_concat*/
41464   0, /*sq_inplace_repeat*/
41465 };
41466 
41467 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
41468   __pyx_memoryview___len__, /*mp_length*/
41469   __pyx_memoryview___getitem__, /*mp_subscript*/
41470   __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
41471 };
41472 
41473 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
41474   #if PY_MAJOR_VERSION < 3
41475   0, /*bf_getreadbuffer*/
41476   #endif
41477   #if PY_MAJOR_VERSION < 3
41478   0, /*bf_getwritebuffer*/
41479   #endif
41480   #if PY_MAJOR_VERSION < 3
41481   0, /*bf_getsegcount*/
41482   #endif
41483   #if PY_MAJOR_VERSION < 3
41484   0, /*bf_getcharbuffer*/
41485   #endif
41486   __pyx_memoryview_getbuffer, /*bf_getbuffer*/
41487   0, /*bf_releasebuffer*/
41488 };
41489 
41490 static PyTypeObject __pyx_type___pyx_memoryview = {
41491   PyVarObject_HEAD_INIT(0, 0)
41492   "rasterio._base.memoryview", /*tp_name*/
41493   sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
41494   0, /*tp_itemsize*/
41495   __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
41496   #if PY_VERSION_HEX < 0x030800b4
41497   0, /*tp_print*/
41498   #endif
41499   #if PY_VERSION_HEX >= 0x030800b4
41500   0, /*tp_vectorcall_offset*/
41501   #endif
41502   0, /*tp_getattr*/
41503   0, /*tp_setattr*/
41504   #if PY_MAJOR_VERSION < 3
41505   0, /*tp_compare*/
41506   #endif
41507   #if PY_MAJOR_VERSION >= 3
41508   0, /*tp_as_async*/
41509   #endif
41510   __pyx_memoryview___repr__, /*tp_repr*/
41511   0, /*tp_as_number*/
41512   &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
41513   &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
41514   0, /*tp_hash*/
41515   0, /*tp_call*/
41516   __pyx_memoryview___str__, /*tp_str*/
41517   0, /*tp_getattro*/
41518   0, /*tp_setattro*/
41519   &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
41520   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
41521   0, /*tp_doc*/
41522   __pyx_tp_traverse_memoryview, /*tp_traverse*/
41523   __pyx_tp_clear_memoryview, /*tp_clear*/
41524   0, /*tp_richcompare*/
41525   0, /*tp_weaklistoffset*/
41526   0, /*tp_iter*/
41527   0, /*tp_iternext*/
41528   __pyx_methods_memoryview, /*tp_methods*/
41529   0, /*tp_members*/
41530   __pyx_getsets_memoryview, /*tp_getset*/
41531   0, /*tp_base*/
41532   0, /*tp_dict*/
41533   0, /*tp_descr_get*/
41534   0, /*tp_descr_set*/
41535   0, /*tp_dictoffset*/
41536   0, /*tp_init*/
41537   0, /*tp_alloc*/
41538   __pyx_tp_new_memoryview, /*tp_new*/
41539   0, /*tp_free*/
41540   0, /*tp_is_gc*/
41541   0, /*tp_bases*/
41542   0, /*tp_mro*/
41543   0, /*tp_cache*/
41544   0, /*tp_subclasses*/
41545   0, /*tp_weaklist*/
41546   0, /*tp_del*/
41547   0, /*tp_version_tag*/
41548   #if PY_VERSION_HEX >= 0x030400a1
41549   0, /*tp_finalize*/
41550   #endif
41551   #if PY_VERSION_HEX >= 0x030800b1
41552   0, /*tp_vectorcall*/
41553   #endif
41554   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
41555   0, /*tp_print*/
41556   #endif
41557 };
41558 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
41559 
__pyx_tp_new__memoryviewslice(PyTypeObject * t,PyObject * a,PyObject * k)41560 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
41561   struct __pyx_memoryviewslice_obj *p;
41562   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
41563   if (unlikely(!o)) return 0;
41564   p = ((struct __pyx_memoryviewslice_obj *)o);
41565   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
41566   p->from_object = Py_None; Py_INCREF(Py_None);
41567   p->from_slice.memview = NULL;
41568   return o;
41569 }
41570 
__pyx_tp_dealloc__memoryviewslice(PyObject * o)41571 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
41572   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
41573   #if CYTHON_USE_TP_FINALIZE
41574   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
41575     if (PyObject_CallFinalizerFromDealloc(o)) return;
41576   }
41577   #endif
41578   PyObject_GC_UnTrack(o);
41579   {
41580     PyObject *etype, *eval, *etb;
41581     PyErr_Fetch(&etype, &eval, &etb);
41582     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
41583     __pyx_memoryviewslice___dealloc__(o);
41584     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
41585     PyErr_Restore(etype, eval, etb);
41586   }
41587   Py_CLEAR(p->from_object);
41588   PyObject_GC_Track(o);
41589   __pyx_tp_dealloc_memoryview(o);
41590 }
41591 
__pyx_tp_traverse__memoryviewslice(PyObject * o,visitproc v,void * a)41592 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
41593   int e;
41594   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
41595   e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
41596   if (p->from_object) {
41597     e = (*v)(p->from_object, a); if (e) return e;
41598   }
41599   return 0;
41600 }
41601 
__pyx_tp_clear__memoryviewslice(PyObject * o)41602 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
41603   PyObject* tmp;
41604   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
41605   __pyx_tp_clear_memoryview(o);
41606   tmp = ((PyObject*)p->from_object);
41607   p->from_object = Py_None; Py_INCREF(Py_None);
41608   Py_XDECREF(tmp);
41609   __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
41610   return 0;
41611 }
41612 
__pyx_getprop___pyx_memoryviewslice_base(PyObject * o,CYTHON_UNUSED void * x)41613 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
41614   return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
41615 }
41616 
41617 static PyMethodDef __pyx_methods__memoryviewslice[] = {
41618   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
41619   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
41620   {0, 0, 0, 0}
41621 };
41622 
41623 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
41624   {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
41625   {0, 0, 0, 0, 0}
41626 };
41627 
41628 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
41629   PyVarObject_HEAD_INIT(0, 0)
41630   "rasterio._base._memoryviewslice", /*tp_name*/
41631   sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
41632   0, /*tp_itemsize*/
41633   __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
41634   #if PY_VERSION_HEX < 0x030800b4
41635   0, /*tp_print*/
41636   #endif
41637   #if PY_VERSION_HEX >= 0x030800b4
41638   0, /*tp_vectorcall_offset*/
41639   #endif
41640   0, /*tp_getattr*/
41641   0, /*tp_setattr*/
41642   #if PY_MAJOR_VERSION < 3
41643   0, /*tp_compare*/
41644   #endif
41645   #if PY_MAJOR_VERSION >= 3
41646   0, /*tp_as_async*/
41647   #endif
41648   #if CYTHON_COMPILING_IN_PYPY
41649   __pyx_memoryview___repr__, /*tp_repr*/
41650   #else
41651   0, /*tp_repr*/
41652   #endif
41653   0, /*tp_as_number*/
41654   0, /*tp_as_sequence*/
41655   0, /*tp_as_mapping*/
41656   0, /*tp_hash*/
41657   0, /*tp_call*/
41658   #if CYTHON_COMPILING_IN_PYPY
41659   __pyx_memoryview___str__, /*tp_str*/
41660   #else
41661   0, /*tp_str*/
41662   #endif
41663   0, /*tp_getattro*/
41664   0, /*tp_setattro*/
41665   0, /*tp_as_buffer*/
41666   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
41667   "Internal class for passing memoryview slices to Python", /*tp_doc*/
41668   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
41669   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
41670   0, /*tp_richcompare*/
41671   0, /*tp_weaklistoffset*/
41672   0, /*tp_iter*/
41673   0, /*tp_iternext*/
41674   __pyx_methods__memoryviewslice, /*tp_methods*/
41675   0, /*tp_members*/
41676   __pyx_getsets__memoryviewslice, /*tp_getset*/
41677   0, /*tp_base*/
41678   0, /*tp_dict*/
41679   0, /*tp_descr_get*/
41680   0, /*tp_descr_set*/
41681   0, /*tp_dictoffset*/
41682   0, /*tp_init*/
41683   0, /*tp_alloc*/
41684   __pyx_tp_new__memoryviewslice, /*tp_new*/
41685   0, /*tp_free*/
41686   0, /*tp_is_gc*/
41687   0, /*tp_bases*/
41688   0, /*tp_mro*/
41689   0, /*tp_cache*/
41690   0, /*tp_subclasses*/
41691   0, /*tp_weaklist*/
41692   0, /*tp_del*/
41693   0, /*tp_version_tag*/
41694   #if PY_VERSION_HEX >= 0x030400a1
41695   0, /*tp_finalize*/
41696   #endif
41697   #if PY_VERSION_HEX >= 0x030800b1
41698   0, /*tp_vectorcall*/
41699   #endif
41700   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
41701   0, /*tp_print*/
41702   #endif
41703 };
41704 
41705 static PyMethodDef __pyx_methods[] = {
41706   {0, 0, 0, 0}
41707 };
41708 
41709 #if PY_MAJOR_VERSION >= 3
41710 #if CYTHON_PEP489_MULTI_PHASE_INIT
41711 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
41712 static int __pyx_pymod_exec__base(PyObject* module); /*proto*/
41713 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
41714   {Py_mod_create, (void*)__pyx_pymod_create},
41715   {Py_mod_exec, (void*)__pyx_pymod_exec__base},
41716   {0, NULL}
41717 };
41718 #endif
41719 
41720 static struct PyModuleDef __pyx_moduledef = {
41721     PyModuleDef_HEAD_INIT,
41722     "_base",
41723     __pyx_k_Numpy_free_base_classes, /* m_doc */
41724   #if CYTHON_PEP489_MULTI_PHASE_INIT
41725     0, /* m_size */
41726   #else
41727     -1, /* m_size */
41728   #endif
41729     __pyx_methods /* m_methods */,
41730   #if CYTHON_PEP489_MULTI_PHASE_INIT
41731     __pyx_moduledef_slots, /* m_slots */
41732   #else
41733     NULL, /* m_reload */
41734   #endif
41735     NULL, /* m_traverse */
41736     NULL, /* m_clear */
41737     NULL /* m_free */
41738 };
41739 #endif
41740 #ifndef CYTHON_SMALL_CODE
41741 #if defined(__clang__)
41742     #define CYTHON_SMALL_CODE
41743 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
41744     #define CYTHON_SMALL_CODE __attribute__((cold))
41745 #else
41746     #define CYTHON_SMALL_CODE
41747 #endif
41748 #endif
41749 
41750 static __Pyx_StringTabEntry __pyx_string_tab[] = {
41751   {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0},
41752   {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
41753   {&__pyx_kp_u_A_band_index_must_be_provided_wh, __pyx_k_A_band_index_must_be_provided_wh, sizeof(__pyx_k_A_band_index_must_be_provided_wh), 0, 1, 0, 0},
41754   {&__pyx_n_s_Affine, __pyx_k_Affine, sizeof(__pyx_k_Affine), 0, 0, 1, 1},
41755   {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
41756   {&__pyx_kp_u_BLOCK_SIZE__0___1, __pyx_k_BLOCK_SIZE__0___1, sizeof(__pyx_k_BLOCK_SIZE__0___1), 0, 1, 0, 0},
41757   {&__pyx_n_s_BandOverviewError, __pyx_k_BandOverviewError, sizeof(__pyx_k_BandOverviewError), 0, 0, 1, 1},
41758   {&__pyx_kp_u_Band_index_bidx_option_needed_fo, __pyx_k_Band_index_bidx_option_needed_fo, sizeof(__pyx_k_Band_index_bidx_option_needed_fo), 0, 1, 0, 0},
41759   {&__pyx_kp_u_Block_i_0_j_1_size_can_t_be_dete, __pyx_k_Block_i_0_j_1_size_can_t_be_dete, sizeof(__pyx_k_Block_i_0_j_1_size_can_t_be_dete), 0, 1, 0, 0},
41760   {&__pyx_n_s_BoundingBox, __pyx_k_BoundingBox, sizeof(__pyx_k_BoundingBox), 0, 0, 1, 1},
41761   {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
41762   {&__pyx_n_u_COMPRESSION, __pyx_k_COMPRESSION, sizeof(__pyx_k_COMPRESSION), 0, 1, 0, 1},
41763   {&__pyx_n_s_CPLE_BaseError, __pyx_k_CPLE_BaseError, sizeof(__pyx_k_CPLE_BaseError), 0, 0, 1, 1},
41764   {&__pyx_n_s_CPLE_IllegalArgError, __pyx_k_CPLE_IllegalArgError, sizeof(__pyx_k_CPLE_IllegalArgError), 0, 0, 1, 1},
41765   {&__pyx_n_s_CPLE_NotSupportedError, __pyx_k_CPLE_NotSupportedError, sizeof(__pyx_k_CPLE_NotSupportedError), 0, 0, 1, 1},
41766   {&__pyx_n_s_CPLE_OpenFailedError, __pyx_k_CPLE_OpenFailedError, sizeof(__pyx_k_CPLE_OpenFailedError), 0, 0, 1, 1},
41767   {&__pyx_n_s_CRS, __pyx_k_CRS, sizeof(__pyx_k_CRS), 0, 0, 1, 1},
41768   {&__pyx_n_s_CRSError, __pyx_k_CRSError, sizeof(__pyx_k_CRSError), 0, 0, 1, 1},
41769   {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
41770   {&__pyx_kp_u_Can_only_set_color_interpretatio, __pyx_k_Can_only_set_color_interpretatio, sizeof(__pyx_k_Can_only_set_color_interpretatio), 0, 1, 0, 0},
41771   {&__pyx_kp_u_Can_t_read_closed_raster_file, __pyx_k_Can_t_read_closed_raster_file, sizeof(__pyx_k_Can_t_read_closed_raster_file), 0, 1, 0, 0},
41772   {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
41773   {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
41774   {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
41775   {&__pyx_n_s_ColorInterp, __pyx_k_ColorInterp, sizeof(__pyx_k_ColorInterp), 0, 0, 1, 1},
41776   {&__pyx_kp_u_Color_d_d_d_d, __pyx_k_Color_d_d_d_d, sizeof(__pyx_k_Color_d_d_d_d), 0, 1, 0, 0},
41777   {&__pyx_n_s_Compression, __pyx_k_Compression, sizeof(__pyx_k_Compression), 0, 0, 1, 1},
41778   {&__pyx_n_u_DCAP_CREATE, __pyx_k_DCAP_CREATE, sizeof(__pyx_k_DCAP_CREATE), 0, 1, 0, 1},
41779   {&__pyx_n_u_DCAP_CREATECOPY, __pyx_k_DCAP_CREATECOPY, sizeof(__pyx_k_DCAP_CREATECOPY), 0, 1, 0, 1},
41780   {&__pyx_n_s_DatasetAttributeError, __pyx_k_DatasetAttributeError, sizeof(__pyx_k_DatasetAttributeError), 0, 0, 1, 1},
41781   {&__pyx_n_s_DatasetBase, __pyx_k_DatasetBase, sizeof(__pyx_k_DatasetBase), 0, 0, 1, 1},
41782   {&__pyx_n_s_DatasetBase___get___locals_genex, __pyx_k_DatasetBase___get___locals_genex, sizeof(__pyx_k_DatasetBase___get___locals_genex), 0, 0, 1, 1},
41783   {&__pyx_n_s_DatasetBase_block_windows, __pyx_k_DatasetBase_block_windows, sizeof(__pyx_k_DatasetBase_block_windows), 0, 0, 1, 1},
41784   {&__pyx_kp_u_DatasetBase_name, __pyx_k_DatasetBase_name, sizeof(__pyx_k_DatasetBase_name), 0, 1, 0, 0},
41785   {&__pyx_kp_u_Dataset_has_no_geotransform_gcps, __pyx_k_Dataset_has_no_geotransform_gcps, sizeof(__pyx_k_Dataset_has_no_geotransform_gcps), 0, 1, 0, 0},
41786   {&__pyx_kp_u_Dataset_is_closed, __pyx_k_Dataset_is_closed, sizeof(__pyx_k_Dataset_is_closed), 0, 1, 0, 0},
41787   {&__pyx_kp_u_Dataset_r_is_started, __pyx_k_Dataset_r_is_started, sizeof(__pyx_k_Dataset_r_is_started), 0, 1, 0, 0},
41788   {&__pyx_n_s_DriverRegistrationError, __pyx_k_DriverRegistrationError, sizeof(__pyx_k_DriverRegistrationError), 0, 0, 1, 1},
41789   {&__pyx_kp_u_Driver_has_no_metadata, __pyx_k_Driver_has_no_metadata, sizeof(__pyx_k_Driver_has_no_metadata), 0, 1, 0, 0},
41790   {&__pyx_n_u_EPSG, __pyx_k_EPSG, sizeof(__pyx_k_EPSG), 0, 1, 0, 1},
41791   {&__pyx_kp_u_EPSG_2, __pyx_k_EPSG_2, sizeof(__pyx_k_EPSG_2), 0, 1, 0, 0},
41792   {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
41793   {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
41794   {&__pyx_n_s_Env, __pyx_k_Env, sizeof(__pyx_k_Env), 0, 0, 1, 1},
41795   {&__pyx_kp_u_Failed_to_decode_metadata_item_i, __pyx_k_Failed_to_decode_metadata_item_i, sizeof(__pyx_k_Failed_to_decode_metadata_item_i), 0, 1, 0, 0},
41796   {&__pyx_kp_u_Failed_to_retrieve_overview, __pyx_k_Failed_to_retrieve_overview, sizeof(__pyx_k_Failed_to_retrieve_overview), 0, 1, 0, 0},
41797   {&__pyx_n_s_GDALError, __pyx_k_GDALError, sizeof(__pyx_k_GDALError), 0, 0, 1, 1},
41798   {&__pyx_n_s_GroundControlPoint, __pyx_k_GroundControlPoint, sizeof(__pyx_k_GroundControlPoint), 0, 0, 1, 1},
41799   {&__pyx_n_u_IMAGE_STRUCTURE, __pyx_k_IMAGE_STRUCTURE, sizeof(__pyx_k_IMAGE_STRUCTURE), 0, 1, 0, 1},
41800   {&__pyx_n_u_INTERLEAVE, __pyx_k_INTERLEAVE, sizeof(__pyx_k_INTERLEAVE), 0, 1, 0, 1},
41801   {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0},
41802   {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
41803   {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
41804   {&__pyx_n_s_Interleaving, __pyx_k_Interleaving, sizeof(__pyx_k_Interleaving), 0, 0, 1, 1},
41805   {&__pyx_kp_u_Invalid_CRS_r, __pyx_k_Invalid_CRS_r, sizeof(__pyx_k_Invalid_CRS_r), 0, 1, 0, 0},
41806   {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
41807   {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
41808   {&__pyx_n_s_MaskFlags, __pyx_k_MaskFlags, sizeof(__pyx_k_MaskFlags), 0, 0, 1, 1},
41809   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
41810   {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
41811   {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
41812   {&__pyx_kp_u_Must_set_color_interpretation_fo, __pyx_k_Must_set_color_interpretation_fo, sizeof(__pyx_k_Must_set_color_interpretation_fo), 0, 1, 0, 0},
41813   {&__pyx_n_u_NETCDF, __pyx_k_NETCDF, sizeof(__pyx_k_NETCDF), 0, 1, 0, 1},
41814   {&__pyx_kp_u_NULL_color_at_d_skipping, __pyx_k_NULL_color_at_d_skipping, sizeof(__pyx_k_NULL_color_at_d_skipping), 0, 1, 0, 0},
41815   {&__pyx_kp_u_NULL_color_table, __pyx_k_NULL_color_table, sizeof(__pyx_k_NULL_color_table), 0, 1, 0, 0},
41816   {&__pyx_kp_u_No_such_band_index_s, __pyx_k_No_such_band_index_s, sizeof(__pyx_k_No_such_band_index_s), 0, 1, 0, 0},
41817   {&__pyx_kp_u_No_such_driver_registered_s, __pyx_k_No_such_driver_registered_s, sizeof(__pyx_k_No_such_driver_registered_s), 0, 1, 0, 0},
41818   {&__pyx_kp_u_Nodata_success_d_Nodata_value_f, __pyx_k_Nodata_success_d_Nodata_value_f, sizeof(__pyx_k_Nodata_success_d_Nodata_value_f), 0, 1, 0, 0},
41819   {&__pyx_n_s_NotGeoreferencedWarning, __pyx_k_NotGeoreferencedWarning, sizeof(__pyx_k_NotGeoreferencedWarning), 0, 0, 1, 1},
41820   {&__pyx_kp_u_Null_dataset, __pyx_k_Null_dataset, sizeof(__pyx_k_Null_dataset), 0, 1, 0, 0},
41821   {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
41822   {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
41823   {&__pyx_kp_u_PROJ_4_to_be_imported_r, __pyx_k_PROJ_4_to_be_imported_r, sizeof(__pyx_k_PROJ_4_to_be_imported_r), 0, 1, 0, 0},
41824   {&__pyx_n_s_PhotometricInterp, __pyx_k_PhotometricInterp, sizeof(__pyx_k_PhotometricInterp), 0, 0, 1, 1},
41825   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
41826   {&__pyx_n_s_Profile, __pyx_k_Profile, sizeof(__pyx_k_Profile), 0, 0, 1, 1},
41827   {&__pyx_n_s_RPC, __pyx_k_RPC, sizeof(__pyx_k_RPC), 0, 0, 1, 1},
41828   {&__pyx_n_u_RPC, __pyx_k_RPC, sizeof(__pyx_k_RPC), 0, 1, 0, 1},
41829   {&__pyx_n_s_RasterBlockError, __pyx_k_RasterBlockError, sizeof(__pyx_k_RasterBlockError), 0, 0, 1, 1},
41830   {&__pyx_n_s_RasterioIOError, __pyx_k_RasterioIOError, sizeof(__pyx_k_RasterioIOError), 0, 0, 1, 1},
41831   {&__pyx_n_u_SOURCE_COLOR_SPACE, __pyx_k_SOURCE_COLOR_SPACE, sizeof(__pyx_k_SOURCE_COLOR_SPACE), 0, 1, 0, 1},
41832   {&__pyx_n_u_SUBDATASETS, __pyx_k_SUBDATASETS, sizeof(__pyx_k_SUBDATASETS), 0, 1, 0, 1},
41833   {&__pyx_kp_u_Sharing_flag_r, __pyx_k_Sharing_flag_r, sizeof(__pyx_k_Sharing_flag_r), 0, 1, 0, 0},
41834   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
41835   {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
41836   {&__pyx_kp_u_Unexpected_NULL_spatial_referenc, __pyx_k_Unexpected_NULL_spatial_referenc, sizeof(__pyx_k_Unexpected_NULL_spatial_referenc), 0, 1, 0, 0},
41837   {&__pyx_n_s_UnicodeDecodeError, __pyx_k_UnicodeDecodeError, sizeof(__pyx_k_UnicodeDecodeError), 0, 0, 1, 1},
41838   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
41839   {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
41840   {&__pyx_n_s_Window, __pyx_k_Window, sizeof(__pyx_k_Window), 0, 0, 1, 1},
41841   {&__pyx_kp_u__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 1, 0, 0},
41842   {&__pyx_kp_u__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 1, 0, 0},
41843   {&__pyx_kp_u__18, __pyx_k__18, sizeof(__pyx_k__18), 0, 1, 0, 0},
41844   {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0},
41845   {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0},
41846   {&__pyx_kp_u__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 1, 0, 0},
41847   {&__pyx_n_u__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 1, 0, 1},
41848   {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
41849   {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
41850   {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
41851   {&__pyx_n_s_as_vsi, __pyx_k_as_vsi, sizeof(__pyx_k_as_vsi), 0, 0, 1, 1},
41852   {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
41853   {&__pyx_n_s_bidx, __pyx_k_bidx, sizeof(__pyx_k_bidx), 0, 0, 1, 1},
41854   {&__pyx_n_s_block_shapes, __pyx_k_block_shapes, sizeof(__pyx_k_block_shapes), 0, 0, 1, 1},
41855   {&__pyx_n_s_block_windows, __pyx_k_block_windows, sizeof(__pyx_k_block_windows), 0, 0, 1, 1},
41856   {&__pyx_n_s_blockxsize, __pyx_k_blockxsize, sizeof(__pyx_k_blockxsize), 0, 0, 1, 1},
41857   {&__pyx_n_s_blockysize, __pyx_k_blockysize, sizeof(__pyx_k_blockysize), 0, 0, 1, 1},
41858   {&__pyx_n_s_bounds, __pyx_k_bounds, sizeof(__pyx_k_bounds), 0, 0, 1, 1},
41859   {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
41860   {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
41861   {&__pyx_n_s_c_drivername, __pyx_k_c_drivername, sizeof(__pyx_k_c_drivername), 0, 0, 1, 1},
41862   {&__pyx_n_s_c_extensions, __pyx_k_c_extensions, sizeof(__pyx_k_c_extensions), 0, 0, 1, 1},
41863   {&__pyx_n_s_can_create_osr, __pyx_k_can_create_osr, sizeof(__pyx_k_can_create_osr), 0, 0, 1, 1},
41864   {&__pyx_n_s_check_gdal_version, __pyx_k_check_gdal_version, sizeof(__pyx_k_check_gdal_version), 0, 0, 1, 1},
41865   {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
41866   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
41867   {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
41868   {&__pyx_n_s_closed, __pyx_k_closed, sizeof(__pyx_k_closed), 0, 0, 1, 1},
41869   {&__pyx_n_u_closed, __pyx_k_closed, sizeof(__pyx_k_closed), 0, 1, 0, 1},
41870   {&__pyx_n_s_col, __pyx_k_col, sizeof(__pyx_k_col), 0, 0, 1, 1},
41871   {&__pyx_n_s_col_off, __pyx_k_col_off, sizeof(__pyx_k_col_off), 0, 0, 1, 1},
41872   {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
41873   {&__pyx_n_u_complex128, __pyx_k_complex128, sizeof(__pyx_k_complex128), 0, 1, 0, 1},
41874   {&__pyx_n_u_complex64, __pyx_k_complex64, sizeof(__pyx_k_complex64), 0, 1, 0, 1},
41875   {&__pyx_n_u_complex_int16, __pyx_k_complex_int16, sizeof(__pyx_k_complex_int16), 0, 1, 0, 1},
41876   {&__pyx_n_u_compress, __pyx_k_compress, sizeof(__pyx_k_compress), 0, 1, 0, 1},
41877   {&__pyx_n_s_compression, __pyx_k_compression, sizeof(__pyx_k_compression), 0, 0, 1, 1},
41878   {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
41879   {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
41880   {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1},
41881   {&__pyx_n_u_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 1, 0, 1},
41882   {&__pyx_n_s_creation_mode, __pyx_k_creation_mode, sizeof(__pyx_k_creation_mode), 0, 0, 1, 1},
41883   {&__pyx_n_s_crop, __pyx_k_crop, sizeof(__pyx_k_crop), 0, 0, 1, 1},
41884   {&__pyx_n_s_crs, __pyx_k_crs, sizeof(__pyx_k_crs), 0, 0, 1, 1},
41885   {&__pyx_n_u_crs, __pyx_k_crs, sizeof(__pyx_k_crs), 0, 1, 0, 1},
41886   {&__pyx_n_s_dataset, __pyx_k_dataset, sizeof(__pyx_k_dataset), 0, 0, 1, 1},
41887   {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
41888   {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
41889   {&__pyx_n_s_defaultdict, __pyx_k_defaultdict, sizeof(__pyx_k_defaultdict), 0, 0, 1, 1},
41890   {&__pyx_n_u_desc, __pyx_k_desc, sizeof(__pyx_k_desc), 0, 1, 0, 1},
41891   {&__pyx_n_u_description, __pyx_k_description, sizeof(__pyx_k_description), 0, 1, 0, 1},
41892   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
41893   {&__pyx_n_s_dm, __pyx_k_dm, sizeof(__pyx_k_dm), 0, 0, 1, 1},
41894   {&__pyx_n_s_driver, __pyx_k_driver, sizeof(__pyx_k_driver), 0, 0, 1, 1},
41895   {&__pyx_n_u_driver, __pyx_k_driver, sizeof(__pyx_k_driver), 0, 1, 0, 1},
41896   {&__pyx_n_s_driver_can_create, __pyx_k_driver_can_create, sizeof(__pyx_k_driver_can_create), 0, 0, 1, 1},
41897   {&__pyx_n_s_driver_can_create_copy, __pyx_k_driver_can_create_copy, sizeof(__pyx_k_driver_can_create_copy), 0, 0, 1, 1},
41898   {&__pyx_n_s_driver_count, __pyx_k_driver_count, sizeof(__pyx_k_driver_count), 0, 0, 1, 1},
41899   {&__pyx_n_s_driver_extensions, __pyx_k_driver_extensions, sizeof(__pyx_k_driver_extensions), 0, 0, 1, 1},
41900   {&__pyx_n_s_driver_supports_mode, __pyx_k_driver_supports_mode, sizeof(__pyx_k_driver_supports_mode), 0, 0, 1, 1},
41901   {&__pyx_n_s_drivername, __pyx_k_drivername, sizeof(__pyx_k_drivername), 0, 0, 1, 1},
41902   {&__pyx_n_s_dst, __pyx_k_dst, sizeof(__pyx_k_dst), 0, 0, 1, 1},
41903   {&__pyx_n_s_dst_crs, __pyx_k_dst_crs, sizeof(__pyx_k_dst_crs), 0, 0, 1, 1},
41904   {&__pyx_n_u_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 1, 0, 1},
41905   {&__pyx_n_s_dtype_fwd, __pyx_k_dtype_fwd, sizeof(__pyx_k_dtype_fwd), 0, 0, 1, 1},
41906   {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
41907   {&__pyx_n_s_dtype_ranges, __pyx_k_dtype_ranges, sizeof(__pyx_k_dtype_ranges), 0, 0, 1, 1},
41908   {&__pyx_n_s_dtypes, __pyx_k_dtypes, sizeof(__pyx_k_dtypes), 0, 0, 1, 1},
41909   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
41910   {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
41911   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
41912   {&__pyx_n_s_env_ctx_if_needed, __pyx_k_env_ctx_if_needed, sizeof(__pyx_k_env_ctx_if_needed), 0, 0, 1, 1},
41913   {&__pyx_kp_u_epsg_4326, __pyx_k_epsg_4326, sizeof(__pyx_k_epsg_4326), 0, 1, 0, 0},
41914   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
41915   {&__pyx_n_s_evaluate, __pyx_k_evaluate, sizeof(__pyx_k_evaluate), 0, 0, 1, 1},
41916   {&__pyx_n_s_exc, __pyx_k_exc, sizeof(__pyx_k_exc), 0, 0, 1, 1},
41917   {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
41918   {&__pyx_n_s_extension, __pyx_k_extension, sizeof(__pyx_k_extension), 0, 0, 1, 1},
41919   {&__pyx_n_s_extensions, __pyx_k_extensions, sizeof(__pyx_k_extensions), 0, 0, 1, 1},
41920   {&__pyx_n_s_failure, __pyx_k_failure, sizeof(__pyx_k_failure), 0, 0, 1, 1},
41921   {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
41922   {&__pyx_n_u_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 1, 0, 1},
41923   {&__pyx_n_u_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 1, 0, 1},
41924   {&__pyx_n_u_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 1, 0, 1},
41925   {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
41926   {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
41927   {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
41928   {&__pyx_n_s_from_gdal, __pyx_k_from_gdal, sizeof(__pyx_k_from_gdal), 0, 0, 1, 1},
41929   {&__pyx_n_s_from_user_input, __pyx_k_from_user_input, sizeof(__pyx_k_from_user_input), 0, 0, 1, 1},
41930   {&__pyx_n_s_from_wkt, __pyx_k_from_wkt, sizeof(__pyx_k_from_wkt), 0, 0, 1, 1},
41931   {&__pyx_n_s_gdal_version, __pyx_k_gdal_version, sizeof(__pyx_k_gdal_version), 0, 0, 1, 1},
41932   {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
41933   {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
41934   {&__pyx_n_s_getLogger, __pyx_k_getLogger, sizeof(__pyx_k_getLogger), 0, 0, 1, 1},
41935   {&__pyx_n_s_get_crs, __pyx_k_get_crs, sizeof(__pyx_k_get_crs), 0, 0, 1, 1},
41936   {&__pyx_n_s_get_dataset_driver, __pyx_k_get_dataset_driver, sizeof(__pyx_k_get_dataset_driver), 0, 0, 1, 1},
41937   {&__pyx_n_s_get_gcps, __pyx_k_get_gcps, sizeof(__pyx_k_get_gcps), 0, 0, 1, 1},
41938   {&__pyx_n_s_get_nodatavals, __pyx_k_get_nodatavals, sizeof(__pyx_k_get_nodatavals), 0, 0, 1, 1},
41939   {&__pyx_n_s_get_rpcs, __pyx_k_get_rpcs, sizeof(__pyx_k_get_rpcs), 0, 0, 1, 1},
41940   {&__pyx_n_s_get_transform, __pyx_k_get_transform, sizeof(__pyx_k_get_transform), 0, 0, 1, 1},
41941   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
41942   {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
41943   {&__pyx_n_s_guard_transform, __pyx_k_guard_transform, sizeof(__pyx_k_guard_transform), 0, 0, 1, 1},
41944   {&__pyx_n_s_handle_crswkt, __pyx_k_handle_crswkt, sizeof(__pyx_k_handle_crswkt), 0, 0, 1, 1},
41945   {&__pyx_n_s_has_gcps_or_rpcs, __pyx_k_has_gcps_or_rpcs, sizeof(__pyx_k_has_gcps_or_rpcs), 0, 0, 1, 1},
41946   {&__pyx_n_s_height, __pyx_k_height, sizeof(__pyx_k_height), 0, 0, 1, 1},
41947   {&__pyx_n_u_height, __pyx_k_height, sizeof(__pyx_k_height), 0, 1, 0, 1},
41948   {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
41949   {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
41950   {&__pyx_n_s_iii, __pyx_k_iii, sizeof(__pyx_k_iii), 0, 0, 1, 1},
41951   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
41952   {&__pyx_n_s_indexes, __pyx_k_indexes, sizeof(__pyx_k_indexes), 0, 0, 1, 1},
41953   {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
41954   {&__pyx_n_u_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 1, 0, 1},
41955   {&__pyx_n_u_int16, __pyx_k_int16, sizeof(__pyx_k_int16), 0, 1, 0, 1},
41956   {&__pyx_n_u_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 1, 0, 1},
41957   {&__pyx_n_u_interleave, __pyx_k_interleave, sizeof(__pyx_k_interleave), 0, 1, 0, 1},
41958   {&__pyx_n_s_interleaving, __pyx_k_interleaving, sizeof(__pyx_k_interleaving), 0, 0, 1, 1},
41959   {&__pyx_n_s_is_tiled, __pyx_k_is_tiled, sizeof(__pyx_k_is_tiled), 0, 0, 1, 1},
41960   {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
41961   {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
41962   {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
41963   {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
41964   {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
41965   {&__pyx_n_s_log, __pyx_k_log, sizeof(__pyx_k_log), 0, 0, 1, 1},
41966   {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1},
41967   {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
41968   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
41969   {&__pyx_n_s_major, __pyx_k_major, sizeof(__pyx_k_major), 0, 0, 1, 1},
41970   {&__pyx_n_s_mask_flags, __pyx_k_mask_flags, sizeof(__pyx_k_mask_flags), 0, 0, 1, 1},
41971   {&__pyx_n_s_mask_flags_locals_genexpr, __pyx_k_mask_flags_locals_genexpr, sizeof(__pyx_k_mask_flags_locals_genexpr), 0, 0, 1, 1},
41972   {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1},
41973   {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
41974   {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
41975   {&__pyx_n_s_meta, __pyx_k_meta, sizeof(__pyx_k_meta), 0, 0, 1, 1},
41976   {&__pyx_n_s_metadata, __pyx_k_metadata, sizeof(__pyx_k_metadata), 0, 0, 1, 1},
41977   {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
41978   {&__pyx_n_s_minor, __pyx_k_minor, sizeof(__pyx_k_minor), 0, 0, 1, 1},
41979   {&__pyx_kp_u_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 1, 0, 0},
41980   {&__pyx_n_s_mode_2, __pyx_k_mode_2, sizeof(__pyx_k_mode_2), 0, 0, 1, 1},
41981   {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
41982   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
41983   {&__pyx_n_u_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 1, 0, 1},
41984   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
41985   {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
41986   {&__pyx_n_u_netcdf, __pyx_k_netcdf, sizeof(__pyx_k_netcdf), 0, 1, 0, 1},
41987   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
41988   {&__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},
41989   {&__pyx_n_s_nodata, __pyx_k_nodata, sizeof(__pyx_k_nodata), 0, 0, 1, 1},
41990   {&__pyx_n_u_nodata, __pyx_k_nodata, sizeof(__pyx_k_nodata), 0, 1, 0, 1},
41991   {&__pyx_n_s_nodatavals, __pyx_k_nodatavals, sizeof(__pyx_k_nodatavals), 0, 0, 1, 1},
41992   {&__pyx_n_s_ns, __pyx_k_ns, sizeof(__pyx_k_ns), 0, 0, 1, 1},
41993   {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
41994   {&__pyx_n_u_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 1, 0, 1},
41995   {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
41996   {&__pyx_n_s_osr, __pyx_k_osr, sizeof(__pyx_k_osr), 0, 0, 1, 1},
41997   {&__pyx_n_s_ovr, __pyx_k_ovr, sizeof(__pyx_k_ovr), 0, 0, 1, 1},
41998   {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
41999   {&__pyx_n_s_parse_path, __pyx_k_parse_path, sizeof(__pyx_k_parse_path), 0, 0, 1, 1},
42000   {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
42001   {&__pyx_n_s_photometric, __pyx_k_photometric, sizeof(__pyx_k_photometric), 0, 0, 1, 1},
42002   {&__pyx_n_u_photometric, __pyx_k_photometric, sizeof(__pyx_k_photometric), 0, 1, 0, 1},
42003   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
42004   {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
42005   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
42006   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
42007   {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
42008   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
42009   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
42010   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
42011   {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
42012   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
42013   {&__pyx_n_u_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 1, 0, 1},
42014   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
42015   {&__pyx_n_s_raster_driver_extensions, __pyx_k_raster_driver_extensions, sizeof(__pyx_k_raster_driver_extensions), 0, 0, 1, 1},
42016   {&__pyx_n_s_rasterio, __pyx_k_rasterio, sizeof(__pyx_k_rasterio), 0, 0, 1, 1},
42017   {&__pyx_n_s_rasterio__base, __pyx_k_rasterio__base, sizeof(__pyx_k_rasterio__base), 0, 0, 1, 1},
42018   {&__pyx_kp_s_rasterio__base_pyx, __pyx_k_rasterio__base_pyx, sizeof(__pyx_k_rasterio__base_pyx), 0, 0, 1, 0},
42019   {&__pyx_n_s_rasterio__err, __pyx_k_rasterio__err, sizeof(__pyx_k_rasterio__err), 0, 0, 1, 1},
42020   {&__pyx_n_s_rasterio_control, __pyx_k_rasterio_control, sizeof(__pyx_k_rasterio_control), 0, 0, 1, 1},
42021   {&__pyx_n_s_rasterio_coords, __pyx_k_rasterio_coords, sizeof(__pyx_k_rasterio_coords), 0, 0, 1, 1},
42022   {&__pyx_n_s_rasterio_crs, __pyx_k_rasterio_crs, sizeof(__pyx_k_rasterio_crs), 0, 0, 1, 1},
42023   {&__pyx_n_s_rasterio_enums, __pyx_k_rasterio_enums, sizeof(__pyx_k_rasterio_enums), 0, 0, 1, 1},
42024   {&__pyx_n_s_rasterio_env, __pyx_k_rasterio_env, sizeof(__pyx_k_rasterio_env), 0, 0, 1, 1},
42025   {&__pyx_n_s_rasterio_errors, __pyx_k_rasterio_errors, sizeof(__pyx_k_rasterio_errors), 0, 0, 1, 1},
42026   {&__pyx_n_s_rasterio_path, __pyx_k_rasterio_path, sizeof(__pyx_k_rasterio_path), 0, 0, 1, 1},
42027   {&__pyx_n_s_rasterio_profiles, __pyx_k_rasterio_profiles, sizeof(__pyx_k_rasterio_profiles), 0, 0, 1, 1},
42028   {&__pyx_n_s_rasterio_rpc, __pyx_k_rasterio_rpc, sizeof(__pyx_k_rasterio_rpc), 0, 0, 1, 1},
42029   {&__pyx_n_s_rasterio_transform, __pyx_k_rasterio_transform, sizeof(__pyx_k_rasterio_transform), 0, 0, 1, 1},
42030   {&__pyx_n_s_read_crs, __pyx_k_read_crs, sizeof(__pyx_k_read_crs), 0, 0, 1, 1},
42031   {&__pyx_kp_u_read_only_attribute, __pyx_k_read_only_attribute, sizeof(__pyx_k_read_only_attribute), 0, 1, 0, 0},
42032   {&__pyx_n_s_read_transform, __pyx_k_read_transform, sizeof(__pyx_k_read_transform), 0, 0, 1, 1},
42033   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
42034   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
42035   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
42036   {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1},
42037   {&__pyx_n_s_res_xs, __pyx_k_res_xs, sizeof(__pyx_k_res_xs), 0, 0, 1, 1},
42038   {&__pyx_n_s_res_ys, __pyx_k_res_ys, sizeof(__pyx_k_res_ys), 0, 0, 1, 1},
42039   {&__pyx_n_s_res_zs, __pyx_k_res_zs, sizeof(__pyx_k_res_zs), 0, 0, 1, 1},
42040   {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1},
42041   {&__pyx_n_s_row, __pyx_k_row, sizeof(__pyx_k_row), 0, 0, 1, 1},
42042   {&__pyx_n_s_row_off, __pyx_k_row_off, sizeof(__pyx_k_row_off), 0, 0, 1, 1},
42043   {&__pyx_kp_s_self__hds_cannot_be_converted_to, __pyx_k_self__hds_cannot_be_converted_to, sizeof(__pyx_k_self__hds_cannot_be_converted_to), 0, 0, 1, 0},
42044   {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
42045   {&__pyx_n_s_set_all_descriptions, __pyx_k_set_all_descriptions, sizeof(__pyx_k_set_all_descriptions), 0, 0, 1, 1},
42046   {&__pyx_n_s_set_all_offsets, __pyx_k_set_all_offsets, sizeof(__pyx_k_set_all_offsets), 0, 0, 1, 1},
42047   {&__pyx_n_s_set_all_scales, __pyx_k_set_all_scales, sizeof(__pyx_k_set_all_scales), 0, 0, 1, 1},
42048   {&__pyx_n_s_set_all_units, __pyx_k_set_all_units, sizeof(__pyx_k_set_all_units), 0, 0, 1, 1},
42049   {&__pyx_n_s_set_attrs_from_dataset_handle, __pyx_k_set_attrs_from_dataset_handle, sizeof(__pyx_k_set_attrs_from_dataset_handle), 0, 0, 1, 1},
42050   {&__pyx_n_s_set_crs, __pyx_k_set_crs, sizeof(__pyx_k_set_crs), 0, 0, 1, 1},
42051   {&__pyx_n_s_set_gcps, __pyx_k_set_gcps, sizeof(__pyx_k_set_gcps), 0, 0, 1, 1},
42052   {&__pyx_n_s_set_nodatavals, __pyx_k_set_nodatavals, sizeof(__pyx_k_set_nodatavals), 0, 0, 1, 1},
42053   {&__pyx_n_s_set_rpcs, __pyx_k_set_rpcs, sizeof(__pyx_k_set_rpcs), 0, 0, 1, 1},
42054   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
42055   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
42056   {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
42057   {&__pyx_n_s_sharing, __pyx_k_sharing, sizeof(__pyx_k_sharing), 0, 0, 1, 1},
42058   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
42059   {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
42060   {&__pyx_n_s_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 0, 0, 1, 1},
42061   {&__pyx_n_s_src, __pyx_k_src, sizeof(__pyx_k_src), 0, 0, 1, 1},
42062   {&__pyx_n_s_src_crs, __pyx_k_src_crs, sizeof(__pyx_k_src_crs), 0, 0, 1, 1},
42063   {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
42064   {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
42065   {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
42066   {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
42067   {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
42068   {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
42069   {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
42070   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
42071   {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1},
42072   {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
42073   {&__pyx_n_s_tags, __pyx_k_tags, sizeof(__pyx_k_tags), 0, 0, 1, 1},
42074   {&__pyx_n_s_tastes_like_gdal, __pyx_k_tastes_like_gdal, sizeof(__pyx_k_tastes_like_gdal), 0, 0, 1, 1},
42075   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
42076   {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
42077   {&__pyx_n_s_tiled, __pyx_k_tiled, sizeof(__pyx_k_tiled), 0, 0, 1, 1},
42078   {&__pyx_n_s_to_gdal, __pyx_k_to_gdal, sizeof(__pyx_k_to_gdal), 0, 0, 1, 1},
42079   {&__pyx_n_s_to_string, __pyx_k_to_string, sizeof(__pyx_k_to_string), 0, 0, 1, 1},
42080   {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1},
42081   {&__pyx_n_s_transform, __pyx_k_transform, sizeof(__pyx_k_transform), 0, 0, 1, 1},
42082   {&__pyx_n_u_transform, __pyx_k_transform, sizeof(__pyx_k_transform), 0, 1, 0, 1},
42083   {&__pyx_n_s_transform_2, __pyx_k_transform_2, sizeof(__pyx_k_transform_2), 0, 0, 1, 1},
42084   {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
42085   {&__pyx_n_u_uint8, __pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 1, 0, 1},
42086   {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
42087   {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
42088   {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
42089   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
42090   {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1},
42091   {&__pyx_kp_u_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0, 0},
42092   {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
42093   {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1},
42094   {&__pyx_n_s_warning, __pyx_k_warning, sizeof(__pyx_k_warning), 0, 0, 1, 1},
42095   {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1},
42096   {&__pyx_n_s_width, __pyx_k_width, sizeof(__pyx_k_width), 0, 0, 1, 1},
42097   {&__pyx_n_u_width, __pyx_k_width, sizeof(__pyx_k_width), 0, 1, 0, 1},
42098   {&__pyx_n_s_window, __pyx_k_window, sizeof(__pyx_k_window), 0, 0, 1, 1},
42099   {&__pyx_n_s_windows, __pyx_k_windows, sizeof(__pyx_k_windows), 0, 0, 1, 1},
42100   {&__pyx_n_s_wkt, __pyx_k_wkt, sizeof(__pyx_k_wkt), 0, 0, 1, 1},
42101   {&__pyx_n_s_write_transform, __pyx_k_write_transform, sizeof(__pyx_k_write_transform), 0, 0, 1, 1},
42102   {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
42103   {&__pyx_n_s_xs, __pyx_k_xs, sizeof(__pyx_k_xs), 0, 0, 1, 1},
42104   {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
42105   {&__pyx_n_s_ys, __pyx_k_ys, sizeof(__pyx_k_ys), 0, 0, 1, 1},
42106   {&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1},
42107   {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
42108   {&__pyx_n_s_zs, __pyx_k_zs, sizeof(__pyx_k_zs), 0, 0, 1, 1},
42109   {0, 0, 0, 0, 0, 0, 0}
42110 };
__Pyx_InitCachedBuiltins(void)42111 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
42112   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 82, __pyx_L1_error)
42113   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 106, __pyx_L1_error)
42114   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 131, __pyx_L1_error)
42115   __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 149, __pyx_L1_error)
42116   __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 316, __pyx_L1_error)
42117   __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_n_s_min); if (!__pyx_builtin_min) __PYX_ERR(0, 890, __pyx_L1_error)
42118   __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s_max); if (!__pyx_builtin_max) __PYX_ERR(0, 890, __pyx_L1_error)
42119   __pyx_builtin_UnicodeDecodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeDecodeError); if (!__pyx_builtin_UnicodeDecodeError) __PYX_ERR(0, 1091, __pyx_L1_error)
42120   __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 1215, __pyx_L1_error)
42121   __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_n_s_round); if (!__pyx_builtin_round) __PYX_ERR(0, 1256, __pyx_L1_error)
42122   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error)
42123   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 151, __pyx_L1_error)
42124   __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 404, __pyx_L1_error)
42125   __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 613, __pyx_L1_error)
42126   return 0;
42127   __pyx_L1_error:;
42128   return -1;
42129 }
42130 
__Pyx_InitCachedConstants(void)42131 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
42132   __Pyx_RefNannyDeclarations
42133   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
42134 
42135   /* "rasterio/_base.pyx":106
42136  *     metadata = GDALGetMetadata(driver, NULL)
42137  *     if metadata == NULL:
42138  *         raise ValueError("Driver has no metadata")             # <<<<<<<<<<<<<<
42139  *
42140  *     return bool(CSLFetchBoolean(metadata, <const char *>creation_mode, 0))
42141  */
42142   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Driver_has_no_metadata); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 106, __pyx_L1_error)
42143   __Pyx_GOTREF(__pyx_tuple_);
42144   __Pyx_GIVEREF(__pyx_tuple_);
42145 
42146   /* "rasterio/_base.pyx":354
42147  *         cdef const char *wkt = GDALGetProjectionRef(self.handle())
42148  *         if wkt == NULL:
42149  *             raise ValueError("Unexpected NULL spatial reference")             # <<<<<<<<<<<<<<
42150  *         return self._handle_crswkt(wkt)
42151  *
42152  */
42153   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Unexpected_NULL_spatial_referenc); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 354, __pyx_L1_error)
42154   __Pyx_GOTREF(__pyx_tuple__4);
42155   __Pyx_GIVEREF(__pyx_tuple__4);
42156 
42157   /* "rasterio/_base.pyx":362
42158  *
42159  *         if self._hds == NULL:
42160  *             raise ValueError("Null dataset")             # <<<<<<<<<<<<<<
42161  *         err = GDALGetGeoTransform(self._hds, gt)
42162  *         if err == GDALError.failure and not self._has_gcps_or_rpcs():
42163  */
42164   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Null_dataset); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 362, __pyx_L1_error)
42165   __Pyx_GOTREF(__pyx_tuple__5);
42166   __Pyx_GIVEREF(__pyx_tuple__5);
42167 
42168   /* "rasterio/_base.pyx":422
42169  *         if not self._count:
42170  *             if self._hds == NULL:
42171  *                 raise ValueError("Can't read closed raster file")             # <<<<<<<<<<<<<<
42172  *             self._count = GDALGetRasterCount(self._hds)
42173  *         return self._count
42174  */
42175   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Can_t_read_closed_raster_file); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 422, __pyx_L1_error)
42176   __Pyx_GOTREF(__pyx_tuple__6);
42177   __Pyx_GIVEREF(__pyx_tuple__6);
42178 
42179   /* "rasterio/_base.pyx":849
42180  *         if bidx < 1:
42181  *             if len(set(block_shapes)) > 1:
42182  *                 raise ValueError(             # <<<<<<<<<<<<<<
42183  *                     "A band index must be provided when band block shapes"
42184  *                     "are inhomogeneous")
42185  */
42186   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_A_band_index_must_be_provided_wh); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 849, __pyx_L1_error)
42187   __Pyx_GOTREF(__pyx_tuple__7);
42188   __Pyx_GIVEREF(__pyx_tuple__7);
42189 
42190   /* "rasterio/_base.pyx":1019
42191  *                     fld = 'description'
42192  *                 if fld == 'name':
42193  *                     val = val.replace('NETCDF', 'netcdf')             # <<<<<<<<<<<<<<
42194  *                 subs[idx][fld] = val.replace('"', '')
42195  *             return [subs[idx]['name'] for idx in sorted(subs.keys())]
42196  */
42197   __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_u_NETCDF, __pyx_n_u_netcdf); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 1019, __pyx_L1_error)
42198   __Pyx_GOTREF(__pyx_tuple__10);
42199   __Pyx_GIVEREF(__pyx_tuple__10);
42200 
42201   /* "rasterio/_base.pyx":1020
42202  *                 if fld == 'name':
42203  *                     val = val.replace('NETCDF', 'netcdf')
42204  *                 subs[idx][fld] = val.replace('"', '')             # <<<<<<<<<<<<<<
42205  *             return [subs[idx]['name'] for idx in sorted(subs.keys())]
42206  *
42207  */
42208   __pyx_tuple__13 = PyTuple_Pack(2, __pyx_kp_u__11, __pyx_kp_u__12); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 1020, __pyx_L1_error)
42209   __Pyx_GOTREF(__pyx_tuple__13);
42210   __Pyx_GIVEREF(__pyx_tuple__13);
42211 
42212   /* "rasterio/_base.pyx":1132
42213  *
42214  *         if not bidx > 0 and ovr:
42215  *             raise Exception("Band index (bidx) option needed for overview level")             # <<<<<<<<<<<<<<
42216  *
42217  *         if bidx > 0:
42218  */
42219   __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_u_Band_index_bidx_option_needed_fo); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 1132, __pyx_L1_error)
42220   __Pyx_GOTREF(__pyx_tuple__14);
42221   __Pyx_GIVEREF(__pyx_tuple__14);
42222 
42223   /* "rasterio/_base.pyx":1229
42224  *         colortable = GDALGetRasterColorTable(band)
42225  *         if colortable == NULL:
42226  *             raise ValueError("NULL color table")             # <<<<<<<<<<<<<<
42227  *         retval = {}
42228  *
42229  */
42230   __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_u_NULL_color_table); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 1229, __pyx_L1_error)
42231   __Pyx_GOTREF(__pyx_tuple__15);
42232   __Pyx_GIVEREF(__pyx_tuple__15);
42233 
42234   /* "(tree fragment)":2
42235  * def __reduce_cython__(self):
42236  *     raise TypeError("self._hds cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
42237  * def __setstate_cython__(self, __pyx_state):
42238  *     raise TypeError("self._hds cannot be converted to a Python object for pickling")
42239  */
42240   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_self__hds_cannot_be_converted_to); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 2, __pyx_L1_error)
42241   __Pyx_GOTREF(__pyx_tuple__16);
42242   __Pyx_GIVEREF(__pyx_tuple__16);
42243 
42244   /* "(tree fragment)":4
42245  *     raise TypeError("self._hds cannot be converted to a Python object for pickling")
42246  * def __setstate_cython__(self, __pyx_state):
42247  *     raise TypeError("self._hds cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
42248  */
42249   __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_self__hds_cannot_be_converted_to); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 4, __pyx_L1_error)
42250   __Pyx_GOTREF(__pyx_tuple__17);
42251   __Pyx_GIVEREF(__pyx_tuple__17);
42252 
42253   /* "View.MemoryView":133
42254  *
42255  *         if not self.ndim:
42256  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
42257  *
42258  *         if itemsize <= 0:
42259  */
42260   __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 133, __pyx_L1_error)
42261   __Pyx_GOTREF(__pyx_tuple__19);
42262   __Pyx_GIVEREF(__pyx_tuple__19);
42263 
42264   /* "View.MemoryView":136
42265  *
42266  *         if itemsize <= 0:
42267  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
42268  *
42269  *         if not isinstance(format, bytes):
42270  */
42271   __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 136, __pyx_L1_error)
42272   __Pyx_GOTREF(__pyx_tuple__20);
42273   __Pyx_GIVEREF(__pyx_tuple__20);
42274 
42275   /* "View.MemoryView":148
42276  *
42277  *         if not self._shape:
42278  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
42279  *
42280  *
42281  */
42282   __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 148, __pyx_L1_error)
42283   __Pyx_GOTREF(__pyx_tuple__21);
42284   __Pyx_GIVEREF(__pyx_tuple__21);
42285 
42286   /* "View.MemoryView":176
42287  *             self.data = <char *>malloc(self.len)
42288  *             if not self.data:
42289  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
42290  *
42291  *             if self.dtype_is_object:
42292  */
42293   __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 176, __pyx_L1_error)
42294   __Pyx_GOTREF(__pyx_tuple__22);
42295   __Pyx_GIVEREF(__pyx_tuple__22);
42296 
42297   /* "View.MemoryView":192
42298  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
42299  *         if not (flags & bufmode):
42300  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
42301  *         info.buf = self.data
42302  *         info.len = self.len
42303  */
42304   __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 192, __pyx_L1_error)
42305   __Pyx_GOTREF(__pyx_tuple__23);
42306   __Pyx_GIVEREF(__pyx_tuple__23);
42307 
42308   /* "(tree fragment)":2
42309  * def __reduce_cython__(self):
42310  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
42311  * def __setstate_cython__(self, __pyx_state):
42312  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
42313  */
42314   __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 2, __pyx_L1_error)
42315   __Pyx_GOTREF(__pyx_tuple__24);
42316   __Pyx_GIVEREF(__pyx_tuple__24);
42317 
42318   /* "(tree fragment)":4
42319  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
42320  * def __setstate_cython__(self, __pyx_state):
42321  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
42322  */
42323   __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 4, __pyx_L1_error)
42324   __Pyx_GOTREF(__pyx_tuple__25);
42325   __Pyx_GIVEREF(__pyx_tuple__25);
42326 
42327   /* "View.MemoryView":418
42328  *     def __setitem__(memoryview self, object index, object value):
42329  *         if self.view.readonly:
42330  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
42331  *
42332  *         have_slices, index = _unellipsify(index, self.view.ndim)
42333  */
42334   __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 418, __pyx_L1_error)
42335   __Pyx_GOTREF(__pyx_tuple__26);
42336   __Pyx_GIVEREF(__pyx_tuple__26);
42337 
42338   /* "View.MemoryView":495
42339  *             result = struct.unpack(self.view.format, bytesitem)
42340  *         except struct.error:
42341  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
42342  *         else:
42343  *             if len(self.view.format) == 1:
42344  */
42345   __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 495, __pyx_L1_error)
42346   __Pyx_GOTREF(__pyx_tuple__27);
42347   __Pyx_GIVEREF(__pyx_tuple__27);
42348 
42349   /* "View.MemoryView":520
42350  *     def __getbuffer__(self, Py_buffer *info, int flags):
42351  *         if flags & PyBUF_WRITABLE and self.view.readonly:
42352  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
42353  *
42354  *         if flags & PyBUF_ND:
42355  */
42356   __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 520, __pyx_L1_error)
42357   __Pyx_GOTREF(__pyx_tuple__28);
42358   __Pyx_GIVEREF(__pyx_tuple__28);
42359 
42360   /* "View.MemoryView":570
42361  *         if self.view.strides == NULL:
42362  *
42363  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
42364  *
42365  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
42366  */
42367   __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 570, __pyx_L1_error)
42368   __Pyx_GOTREF(__pyx_tuple__29);
42369   __Pyx_GIVEREF(__pyx_tuple__29);
42370 
42371   /* "View.MemoryView":577
42372  *     def suboffsets(self):
42373  *         if self.view.suboffsets == NULL:
42374  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
42375  *
42376  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
42377  */
42378   __pyx_tuple__30 = PyTuple_New(1); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 577, __pyx_L1_error)
42379   __Pyx_GOTREF(__pyx_tuple__30);
42380   __Pyx_INCREF(__pyx_int_neg_1);
42381   __Pyx_GIVEREF(__pyx_int_neg_1);
42382   PyTuple_SET_ITEM(__pyx_tuple__30, 0, __pyx_int_neg_1);
42383   __Pyx_GIVEREF(__pyx_tuple__30);
42384 
42385   /* "(tree fragment)":2
42386  * def __reduce_cython__(self):
42387  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
42388  * def __setstate_cython__(self, __pyx_state):
42389  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
42390  */
42391   __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 2, __pyx_L1_error)
42392   __Pyx_GOTREF(__pyx_tuple__31);
42393   __Pyx_GIVEREF(__pyx_tuple__31);
42394 
42395   /* "(tree fragment)":4
42396  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
42397  * def __setstate_cython__(self, __pyx_state):
42398  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
42399  */
42400   __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(1, 4, __pyx_L1_error)
42401   __Pyx_GOTREF(__pyx_tuple__32);
42402   __Pyx_GIVEREF(__pyx_tuple__32);
42403 
42404   /* "View.MemoryView":682
42405  *         if item is Ellipsis:
42406  *             if not seen_ellipsis:
42407  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
42408  *                 seen_ellipsis = True
42409  *             else:
42410  */
42411   __pyx_slice__33 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__33)) __PYX_ERR(1, 682, __pyx_L1_error)
42412   __Pyx_GOTREF(__pyx_slice__33);
42413   __Pyx_GIVEREF(__pyx_slice__33);
42414 
42415   /* "View.MemoryView":703
42416  *     for suboffset in suboffsets[:ndim]:
42417  *         if suboffset >= 0:
42418  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
42419  *
42420  *
42421  */
42422   __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(1, 703, __pyx_L1_error)
42423   __Pyx_GOTREF(__pyx_tuple__34);
42424   __Pyx_GIVEREF(__pyx_tuple__34);
42425 
42426   /* "(tree fragment)":2
42427  * def __reduce_cython__(self):
42428  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
42429  * def __setstate_cython__(self, __pyx_state):
42430  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
42431  */
42432   __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(1, 2, __pyx_L1_error)
42433   __Pyx_GOTREF(__pyx_tuple__35);
42434   __Pyx_GIVEREF(__pyx_tuple__35);
42435 
42436   /* "(tree fragment)":4
42437  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
42438  * def __setstate_cython__(self, __pyx_state):
42439  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
42440  */
42441   __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(1, 4, __pyx_L1_error)
42442   __Pyx_GOTREF(__pyx_tuple__36);
42443   __Pyx_GIVEREF(__pyx_tuple__36);
42444 
42445   /* "rasterio/_base.pyx":43
42446  *
42447  *
42448  * def check_gdal_version(major, minor):             # <<<<<<<<<<<<<<
42449  *     """Return True if the major and minor versions match."""
42450  *     return bool(GDALCheckVersion(int(major), int(minor), NULL))
42451  */
42452   __pyx_tuple__37 = PyTuple_Pack(2, __pyx_n_s_major, __pyx_n_s_minor); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 43, __pyx_L1_error)
42453   __Pyx_GOTREF(__pyx_tuple__37);
42454   __Pyx_GIVEREF(__pyx_tuple__37);
42455   __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_rasterio__base_pyx, __pyx_n_s_check_gdal_version, 43, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 43, __pyx_L1_error)
42456 
42457   /* "rasterio/_base.pyx":48
42458  *
42459  *
42460  * def gdal_version():             # <<<<<<<<<<<<<<
42461  *     """Return the version as a major.minor.patchlevel string."""
42462  *     return GDALVersionInfo("RELEASE_NAME")
42463  */
42464   __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_rasterio__base_pyx, __pyx_n_s_gdal_version, 48, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 48, __pyx_L1_error)
42465 
42466   /* "rasterio/_base.pyx":58
42467  *
42468  *
42469  * def get_dataset_driver(path):             # <<<<<<<<<<<<<<
42470  *     """Return the name of the driver that opens a dataset
42471  *
42472  */
42473   __pyx_tuple__40 = PyTuple_Pack(5, __pyx_n_s_path, __pyx_n_s_dataset, __pyx_n_s_driver, __pyx_n_s_drivername, __pyx_n_s_exc); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 58, __pyx_L1_error)
42474   __Pyx_GOTREF(__pyx_tuple__40);
42475   __Pyx_GIVEREF(__pyx_tuple__40);
42476   __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_rasterio__base_pyx, __pyx_n_s_get_dataset_driver, 58, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 58, __pyx_L1_error)
42477 
42478   /* "rasterio/_base.pyx":91
42479  *
42480  *
42481  * def driver_supports_mode(drivername, creation_mode):             # <<<<<<<<<<<<<<
42482  *     """Return True if the driver supports the mode"""
42483  *     cdef GDALDriverH driver = NULL
42484  */
42485   __pyx_tuple__42 = PyTuple_Pack(4, __pyx_n_s_drivername, __pyx_n_s_creation_mode, __pyx_n_s_driver, __pyx_n_s_metadata); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 91, __pyx_L1_error)
42486   __Pyx_GOTREF(__pyx_tuple__42);
42487   __Pyx_GIVEREF(__pyx_tuple__42);
42488   __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_rasterio__base_pyx, __pyx_n_s_driver_supports_mode, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 91, __pyx_L1_error)
42489 
42490   /* "rasterio/_base.pyx":111
42491  *
42492  *
42493  * def driver_can_create(drivername):             # <<<<<<<<<<<<<<
42494  *     """Return True if the driver has CREATE capability"""
42495  *     return driver_supports_mode(drivername, 'DCAP_CREATE')
42496  */
42497   __pyx_tuple__44 = PyTuple_Pack(1, __pyx_n_s_drivername); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 111, __pyx_L1_error)
42498   __Pyx_GOTREF(__pyx_tuple__44);
42499   __Pyx_GIVEREF(__pyx_tuple__44);
42500   __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_rasterio__base_pyx, __pyx_n_s_driver_can_create, 111, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 111, __pyx_L1_error)
42501 
42502   /* "rasterio/_base.pyx":116
42503  *
42504  *
42505  * def driver_can_create_copy(drivername):             # <<<<<<<<<<<<<<
42506  *     """Return True if the driver has CREATE_COPY capability"""
42507  *     return driver_supports_mode(drivername, 'DCAP_CREATECOPY')
42508  */
42509   __pyx_tuple__46 = PyTuple_Pack(1, __pyx_n_s_drivername); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 116, __pyx_L1_error)
42510   __Pyx_GOTREF(__pyx_tuple__46);
42511   __Pyx_GIVEREF(__pyx_tuple__46);
42512   __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_rasterio__base_pyx, __pyx_n_s_driver_can_create_copy, 116, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 116, __pyx_L1_error)
42513 
42514   /* "rasterio/_base.pyx":121
42515  *
42516  *
42517  * def _raster_driver_extensions():             # <<<<<<<<<<<<<<
42518  *     """
42519  *     Logic based on: https://github.com/mapbox/rasterio/issues/265#issuecomment-367044836
42520  */
42521   __pyx_tuple__48 = PyTuple_Pack(9, __pyx_n_s_iii, __pyx_n_s_driver_count, __pyx_n_s_driver, __pyx_n_s_c_extensions, __pyx_n_s_c_drivername, __pyx_n_s_driver_extensions, __pyx_n_s_extensions, __pyx_n_s_drivername, __pyx_n_s_extension); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 121, __pyx_L1_error)
42522   __Pyx_GOTREF(__pyx_tuple__48);
42523   __Pyx_GIVEREF(__pyx_tuple__48);
42524   __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_rasterio__base_pyx, __pyx_n_s_raster_driver_extensions, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 121, __pyx_L1_error)
42525 
42526   /* "rasterio/_base.pyx":1385
42527  *
42528  *
42529  * def _transform(src_crs, dst_crs, xs, ys, zs):             # <<<<<<<<<<<<<<
42530  *     """Transform input arrays from src to dst CRS."""
42531  *     cdef double *x = NULL
42532  */
42533   __pyx_tuple__50 = PyTuple_Pack(16, __pyx_n_s_src_crs, __pyx_n_s_dst_crs, __pyx_n_s_xs, __pyx_n_s_ys, __pyx_n_s_zs, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z, __pyx_n_s_src, __pyx_n_s_dst, __pyx_n_s_transform, __pyx_n_s_i, __pyx_n_s_n, __pyx_n_s_res_xs, __pyx_n_s_res_ys, __pyx_n_s_res_zs); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 1385, __pyx_L1_error)
42534   __Pyx_GOTREF(__pyx_tuple__50);
42535   __Pyx_GIVEREF(__pyx_tuple__50);
42536   __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(5, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_rasterio__base_pyx, __pyx_n_s_transform_2, 1385, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 1385, __pyx_L1_error)
42537 
42538   /* "rasterio/_base.pyx":1482
42539  *
42540  *
42541  * def _can_create_osr(crs):             # <<<<<<<<<<<<<<
42542  *     """Evaluate if a valid OGRSpatialReference can be created from crs.
42543  *
42544  */
42545   __pyx_tuple__52 = PyTuple_Pack(3, __pyx_n_s_crs, __pyx_n_s_wkt, __pyx_n_s_osr); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 1482, __pyx_L1_error)
42546   __Pyx_GOTREF(__pyx_tuple__52);
42547   __Pyx_GIVEREF(__pyx_tuple__52);
42548   __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_rasterio__base_pyx, __pyx_n_s_can_create_osr, 1482, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 1482, __pyx_L1_error)
42549 
42550   /* "View.MemoryView":286
42551  *         return self.name
42552  *
42553  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
42554  * cdef strided = Enum("<strided and direct>") # default
42555  * cdef indirect = Enum("<strided and indirect>")
42556  */
42557   __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(1, 286, __pyx_L1_error)
42558   __Pyx_GOTREF(__pyx_tuple__54);
42559   __Pyx_GIVEREF(__pyx_tuple__54);
42560 
42561   /* "View.MemoryView":287
42562  *
42563  * cdef generic = Enum("<strided and direct or indirect>")
42564  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
42565  * cdef indirect = Enum("<strided and indirect>")
42566  *
42567  */
42568   __pyx_tuple__55 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(1, 287, __pyx_L1_error)
42569   __Pyx_GOTREF(__pyx_tuple__55);
42570   __Pyx_GIVEREF(__pyx_tuple__55);
42571 
42572   /* "View.MemoryView":288
42573  * cdef generic = Enum("<strided and direct or indirect>")
42574  * cdef strided = Enum("<strided and direct>") # default
42575  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
42576  *
42577  *
42578  */
42579   __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(1, 288, __pyx_L1_error)
42580   __Pyx_GOTREF(__pyx_tuple__56);
42581   __Pyx_GIVEREF(__pyx_tuple__56);
42582 
42583   /* "View.MemoryView":291
42584  *
42585  *
42586  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
42587  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
42588  *
42589  */
42590   __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(1, 291, __pyx_L1_error)
42591   __Pyx_GOTREF(__pyx_tuple__57);
42592   __Pyx_GIVEREF(__pyx_tuple__57);
42593 
42594   /* "View.MemoryView":292
42595  *
42596  * cdef contiguous = Enum("<contiguous and direct>")
42597  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
42598  *
42599  *
42600  */
42601   __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(1, 292, __pyx_L1_error)
42602   __Pyx_GOTREF(__pyx_tuple__58);
42603   __Pyx_GIVEREF(__pyx_tuple__58);
42604 
42605   /* "(tree fragment)":1
42606  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
42607  *     cdef object __pyx_PickleError
42608  *     cdef object __pyx_result
42609  */
42610   __pyx_tuple__59 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(1, 1, __pyx_L1_error)
42611   __Pyx_GOTREF(__pyx_tuple__59);
42612   __Pyx_GIVEREF(__pyx_tuple__59);
42613   __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(1, 1, __pyx_L1_error)
42614   __Pyx_RefNannyFinishContext();
42615   return 0;
42616   __pyx_L1_error:;
42617   __Pyx_RefNannyFinishContext();
42618   return -1;
42619 }
42620 
__Pyx_InitGlobals(void)42621 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
42622   __pyx_umethod_PyList_Type_pop.type = (PyObject*)&PyList_Type;
42623   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
42624   __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) __PYX_ERR(0, 1, __pyx_L1_error)
42625   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
42626   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
42627   __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error)
42628   __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
42629   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
42630   return 0;
42631   __pyx_L1_error:;
42632   return -1;
42633 }
42634 
42635 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
42636 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
42637 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
42638 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
42639 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
42640 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
42641 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
42642 
__Pyx_modinit_global_init_code(void)42643 static int __Pyx_modinit_global_init_code(void) {
42644   __Pyx_RefNannyDeclarations
42645   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
42646   /*--- Global init code ---*/
42647   generic = Py_None; Py_INCREF(Py_None);
42648   strided = Py_None; Py_INCREF(Py_None);
42649   indirect = Py_None; Py_INCREF(Py_None);
42650   contiguous = Py_None; Py_INCREF(Py_None);
42651   indirect_contiguous = Py_None; Py_INCREF(Py_None);
42652   __Pyx_RefNannyFinishContext();
42653   return 0;
42654 }
42655 
__Pyx_modinit_variable_export_code(void)42656 static int __Pyx_modinit_variable_export_code(void) {
42657   __Pyx_RefNannyDeclarations
42658   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
42659   /*--- Variable export code ---*/
42660   __Pyx_RefNannyFinishContext();
42661   return 0;
42662 }
42663 
__Pyx_modinit_function_export_code(void)42664 static int __Pyx_modinit_function_export_code(void) {
42665   __Pyx_RefNannyDeclarations
42666   int __pyx_lineno = 0;
42667   const char *__pyx_filename = NULL;
42668   int __pyx_clineno = 0;
42669   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
42670   /*--- Function export code ---*/
42671   if (__Pyx_ExportFunction("get_driver_name", (void (*)(void))__pyx_f_8rasterio_5_base_get_driver_name, "char const *(GDALDriverH)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42672   if (__Pyx_ExportFunction("_osr_from_crs", (void (*)(void))__pyx_f_8rasterio_5_base__osr_from_crs, "OGRSpatialReferenceH (PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42673   if (__Pyx_ExportFunction("_safe_osr_release", (void (*)(void))__pyx_f_8rasterio_5_base__safe_osr_release, "PyObject *(OGRSpatialReferenceH)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42674   __Pyx_RefNannyFinishContext();
42675   return 0;
42676   __pyx_L1_error:;
42677   __Pyx_RefNannyFinishContext();
42678   return -1;
42679 }
42680 
__Pyx_modinit_type_init_code(void)42681 static int __Pyx_modinit_type_init_code(void) {
42682   __Pyx_RefNannyDeclarations
42683   int __pyx_lineno = 0;
42684   const char *__pyx_filename = NULL;
42685   int __pyx_clineno = 0;
42686   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
42687   /*--- Type init code ---*/
42688   __pyx_vtabptr_8rasterio_5_base_DatasetBase = &__pyx_vtable_8rasterio_5_base_DatasetBase;
42689   __pyx_vtable_8rasterio_5_base_DatasetBase.handle = (GDALDatasetH (*)(struct __pyx_obj_8rasterio_5_base_DatasetBase *))__pyx_f_8rasterio_5_base_11DatasetBase_handle;
42690   __pyx_vtable_8rasterio_5_base_DatasetBase.band = (GDALRasterBandH (*)(struct __pyx_obj_8rasterio_5_base_DatasetBase *, int))__pyx_f_8rasterio_5_base_11DatasetBase_band;
42691   if (PyType_Ready(&__pyx_type_8rasterio_5_base_DatasetBase) < 0) __PYX_ERR(0, 179, __pyx_L1_error)
42692   #if PY_VERSION_HEX < 0x030800B1
42693   __pyx_type_8rasterio_5_base_DatasetBase.tp_print = 0;
42694   #endif
42695   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8rasterio_5_base_DatasetBase.tp_dictoffset && __pyx_type_8rasterio_5_base_DatasetBase.tp_getattro == PyObject_GenericGetAttr)) {
42696     __pyx_type_8rasterio_5_base_DatasetBase.tp_getattro = __Pyx_PyObject_GenericGetAttr;
42697   }
42698   #if CYTHON_COMPILING_IN_CPYTHON
42699   {
42700     PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8rasterio_5_base_DatasetBase, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 179, __pyx_L1_error)
42701     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
42702       __pyx_wrapperbase_8rasterio_5_base_11DatasetBase___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
42703       __pyx_wrapperbase_8rasterio_5_base_11DatasetBase___init__.doc = __pyx_doc_8rasterio_5_base_11DatasetBase___init__;
42704       ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8rasterio_5_base_11DatasetBase___init__;
42705     }
42706   }
42707   #endif
42708   if (__Pyx_SetVtable(__pyx_type_8rasterio_5_base_DatasetBase.tp_dict, __pyx_vtabptr_8rasterio_5_base_DatasetBase) < 0) __PYX_ERR(0, 179, __pyx_L1_error)
42709   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DatasetBase, (PyObject *)&__pyx_type_8rasterio_5_base_DatasetBase) < 0) __PYX_ERR(0, 179, __pyx_L1_error)
42710   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_8rasterio_5_base_DatasetBase) < 0) __PYX_ERR(0, 179, __pyx_L1_error)
42711   __pyx_ptype_8rasterio_5_base_DatasetBase = &__pyx_type_8rasterio_5_base_DatasetBase;
42712   if (PyType_Ready(&__pyx_type_8rasterio_5_base___pyx_scope_struct___mask_flags) < 0) __PYX_ERR(0, 555, __pyx_L1_error)
42713   #if PY_VERSION_HEX < 0x030800B1
42714   __pyx_type_8rasterio_5_base___pyx_scope_struct___mask_flags.tp_print = 0;
42715   #endif
42716   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8rasterio_5_base___pyx_scope_struct___mask_flags.tp_dictoffset && __pyx_type_8rasterio_5_base___pyx_scope_struct___mask_flags.tp_getattro == PyObject_GenericGetAttr)) {
42717     __pyx_type_8rasterio_5_base___pyx_scope_struct___mask_flags.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
42718   }
42719   __pyx_ptype_8rasterio_5_base___pyx_scope_struct___mask_flags = &__pyx_type_8rasterio_5_base___pyx_scope_struct___mask_flags;
42720   if (PyType_Ready(&__pyx_type_8rasterio_5_base___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 558, __pyx_L1_error)
42721   #if PY_VERSION_HEX < 0x030800B1
42722   __pyx_type_8rasterio_5_base___pyx_scope_struct_1_genexpr.tp_print = 0;
42723   #endif
42724   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8rasterio_5_base___pyx_scope_struct_1_genexpr.tp_dictoffset && __pyx_type_8rasterio_5_base___pyx_scope_struct_1_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
42725     __pyx_type_8rasterio_5_base___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
42726   }
42727   __pyx_ptype_8rasterio_5_base___pyx_scope_struct_1_genexpr = &__pyx_type_8rasterio_5_base___pyx_scope_struct_1_genexpr;
42728   if (PyType_Ready(&__pyx_type_8rasterio_5_base___pyx_scope_struct_2___get__) < 0) __PYX_ERR(0, 590, __pyx_L1_error)
42729   #if PY_VERSION_HEX < 0x030800B1
42730   __pyx_type_8rasterio_5_base___pyx_scope_struct_2___get__.tp_print = 0;
42731   #endif
42732   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8rasterio_5_base___pyx_scope_struct_2___get__.tp_dictoffset && __pyx_type_8rasterio_5_base___pyx_scope_struct_2___get__.tp_getattro == PyObject_GenericGetAttr)) {
42733     __pyx_type_8rasterio_5_base___pyx_scope_struct_2___get__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
42734   }
42735   __pyx_ptype_8rasterio_5_base___pyx_scope_struct_2___get__ = &__pyx_type_8rasterio_5_base___pyx_scope_struct_2___get__;
42736   if (PyType_Ready(&__pyx_type_8rasterio_5_base___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 592, __pyx_L1_error)
42737   #if PY_VERSION_HEX < 0x030800B1
42738   __pyx_type_8rasterio_5_base___pyx_scope_struct_3_genexpr.tp_print = 0;
42739   #endif
42740   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8rasterio_5_base___pyx_scope_struct_3_genexpr.tp_dictoffset && __pyx_type_8rasterio_5_base___pyx_scope_struct_3_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
42741     __pyx_type_8rasterio_5_base___pyx_scope_struct_3_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
42742   }
42743   __pyx_ptype_8rasterio_5_base___pyx_scope_struct_3_genexpr = &__pyx_type_8rasterio_5_base___pyx_scope_struct_3_genexpr;
42744   if (PyType_Ready(&__pyx_type_8rasterio_5_base___pyx_scope_struct_4___get__) < 0) __PYX_ERR(0, 636, __pyx_L1_error)
42745   #if PY_VERSION_HEX < 0x030800B1
42746   __pyx_type_8rasterio_5_base___pyx_scope_struct_4___get__.tp_print = 0;
42747   #endif
42748   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8rasterio_5_base___pyx_scope_struct_4___get__.tp_dictoffset && __pyx_type_8rasterio_5_base___pyx_scope_struct_4___get__.tp_getattro == PyObject_GenericGetAttr)) {
42749     __pyx_type_8rasterio_5_base___pyx_scope_struct_4___get__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
42750   }
42751   __pyx_ptype_8rasterio_5_base___pyx_scope_struct_4___get__ = &__pyx_type_8rasterio_5_base___pyx_scope_struct_4___get__;
42752   if (PyType_Ready(&__pyx_type_8rasterio_5_base___pyx_scope_struct_5_genexpr) < 0) __PYX_ERR(0, 639, __pyx_L1_error)
42753   #if PY_VERSION_HEX < 0x030800B1
42754   __pyx_type_8rasterio_5_base___pyx_scope_struct_5_genexpr.tp_print = 0;
42755   #endif
42756   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8rasterio_5_base___pyx_scope_struct_5_genexpr.tp_dictoffset && __pyx_type_8rasterio_5_base___pyx_scope_struct_5_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
42757     __pyx_type_8rasterio_5_base___pyx_scope_struct_5_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
42758   }
42759   __pyx_ptype_8rasterio_5_base___pyx_scope_struct_5_genexpr = &__pyx_type_8rasterio_5_base___pyx_scope_struct_5_genexpr;
42760   if (PyType_Ready(&__pyx_type_8rasterio_5_base___pyx_scope_struct_6___get__) < 0) __PYX_ERR(0, 715, __pyx_L1_error)
42761   #if PY_VERSION_HEX < 0x030800B1
42762   __pyx_type_8rasterio_5_base___pyx_scope_struct_6___get__.tp_print = 0;
42763   #endif
42764   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8rasterio_5_base___pyx_scope_struct_6___get__.tp_dictoffset && __pyx_type_8rasterio_5_base___pyx_scope_struct_6___get__.tp_getattro == PyObject_GenericGetAttr)) {
42765     __pyx_type_8rasterio_5_base___pyx_scope_struct_6___get__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
42766   }
42767   __pyx_ptype_8rasterio_5_base___pyx_scope_struct_6___get__ = &__pyx_type_8rasterio_5_base___pyx_scope_struct_6___get__;
42768   if (PyType_Ready(&__pyx_type_8rasterio_5_base___pyx_scope_struct_7_genexpr) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
42769   #if PY_VERSION_HEX < 0x030800B1
42770   __pyx_type_8rasterio_5_base___pyx_scope_struct_7_genexpr.tp_print = 0;
42771   #endif
42772   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8rasterio_5_base___pyx_scope_struct_7_genexpr.tp_dictoffset && __pyx_type_8rasterio_5_base___pyx_scope_struct_7_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
42773     __pyx_type_8rasterio_5_base___pyx_scope_struct_7_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
42774   }
42775   __pyx_ptype_8rasterio_5_base___pyx_scope_struct_7_genexpr = &__pyx_type_8rasterio_5_base___pyx_scope_struct_7_genexpr;
42776   if (PyType_Ready(&__pyx_type_8rasterio_5_base___pyx_scope_struct_8_block_windows) < 0) __PYX_ERR(0, 780, __pyx_L1_error)
42777   #if PY_VERSION_HEX < 0x030800B1
42778   __pyx_type_8rasterio_5_base___pyx_scope_struct_8_block_windows.tp_print = 0;
42779   #endif
42780   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8rasterio_5_base___pyx_scope_struct_8_block_windows.tp_dictoffset && __pyx_type_8rasterio_5_base___pyx_scope_struct_8_block_windows.tp_getattro == PyObject_GenericGetAttr)) {
42781     __pyx_type_8rasterio_5_base___pyx_scope_struct_8_block_windows.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
42782   }
42783   __pyx_ptype_8rasterio_5_base___pyx_scope_struct_8_block_windows = &__pyx_type_8rasterio_5_base___pyx_scope_struct_8_block_windows;
42784   __pyx_vtabptr_array = &__pyx_vtable_array;
42785   __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
42786   if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
42787   #if PY_VERSION_HEX < 0x030800B1
42788   __pyx_type___pyx_array.tp_print = 0;
42789   #endif
42790   if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
42791   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
42792   __pyx_array_type = &__pyx_type___pyx_array;
42793   if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
42794   #if PY_VERSION_HEX < 0x030800B1
42795   __pyx_type___pyx_MemviewEnum.tp_print = 0;
42796   #endif
42797   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
42798     __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
42799   }
42800   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
42801   __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
42802   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
42803   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
42804   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
42805   __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
42806   __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
42807   __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
42808   __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
42809   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
42810   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
42811   #if PY_VERSION_HEX < 0x030800B1
42812   __pyx_type___pyx_memoryview.tp_print = 0;
42813   #endif
42814   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
42815     __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
42816   }
42817   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
42818   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
42819   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
42820   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
42821   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
42822   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
42823   __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
42824   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
42825   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
42826   #if PY_VERSION_HEX < 0x030800B1
42827   __pyx_type___pyx_memoryviewslice.tp_print = 0;
42828   #endif
42829   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
42830     __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
42831   }
42832   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
42833   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
42834   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
42835   __Pyx_RefNannyFinishContext();
42836   return 0;
42837   __pyx_L1_error:;
42838   __Pyx_RefNannyFinishContext();
42839   return -1;
42840 }
42841 
__Pyx_modinit_type_import_code(void)42842 static int __Pyx_modinit_type_import_code(void) {
42843   __Pyx_RefNannyDeclarations
42844   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
42845   /*--- Type import code ---*/
42846   __Pyx_RefNannyFinishContext();
42847   return 0;
42848 }
42849 
__Pyx_modinit_variable_import_code(void)42850 static int __Pyx_modinit_variable_import_code(void) {
42851   __Pyx_RefNannyDeclarations
42852   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
42853   /*--- Variable import code ---*/
42854   __Pyx_RefNannyFinishContext();
42855   return 0;
42856 }
42857 
__Pyx_modinit_function_import_code(void)42858 static int __Pyx_modinit_function_import_code(void) {
42859   __Pyx_RefNannyDeclarations
42860   PyObject *__pyx_t_1 = NULL;
42861   int __pyx_lineno = 0;
42862   const char *__pyx_filename = NULL;
42863   int __pyx_clineno = 0;
42864   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
42865   /*--- Function import code ---*/
42866   __pyx_t_1 = PyImport_ImportModule("rasterio._err"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
42867   __Pyx_GOTREF(__pyx_t_1);
42868   if (__Pyx_ImportFunction(__pyx_t_1, "exc_wrap", (void (**)(void))&__pyx_f_8rasterio_4_err_exc_wrap, "int (int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42869   if (__Pyx_ImportFunction(__pyx_t_1, "exc_wrap_int", (void (**)(void))&__pyx_f_8rasterio_4_err_exc_wrap_int, "int (int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42870   if (__Pyx_ImportFunction(__pyx_t_1, "exc_wrap_pointer", (void (**)(void))&__pyx_f_8rasterio_4_err_exc_wrap_pointer, "void *(void *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42871   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
42872   __pyx_t_1 = PyImport_ImportModule("rasterio._shim"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
42873   __Pyx_GOTREF(__pyx_t_1);
42874   if (__Pyx_ImportFunction(__pyx_t_1, "open_dataset", (void (**)(void))&__pyx_f_8rasterio_5_shim_open_dataset, "GDALDatasetH (PyObject *, int, PyObject *, PyObject *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42875   if (__Pyx_ImportFunction(__pyx_t_1, "osr_get_name", (void (**)(void))&__pyx_f_8rasterio_5_shim_osr_get_name, "char const *(OGRSpatialReferenceH)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42876   if (__Pyx_ImportFunction(__pyx_t_1, "osr_set_traditional_axis_mapping_strategy", (void (**)(void))&__pyx_f_8rasterio_5_shim_osr_set_traditional_axis_mapping_strategy, "void (OGRSpatialReferenceH)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42877   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
42878   __Pyx_RefNannyFinishContext();
42879   return 0;
42880   __pyx_L1_error:;
42881   __Pyx_XDECREF(__pyx_t_1);
42882   __Pyx_RefNannyFinishContext();
42883   return -1;
42884 }
42885 
42886 
42887 #ifndef CYTHON_NO_PYINIT_EXPORT
42888 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
42889 #elif PY_MAJOR_VERSION < 3
42890 #ifdef __cplusplus
42891 #define __Pyx_PyMODINIT_FUNC extern "C" void
42892 #else
42893 #define __Pyx_PyMODINIT_FUNC void
42894 #endif
42895 #else
42896 #ifdef __cplusplus
42897 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
42898 #else
42899 #define __Pyx_PyMODINIT_FUNC PyObject *
42900 #endif
42901 #endif
42902 
42903 
42904 #if PY_MAJOR_VERSION < 3
42905 __Pyx_PyMODINIT_FUNC init_base(void) CYTHON_SMALL_CODE; /*proto*/
init_base(void)42906 __Pyx_PyMODINIT_FUNC init_base(void)
42907 #else
42908 __Pyx_PyMODINIT_FUNC PyInit__base(void) CYTHON_SMALL_CODE; /*proto*/
42909 __Pyx_PyMODINIT_FUNC PyInit__base(void)
42910 #if CYTHON_PEP489_MULTI_PHASE_INIT
42911 {
42912   return PyModuleDef_Init(&__pyx_moduledef);
42913 }
42914 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
42915     #if PY_VERSION_HEX >= 0x030700A1
42916     static PY_INT64_T main_interpreter_id = -1;
42917     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
42918     if (main_interpreter_id == -1) {
42919         main_interpreter_id = current_id;
42920         return (unlikely(current_id == -1)) ? -1 : 0;
42921     } else if (unlikely(main_interpreter_id != current_id))
42922     #else
42923     static PyInterpreterState *main_interpreter = NULL;
42924     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
42925     if (!main_interpreter) {
42926         main_interpreter = current_interpreter;
42927     } else if (unlikely(main_interpreter != current_interpreter))
42928     #endif
42929     {
42930         PyErr_SetString(
42931             PyExc_ImportError,
42932             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
42933         return -1;
42934     }
42935     return 0;
42936 }
42937 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) {
42938     PyObject *value = PyObject_GetAttrString(spec, from_name);
42939     int result = 0;
42940     if (likely(value)) {
42941         if (allow_none || value != Py_None) {
42942             result = PyDict_SetItemString(moddict, to_name, value);
42943         }
42944         Py_DECREF(value);
42945     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
42946         PyErr_Clear();
42947     } else {
42948         result = -1;
42949     }
42950     return result;
42951 }
42952 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
42953     PyObject *module = NULL, *moddict, *modname;
42954     if (__Pyx_check_single_interpreter())
42955         return NULL;
42956     if (__pyx_m)
42957         return __Pyx_NewRef(__pyx_m);
42958     modname = PyObject_GetAttrString(spec, "name");
42959     if (unlikely(!modname)) goto bad;
42960     module = PyModule_NewObject(modname);
42961     Py_DECREF(modname);
42962     if (unlikely(!module)) goto bad;
42963     moddict = PyModule_GetDict(module);
42964     if (unlikely(!moddict)) goto bad;
42965     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
42966     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
42967     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
42968     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
42969     return module;
42970 bad:
42971     Py_XDECREF(module);
42972     return NULL;
42973 }
42974 
42975 
42976 static CYTHON_SMALL_CODE int __pyx_pymod_exec__base(PyObject *__pyx_pyinit_module)
42977 #endif
42978 #endif
42979 {
42980   PyObject *__pyx_t_1 = NULL;
42981   PyObject *__pyx_t_2 = NULL;
42982   PyObject *__pyx_t_3 = NULL;
42983   static PyThread_type_lock __pyx_t_4[8];
42984   int __pyx_lineno = 0;
42985   const char *__pyx_filename = NULL;
42986   int __pyx_clineno = 0;
42987   __Pyx_RefNannyDeclarations
42988   #if CYTHON_PEP489_MULTI_PHASE_INIT
42989   if (__pyx_m) {
42990     if (__pyx_m == __pyx_pyinit_module) return 0;
42991     PyErr_SetString(PyExc_RuntimeError, "Module '_base' has already been imported. Re-initialisation is not supported.");
42992     return -1;
42993   }
42994   #elif PY_MAJOR_VERSION >= 3
42995   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
42996   #endif
42997   #if CYTHON_REFNANNY
42998 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
42999 if (!__Pyx_RefNanny) {
43000   PyErr_Clear();
43001   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
43002   if (!__Pyx_RefNanny)
43003       Py_FatalError("failed to import 'refnanny' module");
43004 }
43005 #endif
43006   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__base(void)", 0);
43007   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43008   #ifdef __Pxy_PyFrame_Initialize_Offsets
43009   __Pxy_PyFrame_Initialize_Offsets();
43010   #endif
43011   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
43012   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
43013   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
43014   #ifdef __Pyx_CyFunction_USED
43015   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43016   #endif
43017   #ifdef __Pyx_FusedFunction_USED
43018   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43019   #endif
43020   #ifdef __Pyx_Coroutine_USED
43021   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43022   #endif
43023   #ifdef __Pyx_Generator_USED
43024   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43025   #endif
43026   #ifdef __Pyx_AsyncGen_USED
43027   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43028   #endif
43029   #ifdef __Pyx_StopAsyncIteration_USED
43030   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43031   #endif
43032   /*--- Library function declarations ---*/
43033   /*--- Threads initialization code ---*/
43034   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
43035   #ifdef WITH_THREAD /* Python build with threading support? */
43036   PyEval_InitThreads();
43037   #endif
43038   #endif
43039   /*--- Module creation code ---*/
43040   #if CYTHON_PEP489_MULTI_PHASE_INIT
43041   __pyx_m = __pyx_pyinit_module;
43042   Py_INCREF(__pyx_m);
43043   #else
43044   #if PY_MAJOR_VERSION < 3
43045   __pyx_m = Py_InitModule4("_base", __pyx_methods, __pyx_k_Numpy_free_base_classes, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
43046   #else
43047   __pyx_m = PyModule_Create(&__pyx_moduledef);
43048   #endif
43049   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
43050   #endif
43051   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
43052   Py_INCREF(__pyx_d);
43053   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
43054   Py_INCREF(__pyx_b);
43055   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
43056   Py_INCREF(__pyx_cython_runtime);
43057   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
43058   /*--- Initialize various global constants etc. ---*/
43059   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43060   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
43061   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43062   #endif
43063   if (__pyx_module_is_main_rasterio___base) {
43064     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43065   }
43066   #if PY_MAJOR_VERSION >= 3
43067   {
43068     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
43069     if (!PyDict_GetItemString(modules, "rasterio._base")) {
43070       if (unlikely(PyDict_SetItemString(modules, "rasterio._base", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
43071     }
43072   }
43073   #endif
43074   /*--- Builtin init code ---*/
43075   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43076   /*--- Constants init code ---*/
43077   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43078   /*--- Global type/function init code ---*/
43079   (void)__Pyx_modinit_global_init_code();
43080   (void)__Pyx_modinit_variable_export_code();
43081   if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
43082   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
43083   (void)__Pyx_modinit_type_import_code();
43084   (void)__Pyx_modinit_variable_import_code();
43085   if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
43086   /*--- Execution code ---*/
43087   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
43088   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43089   #endif
43090 
43091   /* "rasterio/_base.pyx":5
43092  * """Numpy-free base classes."""
43093  *
43094  * from collections import defaultdict             # <<<<<<<<<<<<<<
43095  * import logging
43096  * import math
43097  */
43098   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
43099   __Pyx_GOTREF(__pyx_t_1);
43100   __Pyx_INCREF(__pyx_n_s_defaultdict);
43101   __Pyx_GIVEREF(__pyx_n_s_defaultdict);
43102   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_defaultdict);
43103   __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)
43104   __Pyx_GOTREF(__pyx_t_2);
43105   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43106   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
43107   __Pyx_GOTREF(__pyx_t_1);
43108   if (PyDict_SetItem(__pyx_d, __pyx_n_s_defaultdict, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
43109   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43110   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43111 
43112   /* "rasterio/_base.pyx":6
43113  *
43114  * from collections import defaultdict
43115  * import logging             # <<<<<<<<<<<<<<
43116  * import math
43117  * import os
43118  */
43119   __pyx_t_2 = __Pyx_Import(__pyx_n_s_logging, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
43120   __Pyx_GOTREF(__pyx_t_2);
43121   if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
43122   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43123 
43124   /* "rasterio/_base.pyx":7
43125  * from collections import defaultdict
43126  * import logging
43127  * import math             # <<<<<<<<<<<<<<
43128  * import os
43129  * import warnings
43130  */
43131   __pyx_t_2 = __Pyx_Import(__pyx_n_s_math, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
43132   __Pyx_GOTREF(__pyx_t_2);
43133   if (PyDict_SetItem(__pyx_d, __pyx_n_s_math, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
43134   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43135 
43136   /* "rasterio/_base.pyx":8
43137  * import logging
43138  * import math
43139  * import os             # <<<<<<<<<<<<<<
43140  * import warnings
43141  *
43142  */
43143   __pyx_t_2 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
43144   __Pyx_GOTREF(__pyx_t_2);
43145   if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
43146   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43147 
43148   /* "rasterio/_base.pyx":9
43149  * import math
43150  * import os
43151  * import warnings             # <<<<<<<<<<<<<<
43152  *
43153  * from libc.string cimport strncmp
43154  */
43155   __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
43156   __Pyx_GOTREF(__pyx_t_2);
43157   if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
43158   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43159 
43160   /* "rasterio/_base.pyx":14
43161  *
43162  * from rasterio._err import (
43163  *     GDALError, CPLE_BaseError, CPLE_IllegalArgError, CPLE_OpenFailedError,             # <<<<<<<<<<<<<<
43164  *     CPLE_NotSupportedError)
43165  * from rasterio._err cimport exc_wrap_pointer, exc_wrap_int, exc_wrap
43166  */
43167   __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
43168   __Pyx_GOTREF(__pyx_t_2);
43169   __Pyx_INCREF(__pyx_n_s_GDALError);
43170   __Pyx_GIVEREF(__pyx_n_s_GDALError);
43171   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_GDALError);
43172   __Pyx_INCREF(__pyx_n_s_CPLE_BaseError);
43173   __Pyx_GIVEREF(__pyx_n_s_CPLE_BaseError);
43174   PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_CPLE_BaseError);
43175   __Pyx_INCREF(__pyx_n_s_CPLE_IllegalArgError);
43176   __Pyx_GIVEREF(__pyx_n_s_CPLE_IllegalArgError);
43177   PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_CPLE_IllegalArgError);
43178   __Pyx_INCREF(__pyx_n_s_CPLE_OpenFailedError);
43179   __Pyx_GIVEREF(__pyx_n_s_CPLE_OpenFailedError);
43180   PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_CPLE_OpenFailedError);
43181   __Pyx_INCREF(__pyx_n_s_CPLE_NotSupportedError);
43182   __Pyx_GIVEREF(__pyx_n_s_CPLE_NotSupportedError);
43183   PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_CPLE_NotSupportedError);
43184 
43185   /* "rasterio/_base.pyx":13
43186  * from libc.string cimport strncmp
43187  *
43188  * from rasterio._err import (             # <<<<<<<<<<<<<<
43189  *     GDALError, CPLE_BaseError, CPLE_IllegalArgError, CPLE_OpenFailedError,
43190  *     CPLE_NotSupportedError)
43191  */
43192   __pyx_t_1 = __Pyx_Import(__pyx_n_s_rasterio__err, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
43193   __Pyx_GOTREF(__pyx_t_1);
43194   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43195   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_GDALError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
43196   __Pyx_GOTREF(__pyx_t_2);
43197   if (PyDict_SetItem(__pyx_d, __pyx_n_s_GDALError, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
43198   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43199   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CPLE_BaseError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
43200   __Pyx_GOTREF(__pyx_t_2);
43201   if (PyDict_SetItem(__pyx_d, __pyx_n_s_CPLE_BaseError, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
43202   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43203   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CPLE_IllegalArgError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
43204   __Pyx_GOTREF(__pyx_t_2);
43205   if (PyDict_SetItem(__pyx_d, __pyx_n_s_CPLE_IllegalArgError, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
43206   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43207   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CPLE_OpenFailedError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
43208   __Pyx_GOTREF(__pyx_t_2);
43209   if (PyDict_SetItem(__pyx_d, __pyx_n_s_CPLE_OpenFailedError, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
43210   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43211   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CPLE_NotSupportedError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
43212   __Pyx_GOTREF(__pyx_t_2);
43213   if (PyDict_SetItem(__pyx_d, __pyx_n_s_CPLE_NotSupportedError, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
43214   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43215   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43216 
43217   /* "rasterio/_base.pyx":19
43218  * from rasterio._shim cimport open_dataset, osr_get_name, osr_set_traditional_axis_mapping_strategy
43219  *
43220  * from rasterio.control import GroundControlPoint             # <<<<<<<<<<<<<<
43221  * from rasterio.rpc import RPC
43222  * from rasterio import dtypes
43223  */
43224   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
43225   __Pyx_GOTREF(__pyx_t_1);
43226   __Pyx_INCREF(__pyx_n_s_GroundControlPoint);
43227   __Pyx_GIVEREF(__pyx_n_s_GroundControlPoint);
43228   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_GroundControlPoint);
43229   __pyx_t_2 = __Pyx_Import(__pyx_n_s_rasterio_control, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
43230   __Pyx_GOTREF(__pyx_t_2);
43231   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43232   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_GroundControlPoint); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
43233   __Pyx_GOTREF(__pyx_t_1);
43234   if (PyDict_SetItem(__pyx_d, __pyx_n_s_GroundControlPoint, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
43235   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43236   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43237 
43238   /* "rasterio/_base.pyx":20
43239  *
43240  * from rasterio.control import GroundControlPoint
43241  * from rasterio.rpc import RPC             # <<<<<<<<<<<<<<
43242  * from rasterio import dtypes
43243  * from rasterio.coords import BoundingBox
43244  */
43245   __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
43246   __Pyx_GOTREF(__pyx_t_2);
43247   __Pyx_INCREF(__pyx_n_s_RPC);
43248   __Pyx_GIVEREF(__pyx_n_s_RPC);
43249   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_RPC);
43250   __pyx_t_1 = __Pyx_Import(__pyx_n_s_rasterio_rpc, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
43251   __Pyx_GOTREF(__pyx_t_1);
43252   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43253   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_RPC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
43254   __Pyx_GOTREF(__pyx_t_2);
43255   if (PyDict_SetItem(__pyx_d, __pyx_n_s_RPC, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
43256   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43257   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43258 
43259   /* "rasterio/_base.pyx":21
43260  * from rasterio.control import GroundControlPoint
43261  * from rasterio.rpc import RPC
43262  * from rasterio import dtypes             # <<<<<<<<<<<<<<
43263  * from rasterio.coords import BoundingBox
43264  * from rasterio.crs import CRS
43265  */
43266   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
43267   __Pyx_GOTREF(__pyx_t_1);
43268   __Pyx_INCREF(__pyx_n_s_dtypes);
43269   __Pyx_GIVEREF(__pyx_n_s_dtypes);
43270   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_dtypes);
43271   __pyx_t_2 = __Pyx_Import(__pyx_n_s_rasterio, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
43272   __Pyx_GOTREF(__pyx_t_2);
43273   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43274   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
43275   __Pyx_GOTREF(__pyx_t_1);
43276   if (PyDict_SetItem(__pyx_d, __pyx_n_s_dtypes, __pyx_t_1) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
43277   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43278   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43279 
43280   /* "rasterio/_base.pyx":22
43281  * from rasterio.rpc import RPC
43282  * from rasterio import dtypes
43283  * from rasterio.coords import BoundingBox             # <<<<<<<<<<<<<<
43284  * from rasterio.crs import CRS
43285  * from rasterio.enums import (
43286  */
43287   __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
43288   __Pyx_GOTREF(__pyx_t_2);
43289   __Pyx_INCREF(__pyx_n_s_BoundingBox);
43290   __Pyx_GIVEREF(__pyx_n_s_BoundingBox);
43291   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_BoundingBox);
43292   __pyx_t_1 = __Pyx_Import(__pyx_n_s_rasterio_coords, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
43293   __Pyx_GOTREF(__pyx_t_1);
43294   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43295   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_BoundingBox); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
43296   __Pyx_GOTREF(__pyx_t_2);
43297   if (PyDict_SetItem(__pyx_d, __pyx_n_s_BoundingBox, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
43298   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43299   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43300 
43301   /* "rasterio/_base.pyx":23
43302  * from rasterio import dtypes
43303  * from rasterio.coords import BoundingBox
43304  * from rasterio.crs import CRS             # <<<<<<<<<<<<<<
43305  * from rasterio.enums import (
43306  *     ColorInterp, Compression, Interleaving, MaskFlags, PhotometricInterp)
43307  */
43308   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
43309   __Pyx_GOTREF(__pyx_t_1);
43310   __Pyx_INCREF(__pyx_n_s_CRS);
43311   __Pyx_GIVEREF(__pyx_n_s_CRS);
43312   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_CRS);
43313   __pyx_t_2 = __Pyx_Import(__pyx_n_s_rasterio_crs, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
43314   __Pyx_GOTREF(__pyx_t_2);
43315   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43316   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_CRS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
43317   __Pyx_GOTREF(__pyx_t_1);
43318   if (PyDict_SetItem(__pyx_d, __pyx_n_s_CRS, __pyx_t_1) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
43319   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43320   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43321 
43322   /* "rasterio/_base.pyx":25
43323  * from rasterio.crs import CRS
43324  * from rasterio.enums import (
43325  *     ColorInterp, Compression, Interleaving, MaskFlags, PhotometricInterp)             # <<<<<<<<<<<<<<
43326  * from rasterio.env import Env, env_ctx_if_needed
43327  * from rasterio.errors import (
43328  */
43329   __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
43330   __Pyx_GOTREF(__pyx_t_2);
43331   __Pyx_INCREF(__pyx_n_s_ColorInterp);
43332   __Pyx_GIVEREF(__pyx_n_s_ColorInterp);
43333   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ColorInterp);
43334   __Pyx_INCREF(__pyx_n_s_Compression);
43335   __Pyx_GIVEREF(__pyx_n_s_Compression);
43336   PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_Compression);
43337   __Pyx_INCREF(__pyx_n_s_Interleaving);
43338   __Pyx_GIVEREF(__pyx_n_s_Interleaving);
43339   PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_Interleaving);
43340   __Pyx_INCREF(__pyx_n_s_MaskFlags);
43341   __Pyx_GIVEREF(__pyx_n_s_MaskFlags);
43342   PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_MaskFlags);
43343   __Pyx_INCREF(__pyx_n_s_PhotometricInterp);
43344   __Pyx_GIVEREF(__pyx_n_s_PhotometricInterp);
43345   PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_PhotometricInterp);
43346 
43347   /* "rasterio/_base.pyx":24
43348  * from rasterio.coords import BoundingBox
43349  * from rasterio.crs import CRS
43350  * from rasterio.enums import (             # <<<<<<<<<<<<<<
43351  *     ColorInterp, Compression, Interleaving, MaskFlags, PhotometricInterp)
43352  * from rasterio.env import Env, env_ctx_if_needed
43353  */
43354   __pyx_t_1 = __Pyx_Import(__pyx_n_s_rasterio_enums, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
43355   __Pyx_GOTREF(__pyx_t_1);
43356   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43357   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ColorInterp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
43358   __Pyx_GOTREF(__pyx_t_2);
43359   if (PyDict_SetItem(__pyx_d, __pyx_n_s_ColorInterp, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
43360   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43361   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Compression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
43362   __Pyx_GOTREF(__pyx_t_2);
43363   if (PyDict_SetItem(__pyx_d, __pyx_n_s_Compression, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
43364   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43365   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Interleaving); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
43366   __Pyx_GOTREF(__pyx_t_2);
43367   if (PyDict_SetItem(__pyx_d, __pyx_n_s_Interleaving, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
43368   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43369   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_MaskFlags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
43370   __Pyx_GOTREF(__pyx_t_2);
43371   if (PyDict_SetItem(__pyx_d, __pyx_n_s_MaskFlags, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
43372   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43373   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_PhotometricInterp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
43374   __Pyx_GOTREF(__pyx_t_2);
43375   if (PyDict_SetItem(__pyx_d, __pyx_n_s_PhotometricInterp, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
43376   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43377   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43378 
43379   /* "rasterio/_base.pyx":26
43380  * from rasterio.enums import (
43381  *     ColorInterp, Compression, Interleaving, MaskFlags, PhotometricInterp)
43382  * from rasterio.env import Env, env_ctx_if_needed             # <<<<<<<<<<<<<<
43383  * from rasterio.errors import (
43384  *     DatasetAttributeError,
43385  */
43386   __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
43387   __Pyx_GOTREF(__pyx_t_1);
43388   __Pyx_INCREF(__pyx_n_s_Env);
43389   __Pyx_GIVEREF(__pyx_n_s_Env);
43390   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Env);
43391   __Pyx_INCREF(__pyx_n_s_env_ctx_if_needed);
43392   __Pyx_GIVEREF(__pyx_n_s_env_ctx_if_needed);
43393   PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_env_ctx_if_needed);
43394   __pyx_t_2 = __Pyx_Import(__pyx_n_s_rasterio_env, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
43395   __Pyx_GOTREF(__pyx_t_2);
43396   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43397   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Env); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
43398   __Pyx_GOTREF(__pyx_t_1);
43399   if (PyDict_SetItem(__pyx_d, __pyx_n_s_Env, __pyx_t_1) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
43400   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43401   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_env_ctx_if_needed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
43402   __Pyx_GOTREF(__pyx_t_1);
43403   if (PyDict_SetItem(__pyx_d, __pyx_n_s_env_ctx_if_needed, __pyx_t_1) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
43404   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43405   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43406 
43407   /* "rasterio/_base.pyx":28
43408  * from rasterio.env import Env, env_ctx_if_needed
43409  * from rasterio.errors import (
43410  *     DatasetAttributeError,             # <<<<<<<<<<<<<<
43411  *     RasterioIOError, CRSError, DriverRegistrationError, NotGeoreferencedWarning,
43412  *     RasterBlockError, BandOverviewError)
43413  */
43414   __pyx_t_2 = PyList_New(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
43415   __Pyx_GOTREF(__pyx_t_2);
43416   __Pyx_INCREF(__pyx_n_s_DatasetAttributeError);
43417   __Pyx_GIVEREF(__pyx_n_s_DatasetAttributeError);
43418   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_DatasetAttributeError);
43419   __Pyx_INCREF(__pyx_n_s_RasterioIOError);
43420   __Pyx_GIVEREF(__pyx_n_s_RasterioIOError);
43421   PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_RasterioIOError);
43422   __Pyx_INCREF(__pyx_n_s_CRSError);
43423   __Pyx_GIVEREF(__pyx_n_s_CRSError);
43424   PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_CRSError);
43425   __Pyx_INCREF(__pyx_n_s_DriverRegistrationError);
43426   __Pyx_GIVEREF(__pyx_n_s_DriverRegistrationError);
43427   PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_DriverRegistrationError);
43428   __Pyx_INCREF(__pyx_n_s_NotGeoreferencedWarning);
43429   __Pyx_GIVEREF(__pyx_n_s_NotGeoreferencedWarning);
43430   PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_NotGeoreferencedWarning);
43431   __Pyx_INCREF(__pyx_n_s_RasterBlockError);
43432   __Pyx_GIVEREF(__pyx_n_s_RasterBlockError);
43433   PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_RasterBlockError);
43434   __Pyx_INCREF(__pyx_n_s_BandOverviewError);
43435   __Pyx_GIVEREF(__pyx_n_s_BandOverviewError);
43436   PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_s_BandOverviewError);
43437 
43438   /* "rasterio/_base.pyx":27
43439  *     ColorInterp, Compression, Interleaving, MaskFlags, PhotometricInterp)
43440  * from rasterio.env import Env, env_ctx_if_needed
43441  * from rasterio.errors import (             # <<<<<<<<<<<<<<
43442  *     DatasetAttributeError,
43443  *     RasterioIOError, CRSError, DriverRegistrationError, NotGeoreferencedWarning,
43444  */
43445   __pyx_t_1 = __Pyx_Import(__pyx_n_s_rasterio_errors, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
43446   __Pyx_GOTREF(__pyx_t_1);
43447   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43448   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_DatasetAttributeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
43449   __Pyx_GOTREF(__pyx_t_2);
43450   if (PyDict_SetItem(__pyx_d, __pyx_n_s_DatasetAttributeError, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
43451   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43452   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_RasterioIOError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
43453   __Pyx_GOTREF(__pyx_t_2);
43454   if (PyDict_SetItem(__pyx_d, __pyx_n_s_RasterioIOError, __pyx_t_2) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
43455   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43456   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CRSError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
43457   __Pyx_GOTREF(__pyx_t_2);
43458   if (PyDict_SetItem(__pyx_d, __pyx_n_s_CRSError, __pyx_t_2) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
43459   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43460   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_DriverRegistrationError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
43461   __Pyx_GOTREF(__pyx_t_2);
43462   if (PyDict_SetItem(__pyx_d, __pyx_n_s_DriverRegistrationError, __pyx_t_2) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
43463   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43464   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_NotGeoreferencedWarning); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
43465   __Pyx_GOTREF(__pyx_t_2);
43466   if (PyDict_SetItem(__pyx_d, __pyx_n_s_NotGeoreferencedWarning, __pyx_t_2) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
43467   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43468   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_RasterBlockError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
43469   __Pyx_GOTREF(__pyx_t_2);
43470   if (PyDict_SetItem(__pyx_d, __pyx_n_s_RasterBlockError, __pyx_t_2) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
43471   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43472   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_BandOverviewError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
43473   __Pyx_GOTREF(__pyx_t_2);
43474   if (PyDict_SetItem(__pyx_d, __pyx_n_s_BandOverviewError, __pyx_t_2) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
43475   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43476   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43477 
43478   /* "rasterio/_base.pyx":31
43479  *     RasterioIOError, CRSError, DriverRegistrationError, NotGeoreferencedWarning,
43480  *     RasterBlockError, BandOverviewError)
43481  * from rasterio.profiles import Profile             # <<<<<<<<<<<<<<
43482  * from rasterio.transform import Affine, guard_transform, tastes_like_gdal
43483  * from rasterio.path import parse_path
43484  */
43485   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
43486   __Pyx_GOTREF(__pyx_t_1);
43487   __Pyx_INCREF(__pyx_n_s_Profile);
43488   __Pyx_GIVEREF(__pyx_n_s_Profile);
43489   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Profile);
43490   __pyx_t_2 = __Pyx_Import(__pyx_n_s_rasterio_profiles, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error)
43491   __Pyx_GOTREF(__pyx_t_2);
43492   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43493   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Profile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
43494   __Pyx_GOTREF(__pyx_t_1);
43495   if (PyDict_SetItem(__pyx_d, __pyx_n_s_Profile, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
43496   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43497   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43498 
43499   /* "rasterio/_base.pyx":32
43500  *     RasterBlockError, BandOverviewError)
43501  * from rasterio.profiles import Profile
43502  * from rasterio.transform import Affine, guard_transform, tastes_like_gdal             # <<<<<<<<<<<<<<
43503  * from rasterio.path import parse_path
43504  * from rasterio import windows
43505  */
43506   __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
43507   __Pyx_GOTREF(__pyx_t_2);
43508   __Pyx_INCREF(__pyx_n_s_Affine);
43509   __Pyx_GIVEREF(__pyx_n_s_Affine);
43510   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Affine);
43511   __Pyx_INCREF(__pyx_n_s_guard_transform);
43512   __Pyx_GIVEREF(__pyx_n_s_guard_transform);
43513   PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_guard_transform);
43514   __Pyx_INCREF(__pyx_n_s_tastes_like_gdal);
43515   __Pyx_GIVEREF(__pyx_n_s_tastes_like_gdal);
43516   PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_tastes_like_gdal);
43517   __pyx_t_1 = __Pyx_Import(__pyx_n_s_rasterio_transform, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
43518   __Pyx_GOTREF(__pyx_t_1);
43519   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43520   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Affine); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
43521   __Pyx_GOTREF(__pyx_t_2);
43522   if (PyDict_SetItem(__pyx_d, __pyx_n_s_Affine, __pyx_t_2) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
43523   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43524   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_guard_transform); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
43525   __Pyx_GOTREF(__pyx_t_2);
43526   if (PyDict_SetItem(__pyx_d, __pyx_n_s_guard_transform, __pyx_t_2) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
43527   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43528   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_tastes_like_gdal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
43529   __Pyx_GOTREF(__pyx_t_2);
43530   if (PyDict_SetItem(__pyx_d, __pyx_n_s_tastes_like_gdal, __pyx_t_2) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
43531   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43532   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43533 
43534   /* "rasterio/_base.pyx":33
43535  * from rasterio.profiles import Profile
43536  * from rasterio.transform import Affine, guard_transform, tastes_like_gdal
43537  * from rasterio.path import parse_path             # <<<<<<<<<<<<<<
43538  * from rasterio import windows
43539  *
43540  */
43541   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error)
43542   __Pyx_GOTREF(__pyx_t_1);
43543   __Pyx_INCREF(__pyx_n_s_parse_path);
43544   __Pyx_GIVEREF(__pyx_n_s_parse_path);
43545   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_parse_path);
43546   __pyx_t_2 = __Pyx_Import(__pyx_n_s_rasterio_path, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error)
43547   __Pyx_GOTREF(__pyx_t_2);
43548   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43549   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_parse_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error)
43550   __Pyx_GOTREF(__pyx_t_1);
43551   if (PyDict_SetItem(__pyx_d, __pyx_n_s_parse_path, __pyx_t_1) < 0) __PYX_ERR(0, 33, __pyx_L1_error)
43552   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43553   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43554 
43555   /* "rasterio/_base.pyx":34
43556  * from rasterio.transform import Affine, guard_transform, tastes_like_gdal
43557  * from rasterio.path import parse_path
43558  * from rasterio import windows             # <<<<<<<<<<<<<<
43559  *
43560  * cimport cython
43561  */
43562   __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
43563   __Pyx_GOTREF(__pyx_t_2);
43564   __Pyx_INCREF(__pyx_n_s_windows);
43565   __Pyx_GIVEREF(__pyx_n_s_windows);
43566   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_windows);
43567   __pyx_t_1 = __Pyx_Import(__pyx_n_s_rasterio, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error)
43568   __Pyx_GOTREF(__pyx_t_1);
43569   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43570   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_windows); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
43571   __Pyx_GOTREF(__pyx_t_2);
43572   if (PyDict_SetItem(__pyx_d, __pyx_n_s_windows, __pyx_t_2) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
43573   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43574   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43575 
43576   /* "rasterio/_base.pyx":40
43577  * include "gdal.pxi"
43578  *
43579  * log = logging.getLogger(__name__)             # <<<<<<<<<<<<<<
43580  *
43581  *
43582  */
43583   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
43584   __Pyx_GOTREF(__pyx_t_1);
43585   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error)
43586   __Pyx_GOTREF(__pyx_t_2);
43587   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43588   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
43589   __Pyx_GOTREF(__pyx_t_1);
43590   __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error)
43591   __Pyx_GOTREF(__pyx_t_3);
43592   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
43593   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43594   if (PyDict_SetItem(__pyx_d, __pyx_n_s_log, __pyx_t_3) < 0) __PYX_ERR(0, 40, __pyx_L1_error)
43595   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43596 
43597   /* "rasterio/_base.pyx":43
43598  *
43599  *
43600  * def check_gdal_version(major, minor):             # <<<<<<<<<<<<<<
43601  *     """Return True if the major and minor versions match."""
43602  *     return bool(GDALCheckVersion(int(major), int(minor), NULL))
43603  */
43604   __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_8rasterio_5_base_1check_gdal_version, NULL, __pyx_n_s_rasterio__base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error)
43605   __Pyx_GOTREF(__pyx_t_3);
43606   if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_gdal_version, __pyx_t_3) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
43607   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43608 
43609   /* "rasterio/_base.pyx":48
43610  *
43611  *
43612  * def gdal_version():             # <<<<<<<<<<<<<<
43613  *     """Return the version as a major.minor.patchlevel string."""
43614  *     return GDALVersionInfo("RELEASE_NAME")
43615  */
43616   __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_8rasterio_5_base_3gdal_version, NULL, __pyx_n_s_rasterio__base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error)
43617   __Pyx_GOTREF(__pyx_t_3);
43618   if (PyDict_SetItem(__pyx_d, __pyx_n_s_gdal_version, __pyx_t_3) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
43619   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43620 
43621   /* "rasterio/_base.pyx":58
43622  *
43623  *
43624  * def get_dataset_driver(path):             # <<<<<<<<<<<<<<
43625  *     """Return the name of the driver that opens a dataset
43626  *
43627  */
43628   __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_8rasterio_5_base_5get_dataset_driver, NULL, __pyx_n_s_rasterio__base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error)
43629   __Pyx_GOTREF(__pyx_t_3);
43630   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_dataset_driver, __pyx_t_3) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
43631   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43632 
43633   /* "rasterio/_base.pyx":91
43634  *
43635  *
43636  * def driver_supports_mode(drivername, creation_mode):             # <<<<<<<<<<<<<<
43637  *     """Return True if the driver supports the mode"""
43638  *     cdef GDALDriverH driver = NULL
43639  */
43640   __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_8rasterio_5_base_7driver_supports_mode, NULL, __pyx_n_s_rasterio__base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
43641   __Pyx_GOTREF(__pyx_t_3);
43642   if (PyDict_SetItem(__pyx_d, __pyx_n_s_driver_supports_mode, __pyx_t_3) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
43643   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43644 
43645   /* "rasterio/_base.pyx":111
43646  *
43647  *
43648  * def driver_can_create(drivername):             # <<<<<<<<<<<<<<
43649  *     """Return True if the driver has CREATE capability"""
43650  *     return driver_supports_mode(drivername, 'DCAP_CREATE')
43651  */
43652   __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_8rasterio_5_base_9driver_can_create, NULL, __pyx_n_s_rasterio__base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
43653   __Pyx_GOTREF(__pyx_t_3);
43654   if (PyDict_SetItem(__pyx_d, __pyx_n_s_driver_can_create, __pyx_t_3) < 0) __PYX_ERR(0, 111, __pyx_L1_error)
43655   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43656 
43657   /* "rasterio/_base.pyx":116
43658  *
43659  *
43660  * def driver_can_create_copy(drivername):             # <<<<<<<<<<<<<<
43661  *     """Return True if the driver has CREATE_COPY capability"""
43662  *     return driver_supports_mode(drivername, 'DCAP_CREATECOPY')
43663  */
43664   __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_8rasterio_5_base_11driver_can_create_copy, NULL, __pyx_n_s_rasterio__base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error)
43665   __Pyx_GOTREF(__pyx_t_3);
43666   if (PyDict_SetItem(__pyx_d, __pyx_n_s_driver_can_create_copy, __pyx_t_3) < 0) __PYX_ERR(0, 116, __pyx_L1_error)
43667   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43668 
43669   /* "rasterio/_base.pyx":121
43670  *
43671  *
43672  * def _raster_driver_extensions():             # <<<<<<<<<<<<<<
43673  *     """
43674  *     Logic based on: https://github.com/mapbox/rasterio/issues/265#issuecomment-367044836
43675  */
43676   __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_8rasterio_5_base_13_raster_driver_extensions, NULL, __pyx_n_s_rasterio__base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error)
43677   __Pyx_GOTREF(__pyx_t_3);
43678   if (PyDict_SetItem(__pyx_d, __pyx_n_s_raster_driver_extensions, __pyx_t_3) < 0) __PYX_ERR(0, 121, __pyx_L1_error)
43679   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43680 
43681   /* "rasterio/_base.pyx":1385
43682  *
43683  *
43684  * def _transform(src_crs, dst_crs, xs, ys, zs):             # <<<<<<<<<<<<<<
43685  *     """Transform input arrays from src to dst CRS."""
43686  *     cdef double *x = NULL
43687  */
43688   __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_8rasterio_5_base_15_transform, NULL, __pyx_n_s_rasterio__base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1385, __pyx_L1_error)
43689   __Pyx_GOTREF(__pyx_t_3);
43690   if (PyDict_SetItem(__pyx_d, __pyx_n_s_transform_2, __pyx_t_3) < 0) __PYX_ERR(0, 1385, __pyx_L1_error)
43691   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43692 
43693   /* "rasterio/_base.pyx":1482
43694  *
43695  *
43696  * def _can_create_osr(crs):             # <<<<<<<<<<<<<<
43697  *     """Evaluate if a valid OGRSpatialReference can be created from crs.
43698  *
43699  */
43700   __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_8rasterio_5_base_17_can_create_osr, NULL, __pyx_n_s_rasterio__base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1482, __pyx_L1_error)
43701   __Pyx_GOTREF(__pyx_t_3);
43702   if (PyDict_SetItem(__pyx_d, __pyx_n_s_can_create_osr, __pyx_t_3) < 0) __PYX_ERR(0, 1482, __pyx_L1_error)
43703   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43704 
43705   /* "rasterio/_base.pyx":1
43706  * # cython: language_level=3, boundscheck=False, c_string_type=unicode, c_string_encoding=utf8"""             # <<<<<<<<<<<<<<
43707  *
43708  * """Numpy-free base classes."""
43709  */
43710   __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
43711   __Pyx_GOTREF(__pyx_t_3);
43712   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43713   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43714 
43715   /* "View.MemoryView":209
43716  *         info.obj = self
43717  *
43718  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
43719  *
43720  *     def __dealloc__(array self):
43721  */
43722   __pyx_t_3 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 209, __pyx_L1_error)
43723   __Pyx_GOTREF(__pyx_t_3);
43724   if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_3) < 0) __PYX_ERR(1, 209, __pyx_L1_error)
43725   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43726   PyType_Modified(__pyx_array_type);
43727 
43728   /* "View.MemoryView":286
43729  *         return self.name
43730  *
43731  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
43732  * cdef strided = Enum("<strided and direct>") # default
43733  * cdef indirect = Enum("<strided and indirect>")
43734  */
43735   __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 286, __pyx_L1_error)
43736   __Pyx_GOTREF(__pyx_t_3);
43737   __Pyx_XGOTREF(generic);
43738   __Pyx_DECREF_SET(generic, __pyx_t_3);
43739   __Pyx_GIVEREF(__pyx_t_3);
43740   __pyx_t_3 = 0;
43741 
43742   /* "View.MemoryView":287
43743  *
43744  * cdef generic = Enum("<strided and direct or indirect>")
43745  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
43746  * cdef indirect = Enum("<strided and indirect>")
43747  *
43748  */
43749   __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 287, __pyx_L1_error)
43750   __Pyx_GOTREF(__pyx_t_3);
43751   __Pyx_XGOTREF(strided);
43752   __Pyx_DECREF_SET(strided, __pyx_t_3);
43753   __Pyx_GIVEREF(__pyx_t_3);
43754   __pyx_t_3 = 0;
43755 
43756   /* "View.MemoryView":288
43757  * cdef generic = Enum("<strided and direct or indirect>")
43758  * cdef strided = Enum("<strided and direct>") # default
43759  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
43760  *
43761  *
43762  */
43763   __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 288, __pyx_L1_error)
43764   __Pyx_GOTREF(__pyx_t_3);
43765   __Pyx_XGOTREF(indirect);
43766   __Pyx_DECREF_SET(indirect, __pyx_t_3);
43767   __Pyx_GIVEREF(__pyx_t_3);
43768   __pyx_t_3 = 0;
43769 
43770   /* "View.MemoryView":291
43771  *
43772  *
43773  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
43774  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
43775  *
43776  */
43777   __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 291, __pyx_L1_error)
43778   __Pyx_GOTREF(__pyx_t_3);
43779   __Pyx_XGOTREF(contiguous);
43780   __Pyx_DECREF_SET(contiguous, __pyx_t_3);
43781   __Pyx_GIVEREF(__pyx_t_3);
43782   __pyx_t_3 = 0;
43783 
43784   /* "View.MemoryView":292
43785  *
43786  * cdef contiguous = Enum("<contiguous and direct>")
43787  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
43788  *
43789  *
43790  */
43791   __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 292, __pyx_L1_error)
43792   __Pyx_GOTREF(__pyx_t_3);
43793   __Pyx_XGOTREF(indirect_contiguous);
43794   __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_3);
43795   __Pyx_GIVEREF(__pyx_t_3);
43796   __pyx_t_3 = 0;
43797 
43798   /* "View.MemoryView":316
43799  *
43800  * DEF THREAD_LOCKS_PREALLOCATED = 8
43801  * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
43802  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
43803  *     PyThread_allocate_lock(),
43804  */
43805   __pyx_memoryview_thread_locks_used = 0;
43806 
43807   /* "View.MemoryView":317
43808  * DEF THREAD_LOCKS_PREALLOCATED = 8
43809  * cdef int __pyx_memoryview_thread_locks_used = 0
43810  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
43811  *     PyThread_allocate_lock(),
43812  *     PyThread_allocate_lock(),
43813  */
43814   __pyx_t_4[0] = PyThread_allocate_lock();
43815   __pyx_t_4[1] = PyThread_allocate_lock();
43816   __pyx_t_4[2] = PyThread_allocate_lock();
43817   __pyx_t_4[3] = PyThread_allocate_lock();
43818   __pyx_t_4[4] = PyThread_allocate_lock();
43819   __pyx_t_4[5] = PyThread_allocate_lock();
43820   __pyx_t_4[6] = PyThread_allocate_lock();
43821   __pyx_t_4[7] = PyThread_allocate_lock();
43822   memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_4, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
43823 
43824   /* "View.MemoryView":549
43825  *         info.obj = self
43826  *
43827  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
43828  *
43829  *
43830  */
43831   __pyx_t_3 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 549, __pyx_L1_error)
43832   __Pyx_GOTREF(__pyx_t_3);
43833   if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_3) < 0) __PYX_ERR(1, 549, __pyx_L1_error)
43834   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43835   PyType_Modified(__pyx_memoryview_type);
43836 
43837   /* "View.MemoryView":995
43838  *         return self.from_object
43839  *
43840  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
43841  *
43842  *
43843  */
43844   __pyx_t_3 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 995, __pyx_L1_error)
43845   __Pyx_GOTREF(__pyx_t_3);
43846   if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_3) < 0) __PYX_ERR(1, 995, __pyx_L1_error)
43847   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43848   PyType_Modified(__pyx_memoryviewslice_type);
43849 
43850   /* "(tree fragment)":1
43851  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
43852  *     cdef object __pyx_PickleError
43853  *     cdef object __pyx_result
43854  */
43855   __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
43856   __Pyx_GOTREF(__pyx_t_3);
43857   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
43858   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43859 
43860   /* "(tree fragment)":11
43861  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
43862  *     return __pyx_result
43863  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
43864  *     __pyx_result.name = __pyx_state[0]
43865  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
43866  */
43867 
43868   /*--- Wrapped vars code ---*/
43869 
43870   goto __pyx_L0;
43871   __pyx_L1_error:;
43872   __Pyx_XDECREF(__pyx_t_1);
43873   __Pyx_XDECREF(__pyx_t_2);
43874   __Pyx_XDECREF(__pyx_t_3);
43875   if (__pyx_m) {
43876     if (__pyx_d) {
43877       __Pyx_AddTraceback("init rasterio._base", __pyx_clineno, __pyx_lineno, __pyx_filename);
43878     }
43879     Py_CLEAR(__pyx_m);
43880   } else if (!PyErr_Occurred()) {
43881     PyErr_SetString(PyExc_ImportError, "init rasterio._base");
43882   }
43883   __pyx_L0:;
43884   __Pyx_RefNannyFinishContext();
43885   #if CYTHON_PEP489_MULTI_PHASE_INIT
43886   return (__pyx_m != NULL) ? 0 : -1;
43887   #elif PY_MAJOR_VERSION >= 3
43888   return __pyx_m;
43889   #else
43890   return;
43891   #endif
43892 }
43893 
43894 /* --- Runtime support code --- */
43895 /* Refnanny */
43896 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)43897 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
43898     PyObject *m = NULL, *p = NULL;
43899     void *r = NULL;
43900     m = PyImport_ImportModule(modname);
43901     if (!m) goto end;
43902     p = PyObject_GetAttrString(m, "RefNannyAPI");
43903     if (!p) goto end;
43904     r = PyLong_AsVoidPtr(p);
43905 end:
43906     Py_XDECREF(p);
43907     Py_XDECREF(m);
43908     return (__Pyx_RefNannyAPIStruct *)r;
43909 }
43910 #endif
43911 
43912 /* PyObjectGetAttrStr */
43913 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)43914 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
43915     PyTypeObject* tp = Py_TYPE(obj);
43916     if (likely(tp->tp_getattro))
43917         return tp->tp_getattro(obj, attr_name);
43918 #if PY_MAJOR_VERSION < 3
43919     if (likely(tp->tp_getattr))
43920         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
43921 #endif
43922     return PyObject_GetAttr(obj, attr_name);
43923 }
43924 #endif
43925 
43926 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)43927 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
43928     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
43929     if (unlikely(!result)) {
43930         PyErr_Format(PyExc_NameError,
43931 #if PY_MAJOR_VERSION >= 3
43932             "name '%U' is not defined", name);
43933 #else
43934             "name '%.200s' is not defined", PyString_AS_STRING(name));
43935 #endif
43936     }
43937     return result;
43938 }
43939 
43940 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)43941 static void __Pyx_RaiseArgtupleInvalid(
43942     const char* func_name,
43943     int exact,
43944     Py_ssize_t num_min,
43945     Py_ssize_t num_max,
43946     Py_ssize_t num_found)
43947 {
43948     Py_ssize_t num_expected;
43949     const char *more_or_less;
43950     if (num_found < num_min) {
43951         num_expected = num_min;
43952         more_or_less = "at least";
43953     } else {
43954         num_expected = num_max;
43955         more_or_less = "at most";
43956     }
43957     if (exact) {
43958         more_or_less = "exactly";
43959     }
43960     PyErr_Format(PyExc_TypeError,
43961                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
43962                  func_name, more_or_less, num_expected,
43963                  (num_expected == 1) ? "" : "s", num_found);
43964 }
43965 
43966 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)43967 static void __Pyx_RaiseDoubleKeywordsError(
43968     const char* func_name,
43969     PyObject* kw_name)
43970 {
43971     PyErr_Format(PyExc_TypeError,
43972         #if PY_MAJOR_VERSION >= 3
43973         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
43974         #else
43975         "%s() got multiple values for keyword argument '%s'", func_name,
43976         PyString_AsString(kw_name));
43977         #endif
43978 }
43979 
43980 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)43981 static int __Pyx_ParseOptionalKeywords(
43982     PyObject *kwds,
43983     PyObject **argnames[],
43984     PyObject *kwds2,
43985     PyObject *values[],
43986     Py_ssize_t num_pos_args,
43987     const char* function_name)
43988 {
43989     PyObject *key = 0, *value = 0;
43990     Py_ssize_t pos = 0;
43991     PyObject*** name;
43992     PyObject*** first_kw_arg = argnames + num_pos_args;
43993     while (PyDict_Next(kwds, &pos, &key, &value)) {
43994         name = first_kw_arg;
43995         while (*name && (**name != key)) name++;
43996         if (*name) {
43997             values[name-argnames] = value;
43998             continue;
43999         }
44000         name = first_kw_arg;
44001         #if PY_MAJOR_VERSION < 3
44002         if (likely(PyString_Check(key))) {
44003             while (*name) {
44004                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
44005                         && _PyString_Eq(**name, key)) {
44006                     values[name-argnames] = value;
44007                     break;
44008                 }
44009                 name++;
44010             }
44011             if (*name) continue;
44012             else {
44013                 PyObject*** argname = argnames;
44014                 while (argname != first_kw_arg) {
44015                     if ((**argname == key) || (
44016                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
44017                              && _PyString_Eq(**argname, key))) {
44018                         goto arg_passed_twice;
44019                     }
44020                     argname++;
44021                 }
44022             }
44023         } else
44024         #endif
44025         if (likely(PyUnicode_Check(key))) {
44026             while (*name) {
44027                 int cmp = (**name == key) ? 0 :
44028                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
44029                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
44030                 #endif
44031                     PyUnicode_Compare(**name, key);
44032                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
44033                 if (cmp == 0) {
44034                     values[name-argnames] = value;
44035                     break;
44036                 }
44037                 name++;
44038             }
44039             if (*name) continue;
44040             else {
44041                 PyObject*** argname = argnames;
44042                 while (argname != first_kw_arg) {
44043                     int cmp = (**argname == key) ? 0 :
44044                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
44045                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
44046                     #endif
44047                         PyUnicode_Compare(**argname, key);
44048                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
44049                     if (cmp == 0) goto arg_passed_twice;
44050                     argname++;
44051                 }
44052             }
44053         } else
44054             goto invalid_keyword_type;
44055         if (kwds2) {
44056             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
44057         } else {
44058             goto invalid_keyword;
44059         }
44060     }
44061     return 0;
44062 arg_passed_twice:
44063     __Pyx_RaiseDoubleKeywordsError(function_name, key);
44064     goto bad;
44065 invalid_keyword_type:
44066     PyErr_Format(PyExc_TypeError,
44067         "%.200s() keywords must be strings", function_name);
44068     goto bad;
44069 invalid_keyword:
44070     PyErr_Format(PyExc_TypeError,
44071     #if PY_MAJOR_VERSION < 3
44072         "%.200s() got an unexpected keyword argument '%.200s'",
44073         function_name, PyString_AsString(key));
44074     #else
44075         "%s() got an unexpected keyword argument '%U'",
44076         function_name, key);
44077     #endif
44078 bad:
44079     return -1;
44080 }
44081 
44082 /* PyDictVersioning */
44083 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)44084 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
44085     PyObject *dict = Py_TYPE(obj)->tp_dict;
44086     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
44087 }
__Pyx_get_object_dict_version(PyObject * obj)44088 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
44089     PyObject **dictptr = NULL;
44090     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
44091     if (offset) {
44092 #if CYTHON_COMPILING_IN_CPYTHON
44093         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
44094 #else
44095         dictptr = _PyObject_GetDictPtr(obj);
44096 #endif
44097     }
44098     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
44099 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)44100 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
44101     PyObject *dict = Py_TYPE(obj)->tp_dict;
44102     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
44103         return 0;
44104     return obj_dict_version == __Pyx_get_object_dict_version(obj);
44105 }
44106 #endif
44107 
44108 /* GetModuleGlobalName */
44109 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)44110 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
44111 #else
44112 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
44113 #endif
44114 {
44115     PyObject *result;
44116 #if !CYTHON_AVOID_BORROWED_REFS
44117 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
44118     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
44119     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
44120     if (likely(result)) {
44121         return __Pyx_NewRef(result);
44122     } else if (unlikely(PyErr_Occurred())) {
44123         return NULL;
44124     }
44125 #else
44126     result = PyDict_GetItem(__pyx_d, name);
44127     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
44128     if (likely(result)) {
44129         return __Pyx_NewRef(result);
44130     }
44131 #endif
44132 #else
44133     result = PyObject_GetItem(__pyx_d, name);
44134     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
44135     if (likely(result)) {
44136         return __Pyx_NewRef(result);
44137     }
44138     PyErr_Clear();
44139 #endif
44140     return __Pyx_GetBuiltinName(name);
44141 }
44142 
44143 /* PyCFunctionFastCall */
44144 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)44145 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
44146     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
44147     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
44148     PyObject *self = PyCFunction_GET_SELF(func);
44149     int flags = PyCFunction_GET_FLAGS(func);
44150     assert(PyCFunction_Check(func));
44151     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
44152     assert(nargs >= 0);
44153     assert(nargs == 0 || args != NULL);
44154     /* _PyCFunction_FastCallDict() must not be called with an exception set,
44155        because it may clear it (directly or indirectly) and so the
44156        caller loses its exception */
44157     assert(!PyErr_Occurred());
44158     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
44159         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
44160     } else {
44161         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
44162     }
44163 }
44164 #endif
44165 
44166 /* PyFunctionFastCall */
44167 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)44168 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
44169                                                PyObject *globals) {
44170     PyFrameObject *f;
44171     PyThreadState *tstate = __Pyx_PyThreadState_Current;
44172     PyObject **fastlocals;
44173     Py_ssize_t i;
44174     PyObject *result;
44175     assert(globals != NULL);
44176     /* XXX Perhaps we should create a specialized
44177        PyFrame_New() that doesn't take locals, but does
44178        take builtins without sanity checking them.
44179        */
44180     assert(tstate != NULL);
44181     f = PyFrame_New(tstate, co, globals, NULL);
44182     if (f == NULL) {
44183         return NULL;
44184     }
44185     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
44186     for (i = 0; i < na; i++) {
44187         Py_INCREF(*args);
44188         fastlocals[i] = *args++;
44189     }
44190     result = PyEval_EvalFrameEx(f,0);
44191     ++tstate->recursion_depth;
44192     Py_DECREF(f);
44193     --tstate->recursion_depth;
44194     return result;
44195 }
44196 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)44197 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
44198     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
44199     PyObject *globals = PyFunction_GET_GLOBALS(func);
44200     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
44201     PyObject *closure;
44202 #if PY_MAJOR_VERSION >= 3
44203     PyObject *kwdefs;
44204 #endif
44205     PyObject *kwtuple, **k;
44206     PyObject **d;
44207     Py_ssize_t nd;
44208     Py_ssize_t nk;
44209     PyObject *result;
44210     assert(kwargs == NULL || PyDict_Check(kwargs));
44211     nk = kwargs ? PyDict_Size(kwargs) : 0;
44212     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
44213         return NULL;
44214     }
44215     if (
44216 #if PY_MAJOR_VERSION >= 3
44217             co->co_kwonlyargcount == 0 &&
44218 #endif
44219             likely(kwargs == NULL || nk == 0) &&
44220             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
44221         if (argdefs == NULL && co->co_argcount == nargs) {
44222             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
44223             goto done;
44224         }
44225         else if (nargs == 0 && argdefs != NULL
44226                  && co->co_argcount == Py_SIZE(argdefs)) {
44227             /* function called with no arguments, but all parameters have
44228                a default value: use default values as arguments .*/
44229             args = &PyTuple_GET_ITEM(argdefs, 0);
44230             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
44231             goto done;
44232         }
44233     }
44234     if (kwargs != NULL) {
44235         Py_ssize_t pos, i;
44236         kwtuple = PyTuple_New(2 * nk);
44237         if (kwtuple == NULL) {
44238             result = NULL;
44239             goto done;
44240         }
44241         k = &PyTuple_GET_ITEM(kwtuple, 0);
44242         pos = i = 0;
44243         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
44244             Py_INCREF(k[i]);
44245             Py_INCREF(k[i+1]);
44246             i += 2;
44247         }
44248         nk = i / 2;
44249     }
44250     else {
44251         kwtuple = NULL;
44252         k = NULL;
44253     }
44254     closure = PyFunction_GET_CLOSURE(func);
44255 #if PY_MAJOR_VERSION >= 3
44256     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
44257 #endif
44258     if (argdefs != NULL) {
44259         d = &PyTuple_GET_ITEM(argdefs, 0);
44260         nd = Py_SIZE(argdefs);
44261     }
44262     else {
44263         d = NULL;
44264         nd = 0;
44265     }
44266 #if PY_MAJOR_VERSION >= 3
44267     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
44268                                args, (int)nargs,
44269                                k, (int)nk,
44270                                d, (int)nd, kwdefs, closure);
44271 #else
44272     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
44273                                args, (int)nargs,
44274                                k, (int)nk,
44275                                d, (int)nd, closure);
44276 #endif
44277     Py_XDECREF(kwtuple);
44278 done:
44279     Py_LeaveRecursiveCall();
44280     return result;
44281 }
44282 #endif
44283 #endif
44284 
44285 /* PyObjectCall */
44286 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)44287 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
44288     PyObject *result;
44289     ternaryfunc call = func->ob_type->tp_call;
44290     if (unlikely(!call))
44291         return PyObject_Call(func, arg, kw);
44292     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
44293         return NULL;
44294     result = (*call)(func, arg, kw);
44295     Py_LeaveRecursiveCall();
44296     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
44297         PyErr_SetString(
44298             PyExc_SystemError,
44299             "NULL result without error in PyObject_Call");
44300     }
44301     return result;
44302 }
44303 #endif
44304 
44305 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)44306 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
44307     PyObject *args, *result = NULL;
44308     #if CYTHON_FAST_PYCALL
44309     if (PyFunction_Check(function)) {
44310         PyObject *args[2] = {arg1, arg2};
44311         return __Pyx_PyFunction_FastCall(function, args, 2);
44312     }
44313     #endif
44314     #if CYTHON_FAST_PYCCALL
44315     if (__Pyx_PyFastCFunction_Check(function)) {
44316         PyObject *args[2] = {arg1, arg2};
44317         return __Pyx_PyCFunction_FastCall(function, args, 2);
44318     }
44319     #endif
44320     args = PyTuple_New(2);
44321     if (unlikely(!args)) goto done;
44322     Py_INCREF(arg1);
44323     PyTuple_SET_ITEM(args, 0, arg1);
44324     Py_INCREF(arg2);
44325     PyTuple_SET_ITEM(args, 1, arg2);
44326     Py_INCREF(function);
44327     result = __Pyx_PyObject_Call(function, args, NULL);
44328     Py_DECREF(args);
44329     Py_DECREF(function);
44330 done:
44331     return result;
44332 }
44333 
44334 /* PyObjectCallMethO */
44335 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)44336 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
44337     PyObject *self, *result;
44338     PyCFunction cfunc;
44339     cfunc = PyCFunction_GET_FUNCTION(func);
44340     self = PyCFunction_GET_SELF(func);
44341     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
44342         return NULL;
44343     result = cfunc(self, arg);
44344     Py_LeaveRecursiveCall();
44345     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
44346         PyErr_SetString(
44347             PyExc_SystemError,
44348             "NULL result without error in PyObject_Call");
44349     }
44350     return result;
44351 }
44352 #endif
44353 
44354 /* PyObjectCallOneArg */
44355 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)44356 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
44357     PyObject *result;
44358     PyObject *args = PyTuple_New(1);
44359     if (unlikely(!args)) return NULL;
44360     Py_INCREF(arg);
44361     PyTuple_SET_ITEM(args, 0, arg);
44362     result = __Pyx_PyObject_Call(func, args, NULL);
44363     Py_DECREF(args);
44364     return result;
44365 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)44366 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
44367 #if CYTHON_FAST_PYCALL
44368     if (PyFunction_Check(func)) {
44369         return __Pyx_PyFunction_FastCall(func, &arg, 1);
44370     }
44371 #endif
44372     if (likely(PyCFunction_Check(func))) {
44373         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
44374             return __Pyx_PyObject_CallMethO(func, arg);
44375 #if CYTHON_FAST_PYCCALL
44376         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
44377             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
44378 #endif
44379         }
44380     }
44381     return __Pyx__PyObject_CallOneArg(func, arg);
44382 }
44383 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)44384 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
44385     PyObject *result;
44386     PyObject *args = PyTuple_Pack(1, arg);
44387     if (unlikely(!args)) return NULL;
44388     result = __Pyx_PyObject_Call(func, args, NULL);
44389     Py_DECREF(args);
44390     return result;
44391 }
44392 #endif
44393 
44394 /* PyObjectCallNoArg */
44395 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)44396 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
44397 #if CYTHON_FAST_PYCALL
44398     if (PyFunction_Check(func)) {
44399         return __Pyx_PyFunction_FastCall(func, NULL, 0);
44400     }
44401 #endif
44402 #ifdef __Pyx_CyFunction_USED
44403     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
44404 #else
44405     if (likely(PyCFunction_Check(func)))
44406 #endif
44407     {
44408         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
44409             return __Pyx_PyObject_CallMethO(func, NULL);
44410         }
44411     }
44412     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
44413 }
44414 #endif
44415 
44416 /* GetTopmostException */
44417 #if CYTHON_USE_EXC_INFO_STACK
44418 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)44419 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
44420 {
44421     _PyErr_StackItem *exc_info = tstate->exc_info;
44422     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
44423            exc_info->previous_item != NULL)
44424     {
44425         exc_info = exc_info->previous_item;
44426     }
44427     return exc_info;
44428 }
44429 #endif
44430 
44431 /* SaveResetException */
44432 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)44433 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
44434     #if CYTHON_USE_EXC_INFO_STACK
44435     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
44436     *type = exc_info->exc_type;
44437     *value = exc_info->exc_value;
44438     *tb = exc_info->exc_traceback;
44439     #else
44440     *type = tstate->exc_type;
44441     *value = tstate->exc_value;
44442     *tb = tstate->exc_traceback;
44443     #endif
44444     Py_XINCREF(*type);
44445     Py_XINCREF(*value);
44446     Py_XINCREF(*tb);
44447 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)44448 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
44449     PyObject *tmp_type, *tmp_value, *tmp_tb;
44450     #if CYTHON_USE_EXC_INFO_STACK
44451     _PyErr_StackItem *exc_info = tstate->exc_info;
44452     tmp_type = exc_info->exc_type;
44453     tmp_value = exc_info->exc_value;
44454     tmp_tb = exc_info->exc_traceback;
44455     exc_info->exc_type = type;
44456     exc_info->exc_value = value;
44457     exc_info->exc_traceback = tb;
44458     #else
44459     tmp_type = tstate->exc_type;
44460     tmp_value = tstate->exc_value;
44461     tmp_tb = tstate->exc_traceback;
44462     tstate->exc_type = type;
44463     tstate->exc_value = value;
44464     tstate->exc_traceback = tb;
44465     #endif
44466     Py_XDECREF(tmp_type);
44467     Py_XDECREF(tmp_value);
44468     Py_XDECREF(tmp_tb);
44469 }
44470 #endif
44471 
44472 /* PyErrFetchRestore */
44473 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)44474 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
44475     PyObject *tmp_type, *tmp_value, *tmp_tb;
44476     tmp_type = tstate->curexc_type;
44477     tmp_value = tstate->curexc_value;
44478     tmp_tb = tstate->curexc_traceback;
44479     tstate->curexc_type = type;
44480     tstate->curexc_value = value;
44481     tstate->curexc_traceback = tb;
44482     Py_XDECREF(tmp_type);
44483     Py_XDECREF(tmp_value);
44484     Py_XDECREF(tmp_tb);
44485 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)44486 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
44487     *type = tstate->curexc_type;
44488     *value = tstate->curexc_value;
44489     *tb = tstate->curexc_traceback;
44490     tstate->curexc_type = 0;
44491     tstate->curexc_value = 0;
44492     tstate->curexc_traceback = 0;
44493 }
44494 #endif
44495 
44496 /* FastTypeChecks */
44497 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)44498 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
44499     while (a) {
44500         a = a->tp_base;
44501         if (a == b)
44502             return 1;
44503     }
44504     return b == &PyBaseObject_Type;
44505 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)44506 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
44507     PyObject *mro;
44508     if (a == b) return 1;
44509     mro = a->tp_mro;
44510     if (likely(mro)) {
44511         Py_ssize_t i, n;
44512         n = PyTuple_GET_SIZE(mro);
44513         for (i = 0; i < n; i++) {
44514             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
44515                 return 1;
44516         }
44517         return 0;
44518     }
44519     return __Pyx_InBases(a, b);
44520 }
44521 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)44522 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
44523     PyObject *exception, *value, *tb;
44524     int res;
44525     __Pyx_PyThreadState_declare
44526     __Pyx_PyThreadState_assign
44527     __Pyx_ErrFetch(&exception, &value, &tb);
44528     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
44529     if (unlikely(res == -1)) {
44530         PyErr_WriteUnraisable(err);
44531         res = 0;
44532     }
44533     if (!res) {
44534         res = PyObject_IsSubclass(err, exc_type2);
44535         if (unlikely(res == -1)) {
44536             PyErr_WriteUnraisable(err);
44537             res = 0;
44538         }
44539     }
44540     __Pyx_ErrRestore(exception, value, tb);
44541     return res;
44542 }
44543 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)44544 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
44545     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
44546     if (!res) {
44547         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
44548     }
44549     return res;
44550 }
44551 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)44552 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
44553     Py_ssize_t i, n;
44554     assert(PyExceptionClass_Check(exc_type));
44555     n = PyTuple_GET_SIZE(tuple);
44556 #if PY_MAJOR_VERSION >= 3
44557     for (i=0; i<n; i++) {
44558         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
44559     }
44560 #endif
44561     for (i=0; i<n; i++) {
44562         PyObject *t = PyTuple_GET_ITEM(tuple, i);
44563         #if PY_MAJOR_VERSION < 3
44564         if (likely(exc_type == t)) return 1;
44565         #endif
44566         if (likely(PyExceptionClass_Check(t))) {
44567             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
44568         } else {
44569         }
44570     }
44571     return 0;
44572 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)44573 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
44574     if (likely(err == exc_type)) return 1;
44575     if (likely(PyExceptionClass_Check(err))) {
44576         if (likely(PyExceptionClass_Check(exc_type))) {
44577             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
44578         } else if (likely(PyTuple_Check(exc_type))) {
44579             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
44580         } else {
44581         }
44582     }
44583     return PyErr_GivenExceptionMatches(err, exc_type);
44584 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)44585 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
44586     assert(PyExceptionClass_Check(exc_type1));
44587     assert(PyExceptionClass_Check(exc_type2));
44588     if (likely(err == exc_type1 || err == exc_type2)) return 1;
44589     if (likely(PyExceptionClass_Check(err))) {
44590         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
44591     }
44592     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
44593 }
44594 #endif
44595 
44596 /* GetException */
44597 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)44598 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
44599 #else
44600 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
44601 #endif
44602 {
44603     PyObject *local_type, *local_value, *local_tb;
44604 #if CYTHON_FAST_THREAD_STATE
44605     PyObject *tmp_type, *tmp_value, *tmp_tb;
44606     local_type = tstate->curexc_type;
44607     local_value = tstate->curexc_value;
44608     local_tb = tstate->curexc_traceback;
44609     tstate->curexc_type = 0;
44610     tstate->curexc_value = 0;
44611     tstate->curexc_traceback = 0;
44612 #else
44613     PyErr_Fetch(&local_type, &local_value, &local_tb);
44614 #endif
44615     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
44616 #if CYTHON_FAST_THREAD_STATE
44617     if (unlikely(tstate->curexc_type))
44618 #else
44619     if (unlikely(PyErr_Occurred()))
44620 #endif
44621         goto bad;
44622     #if PY_MAJOR_VERSION >= 3
44623     if (local_tb) {
44624         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
44625             goto bad;
44626     }
44627     #endif
44628     Py_XINCREF(local_tb);
44629     Py_XINCREF(local_type);
44630     Py_XINCREF(local_value);
44631     *type = local_type;
44632     *value = local_value;
44633     *tb = local_tb;
44634 #if CYTHON_FAST_THREAD_STATE
44635     #if CYTHON_USE_EXC_INFO_STACK
44636     {
44637         _PyErr_StackItem *exc_info = tstate->exc_info;
44638         tmp_type = exc_info->exc_type;
44639         tmp_value = exc_info->exc_value;
44640         tmp_tb = exc_info->exc_traceback;
44641         exc_info->exc_type = local_type;
44642         exc_info->exc_value = local_value;
44643         exc_info->exc_traceback = local_tb;
44644     }
44645     #else
44646     tmp_type = tstate->exc_type;
44647     tmp_value = tstate->exc_value;
44648     tmp_tb = tstate->exc_traceback;
44649     tstate->exc_type = local_type;
44650     tstate->exc_value = local_value;
44651     tstate->exc_traceback = local_tb;
44652     #endif
44653     Py_XDECREF(tmp_type);
44654     Py_XDECREF(tmp_value);
44655     Py_XDECREF(tmp_tb);
44656 #else
44657     PyErr_SetExcInfo(local_type, local_value, local_tb);
44658 #endif
44659     return 0;
44660 bad:
44661     *type = 0;
44662     *value = 0;
44663     *tb = 0;
44664     Py_XDECREF(local_type);
44665     Py_XDECREF(local_value);
44666     Py_XDECREF(local_tb);
44667     return -1;
44668 }
44669 
44670 /* RaiseException */
44671 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)44672 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
44673                         CYTHON_UNUSED PyObject *cause) {
44674     __Pyx_PyThreadState_declare
44675     Py_XINCREF(type);
44676     if (!value || value == Py_None)
44677         value = NULL;
44678     else
44679         Py_INCREF(value);
44680     if (!tb || tb == Py_None)
44681         tb = NULL;
44682     else {
44683         Py_INCREF(tb);
44684         if (!PyTraceBack_Check(tb)) {
44685             PyErr_SetString(PyExc_TypeError,
44686                 "raise: arg 3 must be a traceback or None");
44687             goto raise_error;
44688         }
44689     }
44690     if (PyType_Check(type)) {
44691 #if CYTHON_COMPILING_IN_PYPY
44692         if (!value) {
44693             Py_INCREF(Py_None);
44694             value = Py_None;
44695         }
44696 #endif
44697         PyErr_NormalizeException(&type, &value, &tb);
44698     } else {
44699         if (value) {
44700             PyErr_SetString(PyExc_TypeError,
44701                 "instance exception may not have a separate value");
44702             goto raise_error;
44703         }
44704         value = type;
44705         type = (PyObject*) Py_TYPE(type);
44706         Py_INCREF(type);
44707         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
44708             PyErr_SetString(PyExc_TypeError,
44709                 "raise: exception class must be a subclass of BaseException");
44710             goto raise_error;
44711         }
44712     }
44713     __Pyx_PyThreadState_assign
44714     __Pyx_ErrRestore(type, value, tb);
44715     return;
44716 raise_error:
44717     Py_XDECREF(value);
44718     Py_XDECREF(type);
44719     Py_XDECREF(tb);
44720     return;
44721 }
44722 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)44723 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
44724     PyObject* owned_instance = NULL;
44725     if (tb == Py_None) {
44726         tb = 0;
44727     } else if (tb && !PyTraceBack_Check(tb)) {
44728         PyErr_SetString(PyExc_TypeError,
44729             "raise: arg 3 must be a traceback or None");
44730         goto bad;
44731     }
44732     if (value == Py_None)
44733         value = 0;
44734     if (PyExceptionInstance_Check(type)) {
44735         if (value) {
44736             PyErr_SetString(PyExc_TypeError,
44737                 "instance exception may not have a separate value");
44738             goto bad;
44739         }
44740         value = type;
44741         type = (PyObject*) Py_TYPE(value);
44742     } else if (PyExceptionClass_Check(type)) {
44743         PyObject *instance_class = NULL;
44744         if (value && PyExceptionInstance_Check(value)) {
44745             instance_class = (PyObject*) Py_TYPE(value);
44746             if (instance_class != type) {
44747                 int is_subclass = PyObject_IsSubclass(instance_class, type);
44748                 if (!is_subclass) {
44749                     instance_class = NULL;
44750                 } else if (unlikely(is_subclass == -1)) {
44751                     goto bad;
44752                 } else {
44753                     type = instance_class;
44754                 }
44755             }
44756         }
44757         if (!instance_class) {
44758             PyObject *args;
44759             if (!value)
44760                 args = PyTuple_New(0);
44761             else if (PyTuple_Check(value)) {
44762                 Py_INCREF(value);
44763                 args = value;
44764             } else
44765                 args = PyTuple_Pack(1, value);
44766             if (!args)
44767                 goto bad;
44768             owned_instance = PyObject_Call(type, args, NULL);
44769             Py_DECREF(args);
44770             if (!owned_instance)
44771                 goto bad;
44772             value = owned_instance;
44773             if (!PyExceptionInstance_Check(value)) {
44774                 PyErr_Format(PyExc_TypeError,
44775                              "calling %R should have returned an instance of "
44776                              "BaseException, not %R",
44777                              type, Py_TYPE(value));
44778                 goto bad;
44779             }
44780         }
44781     } else {
44782         PyErr_SetString(PyExc_TypeError,
44783             "raise: exception class must be a subclass of BaseException");
44784         goto bad;
44785     }
44786     if (cause) {
44787         PyObject *fixed_cause;
44788         if (cause == Py_None) {
44789             fixed_cause = NULL;
44790         } else if (PyExceptionClass_Check(cause)) {
44791             fixed_cause = PyObject_CallObject(cause, NULL);
44792             if (fixed_cause == NULL)
44793                 goto bad;
44794         } else if (PyExceptionInstance_Check(cause)) {
44795             fixed_cause = cause;
44796             Py_INCREF(fixed_cause);
44797         } else {
44798             PyErr_SetString(PyExc_TypeError,
44799                             "exception causes must derive from "
44800                             "BaseException");
44801             goto bad;
44802         }
44803         PyException_SetCause(value, fixed_cause);
44804     }
44805     PyErr_SetObject(type, value);
44806     if (tb) {
44807 #if CYTHON_COMPILING_IN_PYPY
44808         PyObject *tmp_type, *tmp_value, *tmp_tb;
44809         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
44810         Py_INCREF(tb);
44811         PyErr_Restore(tmp_type, tmp_value, tb);
44812         Py_XDECREF(tmp_tb);
44813 #else
44814         PyThreadState *tstate = __Pyx_PyThreadState_Current;
44815         PyObject* tmp_tb = tstate->curexc_traceback;
44816         if (tb != tmp_tb) {
44817             Py_INCREF(tb);
44818             tstate->curexc_traceback = tb;
44819             Py_XDECREF(tmp_tb);
44820         }
44821 #endif
44822     }
44823 bad:
44824     Py_XDECREF(owned_instance);
44825     return;
44826 }
44827 #endif
44828 
44829 /* SwapException */
44830 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)44831 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
44832     PyObject *tmp_type, *tmp_value, *tmp_tb;
44833     #if CYTHON_USE_EXC_INFO_STACK
44834     _PyErr_StackItem *exc_info = tstate->exc_info;
44835     tmp_type = exc_info->exc_type;
44836     tmp_value = exc_info->exc_value;
44837     tmp_tb = exc_info->exc_traceback;
44838     exc_info->exc_type = *type;
44839     exc_info->exc_value = *value;
44840     exc_info->exc_traceback = *tb;
44841     #else
44842     tmp_type = tstate->exc_type;
44843     tmp_value = tstate->exc_value;
44844     tmp_tb = tstate->exc_traceback;
44845     tstate->exc_type = *type;
44846     tstate->exc_value = *value;
44847     tstate->exc_traceback = *tb;
44848     #endif
44849     *type = tmp_type;
44850     *value = tmp_value;
44851     *tb = tmp_tb;
44852 }
44853 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)44854 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
44855     PyObject *tmp_type, *tmp_value, *tmp_tb;
44856     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
44857     PyErr_SetExcInfo(*type, *value, *tb);
44858     *type = tmp_type;
44859     *value = tmp_value;
44860     *tb = tmp_tb;
44861 }
44862 #endif
44863 
44864 /* PyErrExceptionMatches */
44865 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)44866 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
44867     Py_ssize_t i, n;
44868     n = PyTuple_GET_SIZE(tuple);
44869 #if PY_MAJOR_VERSION >= 3
44870     for (i=0; i<n; i++) {
44871         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
44872     }
44873 #endif
44874     for (i=0; i<n; i++) {
44875         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
44876     }
44877     return 0;
44878 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)44879 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
44880     PyObject *exc_type = tstate->curexc_type;
44881     if (exc_type == err) return 1;
44882     if (unlikely(!exc_type)) return 0;
44883     if (unlikely(PyTuple_Check(err)))
44884         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
44885     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
44886 }
44887 #endif
44888 
44889 /* None */
__Pyx_RaiseUnboundLocalError(const char * varname)44890 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
44891     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
44892 }
44893 
44894 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)44895 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
44896     PyObject *r;
44897     if (!j) return NULL;
44898     r = PyObject_GetItem(o, j);
44899     Py_DECREF(j);
44900     return r;
44901 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)44902 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
44903                                                               CYTHON_NCP_UNUSED int wraparound,
44904                                                               CYTHON_NCP_UNUSED int boundscheck) {
44905 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
44906     Py_ssize_t wrapped_i = i;
44907     if (wraparound & unlikely(i < 0)) {
44908         wrapped_i += PyList_GET_SIZE(o);
44909     }
44910     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
44911         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
44912         Py_INCREF(r);
44913         return r;
44914     }
44915     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
44916 #else
44917     return PySequence_GetItem(o, i);
44918 #endif
44919 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)44920 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
44921                                                               CYTHON_NCP_UNUSED int wraparound,
44922                                                               CYTHON_NCP_UNUSED int boundscheck) {
44923 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
44924     Py_ssize_t wrapped_i = i;
44925     if (wraparound & unlikely(i < 0)) {
44926         wrapped_i += PyTuple_GET_SIZE(o);
44927     }
44928     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
44929         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
44930         Py_INCREF(r);
44931         return r;
44932     }
44933     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
44934 #else
44935     return PySequence_GetItem(o, i);
44936 #endif
44937 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)44938 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
44939                                                      CYTHON_NCP_UNUSED int wraparound,
44940                                                      CYTHON_NCP_UNUSED int boundscheck) {
44941 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
44942     if (is_list || PyList_CheckExact(o)) {
44943         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
44944         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
44945             PyObject *r = PyList_GET_ITEM(o, n);
44946             Py_INCREF(r);
44947             return r;
44948         }
44949     }
44950     else if (PyTuple_CheckExact(o)) {
44951         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
44952         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
44953             PyObject *r = PyTuple_GET_ITEM(o, n);
44954             Py_INCREF(r);
44955             return r;
44956         }
44957     } else {
44958         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
44959         if (likely(m && m->sq_item)) {
44960             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
44961                 Py_ssize_t l = m->sq_length(o);
44962                 if (likely(l >= 0)) {
44963                     i += l;
44964                 } else {
44965                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
44966                         return NULL;
44967                     PyErr_Clear();
44968                 }
44969             }
44970             return m->sq_item(o, i);
44971         }
44972     }
44973 #else
44974     if (is_list || PySequence_Check(o)) {
44975         return PySequence_GetItem(o, i);
44976     }
44977 #endif
44978     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
44979 }
44980 
44981 /* PyObjectFormatAndDecref */
__Pyx_PyObject_FormatSimpleAndDecref(PyObject * s,PyObject * f)44982 static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) {
44983     if (unlikely(!s)) return NULL;
44984     if (likely(PyUnicode_CheckExact(s))) return s;
44985     #if PY_MAJOR_VERSION < 3
44986     if (likely(PyString_CheckExact(s))) {
44987         PyObject *result = PyUnicode_FromEncodedObject(s, NULL, "strict");
44988         Py_DECREF(s);
44989         return result;
44990     }
44991     #endif
44992     return __Pyx_PyObject_FormatAndDecref(s, f);
44993 }
__Pyx_PyObject_FormatAndDecref(PyObject * s,PyObject * f)44994 static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) {
44995     PyObject *result = PyObject_Format(s, f);
44996     Py_DECREF(s);
44997     return result;
44998 }
44999 
45000 /* JoinPyUnicode */
__Pyx_PyUnicode_Join(PyObject * value_tuple,Py_ssize_t value_count,Py_ssize_t result_ulength,CYTHON_UNUSED Py_UCS4 max_char)45001 static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
45002                                       CYTHON_UNUSED Py_UCS4 max_char) {
45003 #if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
45004     PyObject *result_uval;
45005     int result_ukind;
45006     Py_ssize_t i, char_pos;
45007     void *result_udata;
45008 #if CYTHON_PEP393_ENABLED
45009     result_uval = PyUnicode_New(result_ulength, max_char);
45010     if (unlikely(!result_uval)) return NULL;
45011     result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
45012     result_udata = PyUnicode_DATA(result_uval);
45013 #else
45014     result_uval = PyUnicode_FromUnicode(NULL, result_ulength);
45015     if (unlikely(!result_uval)) return NULL;
45016     result_ukind = sizeof(Py_UNICODE);
45017     result_udata = PyUnicode_AS_UNICODE(result_uval);
45018 #endif
45019     char_pos = 0;
45020     for (i=0; i < value_count; i++) {
45021         int ukind;
45022         Py_ssize_t ulength;
45023         void *udata;
45024         PyObject *uval = PyTuple_GET_ITEM(value_tuple, i);
45025         if (unlikely(__Pyx_PyUnicode_READY(uval)))
45026             goto bad;
45027         ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
45028         if (unlikely(!ulength))
45029             continue;
45030         if (unlikely(char_pos + ulength < 0))
45031             goto overflow;
45032         ukind = __Pyx_PyUnicode_KIND(uval);
45033         udata = __Pyx_PyUnicode_DATA(uval);
45034         if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
45035             memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind));
45036         } else {
45037             #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
45038             _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
45039             #else
45040             Py_ssize_t j;
45041             for (j=0; j < ulength; j++) {
45042                 Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
45043                 __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
45044             }
45045             #endif
45046         }
45047         char_pos += ulength;
45048     }
45049     return result_uval;
45050 overflow:
45051     PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
45052 bad:
45053     Py_DECREF(result_uval);
45054     return NULL;
45055 #else
45056     result_ulength++;
45057     value_count++;
45058     return PyUnicode_Join(__pyx_empty_unicode, value_tuple);
45059 #endif
45060 }
45061 
45062 /* PyIntBinop */
45063 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AddObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)45064 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
45065     (void)inplace;
45066     (void)zerodivision_check;
45067     #if PY_MAJOR_VERSION < 3
45068     if (likely(PyInt_CheckExact(op1))) {
45069         const long b = intval;
45070         long x;
45071         long a = PyInt_AS_LONG(op1);
45072             x = (long)((unsigned long)a + b);
45073             if (likely((x^a) >= 0 || (x^b) >= 0))
45074                 return PyInt_FromLong(x);
45075             return PyLong_Type.tp_as_number->nb_add(op1, op2);
45076     }
45077     #endif
45078     #if CYTHON_USE_PYLONG_INTERNALS
45079     if (likely(PyLong_CheckExact(op1))) {
45080         const long b = intval;
45081         long a, x;
45082 #ifdef HAVE_LONG_LONG
45083         const PY_LONG_LONG llb = intval;
45084         PY_LONG_LONG lla, llx;
45085 #endif
45086         const digit* digits = ((PyLongObject*)op1)->ob_digit;
45087         const Py_ssize_t size = Py_SIZE(op1);
45088         if (likely(__Pyx_sst_abs(size) <= 1)) {
45089             a = likely(size) ? digits[0] : 0;
45090             if (size == -1) a = -a;
45091         } else {
45092             switch (size) {
45093                 case -2:
45094                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
45095                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45096                         break;
45097 #ifdef HAVE_LONG_LONG
45098                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
45099                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45100                         goto long_long;
45101 #endif
45102                     }
45103                     CYTHON_FALLTHROUGH;
45104                 case 2:
45105                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
45106                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45107                         break;
45108 #ifdef HAVE_LONG_LONG
45109                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
45110                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45111                         goto long_long;
45112 #endif
45113                     }
45114                     CYTHON_FALLTHROUGH;
45115                 case -3:
45116                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
45117                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45118                         break;
45119 #ifdef HAVE_LONG_LONG
45120                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
45121                         lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45122                         goto long_long;
45123 #endif
45124                     }
45125                     CYTHON_FALLTHROUGH;
45126                 case 3:
45127                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
45128                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45129                         break;
45130 #ifdef HAVE_LONG_LONG
45131                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
45132                         lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45133                         goto long_long;
45134 #endif
45135                     }
45136                     CYTHON_FALLTHROUGH;
45137                 case -4:
45138                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
45139                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45140                         break;
45141 #ifdef HAVE_LONG_LONG
45142                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
45143                         lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45144                         goto long_long;
45145 #endif
45146                     }
45147                     CYTHON_FALLTHROUGH;
45148                 case 4:
45149                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
45150                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45151                         break;
45152 #ifdef HAVE_LONG_LONG
45153                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
45154                         lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45155                         goto long_long;
45156 #endif
45157                     }
45158                     CYTHON_FALLTHROUGH;
45159                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
45160             }
45161         }
45162                 x = a + b;
45163             return PyLong_FromLong(x);
45164 #ifdef HAVE_LONG_LONG
45165         long_long:
45166                 llx = lla + llb;
45167             return PyLong_FromLongLong(llx);
45168 #endif
45169 
45170 
45171     }
45172     #endif
45173     if (PyFloat_CheckExact(op1)) {
45174         const long b = intval;
45175         double a = PyFloat_AS_DOUBLE(op1);
45176             double result;
45177             PyFPE_START_PROTECT("add", return NULL)
45178             result = ((double)a) + (double)b;
45179             PyFPE_END_PROTECT(result)
45180             return PyFloat_FromDouble(result);
45181     }
45182     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
45183 }
45184 #endif
45185 
45186 /* PyObjectGetMethod */
__Pyx_PyObject_GetMethod(PyObject * obj,PyObject * name,PyObject ** method)45187 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
45188     PyObject *attr;
45189 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
45190     PyTypeObject *tp = Py_TYPE(obj);
45191     PyObject *descr;
45192     descrgetfunc f = NULL;
45193     PyObject **dictptr, *dict;
45194     int meth_found = 0;
45195     assert (*method == NULL);
45196     if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
45197         attr = __Pyx_PyObject_GetAttrStr(obj, name);
45198         goto try_unpack;
45199     }
45200     if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
45201         return 0;
45202     }
45203     descr = _PyType_Lookup(tp, name);
45204     if (likely(descr != NULL)) {
45205         Py_INCREF(descr);
45206 #if PY_MAJOR_VERSION >= 3
45207         #ifdef __Pyx_CyFunction_USED
45208         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
45209         #else
45210         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
45211         #endif
45212 #else
45213         #ifdef __Pyx_CyFunction_USED
45214         if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
45215         #else
45216         if (likely(PyFunction_Check(descr)))
45217         #endif
45218 #endif
45219         {
45220             meth_found = 1;
45221         } else {
45222             f = Py_TYPE(descr)->tp_descr_get;
45223             if (f != NULL && PyDescr_IsData(descr)) {
45224                 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
45225                 Py_DECREF(descr);
45226                 goto try_unpack;
45227             }
45228         }
45229     }
45230     dictptr = _PyObject_GetDictPtr(obj);
45231     if (dictptr != NULL && (dict = *dictptr) != NULL) {
45232         Py_INCREF(dict);
45233         attr = __Pyx_PyDict_GetItemStr(dict, name);
45234         if (attr != NULL) {
45235             Py_INCREF(attr);
45236             Py_DECREF(dict);
45237             Py_XDECREF(descr);
45238             goto try_unpack;
45239         }
45240         Py_DECREF(dict);
45241     }
45242     if (meth_found) {
45243         *method = descr;
45244         return 1;
45245     }
45246     if (f != NULL) {
45247         attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
45248         Py_DECREF(descr);
45249         goto try_unpack;
45250     }
45251     if (descr != NULL) {
45252         *method = descr;
45253         return 0;
45254     }
45255     PyErr_Format(PyExc_AttributeError,
45256 #if PY_MAJOR_VERSION >= 3
45257                  "'%.50s' object has no attribute '%U'",
45258                  tp->tp_name, name);
45259 #else
45260                  "'%.50s' object has no attribute '%.400s'",
45261                  tp->tp_name, PyString_AS_STRING(name));
45262 #endif
45263     return 0;
45264 #else
45265     attr = __Pyx_PyObject_GetAttrStr(obj, name);
45266     goto try_unpack;
45267 #endif
45268 try_unpack:
45269 #if CYTHON_UNPACK_METHODS
45270     if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
45271         PyObject *function = PyMethod_GET_FUNCTION(attr);
45272         Py_INCREF(function);
45273         Py_DECREF(attr);
45274         *method = function;
45275         return 1;
45276     }
45277 #endif
45278     *method = attr;
45279     return 0;
45280 }
45281 
45282 /* PyObjectCallMethod1 */
__Pyx__PyObject_CallMethod1(PyObject * method,PyObject * arg)45283 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
45284     PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
45285     Py_DECREF(method);
45286     return result;
45287 }
__Pyx_PyObject_CallMethod1(PyObject * obj,PyObject * method_name,PyObject * arg)45288 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
45289     PyObject *method = NULL, *result;
45290     int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
45291     if (likely(is_method)) {
45292         result = __Pyx_PyObject_Call2Args(method, obj, arg);
45293         Py_DECREF(method);
45294         return result;
45295     }
45296     if (unlikely(!method)) return NULL;
45297     return __Pyx__PyObject_CallMethod1(method, arg);
45298 }
45299 
45300 /* append */
__Pyx_PyObject_Append(PyObject * L,PyObject * x)45301 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
45302     if (likely(PyList_CheckExact(L))) {
45303         if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
45304     } else {
45305         PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
45306         if (unlikely(!retval))
45307             return -1;
45308         Py_DECREF(retval);
45309     }
45310     return 0;
45311 }
45312 
45313 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)45314 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
45315 #if CYTHON_COMPILING_IN_PYPY
45316     return PyObject_RichCompareBool(s1, s2, equals);
45317 #else
45318     if (s1 == s2) {
45319         return (equals == Py_EQ);
45320     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
45321         const char *ps1, *ps2;
45322         Py_ssize_t length = PyBytes_GET_SIZE(s1);
45323         if (length != PyBytes_GET_SIZE(s2))
45324             return (equals == Py_NE);
45325         ps1 = PyBytes_AS_STRING(s1);
45326         ps2 = PyBytes_AS_STRING(s2);
45327         if (ps1[0] != ps2[0]) {
45328             return (equals == Py_NE);
45329         } else if (length == 1) {
45330             return (equals == Py_EQ);
45331         } else {
45332             int result;
45333 #if CYTHON_USE_UNICODE_INTERNALS
45334             Py_hash_t hash1, hash2;
45335             hash1 = ((PyBytesObject*)s1)->ob_shash;
45336             hash2 = ((PyBytesObject*)s2)->ob_shash;
45337             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
45338                 return (equals == Py_NE);
45339             }
45340 #endif
45341             result = memcmp(ps1, ps2, (size_t)length);
45342             return (equals == Py_EQ) ? (result == 0) : (result != 0);
45343         }
45344     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
45345         return (equals == Py_NE);
45346     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
45347         return (equals == Py_NE);
45348     } else {
45349         int result;
45350         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
45351         if (!py_result)
45352             return -1;
45353         result = __Pyx_PyObject_IsTrue(py_result);
45354         Py_DECREF(py_result);
45355         return result;
45356     }
45357 #endif
45358 }
45359 
45360 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)45361 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
45362 #if CYTHON_COMPILING_IN_PYPY
45363     return PyObject_RichCompareBool(s1, s2, equals);
45364 #else
45365 #if PY_MAJOR_VERSION < 3
45366     PyObject* owned_ref = NULL;
45367 #endif
45368     int s1_is_unicode, s2_is_unicode;
45369     if (s1 == s2) {
45370         goto return_eq;
45371     }
45372     s1_is_unicode = PyUnicode_CheckExact(s1);
45373     s2_is_unicode = PyUnicode_CheckExact(s2);
45374 #if PY_MAJOR_VERSION < 3
45375     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
45376         owned_ref = PyUnicode_FromObject(s2);
45377         if (unlikely(!owned_ref))
45378             return -1;
45379         s2 = owned_ref;
45380         s2_is_unicode = 1;
45381     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
45382         owned_ref = PyUnicode_FromObject(s1);
45383         if (unlikely(!owned_ref))
45384             return -1;
45385         s1 = owned_ref;
45386         s1_is_unicode = 1;
45387     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
45388         return __Pyx_PyBytes_Equals(s1, s2, equals);
45389     }
45390 #endif
45391     if (s1_is_unicode & s2_is_unicode) {
45392         Py_ssize_t length;
45393         int kind;
45394         void *data1, *data2;
45395         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
45396             return -1;
45397         length = __Pyx_PyUnicode_GET_LENGTH(s1);
45398         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
45399             goto return_ne;
45400         }
45401 #if CYTHON_USE_UNICODE_INTERNALS
45402         {
45403             Py_hash_t hash1, hash2;
45404         #if CYTHON_PEP393_ENABLED
45405             hash1 = ((PyASCIIObject*)s1)->hash;
45406             hash2 = ((PyASCIIObject*)s2)->hash;
45407         #else
45408             hash1 = ((PyUnicodeObject*)s1)->hash;
45409             hash2 = ((PyUnicodeObject*)s2)->hash;
45410         #endif
45411             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
45412                 goto return_ne;
45413             }
45414         }
45415 #endif
45416         kind = __Pyx_PyUnicode_KIND(s1);
45417         if (kind != __Pyx_PyUnicode_KIND(s2)) {
45418             goto return_ne;
45419         }
45420         data1 = __Pyx_PyUnicode_DATA(s1);
45421         data2 = __Pyx_PyUnicode_DATA(s2);
45422         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
45423             goto return_ne;
45424         } else if (length == 1) {
45425             goto return_eq;
45426         } else {
45427             int result = memcmp(data1, data2, (size_t)(length * kind));
45428             #if PY_MAJOR_VERSION < 3
45429             Py_XDECREF(owned_ref);
45430             #endif
45431             return (equals == Py_EQ) ? (result == 0) : (result != 0);
45432         }
45433     } else if ((s1 == Py_None) & s2_is_unicode) {
45434         goto return_ne;
45435     } else if ((s2 == Py_None) & s1_is_unicode) {
45436         goto return_ne;
45437     } else {
45438         int result;
45439         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
45440         #if PY_MAJOR_VERSION < 3
45441         Py_XDECREF(owned_ref);
45442         #endif
45443         if (!py_result)
45444             return -1;
45445         result = __Pyx_PyObject_IsTrue(py_result);
45446         Py_DECREF(py_result);
45447         return result;
45448     }
45449 return_eq:
45450     #if PY_MAJOR_VERSION < 3
45451     Py_XDECREF(owned_ref);
45452     #endif
45453     return (equals == Py_EQ);
45454 return_ne:
45455     #if PY_MAJOR_VERSION < 3
45456     Py_XDECREF(owned_ref);
45457     #endif
45458     return (equals == Py_NE);
45459 #endif
45460 }
45461 
45462 /* ObjectGetItem */
45463 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)45464 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
45465     PyObject *runerr;
45466     Py_ssize_t key_value;
45467     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
45468     if (unlikely(!(m && m->sq_item))) {
45469         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
45470         return NULL;
45471     }
45472     key_value = __Pyx_PyIndex_AsSsize_t(index);
45473     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
45474         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
45475     }
45476     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
45477         PyErr_Clear();
45478         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
45479     }
45480     return NULL;
45481 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)45482 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
45483     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
45484     if (likely(m && m->mp_subscript)) {
45485         return m->mp_subscript(obj, key);
45486     }
45487     return __Pyx_PyObject_GetIndex(obj, key);
45488 }
45489 #endif
45490 
45491 /* PyIntCompare */
__Pyx_PyInt_EqObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,CYTHON_UNUSED long inplace)45492 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
45493     if (op1 == op2) {
45494         Py_RETURN_TRUE;
45495     }
45496     #if PY_MAJOR_VERSION < 3
45497     if (likely(PyInt_CheckExact(op1))) {
45498         const long b = intval;
45499         long a = PyInt_AS_LONG(op1);
45500         if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
45501     }
45502     #endif
45503     #if CYTHON_USE_PYLONG_INTERNALS
45504     if (likely(PyLong_CheckExact(op1))) {
45505         int unequal;
45506         unsigned long uintval;
45507         Py_ssize_t size = Py_SIZE(op1);
45508         const digit* digits = ((PyLongObject*)op1)->ob_digit;
45509         if (intval == 0) {
45510             if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
45511         } else if (intval < 0) {
45512             if (size >= 0)
45513                 Py_RETURN_FALSE;
45514             intval = -intval;
45515             size = -size;
45516         } else {
45517             if (size <= 0)
45518                 Py_RETURN_FALSE;
45519         }
45520         uintval = (unsigned long) intval;
45521 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
45522         if (uintval >> (PyLong_SHIFT * 4)) {
45523             unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
45524                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
45525         } else
45526 #endif
45527 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
45528         if (uintval >> (PyLong_SHIFT * 3)) {
45529             unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
45530                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
45531         } else
45532 #endif
45533 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
45534         if (uintval >> (PyLong_SHIFT * 2)) {
45535             unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
45536                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
45537         } else
45538 #endif
45539 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
45540         if (uintval >> (PyLong_SHIFT * 1)) {
45541             unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
45542                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
45543         } else
45544 #endif
45545             unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
45546         if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
45547     }
45548     #endif
45549     if (PyFloat_CheckExact(op1)) {
45550         const long b = intval;
45551         double a = PyFloat_AS_DOUBLE(op1);
45552         if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
45553     }
45554     return (
45555         PyObject_RichCompare(op1, op2, Py_EQ));
45556 }
45557 
45558 /* None */
__Pyx_RaiseClosureNameError(const char * varname)45559 static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
45560     PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
45561 }
45562 
45563 /* PyIntBinop */
45564 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_SubtractObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)45565 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
45566     (void)inplace;
45567     (void)zerodivision_check;
45568     #if PY_MAJOR_VERSION < 3
45569     if (likely(PyInt_CheckExact(op1))) {
45570         const long b = intval;
45571         long x;
45572         long a = PyInt_AS_LONG(op1);
45573             x = (long)((unsigned long)a - b);
45574             if (likely((x^a) >= 0 || (x^~b) >= 0))
45575                 return PyInt_FromLong(x);
45576             return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
45577     }
45578     #endif
45579     #if CYTHON_USE_PYLONG_INTERNALS
45580     if (likely(PyLong_CheckExact(op1))) {
45581         const long b = intval;
45582         long a, x;
45583 #ifdef HAVE_LONG_LONG
45584         const PY_LONG_LONG llb = intval;
45585         PY_LONG_LONG lla, llx;
45586 #endif
45587         const digit* digits = ((PyLongObject*)op1)->ob_digit;
45588         const Py_ssize_t size = Py_SIZE(op1);
45589         if (likely(__Pyx_sst_abs(size) <= 1)) {
45590             a = likely(size) ? digits[0] : 0;
45591             if (size == -1) a = -a;
45592         } else {
45593             switch (size) {
45594                 case -2:
45595                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
45596                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45597                         break;
45598 #ifdef HAVE_LONG_LONG
45599                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
45600                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45601                         goto long_long;
45602 #endif
45603                     }
45604                     CYTHON_FALLTHROUGH;
45605                 case 2:
45606                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
45607                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45608                         break;
45609 #ifdef HAVE_LONG_LONG
45610                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
45611                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45612                         goto long_long;
45613 #endif
45614                     }
45615                     CYTHON_FALLTHROUGH;
45616                 case -3:
45617                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
45618                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45619                         break;
45620 #ifdef HAVE_LONG_LONG
45621                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
45622                         lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45623                         goto long_long;
45624 #endif
45625                     }
45626                     CYTHON_FALLTHROUGH;
45627                 case 3:
45628                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
45629                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45630                         break;
45631 #ifdef HAVE_LONG_LONG
45632                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
45633                         lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45634                         goto long_long;
45635 #endif
45636                     }
45637                     CYTHON_FALLTHROUGH;
45638                 case -4:
45639                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
45640                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45641                         break;
45642 #ifdef HAVE_LONG_LONG
45643                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
45644                         lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45645                         goto long_long;
45646 #endif
45647                     }
45648                     CYTHON_FALLTHROUGH;
45649                 case 4:
45650                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
45651                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45652                         break;
45653 #ifdef HAVE_LONG_LONG
45654                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
45655                         lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45656                         goto long_long;
45657 #endif
45658                     }
45659                     CYTHON_FALLTHROUGH;
45660                 default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
45661             }
45662         }
45663                 x = a - b;
45664             return PyLong_FromLong(x);
45665 #ifdef HAVE_LONG_LONG
45666         long_long:
45667                 llx = lla - llb;
45668             return PyLong_FromLongLong(llx);
45669 #endif
45670 
45671 
45672     }
45673     #endif
45674     if (PyFloat_CheckExact(op1)) {
45675         const long b = intval;
45676         double a = PyFloat_AS_DOUBLE(op1);
45677             double result;
45678             PyFPE_START_PROTECT("subtract", return NULL)
45679             result = ((double)a) - (double)b;
45680             PyFPE_END_PROTECT(result)
45681             return PyFloat_FromDouble(result);
45682     }
45683     return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
45684 }
45685 #endif
45686 
45687 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)45688 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
45689     PyErr_Format(PyExc_ValueError,
45690                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
45691 }
45692 
45693 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)45694 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
45695     PyErr_Format(PyExc_ValueError,
45696                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
45697                  index, (index == 1) ? "" : "s");
45698 }
45699 
45700 /* IterFinish */
__Pyx_IterFinish(void)45701 static CYTHON_INLINE int __Pyx_IterFinish(void) {
45702 #if CYTHON_FAST_THREAD_STATE
45703     PyThreadState *tstate = __Pyx_PyThreadState_Current;
45704     PyObject* exc_type = tstate->curexc_type;
45705     if (unlikely(exc_type)) {
45706         if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
45707             PyObject *exc_value, *exc_tb;
45708             exc_value = tstate->curexc_value;
45709             exc_tb = tstate->curexc_traceback;
45710             tstate->curexc_type = 0;
45711             tstate->curexc_value = 0;
45712             tstate->curexc_traceback = 0;
45713             Py_DECREF(exc_type);
45714             Py_XDECREF(exc_value);
45715             Py_XDECREF(exc_tb);
45716             return 0;
45717         } else {
45718             return -1;
45719         }
45720     }
45721     return 0;
45722 #else
45723     if (unlikely(PyErr_Occurred())) {
45724         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
45725             PyErr_Clear();
45726             return 0;
45727         } else {
45728             return -1;
45729         }
45730     }
45731     return 0;
45732 #endif
45733 }
45734 
45735 /* UnpackItemEndCheck */
__Pyx_IternextUnpackEndCheck(PyObject * retval,Py_ssize_t expected)45736 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
45737     if (unlikely(retval)) {
45738         Py_DECREF(retval);
45739         __Pyx_RaiseTooManyValuesError(expected);
45740         return -1;
45741     } else {
45742         return __Pyx_IterFinish();
45743     }
45744     return 0;
45745 }
45746 
45747 /* PyIntBinop */
45748 #if !CYTHON_COMPILING_IN_PYPY
45749 #if PY_MAJOR_VERSION < 3 || CYTHON_USE_PYLONG_INTERNALS
45750 #define __Pyx_PyInt_RemainderObjC_ZeroDivisionError(operand)\
45751     if (unlikely(zerodivision_check && ((operand) == 0))) {\
45752         PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");\
45753         return NULL;\
45754     }
45755 #endif
__Pyx_PyInt_RemainderObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)45756 static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
45757     (void)inplace;
45758     (void)zerodivision_check;
45759     #if PY_MAJOR_VERSION < 3
45760     if (likely(PyInt_CheckExact(op1))) {
45761         const long b = intval;
45762         long x;
45763         long a = PyInt_AS_LONG(op1);
45764             __Pyx_PyInt_RemainderObjC_ZeroDivisionError(b)
45765             x = a % b;
45766             x += ((x != 0) & ((x ^ b) < 0)) * b;
45767             return PyInt_FromLong(x);
45768     }
45769     #endif
45770     #if CYTHON_USE_PYLONG_INTERNALS
45771     if (likely(PyLong_CheckExact(op1))) {
45772         const long b = intval;
45773         long a, x;
45774 #ifdef HAVE_LONG_LONG
45775         const PY_LONG_LONG llb = intval;
45776         PY_LONG_LONG lla, llx;
45777 #endif
45778         const digit* digits = ((PyLongObject*)op1)->ob_digit;
45779         const Py_ssize_t size = Py_SIZE(op1);
45780         if (likely(__Pyx_sst_abs(size) <= 1)) {
45781             a = likely(size) ? digits[0] : 0;
45782             if (size == -1) a = -a;
45783         } else {
45784             switch (size) {
45785                 case -2:
45786                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
45787                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45788                         break;
45789 #ifdef HAVE_LONG_LONG
45790                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
45791                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45792                         goto long_long;
45793 #endif
45794                     }
45795                     CYTHON_FALLTHROUGH;
45796                 case 2:
45797                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
45798                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45799                         break;
45800 #ifdef HAVE_LONG_LONG
45801                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
45802                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45803                         goto long_long;
45804 #endif
45805                     }
45806                     CYTHON_FALLTHROUGH;
45807                 case -3:
45808                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
45809                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45810                         break;
45811 #ifdef HAVE_LONG_LONG
45812                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
45813                         lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45814                         goto long_long;
45815 #endif
45816                     }
45817                     CYTHON_FALLTHROUGH;
45818                 case 3:
45819                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
45820                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45821                         break;
45822 #ifdef HAVE_LONG_LONG
45823                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
45824                         lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45825                         goto long_long;
45826 #endif
45827                     }
45828                     CYTHON_FALLTHROUGH;
45829                 case -4:
45830                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
45831                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45832                         break;
45833 #ifdef HAVE_LONG_LONG
45834                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
45835                         lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45836                         goto long_long;
45837 #endif
45838                     }
45839                     CYTHON_FALLTHROUGH;
45840                 case 4:
45841                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
45842                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45843                         break;
45844 #ifdef HAVE_LONG_LONG
45845                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
45846                         lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
45847                         goto long_long;
45848 #endif
45849                     }
45850                     CYTHON_FALLTHROUGH;
45851                 default: return PyLong_Type.tp_as_number->nb_remainder(op1, op2);
45852             }
45853         }
45854                 __Pyx_PyInt_RemainderObjC_ZeroDivisionError(b)
45855                 x = a % b;
45856                 x += ((x != 0) & ((x ^ b) < 0)) * b;
45857             return PyLong_FromLong(x);
45858 #ifdef HAVE_LONG_LONG
45859         long_long:
45860                 llx = lla % llb;
45861                 llx += ((llx != 0) & ((llx ^ llb) < 0)) * llb;
45862             return PyLong_FromLongLong(llx);
45863 #endif
45864 
45865 
45866     }
45867     #endif
45868     return (inplace ? PyNumber_InPlaceRemainder : PyNumber_Remainder)(op1, op2);
45869 }
45870 #endif
45871 
45872 /* PyFloatBinop */
45873 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyFloat_TrueDivideObjC(PyObject * op1,PyObject * op2,double floatval,int inplace,int zerodivision_check)45874 static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
45875     const double b = floatval;
45876     double a, result;
45877     (void)inplace;
45878     (void)zerodivision_check;
45879     if (likely(PyFloat_CheckExact(op1))) {
45880         a = PyFloat_AS_DOUBLE(op1);
45881 
45882     } else
45883     #if PY_MAJOR_VERSION < 3
45884     if (likely(PyInt_CheckExact(op1))) {
45885         a = (double) PyInt_AS_LONG(op1);
45886 
45887     } else
45888     #endif
45889     if (likely(PyLong_CheckExact(op1))) {
45890         #if CYTHON_USE_PYLONG_INTERNALS
45891         const digit* digits = ((PyLongObject*)op1)->ob_digit;
45892         const Py_ssize_t size = Py_SIZE(op1);
45893         switch (size) {
45894             case  0: a = 0.0; break;
45895             case -1: a = -(double) digits[0]; break;
45896             case  1: a = (double) digits[0]; break;
45897             case -2:
45898             case 2:
45899                 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
45900                     a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45901                     if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
45902                         if (size == -2)
45903                             a = -a;
45904                         break;
45905                     }
45906                 }
45907                 CYTHON_FALLTHROUGH;
45908             case -3:
45909             case 3:
45910                 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
45911                     a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45912                     if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
45913                         if (size == -3)
45914                             a = -a;
45915                         break;
45916                     }
45917                 }
45918                 CYTHON_FALLTHROUGH;
45919             case -4:
45920             case 4:
45921                 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
45922                     a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
45923                     if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
45924                         if (size == -4)
45925                             a = -a;
45926                         break;
45927                     }
45928                 }
45929                 CYTHON_FALLTHROUGH;
45930             default:
45931         #else
45932         {
45933         #endif
45934             a = PyLong_AsDouble(op1);
45935             if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
45936 
45937         }
45938     } else {
45939         return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
45940     }
45941 
45942         PyFPE_START_PROTECT("divide", return NULL)
45943         result = a / b;
45944         PyFPE_END_PROTECT(result)
45945         return PyFloat_FromDouble(result);
45946 }
45947 #endif
45948 
45949 /* PyObjectCallMethod0 */
45950   static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
45951     PyObject *method = NULL, *result = NULL;
45952     int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
45953     if (likely(is_method)) {
45954         result = __Pyx_PyObject_CallOneArg(method, obj);
45955         Py_DECREF(method);
45956         return result;
45957     }
45958     if (unlikely(!method)) goto bad;
45959     result = __Pyx_PyObject_CallNoArg(method);
45960     Py_DECREF(method);
45961 bad:
45962     return result;
45963 }
45964 
45965 /* UnpackUnboundCMethod */
45966   static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
45967     PyObject *method;
45968     method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
45969     if (unlikely(!method))
45970         return -1;
45971     target->method = method;
45972 #if CYTHON_COMPILING_IN_CPYTHON
45973     #if PY_MAJOR_VERSION >= 3
45974     if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
45975     #endif
45976     {
45977         PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
45978         target->func = descr->d_method->ml_meth;
45979         target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
45980     }
45981 #endif
45982     return 0;
45983 }
45984 
45985 /* CallUnboundCMethod0 */
45986   static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
45987     PyObject *args, *result = NULL;
45988     if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
45989 #if CYTHON_ASSUME_SAFE_MACROS
45990     args = PyTuple_New(1);
45991     if (unlikely(!args)) goto bad;
45992     Py_INCREF(self);
45993     PyTuple_SET_ITEM(args, 0, self);
45994 #else
45995     args = PyTuple_Pack(1, self);
45996     if (unlikely(!args)) goto bad;
45997 #endif
45998     result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
45999     Py_DECREF(args);
46000 bad:
46001     return result;
46002 }
46003 
46004 /* pop */
46005   static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
46006     if (Py_TYPE(L) == &PySet_Type) {
46007         return PySet_Pop(L);
46008     }
46009     return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
46010 }
46011 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
46012 static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
46013     if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
46014         __Pyx_SET_SIZE(L, Py_SIZE(L) - 1);
46015         return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
46016     }
46017     return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_pop, L);
46018 }
46019 #endif
46020 
46021 /* RaiseNoneIterError */
46022   static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
46023     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
46024 }
46025 
46026 /* UnpackTupleError */
46027   static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
46028     if (t == Py_None) {
46029       __Pyx_RaiseNoneNotIterableError();
46030     } else if (PyTuple_GET_SIZE(t) < index) {
46031       __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
46032     } else {
46033       __Pyx_RaiseTooManyValuesError(index);
46034     }
46035 }
46036 
46037 /* UnpackTuple2 */
46038   static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
46039         PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
46040     PyObject *value1 = NULL, *value2 = NULL;
46041 #if CYTHON_COMPILING_IN_PYPY
46042     value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
46043     value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
46044 #else
46045     value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
46046     value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
46047 #endif
46048     if (decref_tuple) {
46049         Py_DECREF(tuple);
46050     }
46051     *pvalue1 = value1;
46052     *pvalue2 = value2;
46053     return 0;
46054 #if CYTHON_COMPILING_IN_PYPY
46055 bad:
46056     Py_XDECREF(value1);
46057     Py_XDECREF(value2);
46058     if (decref_tuple) { Py_XDECREF(tuple); }
46059     return -1;
46060 #endif
46061 }
46062 static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
46063                                        int has_known_size, int decref_tuple) {
46064     Py_ssize_t index;
46065     PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
46066     iternextfunc iternext;
46067     iter = PyObject_GetIter(tuple);
46068     if (unlikely(!iter)) goto bad;
46069     if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
46070     iternext = Py_TYPE(iter)->tp_iternext;
46071     value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
46072     value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
46073     if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
46074     Py_DECREF(iter);
46075     *pvalue1 = value1;
46076     *pvalue2 = value2;
46077     return 0;
46078 unpacking_failed:
46079     if (!has_known_size && __Pyx_IterFinish() == 0)
46080         __Pyx_RaiseNeedMoreValuesError(index);
46081 bad:
46082     Py_XDECREF(iter);
46083     Py_XDECREF(value1);
46084     Py_XDECREF(value2);
46085     if (decref_tuple) { Py_XDECREF(tuple); }
46086     return -1;
46087 }
46088 
46089 /* dict_iter */
46090   static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
46091                                                    Py_ssize_t* p_orig_length, int* p_source_is_dict) {
46092     is_dict = is_dict || likely(PyDict_CheckExact(iterable));
46093     *p_source_is_dict = is_dict;
46094     if (is_dict) {
46095 #if !CYTHON_COMPILING_IN_PYPY
46096         *p_orig_length = PyDict_Size(iterable);
46097         Py_INCREF(iterable);
46098         return iterable;
46099 #elif PY_MAJOR_VERSION >= 3
46100         static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
46101         PyObject **pp = NULL;
46102         if (method_name) {
46103             const char *name = PyUnicode_AsUTF8(method_name);
46104             if (strcmp(name, "iteritems") == 0) pp = &py_items;
46105             else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
46106             else if (strcmp(name, "itervalues") == 0) pp = &py_values;
46107             if (pp) {
46108                 if (!*pp) {
46109                     *pp = PyUnicode_FromString(name + 4);
46110                     if (!*pp)
46111                         return NULL;
46112                 }
46113                 method_name = *pp;
46114             }
46115         }
46116 #endif
46117     }
46118     *p_orig_length = 0;
46119     if (method_name) {
46120         PyObject* iter;
46121         iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
46122         if (!iterable)
46123             return NULL;
46124 #if !CYTHON_COMPILING_IN_PYPY
46125         if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
46126             return iterable;
46127 #endif
46128         iter = PyObject_GetIter(iterable);
46129         Py_DECREF(iterable);
46130         return iter;
46131     }
46132     return PyObject_GetIter(iterable);
46133 }
46134 static CYTHON_INLINE int __Pyx_dict_iter_next(
46135         PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
46136         PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
46137     PyObject* next_item;
46138 #if !CYTHON_COMPILING_IN_PYPY
46139     if (source_is_dict) {
46140         PyObject *key, *value;
46141         if (unlikely(orig_length != PyDict_Size(iter_obj))) {
46142             PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
46143             return -1;
46144         }
46145         if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
46146             return 0;
46147         }
46148         if (pitem) {
46149             PyObject* tuple = PyTuple_New(2);
46150             if (unlikely(!tuple)) {
46151                 return -1;
46152             }
46153             Py_INCREF(key);
46154             Py_INCREF(value);
46155             PyTuple_SET_ITEM(tuple, 0, key);
46156             PyTuple_SET_ITEM(tuple, 1, value);
46157             *pitem = tuple;
46158         } else {
46159             if (pkey) {
46160                 Py_INCREF(key);
46161                 *pkey = key;
46162             }
46163             if (pvalue) {
46164                 Py_INCREF(value);
46165                 *pvalue = value;
46166             }
46167         }
46168         return 1;
46169     } else if (PyTuple_CheckExact(iter_obj)) {
46170         Py_ssize_t pos = *ppos;
46171         if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
46172         *ppos = pos + 1;
46173         next_item = PyTuple_GET_ITEM(iter_obj, pos);
46174         Py_INCREF(next_item);
46175     } else if (PyList_CheckExact(iter_obj)) {
46176         Py_ssize_t pos = *ppos;
46177         if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
46178         *ppos = pos + 1;
46179         next_item = PyList_GET_ITEM(iter_obj, pos);
46180         Py_INCREF(next_item);
46181     } else
46182 #endif
46183     {
46184         next_item = PyIter_Next(iter_obj);
46185         if (unlikely(!next_item)) {
46186             return __Pyx_IterFinish();
46187         }
46188     }
46189     if (pitem) {
46190         *pitem = next_item;
46191     } else if (pkey && pvalue) {
46192         if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
46193             return -1;
46194     } else if (pkey) {
46195         *pkey = next_item;
46196     } else {
46197         *pvalue = next_item;
46198     }
46199     return 1;
46200 }
46201 
46202 /* DictGetItem */
46203   #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
46204 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
46205     PyObject *value;
46206     value = PyDict_GetItemWithError(d, key);
46207     if (unlikely(!value)) {
46208         if (!PyErr_Occurred()) {
46209             if (unlikely(PyTuple_Check(key))) {
46210                 PyObject* args = PyTuple_Pack(1, key);
46211                 if (likely(args)) {
46212                     PyErr_SetObject(PyExc_KeyError, args);
46213                     Py_DECREF(args);
46214                 }
46215             } else {
46216                 PyErr_SetObject(PyExc_KeyError, key);
46217             }
46218         }
46219         return NULL;
46220     }
46221     Py_INCREF(value);
46222     return value;
46223 }
46224 #endif
46225 
46226 /* pyobject_as_double */
46227   static double __Pyx__PyObject_AsDouble(PyObject* obj) {
46228     PyObject* float_value;
46229 #if !CYTHON_USE_TYPE_SLOTS
46230     float_value = PyNumber_Float(obj);  if ((0)) goto bad;
46231 #else
46232     PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
46233     if (likely(nb) && likely(nb->nb_float)) {
46234         float_value = nb->nb_float(obj);
46235         if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
46236             PyErr_Format(PyExc_TypeError,
46237                 "__float__ returned non-float (type %.200s)",
46238                 Py_TYPE(float_value)->tp_name);
46239             Py_DECREF(float_value);
46240             goto bad;
46241         }
46242     } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
46243 #if PY_MAJOR_VERSION >= 3
46244         float_value = PyFloat_FromString(obj);
46245 #else
46246         float_value = PyFloat_FromString(obj, 0);
46247 #endif
46248     } else {
46249         PyObject* args = PyTuple_New(1);
46250         if (unlikely(!args)) goto bad;
46251         PyTuple_SET_ITEM(args, 0, obj);
46252         float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
46253         PyTuple_SET_ITEM(args, 0, 0);
46254         Py_DECREF(args);
46255     }
46256 #endif
46257     if (likely(float_value)) {
46258         double value = PyFloat_AS_DOUBLE(float_value);
46259         Py_DECREF(float_value);
46260         return value;
46261     }
46262 bad:
46263     return (double)-1;
46264 }
46265 
46266 /* SetItemInt */
46267   static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
46268     int r;
46269     if (!j) return -1;
46270     r = PyObject_SetItem(o, j, v);
46271     Py_DECREF(j);
46272     return r;
46273 }
46274 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
46275                                                CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
46276 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
46277     if (is_list || PyList_CheckExact(o)) {
46278         Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
46279         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
46280             PyObject* old = PyList_GET_ITEM(o, n);
46281             Py_INCREF(v);
46282             PyList_SET_ITEM(o, n, v);
46283             Py_DECREF(old);
46284             return 1;
46285         }
46286     } else {
46287         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
46288         if (likely(m && m->sq_ass_item)) {
46289             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
46290                 Py_ssize_t l = m->sq_length(o);
46291                 if (likely(l >= 0)) {
46292                     i += l;
46293                 } else {
46294                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
46295                         return -1;
46296                     PyErr_Clear();
46297                 }
46298             }
46299             return m->sq_ass_item(o, i, v);
46300         }
46301     }
46302 #else
46303 #if CYTHON_COMPILING_IN_PYPY
46304     if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
46305 #else
46306     if (is_list || PySequence_Check(o))
46307 #endif
46308     {
46309         return PySequence_SetItem(o, i, v);
46310     }
46311 #endif
46312     return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
46313 }
46314 
46315 /* ArgTypeTest */
46316   static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
46317 {
46318     if (unlikely(!type)) {
46319         PyErr_SetString(PyExc_SystemError, "Missing type object");
46320         return 0;
46321     }
46322     else if (exact) {
46323         #if PY_MAJOR_VERSION == 2
46324         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
46325         #endif
46326     }
46327     else {
46328         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
46329     }
46330     PyErr_Format(PyExc_TypeError,
46331         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
46332         name, type->tp_name, Py_TYPE(obj)->tp_name);
46333     return 0;
46334 }
46335 
46336 /* None */
46337   static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
46338     Py_ssize_t q = a / b;
46339     Py_ssize_t r = a - q*b;
46340     q -= ((r != 0) & ((r ^ b) < 0));
46341     return q;
46342 }
46343 
46344 /* GetAttr */
46345   static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
46346 #if CYTHON_USE_TYPE_SLOTS
46347 #if PY_MAJOR_VERSION >= 3
46348     if (likely(PyUnicode_Check(n)))
46349 #else
46350     if (likely(PyString_Check(n)))
46351 #endif
46352         return __Pyx_PyObject_GetAttrStr(o, n);
46353 #endif
46354     return PyObject_GetAttr(o, n);
46355 }
46356 
46357 /* decode_c_string */
46358   static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
46359          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
46360          const char* encoding, const char* errors,
46361          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
46362     Py_ssize_t length;
46363     if (unlikely((start < 0) | (stop < 0))) {
46364         size_t slen = strlen(cstring);
46365         if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
46366             PyErr_SetString(PyExc_OverflowError,
46367                             "c-string too long to convert to Python");
46368             return NULL;
46369         }
46370         length = (Py_ssize_t) slen;
46371         if (start < 0) {
46372             start += length;
46373             if (start < 0)
46374                 start = 0;
46375         }
46376         if (stop < 0)
46377             stop += length;
46378     }
46379     if (unlikely(stop <= start))
46380         return __Pyx_NewRef(__pyx_empty_unicode);
46381     length = stop - start;
46382     cstring += start;
46383     if (decode_func) {
46384         return decode_func(cstring, length, errors);
46385     } else {
46386         return PyUnicode_Decode(cstring, length, encoding, errors);
46387     }
46388 }
46389 
46390 /* GetAttr3 */
46391   static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
46392     __Pyx_PyThreadState_declare
46393     __Pyx_PyThreadState_assign
46394     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
46395         return NULL;
46396     __Pyx_PyErr_Clear();
46397     Py_INCREF(d);
46398     return d;
46399 }
46400 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
46401     PyObject *r = __Pyx_GetAttr(o, n);
46402     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
46403 }
46404 
46405 /* ExtTypeTest */
46406   static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
46407     if (unlikely(!type)) {
46408         PyErr_SetString(PyExc_SystemError, "Missing type object");
46409         return 0;
46410     }
46411     if (likely(__Pyx_TypeCheck(obj, type)))
46412         return 1;
46413     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
46414                  Py_TYPE(obj)->tp_name, type->tp_name);
46415     return 0;
46416 }
46417 
46418 /* Import */
46419   static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
46420     PyObject *empty_list = 0;
46421     PyObject *module = 0;
46422     PyObject *global_dict = 0;
46423     PyObject *empty_dict = 0;
46424     PyObject *list;
46425     #if PY_MAJOR_VERSION < 3
46426     PyObject *py_import;
46427     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
46428     if (!py_import)
46429         goto bad;
46430     #endif
46431     if (from_list)
46432         list = from_list;
46433     else {
46434         empty_list = PyList_New(0);
46435         if (!empty_list)
46436             goto bad;
46437         list = empty_list;
46438     }
46439     global_dict = PyModule_GetDict(__pyx_m);
46440     if (!global_dict)
46441         goto bad;
46442     empty_dict = PyDict_New();
46443     if (!empty_dict)
46444         goto bad;
46445     {
46446         #if PY_MAJOR_VERSION >= 3
46447         if (level == -1) {
46448             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
46449                 module = PyImport_ImportModuleLevelObject(
46450                     name, global_dict, empty_dict, list, 1);
46451                 if (!module) {
46452                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
46453                         goto bad;
46454                     PyErr_Clear();
46455                 }
46456             }
46457             level = 0;
46458         }
46459         #endif
46460         if (!module) {
46461             #if PY_MAJOR_VERSION < 3
46462             PyObject *py_level = PyInt_FromLong(level);
46463             if (!py_level)
46464                 goto bad;
46465             module = PyObject_CallFunctionObjArgs(py_import,
46466                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
46467             Py_DECREF(py_level);
46468             #else
46469             module = PyImport_ImportModuleLevelObject(
46470                 name, global_dict, empty_dict, list, level);
46471             #endif
46472         }
46473     }
46474 bad:
46475     #if PY_MAJOR_VERSION < 3
46476     Py_XDECREF(py_import);
46477     #endif
46478     Py_XDECREF(empty_list);
46479     Py_XDECREF(empty_dict);
46480     return module;
46481 }
46482 
46483 /* None */
46484   static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
46485     long q = a / b;
46486     long r = a - q*b;
46487     q -= ((r != 0) & ((r ^ b) < 0));
46488     return q;
46489 }
46490 
46491 /* ImportFrom */
46492   static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
46493     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
46494     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
46495         PyErr_Format(PyExc_ImportError,
46496         #if PY_MAJOR_VERSION < 3
46497             "cannot import name %.230s", PyString_AS_STRING(name));
46498         #else
46499             "cannot import name %S", name);
46500         #endif
46501     }
46502     return value;
46503 }
46504 
46505 /* HasAttr */
46506   static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
46507     PyObject *r;
46508     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
46509         PyErr_SetString(PyExc_TypeError,
46510                         "hasattr(): attribute name must be string");
46511         return -1;
46512     }
46513     r = __Pyx_GetAttr(o, n);
46514     if (unlikely(!r)) {
46515         PyErr_Clear();
46516         return 0;
46517     } else {
46518         Py_DECREF(r);
46519         return 1;
46520     }
46521 }
46522 
46523 /* PyObject_GenericGetAttrNoDict */
46524   #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
46525 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
46526     PyErr_Format(PyExc_AttributeError,
46527 #if PY_MAJOR_VERSION >= 3
46528                  "'%.50s' object has no attribute '%U'",
46529                  tp->tp_name, attr_name);
46530 #else
46531                  "'%.50s' object has no attribute '%.400s'",
46532                  tp->tp_name, PyString_AS_STRING(attr_name));
46533 #endif
46534     return NULL;
46535 }
46536 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
46537     PyObject *descr;
46538     PyTypeObject *tp = Py_TYPE(obj);
46539     if (unlikely(!PyString_Check(attr_name))) {
46540         return PyObject_GenericGetAttr(obj, attr_name);
46541     }
46542     assert(!tp->tp_dictoffset);
46543     descr = _PyType_Lookup(tp, attr_name);
46544     if (unlikely(!descr)) {
46545         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
46546     }
46547     Py_INCREF(descr);
46548     #if PY_MAJOR_VERSION < 3
46549     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
46550     #endif
46551     {
46552         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
46553         if (unlikely(f)) {
46554             PyObject *res = f(descr, obj, (PyObject *)tp);
46555             Py_DECREF(descr);
46556             return res;
46557         }
46558     }
46559     return descr;
46560 }
46561 #endif
46562 
46563 /* PyObject_GenericGetAttr */
46564   #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
46565 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
46566     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
46567         return PyObject_GenericGetAttr(obj, attr_name);
46568     }
46569     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
46570 }
46571 #endif
46572 
46573 /* SetVTable */
46574   static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
46575 #if PY_VERSION_HEX >= 0x02070000
46576     PyObject *ob = PyCapsule_New(vtable, 0, 0);
46577 #else
46578     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
46579 #endif
46580     if (!ob)
46581         goto bad;
46582     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
46583         goto bad;
46584     Py_DECREF(ob);
46585     return 0;
46586 bad:
46587     Py_XDECREF(ob);
46588     return -1;
46589 }
46590 
46591 /* PyObjectGetAttrStrNoError */
46592   static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
46593     __Pyx_PyThreadState_declare
46594     __Pyx_PyThreadState_assign
46595     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
46596         __Pyx_PyErr_Clear();
46597 }
46598 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
46599     PyObject *result;
46600 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
46601     PyTypeObject* tp = Py_TYPE(obj);
46602     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
46603         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
46604     }
46605 #endif
46606     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
46607     if (unlikely(!result)) {
46608         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
46609     }
46610     return result;
46611 }
46612 
46613 /* SetupReduce */
46614   static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
46615   int ret;
46616   PyObject *name_attr;
46617   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
46618   if (likely(name_attr)) {
46619       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
46620   } else {
46621       ret = -1;
46622   }
46623   if (unlikely(ret < 0)) {
46624       PyErr_Clear();
46625       ret = 0;
46626   }
46627   Py_XDECREF(name_attr);
46628   return ret;
46629 }
46630 static int __Pyx_setup_reduce(PyObject* type_obj) {
46631     int ret = 0;
46632     PyObject *object_reduce = NULL;
46633     PyObject *object_reduce_ex = NULL;
46634     PyObject *reduce = NULL;
46635     PyObject *reduce_ex = NULL;
46636     PyObject *reduce_cython = NULL;
46637     PyObject *setstate = NULL;
46638     PyObject *setstate_cython = NULL;
46639 #if CYTHON_USE_PYTYPE_LOOKUP
46640     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
46641 #else
46642     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
46643 #endif
46644 #if CYTHON_USE_PYTYPE_LOOKUP
46645     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
46646 #else
46647     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
46648 #endif
46649     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
46650     if (reduce_ex == object_reduce_ex) {
46651 #if CYTHON_USE_PYTYPE_LOOKUP
46652         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
46653 #else
46654         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
46655 #endif
46656         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
46657         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
46658             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
46659             if (likely(reduce_cython)) {
46660                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
46661                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
46662             } else if (reduce == object_reduce || PyErr_Occurred()) {
46663                 goto __PYX_BAD;
46664             }
46665             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
46666             if (!setstate) PyErr_Clear();
46667             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
46668                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
46669                 if (likely(setstate_cython)) {
46670                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
46671                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
46672                 } else if (!setstate || PyErr_Occurred()) {
46673                     goto __PYX_BAD;
46674                 }
46675             }
46676             PyType_Modified((PyTypeObject*)type_obj);
46677         }
46678     }
46679     goto __PYX_GOOD;
46680 __PYX_BAD:
46681     if (!PyErr_Occurred())
46682         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
46683     ret = -1;
46684 __PYX_GOOD:
46685 #if !CYTHON_USE_PYTYPE_LOOKUP
46686     Py_XDECREF(object_reduce);
46687     Py_XDECREF(object_reduce_ex);
46688 #endif
46689     Py_XDECREF(reduce);
46690     Py_XDECREF(reduce_ex);
46691     Py_XDECREF(reduce_cython);
46692     Py_XDECREF(setstate);
46693     Py_XDECREF(setstate_cython);
46694     return ret;
46695 }
46696 
46697 /* CLineInTraceback */
46698   #ifndef CYTHON_CLINE_IN_TRACEBACK
46699 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
46700     PyObject *use_cline;
46701     PyObject *ptype, *pvalue, *ptraceback;
46702 #if CYTHON_COMPILING_IN_CPYTHON
46703     PyObject **cython_runtime_dict;
46704 #endif
46705     if (unlikely(!__pyx_cython_runtime)) {
46706         return c_line;
46707     }
46708     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
46709 #if CYTHON_COMPILING_IN_CPYTHON
46710     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
46711     if (likely(cython_runtime_dict)) {
46712         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
46713             use_cline, *cython_runtime_dict,
46714             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
46715     } else
46716 #endif
46717     {
46718       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
46719       if (use_cline_obj) {
46720         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
46721         Py_DECREF(use_cline_obj);
46722       } else {
46723         PyErr_Clear();
46724         use_cline = NULL;
46725       }
46726     }
46727     if (!use_cline) {
46728         c_line = 0;
46729         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
46730     }
46731     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
46732         c_line = 0;
46733     }
46734     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
46735     return c_line;
46736 }
46737 #endif
46738 
46739 /* CodeObjectCache */
46740   static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
46741     int start = 0, mid = 0, end = count - 1;
46742     if (end >= 0 && code_line > entries[end].code_line) {
46743         return count;
46744     }
46745     while (start < end) {
46746         mid = start + (end - start) / 2;
46747         if (code_line < entries[mid].code_line) {
46748             end = mid;
46749         } else if (code_line > entries[mid].code_line) {
46750              start = mid + 1;
46751         } else {
46752             return mid;
46753         }
46754     }
46755     if (code_line <= entries[mid].code_line) {
46756         return mid;
46757     } else {
46758         return mid + 1;
46759     }
46760 }
46761 static PyCodeObject *__pyx_find_code_object(int code_line) {
46762     PyCodeObject* code_object;
46763     int pos;
46764     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
46765         return NULL;
46766     }
46767     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
46768     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
46769         return NULL;
46770     }
46771     code_object = __pyx_code_cache.entries[pos].code_object;
46772     Py_INCREF(code_object);
46773     return code_object;
46774 }
46775 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
46776     int pos, i;
46777     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
46778     if (unlikely(!code_line)) {
46779         return;
46780     }
46781     if (unlikely(!entries)) {
46782         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
46783         if (likely(entries)) {
46784             __pyx_code_cache.entries = entries;
46785             __pyx_code_cache.max_count = 64;
46786             __pyx_code_cache.count = 1;
46787             entries[0].code_line = code_line;
46788             entries[0].code_object = code_object;
46789             Py_INCREF(code_object);
46790         }
46791         return;
46792     }
46793     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
46794     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
46795         PyCodeObject* tmp = entries[pos].code_object;
46796         entries[pos].code_object = code_object;
46797         Py_DECREF(tmp);
46798         return;
46799     }
46800     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
46801         int new_max = __pyx_code_cache.max_count + 64;
46802         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
46803             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
46804         if (unlikely(!entries)) {
46805             return;
46806         }
46807         __pyx_code_cache.entries = entries;
46808         __pyx_code_cache.max_count = new_max;
46809     }
46810     for (i=__pyx_code_cache.count; i>pos; i--) {
46811         entries[i] = entries[i-1];
46812     }
46813     entries[pos].code_line = code_line;
46814     entries[pos].code_object = code_object;
46815     __pyx_code_cache.count++;
46816     Py_INCREF(code_object);
46817 }
46818 
46819 /* AddTraceback */
46820   #include "compile.h"
46821 #include "frameobject.h"
46822 #include "traceback.h"
46823 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
46824             const char *funcname, int c_line,
46825             int py_line, const char *filename) {
46826     PyCodeObject *py_code = 0;
46827     PyObject *py_srcfile = 0;
46828     PyObject *py_funcname = 0;
46829     #if PY_MAJOR_VERSION < 3
46830     py_srcfile = PyString_FromString(filename);
46831     #else
46832     py_srcfile = PyUnicode_FromString(filename);
46833     #endif
46834     if (!py_srcfile) goto bad;
46835     if (c_line) {
46836         #if PY_MAJOR_VERSION < 3
46837         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
46838         #else
46839         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
46840         #endif
46841     }
46842     else {
46843         #if PY_MAJOR_VERSION < 3
46844         py_funcname = PyString_FromString(funcname);
46845         #else
46846         py_funcname = PyUnicode_FromString(funcname);
46847         #endif
46848     }
46849     if (!py_funcname) goto bad;
46850     py_code = __Pyx_PyCode_New(
46851         0,
46852         0,
46853         0,
46854         0,
46855         0,
46856         __pyx_empty_bytes, /*PyObject *code,*/
46857         __pyx_empty_tuple, /*PyObject *consts,*/
46858         __pyx_empty_tuple, /*PyObject *names,*/
46859         __pyx_empty_tuple, /*PyObject *varnames,*/
46860         __pyx_empty_tuple, /*PyObject *freevars,*/
46861         __pyx_empty_tuple, /*PyObject *cellvars,*/
46862         py_srcfile,   /*PyObject *filename,*/
46863         py_funcname,  /*PyObject *name,*/
46864         py_line,
46865         __pyx_empty_bytes  /*PyObject *lnotab*/
46866     );
46867     Py_DECREF(py_srcfile);
46868     Py_DECREF(py_funcname);
46869     return py_code;
46870 bad:
46871     Py_XDECREF(py_srcfile);
46872     Py_XDECREF(py_funcname);
46873     return NULL;
46874 }
46875 static void __Pyx_AddTraceback(const char *funcname, int c_line,
46876                                int py_line, const char *filename) {
46877     PyCodeObject *py_code = 0;
46878     PyFrameObject *py_frame = 0;
46879     PyThreadState *tstate = __Pyx_PyThreadState_Current;
46880     if (c_line) {
46881         c_line = __Pyx_CLineForTraceback(tstate, c_line);
46882     }
46883     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
46884     if (!py_code) {
46885         py_code = __Pyx_CreateCodeObjectForTraceback(
46886             funcname, c_line, py_line, filename);
46887         if (!py_code) goto bad;
46888         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
46889     }
46890     py_frame = PyFrame_New(
46891         tstate,            /*PyThreadState *tstate,*/
46892         py_code,           /*PyCodeObject *code,*/
46893         __pyx_d,    /*PyObject *globals,*/
46894         0                  /*PyObject *locals*/
46895     );
46896     if (!py_frame) goto bad;
46897     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
46898     PyTraceBack_Here(py_frame);
46899 bad:
46900     Py_XDECREF(py_code);
46901     Py_XDECREF(py_frame);
46902 }
46903 
46904 /* CIntFromPyVerify */
46905   #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
46906     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
46907 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
46908     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
46909 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
46910     {\
46911         func_type value = func_value;\
46912         if (sizeof(target_type) < sizeof(func_type)) {\
46913             if (unlikely(value != (func_type) (target_type) value)) {\
46914                 func_type zero = 0;\
46915                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
46916                     return (target_type) -1;\
46917                 if (is_unsigned && unlikely(value < zero))\
46918                     goto raise_neg_overflow;\
46919                 else\
46920                     goto raise_overflow;\
46921             }\
46922         }\
46923         return (target_type) value;\
46924     }
46925 
46926 /* CIntToPy */
46927   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
46928     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
46929     const int is_unsigned = neg_one > const_zero;
46930     if (is_unsigned) {
46931         if (sizeof(int) < sizeof(long)) {
46932             return PyInt_FromLong((long) value);
46933         } else if (sizeof(int) <= sizeof(unsigned long)) {
46934             return PyLong_FromUnsignedLong((unsigned long) value);
46935 #ifdef HAVE_LONG_LONG
46936         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
46937             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
46938 #endif
46939         }
46940     } else {
46941         if (sizeof(int) <= sizeof(long)) {
46942             return PyInt_FromLong((long) value);
46943 #ifdef HAVE_LONG_LONG
46944         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
46945             return PyLong_FromLongLong((PY_LONG_LONG) value);
46946 #endif
46947         }
46948     }
46949     {
46950         int one = 1; int little = (int)*(unsigned char *)&one;
46951         unsigned char *bytes = (unsigned char *)&value;
46952         return _PyLong_FromByteArray(bytes, sizeof(int),
46953                                      little, !is_unsigned);
46954     }
46955 }
46956 
46957 /* CIntToPy */
46958   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
46959     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
46960     const int is_unsigned = neg_one > const_zero;
46961     if (is_unsigned) {
46962         if (sizeof(long) < sizeof(long)) {
46963             return PyInt_FromLong((long) value);
46964         } else if (sizeof(long) <= sizeof(unsigned long)) {
46965             return PyLong_FromUnsignedLong((unsigned long) value);
46966 #ifdef HAVE_LONG_LONG
46967         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
46968             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
46969 #endif
46970         }
46971     } else {
46972         if (sizeof(long) <= sizeof(long)) {
46973             return PyInt_FromLong((long) value);
46974 #ifdef HAVE_LONG_LONG
46975         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
46976             return PyLong_FromLongLong((PY_LONG_LONG) value);
46977 #endif
46978         }
46979     }
46980     {
46981         int one = 1; int little = (int)*(unsigned char *)&one;
46982         unsigned char *bytes = (unsigned char *)&value;
46983         return _PyLong_FromByteArray(bytes, sizeof(long),
46984                                      little, !is_unsigned);
46985     }
46986 }
46987 
46988 /* CIntToPy */
46989   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value) {
46990     const short neg_one = (short) ((short) 0 - (short) 1), const_zero = (short) 0;
46991     const int is_unsigned = neg_one > const_zero;
46992     if (is_unsigned) {
46993         if (sizeof(short) < sizeof(long)) {
46994             return PyInt_FromLong((long) value);
46995         } else if (sizeof(short) <= sizeof(unsigned long)) {
46996             return PyLong_FromUnsignedLong((unsigned long) value);
46997 #ifdef HAVE_LONG_LONG
46998         } else if (sizeof(short) <= sizeof(unsigned PY_LONG_LONG)) {
46999             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
47000 #endif
47001         }
47002     } else {
47003         if (sizeof(short) <= sizeof(long)) {
47004             return PyInt_FromLong((long) value);
47005 #ifdef HAVE_LONG_LONG
47006         } else if (sizeof(short) <= sizeof(PY_LONG_LONG)) {
47007             return PyLong_FromLongLong((PY_LONG_LONG) value);
47008 #endif
47009         }
47010     }
47011     {
47012         int one = 1; int little = (int)*(unsigned char *)&one;
47013         unsigned char *bytes = (unsigned char *)&value;
47014         return _PyLong_FromByteArray(bytes, sizeof(short),
47015                                      little, !is_unsigned);
47016     }
47017 }
47018 
47019 #if PY_MAJOR_VERSION < 3
47020 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
47021     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
47022         if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
47023         if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
47024     PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
47025     return -1;
47026 }
47027 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
47028     PyObject *obj = view->obj;
47029     if (!obj) return;
47030     if (PyObject_CheckBuffer(obj)) {
47031         PyBuffer_Release(view);
47032         return;
47033     }
47034     if ((0)) {}
47035     view->obj = NULL;
47036     Py_DECREF(obj);
47037 }
47038 #endif
47039 
47040 
47041   /* MemviewSliceIsContig */
47042   static int
47043 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
47044 {
47045     int i, index, step, start;
47046     Py_ssize_t itemsize = mvs.memview->view.itemsize;
47047     if (order == 'F') {
47048         step = 1;
47049         start = 0;
47050     } else {
47051         step = -1;
47052         start = ndim - 1;
47053     }
47054     for (i = 0; i < ndim; i++) {
47055         index = start + step * i;
47056         if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
47057             return 0;
47058         itemsize *= mvs.shape[index];
47059     }
47060     return 1;
47061 }
47062 
47063 /* OverlappingSlices */
47064   static void
47065 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
47066                                void **out_start, void **out_end,
47067                                int ndim, size_t itemsize)
47068 {
47069     char *start, *end;
47070     int i;
47071     start = end = slice->data;
47072     for (i = 0; i < ndim; i++) {
47073         Py_ssize_t stride = slice->strides[i];
47074         Py_ssize_t extent = slice->shape[i];
47075         if (extent == 0) {
47076             *out_start = *out_end = start;
47077             return;
47078         } else {
47079             if (stride > 0)
47080                 end += stride * (extent - 1);
47081             else
47082                 start += stride * (extent - 1);
47083         }
47084     }
47085     *out_start = start;
47086     *out_end = end + itemsize;
47087 }
47088 static int
47089 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
47090                      __Pyx_memviewslice *slice2,
47091                      int ndim, size_t itemsize)
47092 {
47093     void *start1, *end1, *start2, *end2;
47094     __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
47095     __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
47096     return (start1 < end2) && (start2 < end1);
47097 }
47098 
47099 /* Capsule */
47100   static CYTHON_INLINE PyObject *
47101 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
47102 {
47103     PyObject *cobj;
47104 #if PY_VERSION_HEX >= 0x02070000
47105     cobj = PyCapsule_New(p, sig, NULL);
47106 #else
47107     cobj = PyCObject_FromVoidPtr(p, NULL);
47108 #endif
47109     return cobj;
47110 }
47111 
47112 /* CIntFromPy */
47113   static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
47114     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
47115     const int is_unsigned = neg_one > const_zero;
47116 #if PY_MAJOR_VERSION < 3
47117     if (likely(PyInt_Check(x))) {
47118         if (sizeof(int) < sizeof(long)) {
47119             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
47120         } else {
47121             long val = PyInt_AS_LONG(x);
47122             if (is_unsigned && unlikely(val < 0)) {
47123                 goto raise_neg_overflow;
47124             }
47125             return (int) val;
47126         }
47127     } else
47128 #endif
47129     if (likely(PyLong_Check(x))) {
47130         if (is_unsigned) {
47131 #if CYTHON_USE_PYLONG_INTERNALS
47132             const digit* digits = ((PyLongObject*)x)->ob_digit;
47133             switch (Py_SIZE(x)) {
47134                 case  0: return (int) 0;
47135                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
47136                 case 2:
47137                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
47138                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47139                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47140                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
47141                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
47142                         }
47143                     }
47144                     break;
47145                 case 3:
47146                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
47147                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47148                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47149                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
47150                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
47151                         }
47152                     }
47153                     break;
47154                 case 4:
47155                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
47156                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47157                             __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])))
47158                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
47159                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
47160                         }
47161                     }
47162                     break;
47163             }
47164 #endif
47165 #if CYTHON_COMPILING_IN_CPYTHON
47166             if (unlikely(Py_SIZE(x) < 0)) {
47167                 goto raise_neg_overflow;
47168             }
47169 #else
47170             {
47171                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
47172                 if (unlikely(result < 0))
47173                     return (int) -1;
47174                 if (unlikely(result == 1))
47175                     goto raise_neg_overflow;
47176             }
47177 #endif
47178             if (sizeof(int) <= sizeof(unsigned long)) {
47179                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
47180 #ifdef HAVE_LONG_LONG
47181             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
47182                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
47183 #endif
47184             }
47185         } else {
47186 #if CYTHON_USE_PYLONG_INTERNALS
47187             const digit* digits = ((PyLongObject*)x)->ob_digit;
47188             switch (Py_SIZE(x)) {
47189                 case  0: return (int) 0;
47190                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
47191                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
47192                 case -2:
47193                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
47194                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47195                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47196                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
47197                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
47198                         }
47199                     }
47200                     break;
47201                 case 2:
47202                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
47203                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47204                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47205                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
47206                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
47207                         }
47208                     }
47209                     break;
47210                 case -3:
47211                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
47212                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47213                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47214                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
47215                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
47216                         }
47217                     }
47218                     break;
47219                 case 3:
47220                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
47221                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47222                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47223                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
47224                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
47225                         }
47226                     }
47227                     break;
47228                 case -4:
47229                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
47230                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47231                             __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])))
47232                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
47233                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
47234                         }
47235                     }
47236                     break;
47237                 case 4:
47238                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
47239                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47240                             __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])))
47241                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
47242                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
47243                         }
47244                     }
47245                     break;
47246             }
47247 #endif
47248             if (sizeof(int) <= sizeof(long)) {
47249                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
47250 #ifdef HAVE_LONG_LONG
47251             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
47252                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
47253 #endif
47254             }
47255         }
47256         {
47257 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
47258             PyErr_SetString(PyExc_RuntimeError,
47259                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
47260 #else
47261             int val;
47262             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
47263  #if PY_MAJOR_VERSION < 3
47264             if (likely(v) && !PyLong_Check(v)) {
47265                 PyObject *tmp = v;
47266                 v = PyNumber_Long(tmp);
47267                 Py_DECREF(tmp);
47268             }
47269  #endif
47270             if (likely(v)) {
47271                 int one = 1; int is_little = (int)*(unsigned char *)&one;
47272                 unsigned char *bytes = (unsigned char *)&val;
47273                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
47274                                               bytes, sizeof(val),
47275                                               is_little, !is_unsigned);
47276                 Py_DECREF(v);
47277                 if (likely(!ret))
47278                     return val;
47279             }
47280 #endif
47281             return (int) -1;
47282         }
47283     } else {
47284         int val;
47285         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
47286         if (!tmp) return (int) -1;
47287         val = __Pyx_PyInt_As_int(tmp);
47288         Py_DECREF(tmp);
47289         return val;
47290     }
47291 raise_overflow:
47292     PyErr_SetString(PyExc_OverflowError,
47293         "value too large to convert to int");
47294     return (int) -1;
47295 raise_neg_overflow:
47296     PyErr_SetString(PyExc_OverflowError,
47297         "can't convert negative value to int");
47298     return (int) -1;
47299 }
47300 
47301 /* CIntFromPy */
47302   static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
47303     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
47304     const int is_unsigned = neg_one > const_zero;
47305 #if PY_MAJOR_VERSION < 3
47306     if (likely(PyInt_Check(x))) {
47307         if (sizeof(long) < sizeof(long)) {
47308             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
47309         } else {
47310             long val = PyInt_AS_LONG(x);
47311             if (is_unsigned && unlikely(val < 0)) {
47312                 goto raise_neg_overflow;
47313             }
47314             return (long) val;
47315         }
47316     } else
47317 #endif
47318     if (likely(PyLong_Check(x))) {
47319         if (is_unsigned) {
47320 #if CYTHON_USE_PYLONG_INTERNALS
47321             const digit* digits = ((PyLongObject*)x)->ob_digit;
47322             switch (Py_SIZE(x)) {
47323                 case  0: return (long) 0;
47324                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
47325                 case 2:
47326                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
47327                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47328                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47329                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
47330                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
47331                         }
47332                     }
47333                     break;
47334                 case 3:
47335                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
47336                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47337                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47338                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
47339                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
47340                         }
47341                     }
47342                     break;
47343                 case 4:
47344                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
47345                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47346                             __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])))
47347                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
47348                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
47349                         }
47350                     }
47351                     break;
47352             }
47353 #endif
47354 #if CYTHON_COMPILING_IN_CPYTHON
47355             if (unlikely(Py_SIZE(x) < 0)) {
47356                 goto raise_neg_overflow;
47357             }
47358 #else
47359             {
47360                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
47361                 if (unlikely(result < 0))
47362                     return (long) -1;
47363                 if (unlikely(result == 1))
47364                     goto raise_neg_overflow;
47365             }
47366 #endif
47367             if (sizeof(long) <= sizeof(unsigned long)) {
47368                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
47369 #ifdef HAVE_LONG_LONG
47370             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
47371                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
47372 #endif
47373             }
47374         } else {
47375 #if CYTHON_USE_PYLONG_INTERNALS
47376             const digit* digits = ((PyLongObject*)x)->ob_digit;
47377             switch (Py_SIZE(x)) {
47378                 case  0: return (long) 0;
47379                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
47380                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
47381                 case -2:
47382                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
47383                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47384                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47385                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
47386                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
47387                         }
47388                     }
47389                     break;
47390                 case 2:
47391                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
47392                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47393                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47394                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
47395                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
47396                         }
47397                     }
47398                     break;
47399                 case -3:
47400                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
47401                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47402                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47403                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
47404                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
47405                         }
47406                     }
47407                     break;
47408                 case 3:
47409                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
47410                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47411                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47412                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
47413                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
47414                         }
47415                     }
47416                     break;
47417                 case -4:
47418                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
47419                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47420                             __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])))
47421                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
47422                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
47423                         }
47424                     }
47425                     break;
47426                 case 4:
47427                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
47428                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47429                             __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])))
47430                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
47431                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
47432                         }
47433                     }
47434                     break;
47435             }
47436 #endif
47437             if (sizeof(long) <= sizeof(long)) {
47438                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
47439 #ifdef HAVE_LONG_LONG
47440             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
47441                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
47442 #endif
47443             }
47444         }
47445         {
47446 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
47447             PyErr_SetString(PyExc_RuntimeError,
47448                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
47449 #else
47450             long val;
47451             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
47452  #if PY_MAJOR_VERSION < 3
47453             if (likely(v) && !PyLong_Check(v)) {
47454                 PyObject *tmp = v;
47455                 v = PyNumber_Long(tmp);
47456                 Py_DECREF(tmp);
47457             }
47458  #endif
47459             if (likely(v)) {
47460                 int one = 1; int is_little = (int)*(unsigned char *)&one;
47461                 unsigned char *bytes = (unsigned char *)&val;
47462                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
47463                                               bytes, sizeof(val),
47464                                               is_little, !is_unsigned);
47465                 Py_DECREF(v);
47466                 if (likely(!ret))
47467                     return val;
47468             }
47469 #endif
47470             return (long) -1;
47471         }
47472     } else {
47473         long val;
47474         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
47475         if (!tmp) return (long) -1;
47476         val = __Pyx_PyInt_As_long(tmp);
47477         Py_DECREF(tmp);
47478         return val;
47479     }
47480 raise_overflow:
47481     PyErr_SetString(PyExc_OverflowError,
47482         "value too large to convert to long");
47483     return (long) -1;
47484 raise_neg_overflow:
47485     PyErr_SetString(PyExc_OverflowError,
47486         "can't convert negative value to long");
47487     return (long) -1;
47488 }
47489 
47490 /* CIntFromPy */
47491   static CYTHON_INLINE GDALColorInterp __Pyx_PyInt_As_GDALColorInterp(PyObject *x) {
47492     const GDALColorInterp neg_one = (GDALColorInterp) ((GDALColorInterp) 0 - (GDALColorInterp) 1), const_zero = (GDALColorInterp) 0;
47493     const int is_unsigned = neg_one > const_zero;
47494 #if PY_MAJOR_VERSION < 3
47495     if (likely(PyInt_Check(x))) {
47496         if (sizeof(GDALColorInterp) < sizeof(long)) {
47497             __PYX_VERIFY_RETURN_INT(GDALColorInterp, long, PyInt_AS_LONG(x))
47498         } else {
47499             long val = PyInt_AS_LONG(x);
47500             if (is_unsigned && unlikely(val < 0)) {
47501                 goto raise_neg_overflow;
47502             }
47503             return (GDALColorInterp) val;
47504         }
47505     } else
47506 #endif
47507     if (likely(PyLong_Check(x))) {
47508         if (is_unsigned) {
47509 #if CYTHON_USE_PYLONG_INTERNALS
47510             const digit* digits = ((PyLongObject*)x)->ob_digit;
47511             switch (Py_SIZE(x)) {
47512                 case  0: return (GDALColorInterp) 0;
47513                 case  1: __PYX_VERIFY_RETURN_INT(GDALColorInterp, digit, digits[0])
47514                 case 2:
47515                     if (8 * sizeof(GDALColorInterp) > 1 * PyLong_SHIFT) {
47516                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47517                             __PYX_VERIFY_RETURN_INT(GDALColorInterp, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47518                         } else if (8 * sizeof(GDALColorInterp) >= 2 * PyLong_SHIFT) {
47519                             return (GDALColorInterp) (((((GDALColorInterp)digits[1]) << PyLong_SHIFT) | (GDALColorInterp)digits[0]));
47520                         }
47521                     }
47522                     break;
47523                 case 3:
47524                     if (8 * sizeof(GDALColorInterp) > 2 * PyLong_SHIFT) {
47525                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47526                             __PYX_VERIFY_RETURN_INT(GDALColorInterp, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47527                         } else if (8 * sizeof(GDALColorInterp) >= 3 * PyLong_SHIFT) {
47528                             return (GDALColorInterp) (((((((GDALColorInterp)digits[2]) << PyLong_SHIFT) | (GDALColorInterp)digits[1]) << PyLong_SHIFT) | (GDALColorInterp)digits[0]));
47529                         }
47530                     }
47531                     break;
47532                 case 4:
47533                     if (8 * sizeof(GDALColorInterp) > 3 * PyLong_SHIFT) {
47534                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47535                             __PYX_VERIFY_RETURN_INT(GDALColorInterp, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47536                         } else if (8 * sizeof(GDALColorInterp) >= 4 * PyLong_SHIFT) {
47537                             return (GDALColorInterp) (((((((((GDALColorInterp)digits[3]) << PyLong_SHIFT) | (GDALColorInterp)digits[2]) << PyLong_SHIFT) | (GDALColorInterp)digits[1]) << PyLong_SHIFT) | (GDALColorInterp)digits[0]));
47538                         }
47539                     }
47540                     break;
47541             }
47542 #endif
47543 #if CYTHON_COMPILING_IN_CPYTHON
47544             if (unlikely(Py_SIZE(x) < 0)) {
47545                 goto raise_neg_overflow;
47546             }
47547 #else
47548             {
47549                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
47550                 if (unlikely(result < 0))
47551                     return (GDALColorInterp) -1;
47552                 if (unlikely(result == 1))
47553                     goto raise_neg_overflow;
47554             }
47555 #endif
47556             if (sizeof(GDALColorInterp) <= sizeof(unsigned long)) {
47557                 __PYX_VERIFY_RETURN_INT_EXC(GDALColorInterp, unsigned long, PyLong_AsUnsignedLong(x))
47558 #ifdef HAVE_LONG_LONG
47559             } else if (sizeof(GDALColorInterp) <= sizeof(unsigned PY_LONG_LONG)) {
47560                 __PYX_VERIFY_RETURN_INT_EXC(GDALColorInterp, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
47561 #endif
47562             }
47563         } else {
47564 #if CYTHON_USE_PYLONG_INTERNALS
47565             const digit* digits = ((PyLongObject*)x)->ob_digit;
47566             switch (Py_SIZE(x)) {
47567                 case  0: return (GDALColorInterp) 0;
47568                 case -1: __PYX_VERIFY_RETURN_INT(GDALColorInterp, sdigit, (sdigit) (-(sdigit)digits[0]))
47569                 case  1: __PYX_VERIFY_RETURN_INT(GDALColorInterp,  digit, +digits[0])
47570                 case -2:
47571                     if (8 * sizeof(GDALColorInterp) - 1 > 1 * PyLong_SHIFT) {
47572                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47573                             __PYX_VERIFY_RETURN_INT(GDALColorInterp, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47574                         } else if (8 * sizeof(GDALColorInterp) - 1 > 2 * PyLong_SHIFT) {
47575                             return (GDALColorInterp) (((GDALColorInterp)-1)*(((((GDALColorInterp)digits[1]) << PyLong_SHIFT) | (GDALColorInterp)digits[0])));
47576                         }
47577                     }
47578                     break;
47579                 case 2:
47580                     if (8 * sizeof(GDALColorInterp) > 1 * PyLong_SHIFT) {
47581                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47582                             __PYX_VERIFY_RETURN_INT(GDALColorInterp, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47583                         } else if (8 * sizeof(GDALColorInterp) - 1 > 2 * PyLong_SHIFT) {
47584                             return (GDALColorInterp) ((((((GDALColorInterp)digits[1]) << PyLong_SHIFT) | (GDALColorInterp)digits[0])));
47585                         }
47586                     }
47587                     break;
47588                 case -3:
47589                     if (8 * sizeof(GDALColorInterp) - 1 > 2 * PyLong_SHIFT) {
47590                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47591                             __PYX_VERIFY_RETURN_INT(GDALColorInterp, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47592                         } else if (8 * sizeof(GDALColorInterp) - 1 > 3 * PyLong_SHIFT) {
47593                             return (GDALColorInterp) (((GDALColorInterp)-1)*(((((((GDALColorInterp)digits[2]) << PyLong_SHIFT) | (GDALColorInterp)digits[1]) << PyLong_SHIFT) | (GDALColorInterp)digits[0])));
47594                         }
47595                     }
47596                     break;
47597                 case 3:
47598                     if (8 * sizeof(GDALColorInterp) > 2 * PyLong_SHIFT) {
47599                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47600                             __PYX_VERIFY_RETURN_INT(GDALColorInterp, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47601                         } else if (8 * sizeof(GDALColorInterp) - 1 > 3 * PyLong_SHIFT) {
47602                             return (GDALColorInterp) ((((((((GDALColorInterp)digits[2]) << PyLong_SHIFT) | (GDALColorInterp)digits[1]) << PyLong_SHIFT) | (GDALColorInterp)digits[0])));
47603                         }
47604                     }
47605                     break;
47606                 case -4:
47607                     if (8 * sizeof(GDALColorInterp) - 1 > 3 * PyLong_SHIFT) {
47608                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47609                             __PYX_VERIFY_RETURN_INT(GDALColorInterp, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47610                         } else if (8 * sizeof(GDALColorInterp) - 1 > 4 * PyLong_SHIFT) {
47611                             return (GDALColorInterp) (((GDALColorInterp)-1)*(((((((((GDALColorInterp)digits[3]) << PyLong_SHIFT) | (GDALColorInterp)digits[2]) << PyLong_SHIFT) | (GDALColorInterp)digits[1]) << PyLong_SHIFT) | (GDALColorInterp)digits[0])));
47612                         }
47613                     }
47614                     break;
47615                 case 4:
47616                     if (8 * sizeof(GDALColorInterp) > 3 * PyLong_SHIFT) {
47617                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47618                             __PYX_VERIFY_RETURN_INT(GDALColorInterp, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47619                         } else if (8 * sizeof(GDALColorInterp) - 1 > 4 * PyLong_SHIFT) {
47620                             return (GDALColorInterp) ((((((((((GDALColorInterp)digits[3]) << PyLong_SHIFT) | (GDALColorInterp)digits[2]) << PyLong_SHIFT) | (GDALColorInterp)digits[1]) << PyLong_SHIFT) | (GDALColorInterp)digits[0])));
47621                         }
47622                     }
47623                     break;
47624             }
47625 #endif
47626             if (sizeof(GDALColorInterp) <= sizeof(long)) {
47627                 __PYX_VERIFY_RETURN_INT_EXC(GDALColorInterp, long, PyLong_AsLong(x))
47628 #ifdef HAVE_LONG_LONG
47629             } else if (sizeof(GDALColorInterp) <= sizeof(PY_LONG_LONG)) {
47630                 __PYX_VERIFY_RETURN_INT_EXC(GDALColorInterp, PY_LONG_LONG, PyLong_AsLongLong(x))
47631 #endif
47632             }
47633         }
47634         {
47635 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
47636             PyErr_SetString(PyExc_RuntimeError,
47637                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
47638 #else
47639             GDALColorInterp val;
47640             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
47641  #if PY_MAJOR_VERSION < 3
47642             if (likely(v) && !PyLong_Check(v)) {
47643                 PyObject *tmp = v;
47644                 v = PyNumber_Long(tmp);
47645                 Py_DECREF(tmp);
47646             }
47647  #endif
47648             if (likely(v)) {
47649                 int one = 1; int is_little = (int)*(unsigned char *)&one;
47650                 unsigned char *bytes = (unsigned char *)&val;
47651                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
47652                                               bytes, sizeof(val),
47653                                               is_little, !is_unsigned);
47654                 Py_DECREF(v);
47655                 if (likely(!ret))
47656                     return val;
47657             }
47658 #endif
47659             return (GDALColorInterp) -1;
47660         }
47661     } else {
47662         GDALColorInterp val;
47663         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
47664         if (!tmp) return (GDALColorInterp) -1;
47665         val = __Pyx_PyInt_As_GDALColorInterp(tmp);
47666         Py_DECREF(tmp);
47667         return val;
47668     }
47669 raise_overflow:
47670     PyErr_SetString(PyExc_OverflowError,
47671         "value too large to convert to GDALColorInterp");
47672     return (GDALColorInterp) -1;
47673 raise_neg_overflow:
47674     PyErr_SetString(PyExc_OverflowError,
47675         "can't convert negative value to GDALColorInterp");
47676     return (GDALColorInterp) -1;
47677 }
47678 
47679 /* CIntFromPy */
47680   static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
47681     const size_t neg_one = (size_t) ((size_t) 0 - (size_t) 1), const_zero = (size_t) 0;
47682     const int is_unsigned = neg_one > const_zero;
47683 #if PY_MAJOR_VERSION < 3
47684     if (likely(PyInt_Check(x))) {
47685         if (sizeof(size_t) < sizeof(long)) {
47686             __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
47687         } else {
47688             long val = PyInt_AS_LONG(x);
47689             if (is_unsigned && unlikely(val < 0)) {
47690                 goto raise_neg_overflow;
47691             }
47692             return (size_t) val;
47693         }
47694     } else
47695 #endif
47696     if (likely(PyLong_Check(x))) {
47697         if (is_unsigned) {
47698 #if CYTHON_USE_PYLONG_INTERNALS
47699             const digit* digits = ((PyLongObject*)x)->ob_digit;
47700             switch (Py_SIZE(x)) {
47701                 case  0: return (size_t) 0;
47702                 case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
47703                 case 2:
47704                     if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
47705                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47706                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47707                         } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
47708                             return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
47709                         }
47710                     }
47711                     break;
47712                 case 3:
47713                     if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
47714                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47715                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47716                         } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
47717                             return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
47718                         }
47719                     }
47720                     break;
47721                 case 4:
47722                     if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
47723                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47724                             __PYX_VERIFY_RETURN_INT(size_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])))
47725                         } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
47726                             return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
47727                         }
47728                     }
47729                     break;
47730             }
47731 #endif
47732 #if CYTHON_COMPILING_IN_CPYTHON
47733             if (unlikely(Py_SIZE(x) < 0)) {
47734                 goto raise_neg_overflow;
47735             }
47736 #else
47737             {
47738                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
47739                 if (unlikely(result < 0))
47740                     return (size_t) -1;
47741                 if (unlikely(result == 1))
47742                     goto raise_neg_overflow;
47743             }
47744 #endif
47745             if (sizeof(size_t) <= sizeof(unsigned long)) {
47746                 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
47747 #ifdef HAVE_LONG_LONG
47748             } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
47749                 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
47750 #endif
47751             }
47752         } else {
47753 #if CYTHON_USE_PYLONG_INTERNALS
47754             const digit* digits = ((PyLongObject*)x)->ob_digit;
47755             switch (Py_SIZE(x)) {
47756                 case  0: return (size_t) 0;
47757                 case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
47758                 case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
47759                 case -2:
47760                     if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
47761                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47762                             __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47763                         } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
47764                             return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
47765                         }
47766                     }
47767                     break;
47768                 case 2:
47769                     if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
47770                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47771                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47772                         } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
47773                             return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
47774                         }
47775                     }
47776                     break;
47777                 case -3:
47778                     if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
47779                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47780                             __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47781                         } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
47782                             return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
47783                         }
47784                     }
47785                     break;
47786                 case 3:
47787                     if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
47788                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47789                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47790                         } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
47791                             return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
47792                         }
47793                     }
47794                     break;
47795                 case -4:
47796                     if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
47797                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47798                             __PYX_VERIFY_RETURN_INT(size_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])))
47799                         } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
47800                             return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
47801                         }
47802                     }
47803                     break;
47804                 case 4:
47805                     if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
47806                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47807                             __PYX_VERIFY_RETURN_INT(size_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])))
47808                         } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
47809                             return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
47810                         }
47811                     }
47812                     break;
47813             }
47814 #endif
47815             if (sizeof(size_t) <= sizeof(long)) {
47816                 __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
47817 #ifdef HAVE_LONG_LONG
47818             } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
47819                 __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
47820 #endif
47821             }
47822         }
47823         {
47824 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
47825             PyErr_SetString(PyExc_RuntimeError,
47826                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
47827 #else
47828             size_t val;
47829             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
47830  #if PY_MAJOR_VERSION < 3
47831             if (likely(v) && !PyLong_Check(v)) {
47832                 PyObject *tmp = v;
47833                 v = PyNumber_Long(tmp);
47834                 Py_DECREF(tmp);
47835             }
47836  #endif
47837             if (likely(v)) {
47838                 int one = 1; int is_little = (int)*(unsigned char *)&one;
47839                 unsigned char *bytes = (unsigned char *)&val;
47840                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
47841                                               bytes, sizeof(val),
47842                                               is_little, !is_unsigned);
47843                 Py_DECREF(v);
47844                 if (likely(!ret))
47845                     return val;
47846             }
47847 #endif
47848             return (size_t) -1;
47849         }
47850     } else {
47851         size_t val;
47852         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
47853         if (!tmp) return (size_t) -1;
47854         val = __Pyx_PyInt_As_size_t(tmp);
47855         Py_DECREF(tmp);
47856         return val;
47857     }
47858 raise_overflow:
47859     PyErr_SetString(PyExc_OverflowError,
47860         "value too large to convert to size_t");
47861     return (size_t) -1;
47862 raise_neg_overflow:
47863     PyErr_SetString(PyExc_OverflowError,
47864         "can't convert negative value to size_t");
47865     return (size_t) -1;
47866 }
47867 
47868 /* MemviewSliceCopyTemplate */
47869   static __Pyx_memviewslice
47870 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
47871                                  const char *mode, int ndim,
47872                                  size_t sizeof_dtype, int contig_flag,
47873                                  int dtype_is_object)
47874 {
47875     __Pyx_RefNannyDeclarations
47876     int i;
47877     __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
47878     struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
47879     Py_buffer *buf = &from_memview->view;
47880     PyObject *shape_tuple = NULL;
47881     PyObject *temp_int = NULL;
47882     struct __pyx_array_obj *array_obj = NULL;
47883     struct __pyx_memoryview_obj *memview_obj = NULL;
47884     __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
47885     for (i = 0; i < ndim; i++) {
47886         if (unlikely(from_mvs->suboffsets[i] >= 0)) {
47887             PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
47888                                            "indirect dimensions (axis %d)", i);
47889             goto fail;
47890         }
47891     }
47892     shape_tuple = PyTuple_New(ndim);
47893     if (unlikely(!shape_tuple)) {
47894         goto fail;
47895     }
47896     __Pyx_GOTREF(shape_tuple);
47897     for(i = 0; i < ndim; i++) {
47898         temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
47899         if(unlikely(!temp_int)) {
47900             goto fail;
47901         } else {
47902             PyTuple_SET_ITEM(shape_tuple, i, temp_int);
47903             temp_int = NULL;
47904         }
47905     }
47906     array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
47907     if (unlikely(!array_obj)) {
47908         goto fail;
47909     }
47910     __Pyx_GOTREF(array_obj);
47911     memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
47912                                     (PyObject *) array_obj, contig_flag,
47913                                     dtype_is_object,
47914                                     from_mvs->memview->typeinfo);
47915     if (unlikely(!memview_obj))
47916         goto fail;
47917     if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
47918         goto fail;
47919     if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
47920                                                 dtype_is_object) < 0))
47921         goto fail;
47922     goto no_fail;
47923 fail:
47924     __Pyx_XDECREF(new_mvs.memview);
47925     new_mvs.memview = NULL;
47926     new_mvs.data = NULL;
47927 no_fail:
47928     __Pyx_XDECREF(shape_tuple);
47929     __Pyx_XDECREF(temp_int);
47930     __Pyx_XDECREF(array_obj);
47931     __Pyx_RefNannyFinishContext();
47932     return new_mvs;
47933 }
47934 
47935 /* MemviewSliceInit */
47936   static int
47937 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
47938                         int ndim,
47939                         __Pyx_memviewslice *memviewslice,
47940                         int memview_is_new_reference)
47941 {
47942     __Pyx_RefNannyDeclarations
47943     int i, retval=-1;
47944     Py_buffer *buf = &memview->view;
47945     __Pyx_RefNannySetupContext("init_memviewslice", 0);
47946     if (unlikely(memviewslice->memview || memviewslice->data)) {
47947         PyErr_SetString(PyExc_ValueError,
47948             "memviewslice is already initialized!");
47949         goto fail;
47950     }
47951     if (buf->strides) {
47952         for (i = 0; i < ndim; i++) {
47953             memviewslice->strides[i] = buf->strides[i];
47954         }
47955     } else {
47956         Py_ssize_t stride = buf->itemsize;
47957         for (i = ndim - 1; i >= 0; i--) {
47958             memviewslice->strides[i] = stride;
47959             stride *= buf->shape[i];
47960         }
47961     }
47962     for (i = 0; i < ndim; i++) {
47963         memviewslice->shape[i]   = buf->shape[i];
47964         if (buf->suboffsets) {
47965             memviewslice->suboffsets[i] = buf->suboffsets[i];
47966         } else {
47967             memviewslice->suboffsets[i] = -1;
47968         }
47969     }
47970     memviewslice->memview = memview;
47971     memviewslice->data = (char *)buf->buf;
47972     if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
47973         Py_INCREF(memview);
47974     }
47975     retval = 0;
47976     goto no_fail;
47977 fail:
47978     memviewslice->memview = 0;
47979     memviewslice->data = 0;
47980     retval = -1;
47981 no_fail:
47982     __Pyx_RefNannyFinishContext();
47983     return retval;
47984 }
47985 #ifndef Py_NO_RETURN
47986 #define Py_NO_RETURN
47987 #endif
47988 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
47989     va_list vargs;
47990     char msg[200];
47991 #ifdef HAVE_STDARG_PROTOTYPES
47992     va_start(vargs, fmt);
47993 #else
47994     va_start(vargs);
47995 #endif
47996     vsnprintf(msg, 200, fmt, vargs);
47997     va_end(vargs);
47998     Py_FatalError(msg);
47999 }
48000 static CYTHON_INLINE int
48001 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
48002                                    PyThread_type_lock lock)
48003 {
48004     int result;
48005     PyThread_acquire_lock(lock, 1);
48006     result = (*acquisition_count)++;
48007     PyThread_release_lock(lock);
48008     return result;
48009 }
48010 static CYTHON_INLINE int
48011 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
48012                                    PyThread_type_lock lock)
48013 {
48014     int result;
48015     PyThread_acquire_lock(lock, 1);
48016     result = (*acquisition_count)--;
48017     PyThread_release_lock(lock);
48018     return result;
48019 }
48020 static CYTHON_INLINE void
48021 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
48022 {
48023     int first_time;
48024     struct __pyx_memoryview_obj *memview = memslice->memview;
48025     if (unlikely(!memview || (PyObject *) memview == Py_None))
48026         return;
48027     if (unlikely(__pyx_get_slice_count(memview) < 0))
48028         __pyx_fatalerror("Acquisition count is %d (line %d)",
48029                          __pyx_get_slice_count(memview), lineno);
48030     first_time = __pyx_add_acquisition_count(memview) == 0;
48031     if (unlikely(first_time)) {
48032         if (have_gil) {
48033             Py_INCREF((PyObject *) memview);
48034         } else {
48035             PyGILState_STATE _gilstate = PyGILState_Ensure();
48036             Py_INCREF((PyObject *) memview);
48037             PyGILState_Release(_gilstate);
48038         }
48039     }
48040 }
48041 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
48042                                              int have_gil, int lineno) {
48043     int last_time;
48044     struct __pyx_memoryview_obj *memview = memslice->memview;
48045     if (unlikely(!memview || (PyObject *) memview == Py_None)) {
48046         memslice->memview = NULL;
48047         return;
48048     }
48049     if (unlikely(__pyx_get_slice_count(memview) <= 0))
48050         __pyx_fatalerror("Acquisition count is %d (line %d)",
48051                          __pyx_get_slice_count(memview), lineno);
48052     last_time = __pyx_sub_acquisition_count(memview) == 1;
48053     memslice->data = NULL;
48054     if (unlikely(last_time)) {
48055         if (have_gil) {
48056             Py_CLEAR(memslice->memview);
48057         } else {
48058             PyGILState_STATE _gilstate = PyGILState_Ensure();
48059             Py_CLEAR(memslice->memview);
48060             PyGILState_Release(_gilstate);
48061         }
48062     } else {
48063         memslice->memview = NULL;
48064     }
48065 }
48066 
48067 /* CIntFromPy */
48068   static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
48069     const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
48070     const int is_unsigned = neg_one > const_zero;
48071 #if PY_MAJOR_VERSION < 3
48072     if (likely(PyInt_Check(x))) {
48073         if (sizeof(char) < sizeof(long)) {
48074             __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
48075         } else {
48076             long val = PyInt_AS_LONG(x);
48077             if (is_unsigned && unlikely(val < 0)) {
48078                 goto raise_neg_overflow;
48079             }
48080             return (char) val;
48081         }
48082     } else
48083 #endif
48084     if (likely(PyLong_Check(x))) {
48085         if (is_unsigned) {
48086 #if CYTHON_USE_PYLONG_INTERNALS
48087             const digit* digits = ((PyLongObject*)x)->ob_digit;
48088             switch (Py_SIZE(x)) {
48089                 case  0: return (char) 0;
48090                 case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
48091                 case 2:
48092                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
48093                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
48094                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48095                         } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
48096                             return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
48097                         }
48098                     }
48099                     break;
48100                 case 3:
48101                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
48102                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
48103                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48104                         } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
48105                             return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
48106                         }
48107                     }
48108                     break;
48109                 case 4:
48110                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
48111                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
48112                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48113                         } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
48114                             return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
48115                         }
48116                     }
48117                     break;
48118             }
48119 #endif
48120 #if CYTHON_COMPILING_IN_CPYTHON
48121             if (unlikely(Py_SIZE(x) < 0)) {
48122                 goto raise_neg_overflow;
48123             }
48124 #else
48125             {
48126                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
48127                 if (unlikely(result < 0))
48128                     return (char) -1;
48129                 if (unlikely(result == 1))
48130                     goto raise_neg_overflow;
48131             }
48132 #endif
48133             if (sizeof(char) <= sizeof(unsigned long)) {
48134                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
48135 #ifdef HAVE_LONG_LONG
48136             } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
48137                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
48138 #endif
48139             }
48140         } else {
48141 #if CYTHON_USE_PYLONG_INTERNALS
48142             const digit* digits = ((PyLongObject*)x)->ob_digit;
48143             switch (Py_SIZE(x)) {
48144                 case  0: return (char) 0;
48145                 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
48146                 case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
48147                 case -2:
48148                     if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
48149                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
48150                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48151                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
48152                             return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
48153                         }
48154                     }
48155                     break;
48156                 case 2:
48157                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
48158                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
48159                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48160                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
48161                             return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
48162                         }
48163                     }
48164                     break;
48165                 case -3:
48166                     if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
48167                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
48168                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48169                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
48170                             return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
48171                         }
48172                     }
48173                     break;
48174                 case 3:
48175                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
48176                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
48177                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48178                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
48179                             return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
48180                         }
48181                     }
48182                     break;
48183                 case -4:
48184                     if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
48185                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
48186                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48187                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
48188                             return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
48189                         }
48190                     }
48191                     break;
48192                 case 4:
48193                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
48194                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
48195                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48196                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
48197                             return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
48198                         }
48199                     }
48200                     break;
48201             }
48202 #endif
48203             if (sizeof(char) <= sizeof(long)) {
48204                 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
48205 #ifdef HAVE_LONG_LONG
48206             } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
48207                 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
48208 #endif
48209             }
48210         }
48211         {
48212 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
48213             PyErr_SetString(PyExc_RuntimeError,
48214                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
48215 #else
48216             char val;
48217             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
48218  #if PY_MAJOR_VERSION < 3
48219             if (likely(v) && !PyLong_Check(v)) {
48220                 PyObject *tmp = v;
48221                 v = PyNumber_Long(tmp);
48222                 Py_DECREF(tmp);
48223             }
48224  #endif
48225             if (likely(v)) {
48226                 int one = 1; int is_little = (int)*(unsigned char *)&one;
48227                 unsigned char *bytes = (unsigned char *)&val;
48228                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
48229                                               bytes, sizeof(val),
48230                                               is_little, !is_unsigned);
48231                 Py_DECREF(v);
48232                 if (likely(!ret))
48233                     return val;
48234             }
48235 #endif
48236             return (char) -1;
48237         }
48238     } else {
48239         char val;
48240         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
48241         if (!tmp) return (char) -1;
48242         val = __Pyx_PyInt_As_char(tmp);
48243         Py_DECREF(tmp);
48244         return val;
48245     }
48246 raise_overflow:
48247     PyErr_SetString(PyExc_OverflowError,
48248         "value too large to convert to char");
48249     return (char) -1;
48250 raise_neg_overflow:
48251     PyErr_SetString(PyExc_OverflowError,
48252         "can't convert negative value to char");
48253     return (char) -1;
48254 }
48255 
48256 /* FetchCommonType */
48257   static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
48258     PyObject* fake_module;
48259     PyTypeObject* cached_type = NULL;
48260     fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
48261     if (!fake_module) return NULL;
48262     Py_INCREF(fake_module);
48263     cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
48264     if (cached_type) {
48265         if (!PyType_Check((PyObject*)cached_type)) {
48266             PyErr_Format(PyExc_TypeError,
48267                 "Shared Cython type %.200s is not a type object",
48268                 type->tp_name);
48269             goto bad;
48270         }
48271         if (cached_type->tp_basicsize != type->tp_basicsize) {
48272             PyErr_Format(PyExc_TypeError,
48273                 "Shared Cython type %.200s has the wrong size, try recompiling",
48274                 type->tp_name);
48275             goto bad;
48276         }
48277     } else {
48278         if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
48279         PyErr_Clear();
48280         if (PyType_Ready(type) < 0) goto bad;
48281         if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
48282             goto bad;
48283         Py_INCREF(type);
48284         cached_type = type;
48285     }
48286 done:
48287     Py_DECREF(fake_module);
48288     return cached_type;
48289 bad:
48290     Py_XDECREF(cached_type);
48291     cached_type = NULL;
48292     goto done;
48293 }
48294 
48295 /* CoroutineBase */
48296   #include <structmember.h>
48297 #include <frameobject.h>
48298 #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
48299 static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
48300     PyObject *et, *ev, *tb;
48301     PyObject *value = NULL;
48302     __Pyx_ErrFetch(&et, &ev, &tb);
48303     if (!et) {
48304         Py_XDECREF(tb);
48305         Py_XDECREF(ev);
48306         Py_INCREF(Py_None);
48307         *pvalue = Py_None;
48308         return 0;
48309     }
48310     if (likely(et == PyExc_StopIteration)) {
48311         if (!ev) {
48312             Py_INCREF(Py_None);
48313             value = Py_None;
48314         }
48315 #if PY_VERSION_HEX >= 0x030300A0
48316         else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
48317             value = ((PyStopIterationObject *)ev)->value;
48318             Py_INCREF(value);
48319             Py_DECREF(ev);
48320         }
48321 #endif
48322         else if (unlikely(PyTuple_Check(ev))) {
48323             if (PyTuple_GET_SIZE(ev) >= 1) {
48324 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
48325                 value = PyTuple_GET_ITEM(ev, 0);
48326                 Py_INCREF(value);
48327 #else
48328                 value = PySequence_ITEM(ev, 0);
48329 #endif
48330             } else {
48331                 Py_INCREF(Py_None);
48332                 value = Py_None;
48333             }
48334             Py_DECREF(ev);
48335         }
48336         else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
48337             value = ev;
48338         }
48339         if (likely(value)) {
48340             Py_XDECREF(tb);
48341             Py_DECREF(et);
48342             *pvalue = value;
48343             return 0;
48344         }
48345     } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
48346         __Pyx_ErrRestore(et, ev, tb);
48347         return -1;
48348     }
48349     PyErr_NormalizeException(&et, &ev, &tb);
48350     if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
48351         __Pyx_ErrRestore(et, ev, tb);
48352         return -1;
48353     }
48354     Py_XDECREF(tb);
48355     Py_DECREF(et);
48356 #if PY_VERSION_HEX >= 0x030300A0
48357     value = ((PyStopIterationObject *)ev)->value;
48358     Py_INCREF(value);
48359     Py_DECREF(ev);
48360 #else
48361     {
48362         PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
48363         Py_DECREF(ev);
48364         if (likely(args)) {
48365             value = PySequence_GetItem(args, 0);
48366             Py_DECREF(args);
48367         }
48368         if (unlikely(!value)) {
48369             __Pyx_ErrRestore(NULL, NULL, NULL);
48370             Py_INCREF(Py_None);
48371             value = Py_None;
48372         }
48373     }
48374 #endif
48375     *pvalue = value;
48376     return 0;
48377 }
48378 static CYTHON_INLINE
48379 void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
48380     PyObject *t, *v, *tb;
48381     t = exc_state->exc_type;
48382     v = exc_state->exc_value;
48383     tb = exc_state->exc_traceback;
48384     exc_state->exc_type = NULL;
48385     exc_state->exc_value = NULL;
48386     exc_state->exc_traceback = NULL;
48387     Py_XDECREF(t);
48388     Py_XDECREF(v);
48389     Py_XDECREF(tb);
48390 }
48391 #define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
48392 static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
48393     const char *msg;
48394     if ((0)) {
48395     #ifdef __Pyx_Coroutine_USED
48396     } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
48397         msg = "coroutine already executing";
48398     #endif
48399     #ifdef __Pyx_AsyncGen_USED
48400     } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
48401         msg = "async generator already executing";
48402     #endif
48403     } else {
48404         msg = "generator already executing";
48405     }
48406     PyErr_SetString(PyExc_ValueError, msg);
48407 }
48408 #define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
48409 static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
48410     const char *msg;
48411     if ((0)) {
48412     #ifdef __Pyx_Coroutine_USED
48413     } else if (__Pyx_Coroutine_Check(gen)) {
48414         msg = "can't send non-None value to a just-started coroutine";
48415     #endif
48416     #ifdef __Pyx_AsyncGen_USED
48417     } else if (__Pyx_AsyncGen_CheckExact(gen)) {
48418         msg = "can't send non-None value to a just-started async generator";
48419     #endif
48420     } else {
48421         msg = "can't send non-None value to a just-started generator";
48422     }
48423     PyErr_SetString(PyExc_TypeError, msg);
48424 }
48425 #define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
48426 static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
48427     #ifdef __Pyx_Coroutine_USED
48428     if (!closing && __Pyx_Coroutine_Check(gen)) {
48429         PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
48430     } else
48431     #endif
48432     if (value) {
48433         #ifdef __Pyx_AsyncGen_USED
48434         if (__Pyx_AsyncGen_CheckExact(gen))
48435             PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
48436         else
48437         #endif
48438         PyErr_SetNone(PyExc_StopIteration);
48439     }
48440 }
48441 static
48442 PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
48443     __Pyx_PyThreadState_declare
48444     PyThreadState *tstate;
48445     __Pyx_ExcInfoStruct *exc_state;
48446     PyObject *retval;
48447     assert(!self->is_running);
48448     if (unlikely(self->resume_label == 0)) {
48449         if (unlikely(value && value != Py_None)) {
48450             return __Pyx_Coroutine_NotStartedError((PyObject*)self);
48451         }
48452     }
48453     if (unlikely(self->resume_label == -1)) {
48454         return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
48455     }
48456 #if CYTHON_FAST_THREAD_STATE
48457     __Pyx_PyThreadState_assign
48458     tstate = __pyx_tstate;
48459 #else
48460     tstate = __Pyx_PyThreadState_Current;
48461 #endif
48462     exc_state = &self->gi_exc_state;
48463     if (exc_state->exc_type) {
48464         #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
48465         #else
48466         if (exc_state->exc_traceback) {
48467             PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
48468             PyFrameObject *f = tb->tb_frame;
48469             Py_XINCREF(tstate->frame);
48470             assert(f->f_back == NULL);
48471             f->f_back = tstate->frame;
48472         }
48473         #endif
48474     }
48475 #if CYTHON_USE_EXC_INFO_STACK
48476     exc_state->previous_item = tstate->exc_info;
48477     tstate->exc_info = exc_state;
48478 #else
48479     if (exc_state->exc_type) {
48480         __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
48481     } else {
48482         __Pyx_Coroutine_ExceptionClear(exc_state);
48483         __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
48484     }
48485 #endif
48486     self->is_running = 1;
48487     retval = self->body((PyObject *) self, tstate, value);
48488     self->is_running = 0;
48489 #if CYTHON_USE_EXC_INFO_STACK
48490     exc_state = &self->gi_exc_state;
48491     tstate->exc_info = exc_state->previous_item;
48492     exc_state->previous_item = NULL;
48493     __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
48494 #endif
48495     return retval;
48496 }
48497 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
48498     PyObject *exc_tb = exc_state->exc_traceback;
48499     if (likely(exc_tb)) {
48500 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
48501 #else
48502         PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
48503         PyFrameObject *f = tb->tb_frame;
48504         Py_CLEAR(f->f_back);
48505 #endif
48506     }
48507 }
48508 static CYTHON_INLINE
48509 PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
48510     if (unlikely(!retval)) {
48511         __Pyx_PyThreadState_declare
48512         __Pyx_PyThreadState_assign
48513         if (!__Pyx_PyErr_Occurred()) {
48514             PyObject *exc = PyExc_StopIteration;
48515             #ifdef __Pyx_AsyncGen_USED
48516             if (__Pyx_AsyncGen_CheckExact(gen))
48517                 exc = __Pyx_PyExc_StopAsyncIteration;
48518             #endif
48519             __Pyx_PyErr_SetNone(exc);
48520         }
48521     }
48522     return retval;
48523 }
48524 static CYTHON_INLINE
48525 PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
48526     PyObject *ret;
48527     PyObject *val = NULL;
48528     __Pyx_Coroutine_Undelegate(gen);
48529     __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
48530     ret = __Pyx_Coroutine_SendEx(gen, val, 0);
48531     Py_XDECREF(val);
48532     return ret;
48533 }
48534 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
48535     PyObject *retval;
48536     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
48537     PyObject *yf = gen->yieldfrom;
48538     if (unlikely(gen->is_running))
48539         return __Pyx_Coroutine_AlreadyRunningError(gen);
48540     if (yf) {
48541         PyObject *ret;
48542         gen->is_running = 1;
48543         #ifdef __Pyx_Generator_USED
48544         if (__Pyx_Generator_CheckExact(yf)) {
48545             ret = __Pyx_Coroutine_Send(yf, value);
48546         } else
48547         #endif
48548         #ifdef __Pyx_Coroutine_USED
48549         if (__Pyx_Coroutine_Check(yf)) {
48550             ret = __Pyx_Coroutine_Send(yf, value);
48551         } else
48552         #endif
48553         #ifdef __Pyx_AsyncGen_USED
48554         if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
48555             ret = __Pyx_async_gen_asend_send(yf, value);
48556         } else
48557         #endif
48558         #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
48559         if (PyGen_CheckExact(yf)) {
48560             ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
48561         } else
48562         #endif
48563         #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
48564         if (PyCoro_CheckExact(yf)) {
48565             ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
48566         } else
48567         #endif
48568         {
48569             if (value == Py_None)
48570                 ret = Py_TYPE(yf)->tp_iternext(yf);
48571             else
48572                 ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
48573         }
48574         gen->is_running = 0;
48575         if (likely(ret)) {
48576             return ret;
48577         }
48578         retval = __Pyx_Coroutine_FinishDelegation(gen);
48579     } else {
48580         retval = __Pyx_Coroutine_SendEx(gen, value, 0);
48581     }
48582     return __Pyx_Coroutine_MethodReturn(self, retval);
48583 }
48584 static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
48585     PyObject *retval = NULL;
48586     int err = 0;
48587     #ifdef __Pyx_Generator_USED
48588     if (__Pyx_Generator_CheckExact(yf)) {
48589         retval = __Pyx_Coroutine_Close(yf);
48590         if (!retval)
48591             return -1;
48592     } else
48593     #endif
48594     #ifdef __Pyx_Coroutine_USED
48595     if (__Pyx_Coroutine_Check(yf)) {
48596         retval = __Pyx_Coroutine_Close(yf);
48597         if (!retval)
48598             return -1;
48599     } else
48600     if (__Pyx_CoroutineAwait_CheckExact(yf)) {
48601         retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
48602         if (!retval)
48603             return -1;
48604     } else
48605     #endif
48606     #ifdef __Pyx_AsyncGen_USED
48607     if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
48608         retval = __Pyx_async_gen_asend_close(yf, NULL);
48609     } else
48610     if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
48611         retval = __Pyx_async_gen_athrow_close(yf, NULL);
48612     } else
48613     #endif
48614     {
48615         PyObject *meth;
48616         gen->is_running = 1;
48617         meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
48618         if (unlikely(!meth)) {
48619             if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
48620                 PyErr_WriteUnraisable(yf);
48621             }
48622             PyErr_Clear();
48623         } else {
48624             retval = PyObject_CallFunction(meth, NULL);
48625             Py_DECREF(meth);
48626             if (!retval)
48627                 err = -1;
48628         }
48629         gen->is_running = 0;
48630     }
48631     Py_XDECREF(retval);
48632     return err;
48633 }
48634 static PyObject *__Pyx_Generator_Next(PyObject *self) {
48635     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
48636     PyObject *yf = gen->yieldfrom;
48637     if (unlikely(gen->is_running))
48638         return __Pyx_Coroutine_AlreadyRunningError(gen);
48639     if (yf) {
48640         PyObject *ret;
48641         gen->is_running = 1;
48642         #ifdef __Pyx_Generator_USED
48643         if (__Pyx_Generator_CheckExact(yf)) {
48644             ret = __Pyx_Generator_Next(yf);
48645         } else
48646         #endif
48647         #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
48648         if (PyGen_CheckExact(yf)) {
48649             ret = _PyGen_Send((PyGenObject*)yf, NULL);
48650         } else
48651         #endif
48652         #ifdef __Pyx_Coroutine_USED
48653         if (__Pyx_Coroutine_Check(yf)) {
48654             ret = __Pyx_Coroutine_Send(yf, Py_None);
48655         } else
48656         #endif
48657             ret = Py_TYPE(yf)->tp_iternext(yf);
48658         gen->is_running = 0;
48659         if (likely(ret)) {
48660             return ret;
48661         }
48662         return __Pyx_Coroutine_FinishDelegation(gen);
48663     }
48664     return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
48665 }
48666 static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
48667     return __Pyx_Coroutine_Close(self);
48668 }
48669 static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
48670     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
48671     PyObject *retval, *raised_exception;
48672     PyObject *yf = gen->yieldfrom;
48673     int err = 0;
48674     if (unlikely(gen->is_running))
48675         return __Pyx_Coroutine_AlreadyRunningError(gen);
48676     if (yf) {
48677         Py_INCREF(yf);
48678         err = __Pyx_Coroutine_CloseIter(gen, yf);
48679         __Pyx_Coroutine_Undelegate(gen);
48680         Py_DECREF(yf);
48681     }
48682     if (err == 0)
48683         PyErr_SetNone(PyExc_GeneratorExit);
48684     retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
48685     if (unlikely(retval)) {
48686         const char *msg;
48687         Py_DECREF(retval);
48688         if ((0)) {
48689         #ifdef __Pyx_Coroutine_USED
48690         } else if (__Pyx_Coroutine_Check(self)) {
48691             msg = "coroutine ignored GeneratorExit";
48692         #endif
48693         #ifdef __Pyx_AsyncGen_USED
48694         } else if (__Pyx_AsyncGen_CheckExact(self)) {
48695 #if PY_VERSION_HEX < 0x03060000
48696             msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
48697 #else
48698             msg = "async generator ignored GeneratorExit";
48699 #endif
48700         #endif
48701         } else {
48702             msg = "generator ignored GeneratorExit";
48703         }
48704         PyErr_SetString(PyExc_RuntimeError, msg);
48705         return NULL;
48706     }
48707     raised_exception = PyErr_Occurred();
48708     if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
48709         if (raised_exception) PyErr_Clear();
48710         Py_INCREF(Py_None);
48711         return Py_None;
48712     }
48713     return NULL;
48714 }
48715 static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
48716                                         PyObject *args, int close_on_genexit) {
48717     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
48718     PyObject *yf = gen->yieldfrom;
48719     if (unlikely(gen->is_running))
48720         return __Pyx_Coroutine_AlreadyRunningError(gen);
48721     if (yf) {
48722         PyObject *ret;
48723         Py_INCREF(yf);
48724         if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
48725             int err = __Pyx_Coroutine_CloseIter(gen, yf);
48726             Py_DECREF(yf);
48727             __Pyx_Coroutine_Undelegate(gen);
48728             if (err < 0)
48729                 return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
48730             goto throw_here;
48731         }
48732         gen->is_running = 1;
48733         if (0
48734         #ifdef __Pyx_Generator_USED
48735             || __Pyx_Generator_CheckExact(yf)
48736         #endif
48737         #ifdef __Pyx_Coroutine_USED
48738             || __Pyx_Coroutine_Check(yf)
48739         #endif
48740             ) {
48741             ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
48742         #ifdef __Pyx_Coroutine_USED
48743         } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
48744             ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
48745         #endif
48746         } else {
48747             PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
48748             if (unlikely(!meth)) {
48749                 Py_DECREF(yf);
48750                 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
48751                     gen->is_running = 0;
48752                     return NULL;
48753                 }
48754                 PyErr_Clear();
48755                 __Pyx_Coroutine_Undelegate(gen);
48756                 gen->is_running = 0;
48757                 goto throw_here;
48758             }
48759             if (likely(args)) {
48760                 ret = PyObject_CallObject(meth, args);
48761             } else {
48762                 ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
48763             }
48764             Py_DECREF(meth);
48765         }
48766         gen->is_running = 0;
48767         Py_DECREF(yf);
48768         if (!ret) {
48769             ret = __Pyx_Coroutine_FinishDelegation(gen);
48770         }
48771         return __Pyx_Coroutine_MethodReturn(self, ret);
48772     }
48773 throw_here:
48774     __Pyx_Raise(typ, val, tb, NULL);
48775     return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
48776 }
48777 static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
48778     PyObject *typ;
48779     PyObject *val = NULL;
48780     PyObject *tb = NULL;
48781     if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
48782         return NULL;
48783     return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
48784 }
48785 static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
48786     Py_VISIT(exc_state->exc_type);
48787     Py_VISIT(exc_state->exc_value);
48788     Py_VISIT(exc_state->exc_traceback);
48789     return 0;
48790 }
48791 static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
48792     Py_VISIT(gen->closure);
48793     Py_VISIT(gen->classobj);
48794     Py_VISIT(gen->yieldfrom);
48795     return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
48796 }
48797 static int __Pyx_Coroutine_clear(PyObject *self) {
48798     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
48799     Py_CLEAR(gen->closure);
48800     Py_CLEAR(gen->classobj);
48801     Py_CLEAR(gen->yieldfrom);
48802     __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
48803 #ifdef __Pyx_AsyncGen_USED
48804     if (__Pyx_AsyncGen_CheckExact(self)) {
48805         Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
48806     }
48807 #endif
48808     Py_CLEAR(gen->gi_code);
48809     Py_CLEAR(gen->gi_name);
48810     Py_CLEAR(gen->gi_qualname);
48811     Py_CLEAR(gen->gi_modulename);
48812     return 0;
48813 }
48814 static void __Pyx_Coroutine_dealloc(PyObject *self) {
48815     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
48816     PyObject_GC_UnTrack(gen);
48817     if (gen->gi_weakreflist != NULL)
48818         PyObject_ClearWeakRefs(self);
48819     if (gen->resume_label >= 0) {
48820         PyObject_GC_Track(self);
48821 #if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
48822         if (PyObject_CallFinalizerFromDealloc(self))
48823 #else
48824         Py_TYPE(gen)->tp_del(self);
48825         if (self->ob_refcnt > 0)
48826 #endif
48827         {
48828             return;
48829         }
48830         PyObject_GC_UnTrack(self);
48831     }
48832 #ifdef __Pyx_AsyncGen_USED
48833     if (__Pyx_AsyncGen_CheckExact(self)) {
48834         /* We have to handle this case for asynchronous generators
48835            right here, because this code has to be between UNTRACK
48836            and GC_Del. */
48837         Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
48838     }
48839 #endif
48840     __Pyx_Coroutine_clear(self);
48841     PyObject_GC_Del(gen);
48842 }
48843 static void __Pyx_Coroutine_del(PyObject *self) {
48844     PyObject *error_type, *error_value, *error_traceback;
48845     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
48846     __Pyx_PyThreadState_declare
48847     if (gen->resume_label < 0) {
48848         return;
48849     }
48850 #if !CYTHON_USE_TP_FINALIZE
48851     assert(self->ob_refcnt == 0);
48852     self->ob_refcnt = 1;
48853 #endif
48854     __Pyx_PyThreadState_assign
48855     __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
48856 #ifdef __Pyx_AsyncGen_USED
48857     if (__Pyx_AsyncGen_CheckExact(self)) {
48858         __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
48859         PyObject *finalizer = agen->ag_finalizer;
48860         if (finalizer && !agen->ag_closed) {
48861             PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
48862             if (unlikely(!res)) {
48863                 PyErr_WriteUnraisable(self);
48864             } else {
48865                 Py_DECREF(res);
48866             }
48867             __Pyx_ErrRestore(error_type, error_value, error_traceback);
48868             return;
48869         }
48870     }
48871 #endif
48872     if (unlikely(gen->resume_label == 0 && !error_value)) {
48873 #ifdef __Pyx_Coroutine_USED
48874 #ifdef __Pyx_Generator_USED
48875     if (!__Pyx_Generator_CheckExact(self))
48876 #endif
48877         {
48878         PyObject_GC_UnTrack(self);
48879 #if PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
48880         if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
48881             PyErr_WriteUnraisable(self);
48882 #else
48883         {PyObject *msg;
48884         char *cmsg;
48885         #if CYTHON_COMPILING_IN_PYPY
48886         msg = NULL;
48887         cmsg = (char*) "coroutine was never awaited";
48888         #else
48889         char *cname;
48890         PyObject *qualname;
48891         qualname = gen->gi_qualname;
48892         cname = PyString_AS_STRING(qualname);
48893         msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
48894         if (unlikely(!msg)) {
48895             PyErr_Clear();
48896             cmsg = (char*) "coroutine was never awaited";
48897         } else {
48898             cmsg = PyString_AS_STRING(msg);
48899         }
48900         #endif
48901         if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
48902             PyErr_WriteUnraisable(self);
48903         Py_XDECREF(msg);}
48904 #endif
48905         PyObject_GC_Track(self);
48906         }
48907 #endif
48908     } else {
48909         PyObject *res = __Pyx_Coroutine_Close(self);
48910         if (unlikely(!res)) {
48911             if (PyErr_Occurred())
48912                 PyErr_WriteUnraisable(self);
48913         } else {
48914             Py_DECREF(res);
48915         }
48916     }
48917     __Pyx_ErrRestore(error_type, error_value, error_traceback);
48918 #if !CYTHON_USE_TP_FINALIZE
48919     assert(self->ob_refcnt > 0);
48920     if (--self->ob_refcnt == 0) {
48921         return;
48922     }
48923     {
48924         Py_ssize_t refcnt = self->ob_refcnt;
48925         _Py_NewReference(self);
48926         self->ob_refcnt = refcnt;
48927     }
48928 #if CYTHON_COMPILING_IN_CPYTHON
48929     assert(PyType_IS_GC(self->ob_type) &&
48930            _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
48931     _Py_DEC_REFTOTAL;
48932 #endif
48933 #ifdef COUNT_ALLOCS
48934     --Py_TYPE(self)->tp_frees;
48935     --Py_TYPE(self)->tp_allocs;
48936 #endif
48937 #endif
48938 }
48939 static PyObject *
48940 __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
48941 {
48942     PyObject *name = self->gi_name;
48943     if (unlikely(!name)) name = Py_None;
48944     Py_INCREF(name);
48945     return name;
48946 }
48947 static int
48948 __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
48949 {
48950     PyObject *tmp;
48951 #if PY_MAJOR_VERSION >= 3
48952     if (unlikely(value == NULL || !PyUnicode_Check(value)))
48953 #else
48954     if (unlikely(value == NULL || !PyString_Check(value)))
48955 #endif
48956     {
48957         PyErr_SetString(PyExc_TypeError,
48958                         "__name__ must be set to a string object");
48959         return -1;
48960     }
48961     tmp = self->gi_name;
48962     Py_INCREF(value);
48963     self->gi_name = value;
48964     Py_XDECREF(tmp);
48965     return 0;
48966 }
48967 static PyObject *
48968 __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
48969 {
48970     PyObject *name = self->gi_qualname;
48971     if (unlikely(!name)) name = Py_None;
48972     Py_INCREF(name);
48973     return name;
48974 }
48975 static int
48976 __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
48977 {
48978     PyObject *tmp;
48979 #if PY_MAJOR_VERSION >= 3
48980     if (unlikely(value == NULL || !PyUnicode_Check(value)))
48981 #else
48982     if (unlikely(value == NULL || !PyString_Check(value)))
48983 #endif
48984     {
48985         PyErr_SetString(PyExc_TypeError,
48986                         "__qualname__ must be set to a string object");
48987         return -1;
48988     }
48989     tmp = self->gi_qualname;
48990     Py_INCREF(value);
48991     self->gi_qualname = value;
48992     Py_XDECREF(tmp);
48993     return 0;
48994 }
48995 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
48996             PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
48997             PyObject *name, PyObject *qualname, PyObject *module_name) {
48998     __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
48999     if (unlikely(!gen))
49000         return NULL;
49001     return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
49002 }
49003 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
49004             __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
49005             PyObject *name, PyObject *qualname, PyObject *module_name) {
49006     gen->body = body;
49007     gen->closure = closure;
49008     Py_XINCREF(closure);
49009     gen->is_running = 0;
49010     gen->resume_label = 0;
49011     gen->classobj = NULL;
49012     gen->yieldfrom = NULL;
49013     gen->gi_exc_state.exc_type = NULL;
49014     gen->gi_exc_state.exc_value = NULL;
49015     gen->gi_exc_state.exc_traceback = NULL;
49016 #if CYTHON_USE_EXC_INFO_STACK
49017     gen->gi_exc_state.previous_item = NULL;
49018 #endif
49019     gen->gi_weakreflist = NULL;
49020     Py_XINCREF(qualname);
49021     gen->gi_qualname = qualname;
49022     Py_XINCREF(name);
49023     gen->gi_name = name;
49024     Py_XINCREF(module_name);
49025     gen->gi_modulename = module_name;
49026     Py_XINCREF(code);
49027     gen->gi_code = code;
49028     PyObject_GC_Track(gen);
49029     return gen;
49030 }
49031 
49032 /* PatchModuleWithCoroutine */
49033   static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
49034 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
49035     int result;
49036     PyObject *globals, *result_obj;
49037     globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
49038     result = PyDict_SetItemString(globals, "_cython_coroutine_type",
49039     #ifdef __Pyx_Coroutine_USED
49040         (PyObject*)__pyx_CoroutineType);
49041     #else
49042         Py_None);
49043     #endif
49044     if (unlikely(result < 0)) goto ignore;
49045     result = PyDict_SetItemString(globals, "_cython_generator_type",
49046     #ifdef __Pyx_Generator_USED
49047         (PyObject*)__pyx_GeneratorType);
49048     #else
49049         Py_None);
49050     #endif
49051     if (unlikely(result < 0)) goto ignore;
49052     if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
49053     if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
49054     result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
49055     if (unlikely(!result_obj)) goto ignore;
49056     Py_DECREF(result_obj);
49057     Py_DECREF(globals);
49058     return module;
49059 ignore:
49060     Py_XDECREF(globals);
49061     PyErr_WriteUnraisable(module);
49062     if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
49063         Py_DECREF(module);
49064         module = NULL;
49065     }
49066 #else
49067     py_code++;
49068 #endif
49069     return module;
49070 }
49071 
49072 /* PatchGeneratorABC */
49073   #ifndef CYTHON_REGISTER_ABCS
49074 #define CYTHON_REGISTER_ABCS 1
49075 #endif
49076 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
49077 static PyObject* __Pyx_patch_abc_module(PyObject *module);
49078 static PyObject* __Pyx_patch_abc_module(PyObject *module) {
49079     module = __Pyx_Coroutine_patch_module(
49080         module, ""
49081 "if _cython_generator_type is not None:\n"
49082 "    try: Generator = _module.Generator\n"
49083 "    except AttributeError: pass\n"
49084 "    else: Generator.register(_cython_generator_type)\n"
49085 "if _cython_coroutine_type is not None:\n"
49086 "    try: Coroutine = _module.Coroutine\n"
49087 "    except AttributeError: pass\n"
49088 "    else: Coroutine.register(_cython_coroutine_type)\n"
49089     );
49090     return module;
49091 }
49092 #endif
49093 static int __Pyx_patch_abc(void) {
49094 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
49095     static int abc_patched = 0;
49096     if (CYTHON_REGISTER_ABCS && !abc_patched) {
49097         PyObject *module;
49098         module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
49099         if (!module) {
49100             PyErr_WriteUnraisable(NULL);
49101             if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
49102                     ((PY_MAJOR_VERSION >= 3) ?
49103                         "Cython module failed to register with collections.abc module" :
49104                         "Cython module failed to register with collections module"), 1) < 0)) {
49105                 return -1;
49106             }
49107         } else {
49108             module = __Pyx_patch_abc_module(module);
49109             abc_patched = 1;
49110             if (unlikely(!module))
49111                 return -1;
49112             Py_DECREF(module);
49113         }
49114         module = PyImport_ImportModule("backports_abc");
49115         if (module) {
49116             module = __Pyx_patch_abc_module(module);
49117             Py_XDECREF(module);
49118         }
49119         if (!module) {
49120             PyErr_Clear();
49121         }
49122     }
49123 #else
49124     if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
49125 #endif
49126     return 0;
49127 }
49128 
49129 /* Generator */
49130   static PyMethodDef __pyx_Generator_methods[] = {
49131     {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
49132      (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
49133     {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
49134      (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
49135     {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
49136      (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
49137     {0, 0, 0, 0}
49138 };
49139 static PyMemberDef __pyx_Generator_memberlist[] = {
49140     {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
49141     {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
49142      (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
49143     {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
49144     {0, 0, 0, 0, 0}
49145 };
49146 static PyGetSetDef __pyx_Generator_getsets[] = {
49147     {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
49148      (char*) PyDoc_STR("name of the generator"), 0},
49149     {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
49150      (char*) PyDoc_STR("qualified name of the generator"), 0},
49151     {0, 0, 0, 0, 0}
49152 };
49153 static PyTypeObject __pyx_GeneratorType_type = {
49154     PyVarObject_HEAD_INIT(0, 0)
49155     "generator",
49156     sizeof(__pyx_CoroutineObject),
49157     0,
49158     (destructor) __Pyx_Coroutine_dealloc,
49159     0,
49160     0,
49161     0,
49162     0,
49163     0,
49164     0,
49165     0,
49166     0,
49167     0,
49168     0,
49169     0,
49170     0,
49171     0,
49172     0,
49173     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
49174     0,
49175     (traverseproc) __Pyx_Coroutine_traverse,
49176     0,
49177     0,
49178     offsetof(__pyx_CoroutineObject, gi_weakreflist),
49179     0,
49180     (iternextfunc) __Pyx_Generator_Next,
49181     __pyx_Generator_methods,
49182     __pyx_Generator_memberlist,
49183     __pyx_Generator_getsets,
49184     0,
49185     0,
49186     0,
49187     0,
49188     0,
49189     0,
49190     0,
49191     0,
49192     0,
49193     0,
49194     0,
49195     0,
49196     0,
49197     0,
49198     0,
49199 #if CYTHON_USE_TP_FINALIZE
49200     0,
49201 #else
49202     __Pyx_Coroutine_del,
49203 #endif
49204     0,
49205 #if CYTHON_USE_TP_FINALIZE
49206     __Pyx_Coroutine_del,
49207 #elif PY_VERSION_HEX >= 0x030400a1
49208     0,
49209 #endif
49210 #if PY_VERSION_HEX >= 0x030800b1
49211     0,
49212 #endif
49213 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
49214     0,
49215 #endif
49216 };
49217 static int __pyx_Generator_init(void) {
49218     __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
49219     __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
49220     __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
49221     if (unlikely(!__pyx_GeneratorType)) {
49222         return -1;
49223     }
49224     return 0;
49225 }
49226 
49227 /* CheckBinaryVersion */
49228   static int __Pyx_check_binary_version(void) {
49229     char ctversion[4], rtversion[4];
49230     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
49231     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
49232     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
49233         char message[200];
49234         PyOS_snprintf(message, sizeof(message),
49235                       "compiletime version %s of module '%.100s' "
49236                       "does not match runtime version %s",
49237                       ctversion, __Pyx_MODULE_NAME, rtversion);
49238         return PyErr_WarnEx(NULL, message, 1);
49239     }
49240     return 0;
49241 }
49242 
49243 /* FunctionExport */
49244   static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
49245     PyObject *d = 0;
49246     PyObject *cobj = 0;
49247     union {
49248         void (*fp)(void);
49249         void *p;
49250     } tmp;
49251     d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
49252     if (!d) {
49253         PyErr_Clear();
49254         d = PyDict_New();
49255         if (!d)
49256             goto bad;
49257         Py_INCREF(d);
49258         if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
49259             goto bad;
49260     }
49261     tmp.fp = f;
49262 #if PY_VERSION_HEX >= 0x02070000
49263     cobj = PyCapsule_New(tmp.p, sig, 0);
49264 #else
49265     cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
49266 #endif
49267     if (!cobj)
49268         goto bad;
49269     if (PyDict_SetItemString(d, name, cobj) < 0)
49270         goto bad;
49271     Py_DECREF(cobj);
49272     Py_DECREF(d);
49273     return 0;
49274 bad:
49275     Py_XDECREF(cobj);
49276     Py_XDECREF(d);
49277     return -1;
49278 }
49279 
49280 /* FunctionImport */
49281   #ifndef __PYX_HAVE_RT_ImportFunction
49282 #define __PYX_HAVE_RT_ImportFunction
49283 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
49284     PyObject *d = 0;
49285     PyObject *cobj = 0;
49286     union {
49287         void (*fp)(void);
49288         void *p;
49289     } tmp;
49290     d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
49291     if (!d)
49292         goto bad;
49293     cobj = PyDict_GetItemString(d, funcname);
49294     if (!cobj) {
49295         PyErr_Format(PyExc_ImportError,
49296             "%.200s does not export expected C function %.200s",
49297                 PyModule_GetName(module), funcname);
49298         goto bad;
49299     }
49300 #if PY_VERSION_HEX >= 0x02070000
49301     if (!PyCapsule_IsValid(cobj, sig)) {
49302         PyErr_Format(PyExc_TypeError,
49303             "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
49304              PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
49305         goto bad;
49306     }
49307     tmp.p = PyCapsule_GetPointer(cobj, sig);
49308 #else
49309     {const char *desc, *s1, *s2;
49310     desc = (const char *)PyCObject_GetDesc(cobj);
49311     if (!desc)
49312         goto bad;
49313     s1 = desc; s2 = sig;
49314     while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
49315     if (*s1 != *s2) {
49316         PyErr_Format(PyExc_TypeError,
49317             "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
49318              PyModule_GetName(module), funcname, sig, desc);
49319         goto bad;
49320     }
49321     tmp.p = PyCObject_AsVoidPtr(cobj);}
49322 #endif
49323     *f = tmp.fp;
49324     if (!(*f))
49325         goto bad;
49326     Py_DECREF(d);
49327     return 0;
49328 bad:
49329     Py_XDECREF(d);
49330     return -1;
49331 }
49332 #endif
49333 
49334 /* InitStrings */
49335   static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
49336     while (t->p) {
49337         #if PY_MAJOR_VERSION < 3
49338         if (t->is_unicode) {
49339             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
49340         } else if (t->intern) {
49341             *t->p = PyString_InternFromString(t->s);
49342         } else {
49343             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
49344         }
49345         #else
49346         if (t->is_unicode | t->is_str) {
49347             if (t->intern) {
49348                 *t->p = PyUnicode_InternFromString(t->s);
49349             } else if (t->encoding) {
49350                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
49351             } else {
49352                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
49353             }
49354         } else {
49355             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
49356         }
49357         #endif
49358         if (!*t->p)
49359             return -1;
49360         if (PyObject_Hash(*t->p) == -1)
49361             return -1;
49362         ++t;
49363     }
49364     return 0;
49365 }
49366 
49367 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
49368     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
49369 }
49370 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
49371     Py_ssize_t ignore;
49372     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
49373 }
49374 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
49375 #if !CYTHON_PEP393_ENABLED
49376 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
49377     char* defenc_c;
49378     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
49379     if (!defenc) return NULL;
49380     defenc_c = PyBytes_AS_STRING(defenc);
49381 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
49382     {
49383         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
49384         char* c;
49385         for (c = defenc_c; c < end; c++) {
49386             if ((unsigned char) (*c) >= 128) {
49387                 PyUnicode_AsASCIIString(o);
49388                 return NULL;
49389             }
49390         }
49391     }
49392 #endif
49393     *length = PyBytes_GET_SIZE(defenc);
49394     return defenc_c;
49395 }
49396 #else
49397 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
49398     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
49399 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
49400     if (likely(PyUnicode_IS_ASCII(o))) {
49401         *length = PyUnicode_GET_LENGTH(o);
49402         return PyUnicode_AsUTF8(o);
49403     } else {
49404         PyUnicode_AsASCIIString(o);
49405         return NULL;
49406     }
49407 #else
49408     return PyUnicode_AsUTF8AndSize(o, length);
49409 #endif
49410 }
49411 #endif
49412 #endif
49413 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
49414 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
49415     if (
49416 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
49417             __Pyx_sys_getdefaultencoding_not_ascii &&
49418 #endif
49419             PyUnicode_Check(o)) {
49420         return __Pyx_PyUnicode_AsStringAndSize(o, length);
49421     } else
49422 #endif
49423 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
49424     if (PyByteArray_Check(o)) {
49425         *length = PyByteArray_GET_SIZE(o);
49426         return PyByteArray_AS_STRING(o);
49427     } else
49428 #endif
49429     {
49430         char* result;
49431         int r = PyBytes_AsStringAndSize(o, &result, length);
49432         if (unlikely(r < 0)) {
49433             return NULL;
49434         } else {
49435             return result;
49436         }
49437     }
49438 }
49439 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
49440    int is_true = x == Py_True;
49441    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
49442    else return PyObject_IsTrue(x);
49443 }
49444 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
49445     int retval;
49446     if (unlikely(!x)) return -1;
49447     retval = __Pyx_PyObject_IsTrue(x);
49448     Py_DECREF(x);
49449     return retval;
49450 }
49451 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
49452 #if PY_MAJOR_VERSION >= 3
49453     if (PyLong_Check(result)) {
49454         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
49455                 "__int__ returned non-int (type %.200s).  "
49456                 "The ability to return an instance of a strict subclass of int "
49457                 "is deprecated, and may be removed in a future version of Python.",
49458                 Py_TYPE(result)->tp_name)) {
49459             Py_DECREF(result);
49460             return NULL;
49461         }
49462         return result;
49463     }
49464 #endif
49465     PyErr_Format(PyExc_TypeError,
49466                  "__%.4s__ returned non-%.4s (type %.200s)",
49467                  type_name, type_name, Py_TYPE(result)->tp_name);
49468     Py_DECREF(result);
49469     return NULL;
49470 }
49471 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
49472 #if CYTHON_USE_TYPE_SLOTS
49473   PyNumberMethods *m;
49474 #endif
49475   const char *name = NULL;
49476   PyObject *res = NULL;
49477 #if PY_MAJOR_VERSION < 3
49478   if (likely(PyInt_Check(x) || PyLong_Check(x)))
49479 #else
49480   if (likely(PyLong_Check(x)))
49481 #endif
49482     return __Pyx_NewRef(x);
49483 #if CYTHON_USE_TYPE_SLOTS
49484   m = Py_TYPE(x)->tp_as_number;
49485   #if PY_MAJOR_VERSION < 3
49486   if (m && m->nb_int) {
49487     name = "int";
49488     res = m->nb_int(x);
49489   }
49490   else if (m && m->nb_long) {
49491     name = "long";
49492     res = m->nb_long(x);
49493   }
49494   #else
49495   if (likely(m && m->nb_int)) {
49496     name = "int";
49497     res = m->nb_int(x);
49498   }
49499   #endif
49500 #else
49501   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
49502     res = PyNumber_Int(x);
49503   }
49504 #endif
49505   if (likely(res)) {
49506 #if PY_MAJOR_VERSION < 3
49507     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
49508 #else
49509     if (unlikely(!PyLong_CheckExact(res))) {
49510 #endif
49511         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
49512     }
49513   }
49514   else if (!PyErr_Occurred()) {
49515     PyErr_SetString(PyExc_TypeError,
49516                     "an integer is required");
49517   }
49518   return res;
49519 }
49520 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
49521   Py_ssize_t ival;
49522   PyObject *x;
49523 #if PY_MAJOR_VERSION < 3
49524   if (likely(PyInt_CheckExact(b))) {
49525     if (sizeof(Py_ssize_t) >= sizeof(long))
49526         return PyInt_AS_LONG(b);
49527     else
49528         return PyInt_AsSsize_t(b);
49529   }
49530 #endif
49531   if (likely(PyLong_CheckExact(b))) {
49532     #if CYTHON_USE_PYLONG_INTERNALS
49533     const digit* digits = ((PyLongObject*)b)->ob_digit;
49534     const Py_ssize_t size = Py_SIZE(b);
49535     if (likely(__Pyx_sst_abs(size) <= 1)) {
49536         ival = likely(size) ? digits[0] : 0;
49537         if (size == -1) ival = -ival;
49538         return ival;
49539     } else {
49540       switch (size) {
49541          case 2:
49542            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
49543              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
49544            }
49545            break;
49546          case -2:
49547            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
49548              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
49549            }
49550            break;
49551          case 3:
49552            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
49553              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
49554            }
49555            break;
49556          case -3:
49557            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
49558              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
49559            }
49560            break;
49561          case 4:
49562            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
49563              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]));
49564            }
49565            break;
49566          case -4:
49567            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
49568              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]));
49569            }
49570            break;
49571       }
49572     }
49573     #endif
49574     return PyLong_AsSsize_t(b);
49575   }
49576   x = PyNumber_Index(b);
49577   if (!x) return -1;
49578   ival = PyInt_AsSsize_t(x);
49579   Py_DECREF(x);
49580   return ival;
49581 }
49582 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
49583   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
49584 }
49585 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
49586     return PyInt_FromSize_t(ival);
49587 }
49588 
49589 
49590 #endif /* Py_PYTHON_H */
49591