/* Generated by Cython 0.17 on Sat Sep 15 02:48:37 2012 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
    #error Cython requires Python 2.4+.
#else
#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define CYTHON_FORMAT_SSIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
                                (PyErr_Format(PyExc_TypeError, \
                                              "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                 (PyObject*)0))
  #define PyIndex_Check(o)     (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
  #define __PYX_BUILD_PY_SSIZE_T "i"
#else
  #define __PYX_BUILD_PY_SSIZE_T "n"
  #define CYTHON_FORMAT_SSIZE_T "z"
#endif
#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)
  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;
  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
  #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
  #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
  typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
  typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
  #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#endif
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_VERSION_HEX < 0x03020000
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__cyhdfs
#define __PYX_HAVE_API__cyhdfs
#include "stdlib.h"
#include "stdint.h"
#include "string.h"
#include "fcntl.h"
#include "stdio.h"
#include "pythread.h"
#include "hdfs.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif


/* inline attribute */
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif

typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/


/* Type Conversion Predeclarations */

#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))

#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))

#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "cyhdfs.pyx",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
};

/*--- Type declarations ---*/
struct __pyx_obj_6cyhdfs_HDFSConnection;
struct __pyx_obj_6cyhdfs_HDFSFile;
struct __pyx_obj_6cyhdfs_HDFSWriteFile;
struct __pyx_obj_6cyhdfs_HDFSReadFile;

/* "cyhdfs.pyx":155
 * 
 * 
 * cdef class HDFSConnection:             # <<<<<<<<<<<<<<
 *     """
 *         HDFSConnection.__init__(host = 'default', unsigned short port = 0, user = '')
 */
struct __pyx_obj_6cyhdfs_HDFSConnection {
  PyObject_HEAD
  struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *__pyx_vtab;
  hdfsFS fs;
  int _connected;
  PyObject *host;
  PyObject *user;
  unsigned short port;
  PyObject *open_files;
  PyObject *__weakref__;
};


/* "cyhdfs.pyx":589
 * 
 * 
 * cdef class HDFSFile:             # <<<<<<<<<<<<<<
 *     """
 *         This is a base class for
 */
struct __pyx_obj_6cyhdfs_HDFSFile {
  PyObject_HEAD
  struct __pyx_vtabstruct_6cyhdfs_HDFSFile *__pyx_vtab;
  hdfsFile h_file;
  hdfsFS fs;
  PyObject *conn;
  PyObject *path;
  int flags;
  int bufferSize;
  short replication;
  int blocksize;
  int _open;
  PyObject *__weakref__;
  unsigned PY_LONG_LONG _write_ops;
  unsigned PY_LONG_LONG _write_bytes;
  unsigned PY_LONG_LONG _read_ops;
  unsigned PY_LONG_LONG _read_bytes;
};


/* "cyhdfs.pyx":763
 * 
 * 
 * cdef class HDFSWriteFile(HDFSFile):             # <<<<<<<<<<<<<<
 * 
 *     def write(self, w_data):
 */
struct __pyx_obj_6cyhdfs_HDFSWriteFile {
  struct __pyx_obj_6cyhdfs_HDFSFile __pyx_base;
};


/* "cyhdfs.pyx":673
 * 
 * 
 * cdef class HDFSReadFile(HDFSFile):             # <<<<<<<<<<<<<<
 * 
 *     def avail(self):
 */
struct __pyx_obj_6cyhdfs_HDFSReadFile {
  struct __pyx_obj_6cyhdfs_HDFSFile __pyx_base;
};



/* "cyhdfs.pyx":589
 * 
 * 
 * cdef class HDFSFile:             # <<<<<<<<<<<<<<
 *     """
 *         This is a base class for
 */

struct __pyx_vtabstruct_6cyhdfs_HDFSFile {
  int (*_close)(struct __pyx_obj_6cyhdfs_HDFSFile *);
};
static struct __pyx_vtabstruct_6cyhdfs_HDFSFile *__pyx_vtabptr_6cyhdfs_HDFSFile;


/* "cyhdfs.pyx":763
 * 
 * 
 * cdef class HDFSWriteFile(HDFSFile):             # <<<<<<<<<<<<<<
 * 
 *     def write(self, w_data):
 */

struct __pyx_vtabstruct_6cyhdfs_HDFSWriteFile {
  struct __pyx_vtabstruct_6cyhdfs_HDFSFile __pyx_base;
};
static struct __pyx_vtabstruct_6cyhdfs_HDFSWriteFile *__pyx_vtabptr_6cyhdfs_HDFSWriteFile;


/* "cyhdfs.pyx":155
 * 
 * 
 * cdef class HDFSConnection:             # <<<<<<<<<<<<<<
 *     """
 *         HDFSConnection.__init__(host = 'default', unsigned short port = 0, user = '')
 */

struct __pyx_vtabstruct_6cyhdfs_HDFSConnection {
  PyObject *(*_complain_no_conn)(struct __pyx_obj_6cyhdfs_HDFSConnection *);
  PyObject *(*_close_fs_files)(struct __pyx_obj_6cyhdfs_HDFSConnection *);
  PyObject *(*_disconnect)(struct __pyx_obj_6cyhdfs_HDFSConnection *);
};
static struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *__pyx_vtabptr_6cyhdfs_HDFSConnection;


/* "cyhdfs.pyx":673
 * 
 * 
 * cdef class HDFSReadFile(HDFSFile):             # <<<<<<<<<<<<<<
 * 
 *     def avail(self):
 */

struct __pyx_vtabstruct_6cyhdfs_HDFSReadFile {
  struct __pyx_vtabstruct_6cyhdfs_HDFSFile __pyx_base;
};
static struct __pyx_vtabstruct_6cyhdfs_HDFSReadFile *__pyx_vtabptr_6cyhdfs_HDFSReadFile;
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          if (acquire_gil) { \
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
              PyGILState_Release(__pyx_gilstate_save); \
          } else { \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext() \
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
    const char* function_name); /*proto*/

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/

static CYTHON_INLINE PyObject* __Pyx_tp_new(PyObject* type_obj) {
    return (PyObject*) (((PyTypeObject*)(type_obj))->tp_new(
        (PyTypeObject*)(type_obj), __pyx_empty_tuple, NULL));
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/

static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name);

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *modname); /*proto*/

static CYTHON_INLINE tTime __Pyx_PyInt_from_py_tTime(PyObject *);

static CYTHON_INLINE int16_t __Pyx_PyInt_from_py_int16_t(PyObject *);

static CYTHON_INLINE int64_t __Pyx_PyInt_from_py_int64_t(PyObject *);

static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject *);

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int64_t(int64_t);

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_tTime(tTime);

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t);

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static int __Pyx_check_binary_version(void);

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

static PyObject *__Pyx_ImportModule(const char *name); /*proto*/

static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/

typedef struct {
    int code_line;
    PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/


/* Module declarations from 'libc.stdlib' */

/* Module declarations from 'cpython.ref' */

/* Module declarations from 'cpython.string' */

/* Module declarations from 'libc' */

/* Module declarations from 'libc.stdint' */

/* Module declarations from 'libc.string' */

/* Module declarations from 'posix.fcntl' */

/* Module declarations from 'cpython.version' */

/* Module declarations from 'cpython.exc' */

/* Module declarations from 'cpython.module' */

/* Module declarations from 'cpython.mem' */

/* Module declarations from 'cpython.tuple' */

/* Module declarations from 'cpython.list' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from 'cpython.object' */

/* Module declarations from 'cpython.sequence' */

/* Module declarations from 'cpython.mapping' */

/* Module declarations from 'cpython.iterator' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

/* Module declarations from 'cpython.number' */

/* Module declarations from 'cpython.int' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.bool' */
static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;

/* Module declarations from 'cpython.long' */

/* Module declarations from 'cpython.float' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.complex' */
static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;

/* Module declarations from 'cpython.unicode' */

/* Module declarations from 'cpython.dict' */

/* Module declarations from 'cpython.instance' */

/* Module declarations from 'cpython.function' */

/* Module declarations from 'cpython.method' */

/* Module declarations from 'cpython.weakref' */

/* Module declarations from 'cpython.getargs' */

/* Module declarations from 'cpython.pythread' */

/* Module declarations from 'cpython.pystate' */

/* Module declarations from 'cpython.cobject' */

/* Module declarations from 'cpython.oldbuffer' */

/* Module declarations from 'cpython.set' */

/* Module declarations from 'cpython.buffer' */

/* Module declarations from 'cpython.bytes' */

/* Module declarations from 'cpython.pycapsule' */

/* Module declarations from 'cpython' */

/* Module declarations from 'cyhdfs' */
static PyTypeObject *__pyx_ptype_6cyhdfs_HDFSConnection = 0;
static PyTypeObject *__pyx_ptype_6cyhdfs_HDFSFile = 0;
static PyTypeObject *__pyx_ptype_6cyhdfs_HDFSReadFile = 0;
static PyTypeObject *__pyx_ptype_6cyhdfs_HDFSWriteFile = 0;
static void __pyx_f_6cyhdfs_hdfs_file_factory(struct __pyx_obj_6cyhdfs_HDFSFile *, PyObject *, PyObject *, hdfsFile, hdfsFS, int, int, short, int); /*proto*/
#define __Pyx_MODULE_NAME "cyhdfs"
int __pyx_module_is_main_cyhdfs = 0;

/* Implementation of 'cyhdfs' */
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection___repr__(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self); /* proto */
static int __pyx_pf_6cyhdfs_14HDFSConnection_2__cinit__(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, PyObject *__pyx_v_host, unsigned short __pyx_v_port, PyObject *__pyx_v_user); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_4utime(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path, tTime __pyx_v_mtime, CYTHON_UNUSED PyObject *__pyx_v_tTime, PyObject *__pyx_v_atime); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_6chmod(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path, short __pyx_v_mode); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_8chown(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path, char *__pyx_v_owner, char *__pyx_v_group); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_10used(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_12capacity(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_14get_default_blocksize(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_16open_file(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, PyObject *__pyx_v_path, int __pyx_v_flags, int __pyx_v_bufferSize, short __pyx_v_replication, int __pyx_v_blocksize); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_18exists(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_20delete(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path, int __pyx_v_recursive); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_22rename(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_old_path, char *__pyx_v_new_path); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_24get_cwd(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_26set_cwd(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_28set_replication(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path, int16_t __pyx_v_replication); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_30mkdir(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_32list_dir(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_34path_info(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_36get_hosts(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path, tOffset __pyx_v_start, tOffset __pyx_v_length); /* proto */
static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_38close(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self); /* proto */
static void __pyx_pf_6cyhdfs_14HDFSConnection_40__dealloc__(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cyhdfs_8HDFSFile_get_stats(struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_self); /* proto */
static int __pyx_pf_6cyhdfs_8HDFSFile_2__init__(CYTHON_UNUSED struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cyhdfs_8HDFSFile_4__repr__(struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cyhdfs_8HDFSFile_6tell(struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cyhdfs_8HDFSFile_8close(struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_self); /* proto */
static void __pyx_pf_6cyhdfs_8HDFSFile_10__dealloc__(struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cyhdfs_12HDFSReadFile_avail(struct __pyx_obj_6cyhdfs_HDFSReadFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cyhdfs_12HDFSReadFile_2seek(struct __pyx_obj_6cyhdfs_HDFSReadFile *__pyx_v_self, tOffset __pyx_v_pos); /* proto */
static PyObject *__pyx_pf_6cyhdfs_12HDFSReadFile_4read(struct __pyx_obj_6cyhdfs_HDFSReadFile *__pyx_v_self, int __pyx_v_length); /* proto */
static PyObject *__pyx_pf_6cyhdfs_12HDFSReadFile_6pread(struct __pyx_obj_6cyhdfs_HDFSReadFile *__pyx_v_self, tOffset __pyx_v_position, tSize __pyx_v_length); /* proto */
static PyObject *__pyx_pf_6cyhdfs_13HDFSWriteFile_write(struct __pyx_obj_6cyhdfs_HDFSWriteFile *__pyx_v_self, PyObject *__pyx_v_w_data); /* proto */
static PyObject *__pyx_pf_6cyhdfs_13HDFSWriteFile_2write_all(struct __pyx_obj_6cyhdfs_HDFSWriteFile *__pyx_v_self, PyObject *__pyx_v_w_data); /* proto */
static PyObject *__pyx_pf_6cyhdfs_13HDFSWriteFile_4flush(struct __pyx_obj_6cyhdfs_HDFSWriteFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cyhdfs_13HDFSWriteFile_6hflush(struct __pyx_obj_6cyhdfs_HDFSWriteFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cyhdfs_copy(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_src_conn, char *__pyx_v_src, struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_dst_conn, char *__pyx_v_dst); /* proto */
static PyObject *__pyx_pf_6cyhdfs_2move(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_src_conn, char *__pyx_v_src, struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_dst_conn, char *__pyx_v_dst); /* proto */
static char __pyx_k_1[] = "<HDFSConnection host=%s port=%s user=%s connected=%s>";
static char __pyx_k_2[] = "";
static char __pyx_k_3[] = "host must be of type string got %s instead.";
static char __pyx_k_4[] = "user must be of type string got %s instead.";
static char __pyx_k_5[] = "Cant connect to %s:%d";
static char __pyx_k_6[] = "No filesystem connected %s";
static char __pyx_k_7[] = "hdfsUtime error in %s";
static char __pyx_k_8[] = "hdfsChmod error in %s";
static char __pyx_k_9[] = "hdfsChown error in %s";
static char __pyx_k_10[] = "hdfsGetUsed error in %s";
static char __pyx_k_11[] = "hdfsGetCapacity error in %s";
static char __pyx_k_12[] = "hdfsGetDefaultBlockSize error in %s";
static char __pyx_k_13[] = "expected string type got %s instead.";
static char __pyx_k_14[] = "Cant open file at \"%s\" flags=%d bufferSize=%d replication=%d blocksize=%d";
static char __pyx_k_15[] = "Open mode %d not supported.";
static char __pyx_k_16[] = "hdfsDelete error in %s";
static char __pyx_k_17[] = "hdfsRename error in %s";
static char __pyx_k_18[] = "hdfsGetWorkingDirectory error in %s";
static char __pyx_k_19[] = "hdfsSetWorkingDirectory error in %s";
static char __pyx_k_20[] = "hdfsSetReplication error in %s";
static char __pyx_k_21[] = "hdfsCreateDirectory error in %s";
static char __pyx_k_22[] = "hdfsListDirectory(path=%s) error in %s";
static char __pyx_k_23[] = "hdfsGetPathInfo(path=%s) error in %s";
static char __pyx_k_24[] = "hdfsGetHosts(path=%s start=%s length=%s) error in %s";
static char __pyx_k_25[] = "hdfsDisconnect error in %s";
static char __pyx_k_26[] = "This class cannot be instantiated from Python";
static char __pyx_k_28[] = "<HDFSFile path=\"%s\" is_open=%d flags=%d bufferSize=%d replication=%d blocksize=%d>";
static char __pyx_k_29[] = "File %s is closed";
static char __pyx_k_30[] = "hdfsTell returned error code file: %s";
static char __pyx_k_31[] = "%s already closed";
static char __pyx_k_32[] = "Cant close: %s";
static char __pyx_k_33[] = "hdfsAvailable returned error code file: %s";
static char __pyx_k_34[] = "hdfsSeek returned error code file: %s";
static char __pyx_k_35[] = "in read(): buf = <void *>malloc( sizeof(char) * length)";
static char __pyx_k_37[] = "Io read error in %s";
static char __pyx_k_39[] = "expected string got: %s instead";
static char __pyx_k_40[] = "write error in %s";
static char __pyx_k_41[] = "Can't flush %s";
static char __pyx_k_42[] = "environmnet variable CLASSPATH not set";
static char __pyx_k_46[] = "/home/turnaev/box/cyhdfs_git/cyhdfs/src/cyhdfs.pyx";
static char __pyx_k__os[] = "os";
static char __pyx_k__add[] = "add";
static char __pyx_k__dst[] = "dst";
static char __pyx_k__src[] = "src";
static char __pyx_k__copy[] = "copy";
static char __pyx_k__host[] = "host";
static char __pyx_k__kind[] = "kind";
static char __pyx_k__mode[] = "mode";
static char __pyx_k__move[] = "move";
static char __pyx_k__name[] = "name";
static char __pyx_k__path[] = "path";
static char __pyx_k__port[] = "port";
static char __pyx_k__size[] = "size";
static char __pyx_k__user[] = "user";
static char __pyx_k__Stats[] = "Stats";
static char __pyx_k__atime[] = "atime";
static char __pyx_k__close[] = "close";
static char __pyx_k__flags[] = "flags";
static char __pyx_k__group[] = "group";
static char __pyx_k__mtime[] = "mtime";
static char __pyx_k__owner[] = "owner";
static char __pyx_k__start[] = "start";
static char __pyx_k__tTime[] = "tTime";
static char __pyx_k__cyhdfs[] = "cyhdfs";
static char __pyx_k__length[] = "length";
static char __pyx_k__WeakSet[] = "WeakSet";
static char __pyx_k__default[] = "default";
static char __pyx_k__environ[] = "environ";
static char __pyx_k__weakref[] = "weakref";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__dst_conn[] = "dst_conn";
static char __pyx_k__last_mod[] = "last_mod";
static char __pyx_k__new_path[] = "new_path";
static char __pyx_k__old_path[] = "old_path";
static char __pyx_k__position[] = "position";
static char __pyx_k__read_ops[] = "read_ops";
static char __pyx_k__src_conn[] = "src_conn";
static char __pyx_k__CLASSPATH[] = "CLASSPATH";
static char __pyx_k__EntryInfo[] = "EntryInfo";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k__HDFSError[] = "HDFSError";
static char __pyx_k__TypeError[] = "TypeError";
static char __pyx_k__blocksize[] = "blocksize";
static char __pyx_k__recursive[] = "recursive";
static char __pyx_k__write_ops[] = "write_ops";
static char __pyx_k__WriteStats[] = "WriteStats";
static char __pyx_k__bufferSize[] = "bufferSize";
static char __pyx_k__namedtuple[] = "namedtuple";
static char __pyx_k__read_bytes[] = "read_bytes";
static char __pyx_k__HDFSIOError[] = "HDFSIOError";
static char __pyx_k__MemoryError[] = "MemoryError";
static char __pyx_k__collections[] = "collections";
static char __pyx_k__last_access[] = "last_access";
static char __pyx_k__permissions[] = "permissions";
static char __pyx_k__replication[] = "replication";
static char __pyx_k__write_bytes[] = "write_bytes";
static char __pyx_k__ENTRY_KIND_DIR[] = "ENTRY_KIND_DIR";
static char __pyx_k__ENTRY_KIND_FILE[] = "ENTRY_KIND_FILE";
static char __pyx_k__HDFSConnectionError[] = "HDFSConnectionError";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_s_10;
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_kp_s_12;
static PyObject *__pyx_kp_s_13;
static PyObject *__pyx_kp_s_14;
static PyObject *__pyx_kp_s_15;
static PyObject *__pyx_kp_s_16;
static PyObject *__pyx_kp_s_17;
static PyObject *__pyx_kp_s_18;
static PyObject *__pyx_kp_s_19;
static PyObject *__pyx_kp_b_2;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_s_20;
static PyObject *__pyx_kp_s_21;
static PyObject *__pyx_kp_s_22;
static PyObject *__pyx_kp_s_23;
static PyObject *__pyx_kp_s_24;
static PyObject *__pyx_kp_s_25;
static PyObject *__pyx_kp_s_26;
static PyObject *__pyx_kp_s_28;
static PyObject *__pyx_kp_s_29;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_30;
static PyObject *__pyx_kp_s_31;
static PyObject *__pyx_kp_s_32;
static PyObject *__pyx_kp_s_33;
static PyObject *__pyx_kp_s_34;
static PyObject *__pyx_kp_s_35;
static PyObject *__pyx_kp_s_37;
static PyObject *__pyx_kp_s_39;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_kp_s_40;
static PyObject *__pyx_kp_s_41;
static PyObject *__pyx_kp_s_42;
static PyObject *__pyx_kp_s_46;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_kp_s_6;
static PyObject *__pyx_kp_s_7;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_kp_s_9;
static PyObject *__pyx_n_s__CLASSPATH;
static PyObject *__pyx_n_s__ENTRY_KIND_DIR;
static PyObject *__pyx_n_s__ENTRY_KIND_FILE;
static PyObject *__pyx_n_s__EntryInfo;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__HDFSConnectionError;
static PyObject *__pyx_n_s__HDFSError;
static PyObject *__pyx_n_s__HDFSIOError;
static PyObject *__pyx_n_s__MemoryError;
static PyObject *__pyx_n_s__Stats;
static PyObject *__pyx_n_s__TypeError;
static PyObject *__pyx_n_s__WeakSet;
static PyObject *__pyx_n_s__WriteStats;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s__add;
static PyObject *__pyx_n_s__atime;
static PyObject *__pyx_n_s__blocksize;
static PyObject *__pyx_n_s__bufferSize;
static PyObject *__pyx_n_s__close;
static PyObject *__pyx_n_s__collections;
static PyObject *__pyx_n_s__copy;
static PyObject *__pyx_n_s__cyhdfs;
static PyObject *__pyx_n_s__default;
static PyObject *__pyx_n_s__dst;
static PyObject *__pyx_n_s__dst_conn;
static PyObject *__pyx_n_s__environ;
static PyObject *__pyx_n_s__flags;
static PyObject *__pyx_n_s__group;
static PyObject *__pyx_n_s__host;
static PyObject *__pyx_n_s__kind;
static PyObject *__pyx_n_s__last_access;
static PyObject *__pyx_n_s__last_mod;
static PyObject *__pyx_n_s__length;
static PyObject *__pyx_n_s__mode;
static PyObject *__pyx_n_s__move;
static PyObject *__pyx_n_s__mtime;
static PyObject *__pyx_n_s__name;
static PyObject *__pyx_n_s__namedtuple;
static PyObject *__pyx_n_s__new_path;
static PyObject *__pyx_n_s__old_path;
static PyObject *__pyx_n_s__os;
static PyObject *__pyx_n_s__owner;
static PyObject *__pyx_n_s__path;
static PyObject *__pyx_n_s__permissions;
static PyObject *__pyx_n_s__port;
static PyObject *__pyx_n_s__position;
static PyObject *__pyx_n_s__read_bytes;
static PyObject *__pyx_n_s__read_ops;
static PyObject *__pyx_n_s__recursive;
static PyObject *__pyx_n_s__replication;
static PyObject *__pyx_n_s__size;
static PyObject *__pyx_n_s__src;
static PyObject *__pyx_n_s__src_conn;
static PyObject *__pyx_n_s__start;
static PyObject *__pyx_n_s__tTime;
static PyObject *__pyx_n_s__user;
static PyObject *__pyx_n_s__weakref;
static PyObject *__pyx_n_s__write_bytes;
static PyObject *__pyx_n_s__write_ops;
static PyObject *__pyx_k_tuple_27;
static PyObject *__pyx_k_tuple_36;
static PyObject *__pyx_k_tuple_38;
static PyObject *__pyx_k_tuple_43;
static PyObject *__pyx_k_tuple_44;
static PyObject *__pyx_k_tuple_47;
static PyObject *__pyx_k_codeobj_45;
static PyObject *__pyx_k_codeobj_48;

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection___repr__(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":194
 *         object __weakref__
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<HDFSConnection host=%s port=%s user=%s connected=%s>" % (self.host, self.port, self.user, self._connected)
 * 
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection___repr__(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "cyhdfs.pyx":195
 * 
 *     def __repr__(self):
 *         return "<HDFSConnection host=%s port=%s user=%s connected=%s>" % (self.host, self.port, self.user, self._connected)             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, host = 'default', unsigned short port = 0, user = ''):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->port); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->_connected); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_self->host);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self->host);
  __Pyx_GIVEREF(__pyx_v_self->host);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->user);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_self->user);
  __Pyx_GIVEREF(__pyx_v_self->user);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6cyhdfs_14HDFSConnection_3__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6cyhdfs_14HDFSConnection_3__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_host = 0;
  unsigned short __pyx_v_port;
  PyObject *__pyx_v_user = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__host,&__pyx_n_s__port,&__pyx_n_s__user,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)__pyx_n_s__default);
    values[2] = ((PyObject *)__pyx_kp_s_2);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__host);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__port);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__user);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_host = values[0];
    if (values[1]) {
      __pyx_v_port = __Pyx_PyInt_AsUnsignedShort(values[1]); if (unlikely((__pyx_v_port == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_port = ((unsigned short)0);
    }
    __pyx_v_user = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_2__cinit__(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self), __pyx_v_host, __pyx_v_port, __pyx_v_user);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":197
 *         return "<HDFSConnection host=%s port=%s user=%s connected=%s>" % (self.host, self.port, self.user, self._connected)
 * 
 *     def __cinit__(self, host = 'default', unsigned short port = 0, user = ''):             # <<<<<<<<<<<<<<
 *         cdef:
 *             char * _host
 */

static int __pyx_pf_6cyhdfs_14HDFSConnection_2__cinit__(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, PyObject *__pyx_v_host, unsigned short __pyx_v_port, PyObject *__pyx_v_user) {
  char *__pyx_v__host;
  hdfsFS __pyx_v_fs;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "cyhdfs.pyx":201
 *             char * _host
 * 
 *         if not PyString_Check(host):             # <<<<<<<<<<<<<<
 *             raise TypeError("host must be of type string got %s instead." % type(host))
 * 
 */
  __pyx_t_1 = (!PyString_Check(__pyx_v_host));
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":202
 * 
 *         if not PyString_Check(host):
 *             raise TypeError("host must be of type string got %s instead." % type(host))             # <<<<<<<<<<<<<<
 * 
 *         if not PyString_Check(user):
 */
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)Py_TYPE(__pyx_v_host))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":204
 *             raise TypeError("host must be of type string got %s instead." % type(host))
 * 
 *         if not PyString_Check(user):             # <<<<<<<<<<<<<<
 *             raise TypeError("user must be of type string got %s instead." % type(host))
 * 
 */
  __pyx_t_1 = (!PyString_Check(__pyx_v_user));
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":205
 * 
 *         if not PyString_Check(user):
 *             raise TypeError("user must be of type string got %s instead." % type(host))             # <<<<<<<<<<<<<<
 * 
 *         self.open_files = weakref.WeakSet()
 */
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)Py_TYPE(__pyx_v_host))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cyhdfs.pyx":207
 *             raise TypeError("user must be of type string got %s instead." % type(host))
 * 
 *         self.open_files = weakref.WeakSet()             # <<<<<<<<<<<<<<
 * 
 *         self.host = host
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__weakref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__WeakSet); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->open_files);
  __Pyx_DECREF(__pyx_v_self->open_files);
  __pyx_v_self->open_files = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cyhdfs.pyx":209
 *         self.open_files = weakref.WeakSet()
 * 
 *         self.host = host             # <<<<<<<<<<<<<<
 *         self.user = user
 *         self.port = port
 */
  __Pyx_INCREF(__pyx_v_host);
  __Pyx_GIVEREF(__pyx_v_host);
  __Pyx_GOTREF(__pyx_v_self->host);
  __Pyx_DECREF(__pyx_v_self->host);
  __pyx_v_self->host = __pyx_v_host;

  /* "cyhdfs.pyx":210
 * 
 *         self.host = host
 *         self.user = user             # <<<<<<<<<<<<<<
 *         self.port = port
 *         self._connected = 0
 */
  __Pyx_INCREF(__pyx_v_user);
  __Pyx_GIVEREF(__pyx_v_user);
  __Pyx_GOTREF(__pyx_v_self->user);
  __Pyx_DECREF(__pyx_v_self->user);
  __pyx_v_self->user = __pyx_v_user;

  /* "cyhdfs.pyx":211
 *         self.host = host
 *         self.user = user
 *         self.port = port             # <<<<<<<<<<<<<<
 *         self._connected = 0
 * 
 */
  __pyx_v_self->port = __pyx_v_port;

  /* "cyhdfs.pyx":212
 *         self.user = user
 *         self.port = port
 *         self._connected = 0             # <<<<<<<<<<<<<<
 * 
 *         if not PyString_GET_SIZE(host):
 */
  __pyx_v_self->_connected = 0;

  /* "cyhdfs.pyx":214
 *         self._connected = 0
 * 
 *         if not PyString_GET_SIZE(host):             # <<<<<<<<<<<<<<
 *             _host = NULL
 *         else:
 */
  __pyx_t_1 = (!PyString_GET_SIZE(__pyx_v_host));
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":215
 * 
 *         if not PyString_GET_SIZE(host):
 *             _host = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             _host = PyString_AS_STRING(host)
 */
    __pyx_v__host = NULL;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "cyhdfs.pyx":217
 *             _host = NULL
 *         else:
 *             _host = PyString_AS_STRING(host)             # <<<<<<<<<<<<<<
 * 
 *         if PyString_GET_SIZE(user):
 */
    __pyx_v__host = PyString_AS_STRING(__pyx_v_host);
  }
  __pyx_L5:;

  /* "cyhdfs.pyx":219
 *             _host = PyString_AS_STRING(host)
 * 
 *         if PyString_GET_SIZE(user):             # <<<<<<<<<<<<<<
 *             fs = hdfsConnectAsUser(_host, port, PyString_AS_STRING(user))
 *         else:
 */
  __pyx_t_4 = PyString_GET_SIZE(__pyx_v_user);
  if (__pyx_t_4) {

    /* "cyhdfs.pyx":220
 * 
 *         if PyString_GET_SIZE(user):
 *             fs = hdfsConnectAsUser(_host, port, PyString_AS_STRING(user))             # <<<<<<<<<<<<<<
 *         else:
 *             fs = hdfsConnect(_host, port)
 */
    __pyx_v_fs = hdfsConnectAsUser(__pyx_v__host, __pyx_v_port, PyString_AS_STRING(__pyx_v_user));
    goto __pyx_L6;
  }
  /*else*/ {

    /* "cyhdfs.pyx":222
 *             fs = hdfsConnectAsUser(_host, port, PyString_AS_STRING(user))
 *         else:
 *             fs = hdfsConnect(_host, port)             # <<<<<<<<<<<<<<
 *         if fs is NULL:
 *             raise HDFSConnectionError("Cant connect to %s:%d" % (host, port))
 */
    __pyx_v_fs = hdfsConnect(__pyx_v__host, __pyx_v_port);
  }
  __pyx_L6:;

  /* "cyhdfs.pyx":223
 *         else:
 *             fs = hdfsConnect(_host, port)
 *         if fs is NULL:             # <<<<<<<<<<<<<<
 *             raise HDFSConnectionError("Cant connect to %s:%d" % (host, port))
 *         self.fs = fs
 */
  __pyx_t_1 = (__pyx_v_fs == NULL);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":224
 *             fs = hdfsConnect(_host, port)
 *         if fs is NULL:
 *             raise HDFSConnectionError("Cant connect to %s:%d" % (host, port))             # <<<<<<<<<<<<<<
 *         self.fs = fs
 *         self._connected = 1
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSConnectionError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyInt_FromLong(__pyx_v_port); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "cyhdfs.pyx":225
 *         if fs is NULL:
 *             raise HDFSConnectionError("Cant connect to %s:%d" % (host, port))
 *         self.fs = fs             # <<<<<<<<<<<<<<
 *         self._connected = 1
 * 
 */
  __pyx_v_self->fs = __pyx_v_fs;

  /* "cyhdfs.pyx":226
 *             raise HDFSConnectionError("Cant connect to %s:%d" % (host, port))
 *         self.fs = fs
 *         self._connected = 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->_connected = 1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":229
 * 
 * 
 *     cdef _complain_no_conn(self):             # <<<<<<<<<<<<<<
 *         if not self._connected:
 *             raise HDFSConnectionError("No filesystem connected %s" % repr(self))
 */

static PyObject *__pyx_f_6cyhdfs_14HDFSConnection__complain_no_conn(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_complain_no_conn", 0);

  /* "cyhdfs.pyx":230
 * 
 *     cdef _complain_no_conn(self):
 *         if not self._connected:             # <<<<<<<<<<<<<<
 *             raise HDFSConnectionError("No filesystem connected %s" % repr(self))
 * 
 */
  __pyx_t_1 = (!__pyx_v_self->_connected);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":231
 *     cdef _complain_no_conn(self):
 *         if not self._connected:
 *             raise HDFSConnectionError("No filesystem connected %s" % repr(self))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSConnectionError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection._complain_no_conn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_5utime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_4utime[] = "HDFSConnection.utime(self, char *path, tTime mtime, tTime, atime)\n\n            :param path: the path to the file or directory\n            :param mtime: new modification time or 0 for only set access time in seconds\n            :param atime: new access time or 0 for only set modification time in seconds\n            :return: None\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_5utime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  char *__pyx_v_path;
  tTime __pyx_v_mtime;
  CYTHON_UNUSED PyObject *__pyx_v_tTime = 0;
  PyObject *__pyx_v_atime = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("utime (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__mtime,&__pyx_n_s__tTime,&__pyx_n_s__atime,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mtime)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("utime", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tTime)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("utime", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__atime)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("utime", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "utime") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_path = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_path) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_mtime = __Pyx_PyInt_from_py_tTime(values[1]); if (unlikely((__pyx_v_mtime == (tTime)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_tTime = values[2];
    __pyx_v_atime = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("utime", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.utime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_4utime(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self), __pyx_v_path, __pyx_v_mtime, __pyx_v_tTime, __pyx_v_atime);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":234
 * 
 * 
 *     def utime(self, char * path, tTime mtime, tTime, atime):             # <<<<<<<<<<<<<<
 *         """
 *             :param path: the path to the file or directory
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_4utime(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path, tTime __pyx_v_mtime, CYTHON_UNUSED PyObject *__pyx_v_tTime, PyObject *__pyx_v_atime) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  tTime __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("utime", 0);

  /* "cyhdfs.pyx":241
 *             :return: None
 *         """
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         if hdfsUtime(self.fs, path, mtime, atime) < 0:
 *             raise HDFSIOError("hdfsUtime error in %s" % repr(self))
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":242
 *         """
 *         self._complain_no_conn()
 *         if hdfsUtime(self.fs, path, mtime, atime) < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsUtime error in %s" % repr(self))
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_from_py_tTime(__pyx_v_atime); if (unlikely((__pyx_t_2 == (tTime)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = (hdfsUtime(__pyx_v_self->fs, __pyx_v_path, __pyx_v_mtime, __pyx_t_2) < 0);
  if (__pyx_t_3) {

    /* "cyhdfs.pyx":243
 *         self._complain_no_conn()
 *         if hdfsUtime(self.fs, path, mtime, atime) < 0:
 *             raise HDFSIOError("hdfsUtime error in %s" % repr(self))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.utime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_7chmod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_6chmod[] = "HDFSConnection.chmod(self, char *path, short mode)\n\n            :param path: the path to the file or directory\n            :param mode: the bitmask to set it to\n            :return: None\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_7chmod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  char *__pyx_v_path;
  short __pyx_v_mode;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chmod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__mode,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("chmod", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "chmod") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_path = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_path) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_mode = __Pyx_PyInt_AsShort(values[1]); if (unlikely((__pyx_v_mode == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chmod", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.chmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_6chmod(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self), __pyx_v_path, __pyx_v_mode);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":246
 * 
 * 
 *     def chmod(self, char * path, short mode):             # <<<<<<<<<<<<<<
 *         """
 *             :param path: the path to the file or directory
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_6chmod(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path, short __pyx_v_mode) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("chmod", 0);

  /* "cyhdfs.pyx":252
 *             :return: None
 *         """
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         if hdfsChmod(self.fs, path, mode) < 0:
 *             raise HDFSIOError("hdfsChmod error in %s" % repr(self))
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":253
 *         """
 *         self._complain_no_conn()
 *         if hdfsChmod(self.fs, path, mode) < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsChmod error in %s" % repr(self))
 * 
 */
  __pyx_t_2 = (hdfsChmod(__pyx_v_self->fs, __pyx_v_path, __pyx_v_mode) < 0);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":254
 *         self._complain_no_conn()
 *         if hdfsChmod(self.fs, path, mode) < 0:
 *             raise HDFSIOError("hdfsChmod error in %s" % repr(self))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.chmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_9chown(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_8chown[] = "HDFSConnection.chown(self, char *path, char *owner, char *group)\n\n            :param path: the path to the file or directory\n            :param owner: this is a string in Hadoop land. Set to \"\" if only setting group\n            :param group: this is a string in Hadoop land. Set to \"\" if only setting user\n            :return: None\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_9chown(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  char *__pyx_v_path;
  char *__pyx_v_owner;
  char *__pyx_v_group;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chown (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__owner,&__pyx_n_s__group,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__owner)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("chown", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__group)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("chown", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "chown") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_path = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_path) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_owner = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_owner) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_group = PyBytes_AsString(values[2]); if (unlikely((!__pyx_v_group) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chown", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.chown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_8chown(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self), __pyx_v_path, __pyx_v_owner, __pyx_v_group);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":257
 * 
 * 
 *     def chown(self, char * path, char * owner, char * group):             # <<<<<<<<<<<<<<
 *         """
 *             :param path: the path to the file or directory
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_8chown(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path, char *__pyx_v_owner, char *__pyx_v_group) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("chown", 0);

  /* "cyhdfs.pyx":264
 *             :return: None
 *         """
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         if hdfsChown(self.fs, path, owner, group) < 0:
 *             raise HDFSIOError("hdfsChown error in %s" % repr(self))
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":265
 *         """
 *         self._complain_no_conn()
 *         if hdfsChown(self.fs, path, owner, group) < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsChown error in %s" % repr(self))
 * 
 */
  __pyx_t_2 = (hdfsChown(__pyx_v_self->fs, __pyx_v_path, __pyx_v_owner, __pyx_v_group) < 0);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":266
 *         self._complain_no_conn()
 *         if hdfsChown(self.fs, path, owner, group) < 0:
 *             raise HDFSIOError("hdfsChown error in %s" % repr(self))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.chown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_11used(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_10used[] = "HDFSConnection.used(self)\n\n            :return: the total raw size of all files in the filesystem.\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_11used(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("used (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_10used(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":269
 * 
 * 
 *     def used(self):             # <<<<<<<<<<<<<<
 *         """
 *             :return: the total raw size of all files in the filesystem.
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_10used(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self) {
  tOffset __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("used", 0);

  /* "cyhdfs.pyx":275
 *         cdef:
 *             tOffset ret
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         ret = hdfsGetUsed(self.fs)
 *         if ret < 0:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":276
 *             tOffset ret
 *         self._complain_no_conn()
 *         ret = hdfsGetUsed(self.fs)             # <<<<<<<<<<<<<<
 *         if ret < 0:
 *             raise HDFSIOError("hdfsGetUsed error in %s" % repr(self))
 */
  __pyx_v_ret = hdfsGetUsed(__pyx_v_self->fs);

  /* "cyhdfs.pyx":277
 *         self._complain_no_conn()
 *         ret = hdfsGetUsed(self.fs)
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsGetUsed error in %s" % repr(self))
 *         return ret
 */
  __pyx_t_2 = (__pyx_v_ret < 0);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":278
 *         ret = hdfsGetUsed(self.fs)
 *         if ret < 0:
 *             raise HDFSIOError("hdfsGetUsed error in %s" % repr(self))             # <<<<<<<<<<<<<<
 *         return ret
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":279
 *         if ret < 0:
 *             raise HDFSIOError("hdfsGetUsed error in %s" % repr(self))
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     def capacity(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_to_py_int64_t(__pyx_v_ret); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.used", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_13capacity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_12capacity[] = "HDFSConnection.capacity(self)\n\n            :return: the raw capacity of the filesystem.\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_13capacity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("capacity (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_12capacity(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":281
 *         return ret
 * 
 *     def capacity(self):             # <<<<<<<<<<<<<<
 *         """
 *             :return: the raw capacity of the filesystem.
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_12capacity(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self) {
  tOffset __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("capacity", 0);

  /* "cyhdfs.pyx":287
 *         cdef:
 *             tOffset ret
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         ret = hdfsGetCapacity(self.fs)
 *         if ret < 0:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":288
 *             tOffset ret
 *         self._complain_no_conn()
 *         ret = hdfsGetCapacity(self.fs)             # <<<<<<<<<<<<<<
 *         if ret < 0:
 *             raise HDFSIOError("hdfsGetCapacity error in %s" % repr(self))
 */
  __pyx_v_ret = hdfsGetCapacity(__pyx_v_self->fs);

  /* "cyhdfs.pyx":289
 *         self._complain_no_conn()
 *         ret = hdfsGetCapacity(self.fs)
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsGetCapacity error in %s" % repr(self))
 *         return ret
 */
  __pyx_t_2 = (__pyx_v_ret < 0);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":290
 *         ret = hdfsGetCapacity(self.fs)
 *         if ret < 0:
 *             raise HDFSIOError("hdfsGetCapacity error in %s" % repr(self))             # <<<<<<<<<<<<<<
 *         return ret
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":291
 *         if ret < 0:
 *             raise HDFSIOError("hdfsGetCapacity error in %s" % repr(self))
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     def get_default_blocksize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_to_py_int64_t(__pyx_v_ret); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.capacity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_15get_default_blocksize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_14get_default_blocksize[] = "HDFSConnection.get_default_blocksize(self)\n\n            :return: default configured block size\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_15get_default_blocksize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_default_blocksize (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_14get_default_blocksize(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":293
 *         return ret
 * 
 *     def get_default_blocksize(self):             # <<<<<<<<<<<<<<
 *         """
 *             :return: default configured block size
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_14get_default_blocksize(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self) {
  tOffset __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_default_blocksize", 0);

  /* "cyhdfs.pyx":299
 *         cdef:
 *             tOffset ret
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         ret = hdfsGetDefaultBlockSize(self.fs)
 *         if ret < 0:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":300
 *             tOffset ret
 *         self._complain_no_conn()
 *         ret = hdfsGetDefaultBlockSize(self.fs)             # <<<<<<<<<<<<<<
 *         if ret < 0:
 *             raise HDFSIOError("hdfsGetDefaultBlockSize error in %s" % repr(self))
 */
  __pyx_v_ret = hdfsGetDefaultBlockSize(__pyx_v_self->fs);

  /* "cyhdfs.pyx":301
 *         self._complain_no_conn()
 *         ret = hdfsGetDefaultBlockSize(self.fs)
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsGetDefaultBlockSize error in %s" % repr(self))
 *         return ret
 */
  __pyx_t_2 = (__pyx_v_ret < 0);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":302
 *         ret = hdfsGetDefaultBlockSize(self.fs)
 *         if ret < 0:
 *             raise HDFSIOError("hdfsGetDefaultBlockSize error in %s" % repr(self))             # <<<<<<<<<<<<<<
 *         return ret
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":303
 *         if ret < 0:
 *             raise HDFSIOError("hdfsGetDefaultBlockSize error in %s" % repr(self))
 *         return ret             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_to_py_int64_t(__pyx_v_ret); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.get_default_blocksize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_17open_file(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_16open_file[] = "HDFSConnection.open_file(self, path, int flags, int bufferSize=0, short replication=0, int blocksize=0)\n\n            :param path: The full path to the file.\n            :param flags: - an | of bits/fcntl.h file flags - supported flags are O_RDONLY, O_WRONLY (meaning create or overwrite i.e., implies O_TRUNCAT).\n            :param bufferSize: Size of buffer for read/write - pass 0 if you want to use the default configured values.\n            :param replication: Block replication - pass 0 if you want to use  the default configured values.\n            :param blocksize: Size of block - pass 0 if you want to use the default configured values.\n            :return: opened file instance\n            :rtype: HDFSReadFile or HDFSWriteFile instance\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_17open_file(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  int __pyx_v_flags;
  int __pyx_v_bufferSize;
  short __pyx_v_replication;
  int __pyx_v_blocksize;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("open_file (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__flags,&__pyx_n_s__bufferSize,&__pyx_n_s__replication,&__pyx_n_s__blocksize,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("open_file", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bufferSize);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__replication);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__blocksize);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "open_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    if (values[2]) {
      __pyx_v_bufferSize = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_bufferSize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_bufferSize = ((int)0);
    }
    if (values[3]) {
      __pyx_v_replication = __Pyx_PyInt_AsShort(values[3]); if (unlikely((__pyx_v_replication == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_replication = ((short)0);
    }
    if (values[4]) {
      __pyx_v_blocksize = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_blocksize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_blocksize = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("open_file", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.open_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_16open_file(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self), __pyx_v_path, __pyx_v_flags, __pyx_v_bufferSize, __pyx_v_replication, __pyx_v_blocksize);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":306
 * 
 * 
 *     def open_file(self, path, int flags, int bufferSize = 0, short replication = 0, int blocksize = 0):             # <<<<<<<<<<<<<<
 *         """
 *             :param path: The full path to the file.
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_16open_file(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, PyObject *__pyx_v_path, int __pyx_v_flags, int __pyx_v_bufferSize, short __pyx_v_replication, int __pyx_v_blocksize) {
  hdfsFile __pyx_v_h_file;
  PyObject *__pyx_v_fl = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("open_file", 0);

  /* "cyhdfs.pyx":319
 *             HDFSWriteFile hdfs_w_file
 *             HDFSReadFile hdfs_r_file
 *         if not PyString_Check(path):             # <<<<<<<<<<<<<<
 *             raise TypeError("expected string type got %s instead." % type(path))
 * 
 */
  __pyx_t_1 = (!PyString_Check(__pyx_v_path));
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":320
 *             HDFSReadFile hdfs_r_file
 *         if not PyString_Check(path):
 *             raise TypeError("expected string type got %s instead." % type(path))             # <<<<<<<<<<<<<<
 * 
 *         self._complain_no_conn()
 */
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), ((PyObject *)Py_TYPE(__pyx_v_path))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":322
 *             raise TypeError("expected string type got %s instead." % type(path))
 * 
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 * 
 *         h_file = hdfsOpenFile(self.fs, PyString_AS_STRING(path), flags, bufferSize, replication, blocksize)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cyhdfs.pyx":324
 *         self._complain_no_conn()
 * 
 *         h_file = hdfsOpenFile(self.fs, PyString_AS_STRING(path), flags, bufferSize, replication, blocksize)             # <<<<<<<<<<<<<<
 *         if h_file is NULL:
 *             raise HDFSIOError("""Cant open file at "%s" flags=%d bufferSize=%d replication=%d blocksize=%d""" % (
 */
  __pyx_v_h_file = hdfsOpenFile(__pyx_v_self->fs, PyString_AS_STRING(__pyx_v_path), __pyx_v_flags, __pyx_v_bufferSize, __pyx_v_replication, __pyx_v_blocksize);

  /* "cyhdfs.pyx":325
 * 
 *         h_file = hdfsOpenFile(self.fs, PyString_AS_STRING(path), flags, bufferSize, replication, blocksize)
 *         if h_file is NULL:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("""Cant open file at "%s" flags=%d bufferSize=%d replication=%d blocksize=%d""" % (
 *             path, flags, bufferSize, replication, blocksize))
 */
  __pyx_t_1 = (__pyx_v_h_file == NULL);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":326
 *         h_file = hdfsOpenFile(self.fs, PyString_AS_STRING(path), flags, bufferSize, replication, blocksize)
 *         if h_file is NULL:
 *             raise HDFSIOError("""Cant open file at "%s" flags=%d bufferSize=%d replication=%d blocksize=%d""" % (             # <<<<<<<<<<<<<<
 *             path, flags, bufferSize, replication, blocksize))
 * 
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "cyhdfs.pyx":327
 *         if h_file is NULL:
 *             raise HDFSIOError("""Cant open file at "%s" flags=%d bufferSize=%d replication=%d blocksize=%d""" % (
 *             path, flags, bufferSize, replication, blocksize))             # <<<<<<<<<<<<<<
 * 
 *         if flags & O_WRONLY == O_WRONLY:
 */
    __pyx_t_3 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyInt_FromLong(__pyx_v_bufferSize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyInt_FromLong(__pyx_v_replication); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyInt_FromLong(__pyx_v_blocksize); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_path);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_path);
    __Pyx_GIVEREF(__pyx_v_path);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __Pyx_Raise(__pyx_t_6, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cyhdfs.pyx":329
 *             path, flags, bufferSize, replication, blocksize))
 * 
 *         if flags & O_WRONLY == O_WRONLY:             # <<<<<<<<<<<<<<
 *             fl = HDFSWriteFile.__new__(HDFSWriteFile)
 *             hdfs_file_factory(fl, self, path, h_file, self.fs, flags, bufferSize, replication, blocksize)
 */
  __pyx_t_1 = ((__pyx_v_flags & O_WRONLY) == O_WRONLY);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":330
 * 
 *         if flags & O_WRONLY == O_WRONLY:
 *             fl = HDFSWriteFile.__new__(HDFSWriteFile)             # <<<<<<<<<<<<<<
 *             hdfs_file_factory(fl, self, path, h_file, self.fs, flags, bufferSize, replication, blocksize)
 *         elif flags & O_RDONLY == O_RDONLY:
 */
    __pyx_t_6 = __Pyx_tp_new(((PyObject*)__pyx_ptype_6cyhdfs_HDFSWriteFile)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_fl = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "cyhdfs.pyx":331
 *         if flags & O_WRONLY == O_WRONLY:
 *             fl = HDFSWriteFile.__new__(HDFSWriteFile)
 *             hdfs_file_factory(fl, self, path, h_file, self.fs, flags, bufferSize, replication, blocksize)             # <<<<<<<<<<<<<<
 *         elif flags & O_RDONLY == O_RDONLY:
 *             fl = HDFSReadFile.__new__(HDFSReadFile)
 */
    if (!(likely(((__pyx_v_fl) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_fl, __pyx_ptype_6cyhdfs_HDFSFile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = __pyx_v_fl;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_f_6cyhdfs_hdfs_file_factory(((struct __pyx_obj_6cyhdfs_HDFSFile *)__pyx_t_6), ((PyObject *)__pyx_v_self), __pyx_v_path, __pyx_v_h_file, __pyx_v_self->fs, __pyx_v_flags, __pyx_v_bufferSize, __pyx_v_replication, __pyx_v_blocksize);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L5;
  }

  /* "cyhdfs.pyx":332
 *             fl = HDFSWriteFile.__new__(HDFSWriteFile)
 *             hdfs_file_factory(fl, self, path, h_file, self.fs, flags, bufferSize, replication, blocksize)
 *         elif flags & O_RDONLY == O_RDONLY:             # <<<<<<<<<<<<<<
 *             fl = HDFSReadFile.__new__(HDFSReadFile)
 *             hdfs_file_factory(fl, self, path, h_file, self.fs, flags, bufferSize, replication, blocksize)
 */
  __pyx_t_1 = ((__pyx_v_flags & O_RDONLY) == O_RDONLY);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":333
 *             hdfs_file_factory(fl, self, path, h_file, self.fs, flags, bufferSize, replication, blocksize)
 *         elif flags & O_RDONLY == O_RDONLY:
 *             fl = HDFSReadFile.__new__(HDFSReadFile)             # <<<<<<<<<<<<<<
 *             hdfs_file_factory(fl, self, path, h_file, self.fs, flags, bufferSize, replication, blocksize)
 *         else:
 */
    __pyx_t_6 = __Pyx_tp_new(((PyObject*)__pyx_ptype_6cyhdfs_HDFSReadFile)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_fl = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "cyhdfs.pyx":334
 *         elif flags & O_RDONLY == O_RDONLY:
 *             fl = HDFSReadFile.__new__(HDFSReadFile)
 *             hdfs_file_factory(fl, self, path, h_file, self.fs, flags, bufferSize, replication, blocksize)             # <<<<<<<<<<<<<<
 *         else:
 *             raise HDFSIOError("Open mode %d not supported." % flags)
 */
    if (!(likely(((__pyx_v_fl) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_fl, __pyx_ptype_6cyhdfs_HDFSFile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = __pyx_v_fl;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_f_6cyhdfs_hdfs_file_factory(((struct __pyx_obj_6cyhdfs_HDFSFile *)__pyx_t_6), ((PyObject *)__pyx_v_self), __pyx_v_path, __pyx_v_h_file, __pyx_v_self->fs, __pyx_v_flags, __pyx_v_bufferSize, __pyx_v_replication, __pyx_v_blocksize);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "cyhdfs.pyx":336
 *             hdfs_file_factory(fl, self, path, h_file, self.fs, flags, bufferSize, replication, blocksize)
 *         else:
 *             raise HDFSIOError("Open mode %d not supported." % flags)             # <<<<<<<<<<<<<<
 *         self.open_files.add(fl)
 *         return fl
 */
    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  /* "cyhdfs.pyx":337
 *         else:
 *             raise HDFSIOError("Open mode %d not supported." % flags)
 *         self.open_files.add(fl)             # <<<<<<<<<<<<<<
 *         return fl
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->open_files, __pyx_n_s__add); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_fl);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_fl);
  __Pyx_GIVEREF(__pyx_v_fl);
  __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "cyhdfs.pyx":338
 *             raise HDFSIOError("Open mode %d not supported." % flags)
 *         self.open_files.add(fl)
 *         return fl             # <<<<<<<<<<<<<<
 * 
 *     def exists(self, char * path):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_fl);
  __pyx_r = __pyx_v_fl;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.open_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_19exists(PyObject *__pyx_v_self, PyObject *__pyx_arg_path); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_18exists[] = "HDFSConnection.exists(self, char *path)\n\n            :return: Checks if a given path exsits on the filesystem\n            :rtype: bool\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_19exists(PyObject *__pyx_v_self, PyObject *__pyx_arg_path) {
  char *__pyx_v_path;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("exists (wrapper)", 0);
  assert(__pyx_arg_path); {
    __pyx_v_path = PyBytes_AsString(__pyx_arg_path); if (unlikely((!__pyx_v_path) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.exists", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_18exists(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self), ((char *)__pyx_v_path));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":340
 *         return fl
 * 
 *     def exists(self, char * path):             # <<<<<<<<<<<<<<
 *         """
 *             :return: Checks if a given path exsits on the filesystem
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_18exists(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("exists", 0);

  /* "cyhdfs.pyx":345
 *             :rtype: bool
 *         """
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         if hdfsExists(self.fs, path) == 0:
 *             return True
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":346
 *         """
 *         self._complain_no_conn()
 *         if hdfsExists(self.fs, path) == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         return False
 */
  __pyx_t_2 = (hdfsExists(__pyx_v_self->fs, __pyx_v_path) == 0);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":347
 *         self._complain_no_conn()
 *         if hdfsExists(self.fs, path) == 0:
 *             return True             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":348
 *         if hdfsExists(self.fs, path) == 0:
 *             return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.exists", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":351
 * 
 * 
 *     cdef _close_fs_files(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             HDFSFile f
 */

static PyObject *__pyx_f_6cyhdfs_14HDFSConnection__close_fs_files(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self) {
  struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_f = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_close_fs_files", 0);

  /* "cyhdfs.pyx":354
 *         cdef:
 *             HDFSFile f
 *         if not self._connected:             # <<<<<<<<<<<<<<
 *             return
 *         for f in self.open_files:
 */
  __pyx_t_1 = (!__pyx_v_self->_connected);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":355
 *             HDFSFile f
 *         if not self._connected:
 *             return             # <<<<<<<<<<<<<<
 *         for f in self.open_files:
 *             f._close()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":356
 *         if not self._connected:
 *             return
 *         for f in self.open_files:             # <<<<<<<<<<<<<<
 *             f._close()
 * 
 */
  if (PyList_CheckExact(__pyx_v_self->open_files) || PyTuple_CheckExact(__pyx_v_self->open_files)) {
    __pyx_t_2 = __pyx_v_self->open_files; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_self->open_files); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __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_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __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_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_6cyhdfs_HDFSFile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_f));
    __pyx_v_f = ((struct __pyx_obj_6cyhdfs_HDFSFile *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "cyhdfs.pyx":357
 *             return
 *         for f in self.open_files:
 *             f._close()             # <<<<<<<<<<<<<<
 * 
 * 
 */
    ((struct __pyx_vtabstruct_6cyhdfs_HDFSFile *)__pyx_v_f->__pyx_vtab)->_close(__pyx_v_f);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection._close_fs_files", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_21delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_20delete[] = "HDFSConnection.delete(self, char *path, int recursive=1)\n\n            Delete file\n            :param path: The path of the file.\n            :return: None\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_21delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  char *__pyx_v_path;
  int __pyx_v_recursive;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("delete (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__recursive,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recursive);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "delete") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_path) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    if (values[1]) {
      __pyx_v_recursive = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_recursive = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("delete", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.delete", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_20delete(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self), __pyx_v_path, __pyx_v_recursive);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":361
 * 
 * 
 *     def delete(self, char * path, int recursive = 1):             # <<<<<<<<<<<<<<
 *         """
 *             Delete file
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_20delete(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path, int __pyx_v_recursive) {
  int __pyx_v_res;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("delete", 0);

  /* "cyhdfs.pyx":369
 *         cdef:
 *             int res
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         IF HADOOP_DELETE_RECURSIVE:
 *             res = hdfsDelete(self.fs, path, recursive)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":371
 *         self._complain_no_conn()
 *         IF HADOOP_DELETE_RECURSIVE:
 *             res = hdfsDelete(self.fs, path, recursive)             # <<<<<<<<<<<<<<
 *         ELSE:
 *             res = hdfsDelete(self.fs, path)
 */
  __pyx_v_res = hdfsDelete(__pyx_v_self->fs, __pyx_v_path, __pyx_v_recursive);

  /* "cyhdfs.pyx":374
 *         ELSE:
 *             res = hdfsDelete(self.fs, path)
 *         if res < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsDelete error in %s" % repr(self))
 * 
 */
  __pyx_t_2 = (__pyx_v_res < 0);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":375
 *             res = hdfsDelete(self.fs, path)
 *         if res < 0:
 *             raise HDFSIOError("hdfsDelete error in %s" % repr(self))             # <<<<<<<<<<<<<<
 * 
 *     def rename(self, char * old_path, char * new_path):
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.delete", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_23rename(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_22rename[] = "HDFSConnection.rename(self, char *old_path, char *new_path)\n\n            Rename file.\n            :param oldPath: The path of the source file. \n            :param newPath: The path of the destination file. \n            :return: None\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_23rename(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  char *__pyx_v_old_path;
  char *__pyx_v_new_path;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rename (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__old_path,&__pyx_n_s__new_path,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__old_path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__new_path)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rename", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rename") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_old_path = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_old_path) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_new_path = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_new_path) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rename", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.rename", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_22rename(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self), __pyx_v_old_path, __pyx_v_new_path);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":377
 *             raise HDFSIOError("hdfsDelete error in %s" % repr(self))
 * 
 *     def rename(self, char * old_path, char * new_path):             # <<<<<<<<<<<<<<
 *         """
 *             Rename file.
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_22rename(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_old_path, char *__pyx_v_new_path) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rename", 0);

  /* "cyhdfs.pyx":384
 *             :return: None
 *         """
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         if hdfsRename(self.fs, old_path, new_path) < 0:
 *             raise HDFSIOError("hdfsRename error in %s" % repr(self))
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":385
 *         """
 *         self._complain_no_conn()
 *         if hdfsRename(self.fs, old_path, new_path) < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsRename error in %s" % repr(self))
 * 
 */
  __pyx_t_2 = (hdfsRename(__pyx_v_self->fs, __pyx_v_old_path, __pyx_v_new_path) < 0);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":386
 *         self._complain_no_conn()
 *         if hdfsRename(self.fs, old_path, new_path) < 0:
 *             raise HDFSIOError("hdfsRename error in %s" % repr(self))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.rename", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_25get_cwd(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_24get_cwd[] = "HDFSConnection.get_cwd(self)\n\n            Get the current working directory for the given filesystem.\n            :return: current working directory path\n            :rtype: string\n\n            .. note::\n                max path length can be set at compile time defaults to 1024\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_25get_cwd(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_cwd (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_24get_cwd(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":390
 * 
 * 
 *     def get_cwd(self):             # <<<<<<<<<<<<<<
 *         """
 *             Get the current working directory for the given filesystem.
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_24get_cwd(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self) {
  char *__pyx_v_ret;
  char __pyx_v_buf[1024];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_cwd", 0);

  /* "cyhdfs.pyx":402
 *             char * ret
 *             char[MAX_PATH_LENGTH] buf
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         ret = hdfsGetWorkingDirectory(self.fs, buf, MAX_PATH_LENGTH)
 *         if ret is NULL:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":403
 *             char[MAX_PATH_LENGTH] buf
 *         self._complain_no_conn()
 *         ret = hdfsGetWorkingDirectory(self.fs, buf, MAX_PATH_LENGTH)             # <<<<<<<<<<<<<<
 *         if ret is NULL:
 *             raise HDFSError("hdfsGetWorkingDirectory error in %s" % repr(self))
 */
  __pyx_v_ret = hdfsGetWorkingDirectory(__pyx_v_self->fs, __pyx_v_buf, 1024);

  /* "cyhdfs.pyx":404
 *         self._complain_no_conn()
 *         ret = hdfsGetWorkingDirectory(self.fs, buf, MAX_PATH_LENGTH)
 *         if ret is NULL:             # <<<<<<<<<<<<<<
 *             raise HDFSError("hdfsGetWorkingDirectory error in %s" % repr(self))
 *         return ret
 */
  __pyx_t_2 = (__pyx_v_ret == NULL);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":405
 *         ret = hdfsGetWorkingDirectory(self.fs, buf, MAX_PATH_LENGTH)
 *         if ret is NULL:
 *             raise HDFSError("hdfsGetWorkingDirectory error in %s" % repr(self))             # <<<<<<<<<<<<<<
 *         return ret
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":406
 *         if ret is NULL:
 *             raise HDFSError("hdfsGetWorkingDirectory error in %s" % repr(self))
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     def set_cwd(self, char * path):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyBytes_FromString(__pyx_v_ret); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.get_cwd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_27set_cwd(PyObject *__pyx_v_self, PyObject *__pyx_arg_path); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_26set_cwd[] = "HDFSConnection.set_cwd(self, char *path)\n\n            Set the working directory. All relative  paths will be resolved relative to it.\n            :param path: The path of the new 'cwd'. \n            :return: None\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_27set_cwd(PyObject *__pyx_v_self, PyObject *__pyx_arg_path) {
  char *__pyx_v_path;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_cwd (wrapper)", 0);
  assert(__pyx_arg_path); {
    __pyx_v_path = PyBytes_AsString(__pyx_arg_path); if (unlikely((!__pyx_v_path) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.set_cwd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_26set_cwd(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self), ((char *)__pyx_v_path));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":408
 *         return ret
 * 
 *     def set_cwd(self, char * path):             # <<<<<<<<<<<<<<
 *         """
 *             Set the working directory. All relative  paths will be resolved relative to it.
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_26set_cwd(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_cwd", 0);

  /* "cyhdfs.pyx":414
 *             :return: None
 *         """
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         if hdfsSetWorkingDirectory(self.fs,path) < 0:
 *             raise HDFSIOError("hdfsSetWorkingDirectory error in %s" % repr(self))
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":415
 *         """
 *         self._complain_no_conn()
 *         if hdfsSetWorkingDirectory(self.fs,path) < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsSetWorkingDirectory error in %s" % repr(self))
 * 
 */
  __pyx_t_2 = (hdfsSetWorkingDirectory(__pyx_v_self->fs, __pyx_v_path) < 0);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":416
 *         self._complain_no_conn()
 *         if hdfsSetWorkingDirectory(self.fs,path) < 0:
 *             raise HDFSIOError("hdfsSetWorkingDirectory error in %s" % repr(self))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.set_cwd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_29set_replication(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_28set_replication[] = "HDFSConnection.set_replication(self, char *path, int16_t replication)\n\n            Set the replication of the specified file to the supplied value\n            :param path: The path of the file. \n            :return: None\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_29set_replication(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  char *__pyx_v_path;
  int16_t __pyx_v_replication;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_replication (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__replication,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__replication)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_replication", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_replication") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_path = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_path) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_replication = __Pyx_PyInt_from_py_int16_t(values[1]); if (unlikely((__pyx_v_replication == (int16_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_replication", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.set_replication", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_28set_replication(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self), __pyx_v_path, __pyx_v_replication);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":419
 * 
 * 
 *     def set_replication(self, char * path, stdint.int16_t replication):             # <<<<<<<<<<<<<<
 *         """
 *             Set the replication of the specified file to the supplied value
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_28set_replication(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path, int16_t __pyx_v_replication) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_replication", 0);

  /* "cyhdfs.pyx":425
 *             :return: None
 *         """
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         if hdfsSetReplication(self.fs, path, replication) < 0:
 *             raise HDFSIOError("hdfsSetReplication error in %s" % repr(self))
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":426
 *         """
 *         self._complain_no_conn()
 *         if hdfsSetReplication(self.fs, path, replication) < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsSetReplication error in %s" % repr(self))
 * 
 */
  __pyx_t_2 = (hdfsSetReplication(__pyx_v_self->fs, __pyx_v_path, __pyx_v_replication) < 0);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":427
 *         self._complain_no_conn()
 *         if hdfsSetReplication(self.fs, path, replication) < 0:
 *             raise HDFSIOError("hdfsSetReplication error in %s" % repr(self))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.set_replication", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_31mkdir(PyObject *__pyx_v_self, PyObject *__pyx_arg_path); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_30mkdir[] = "HDFSConnection.mkdir(self, char *path)\n\n            Make the given file and all non-existent parents into directories.\n            :param path: The path of the directory. \n            :return: None\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_31mkdir(PyObject *__pyx_v_self, PyObject *__pyx_arg_path) {
  char *__pyx_v_path;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mkdir (wrapper)", 0);
  assert(__pyx_arg_path); {
    __pyx_v_path = PyBytes_AsString(__pyx_arg_path); if (unlikely((!__pyx_v_path) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.mkdir", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_30mkdir(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self), ((char *)__pyx_v_path));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":430
 * 
 * 
 *     def mkdir(self, char * path):             # <<<<<<<<<<<<<<
 *         """
 *             Make the given file and all non-existent parents into directories.
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_30mkdir(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mkdir", 0);

  /* "cyhdfs.pyx":436
 *             :return: None
 *         """
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         if hdfsCreateDirectory(self.fs, path) < 0:
 *             raise HDFSIOError("hdfsCreateDirectory error in %s" % repr(self))
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":437
 *         """
 *         self._complain_no_conn()
 *         if hdfsCreateDirectory(self.fs, path) < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsCreateDirectory error in %s" % repr(self))
 * 
 */
  __pyx_t_2 = (hdfsCreateDirectory(__pyx_v_self->fs, __pyx_v_path) < 0);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":438
 *         self._complain_no_conn()
 *         if hdfsCreateDirectory(self.fs, path) < 0:
 *             raise HDFSIOError("hdfsCreateDirectory error in %s" % repr(self))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.mkdir", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_33list_dir(PyObject *__pyx_v_self, PyObject *__pyx_arg_path); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_32list_dir[] = "HDFSConnection.list_dir(self, char *path)\n\n            Get list of files/directories for a given directory-path. \n            :param path: The path of the directory. \n            :rtype: List of EntryInfo instances\n\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_33list_dir(PyObject *__pyx_v_self, PyObject *__pyx_arg_path) {
  char *__pyx_v_path;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("list_dir (wrapper)", 0);
  assert(__pyx_arg_path); {
    __pyx_v_path = PyBytes_AsString(__pyx_arg_path); if (unlikely((!__pyx_v_path) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.list_dir", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_32list_dir(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self), ((char *)__pyx_v_path));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":441
 * 
 * 
 *     def list_dir(self, char * path):             # <<<<<<<<<<<<<<
 *         """
 *             Get list of files/directories for a given directory-path.
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_32list_dir(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path) {
  int __pyx_v_i;
  int __pyx_v_num_entries;
  hdfsFileInfo *__pyx_v_entry_list;
  hdfsFileInfo __pyx_v_entry;
  PyObject *__pyx_v_ret_list = NULL;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("list_dir", 0);

  /* "cyhdfs.pyx":449
 *         """
 *         cdef:
 *             int i = 0             # <<<<<<<<<<<<<<
 *             int num_entries = 0
 *             hdfsFileInfo * entry_list  # entry list
 */
  __pyx_v_i = 0;

  /* "cyhdfs.pyx":450
 *         cdef:
 *             int i = 0
 *             int num_entries = 0             # <<<<<<<<<<<<<<
 *             hdfsFileInfo * entry_list  # entry list
 *             hdfsFileInfo entry
 */
  __pyx_v_num_entries = 0;

  /* "cyhdfs.pyx":454
 *             hdfsFileInfo entry
 * 
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         entry_list = hdfsListDirectory(self.fs, path, &num_entries)
 *         if entry_list is NULL:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":455
 * 
 *         self._complain_no_conn()
 *         entry_list = hdfsListDirectory(self.fs, path, &num_entries)             # <<<<<<<<<<<<<<
 *         if entry_list is NULL:
 *             raise HDFSIOError("hdfsListDirectory(path=%s) error in %s" % (path, repr(self)))
 */
  __pyx_v_entry_list = hdfsListDirectory(__pyx_v_self->fs, __pyx_v_path, (&__pyx_v_num_entries));

  /* "cyhdfs.pyx":456
 *         self._complain_no_conn()
 *         entry_list = hdfsListDirectory(self.fs, path, &num_entries)
 *         if entry_list is NULL:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsListDirectory(path=%s) error in %s" % (path, repr(self)))
 *         if num_entries == 0:
 */
  __pyx_t_2 = (__pyx_v_entry_list == NULL);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":457
 *         entry_list = hdfsListDirectory(self.fs, path, &num_entries)
 *         if entry_list is NULL:
 *             raise HDFSIOError("hdfsListDirectory(path=%s) error in %s" % (path, repr(self)))             # <<<<<<<<<<<<<<
 *         if num_entries == 0:
 *             return []
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyBytes_FromString(__pyx_v_path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_4 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":458
 *         if entry_list is NULL:
 *             raise HDFSIOError("hdfsListDirectory(path=%s) error in %s" % (path, repr(self)))
 *         if num_entries == 0:             # <<<<<<<<<<<<<<
 *             return []
 *         try:
 */
  __pyx_t_2 = (__pyx_v_num_entries == 0);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":459
 *             raise HDFSIOError("hdfsListDirectory(path=%s) error in %s" % (path, repr(self)))
 *         if num_entries == 0:
 *             return []             # <<<<<<<<<<<<<<
 *         try:
 *             ret_list = []
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = ((PyObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cyhdfs.pyx":460
 *         if num_entries == 0:
 *             return []
 *         try:             # <<<<<<<<<<<<<<
 *             ret_list = []
 *             while i < num_entries:
 */
  /*try:*/ {

    /* "cyhdfs.pyx":461
 *             return []
 *         try:
 *             ret_list = []             # <<<<<<<<<<<<<<
 *             while i < num_entries:
 *                 entry = entry_list[i]
 */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_ret_list = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "cyhdfs.pyx":462
 *         try:
 *             ret_list = []
 *             while i < num_entries:             # <<<<<<<<<<<<<<
 *                 entry = entry_list[i]
 *                 e = EntryInfo(entry.mKind,
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_i < __pyx_v_num_entries);
      if (!__pyx_t_2) break;

      /* "cyhdfs.pyx":463
 *             ret_list = []
 *             while i < num_entries:
 *                 entry = entry_list[i]             # <<<<<<<<<<<<<<
 *                 e = EntryInfo(entry.mKind,
 *                               entry.mName,
 */
      __pyx_v_entry = (__pyx_v_entry_list[__pyx_v_i]);

      /* "cyhdfs.pyx":464
 *             while i < num_entries:
 *                 entry = entry_list[i]
 *                 e = EntryInfo(entry.mKind,             # <<<<<<<<<<<<<<
 *                               entry.mName,
 *                               entry.mLastMod,
 */
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__EntryInfo); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyInt_FromLong(__pyx_v_entry.mKind); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(__pyx_t_5);

      /* "cyhdfs.pyx":465
 *                 entry = entry_list[i]
 *                 e = EntryInfo(entry.mKind,
 *                               entry.mName,             # <<<<<<<<<<<<<<
 *                               entry.mLastMod,
 *                               entry.mSize,
 */
      __pyx_t_1 = PyBytes_FromString(__pyx_v_entry.mName); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));

      /* "cyhdfs.pyx":466
 *                 e = EntryInfo(entry.mKind,
 *                               entry.mName,
 *                               entry.mLastMod,             # <<<<<<<<<<<<<<
 *                               entry.mSize,
 *                               entry.mReplication,
 */
      __pyx_t_3 = __Pyx_PyInt_to_py_tTime(__pyx_v_entry.mLastMod); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(__pyx_t_3);

      /* "cyhdfs.pyx":467
 *                               entry.mName,
 *                               entry.mLastMod,
 *                               entry.mSize,             # <<<<<<<<<<<<<<
 *                               entry.mReplication,
 *                               entry.mBlockSize,
 */
      __pyx_t_6 = __Pyx_PyInt_to_py_int64_t(__pyx_v_entry.mSize); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(__pyx_t_6);

      /* "cyhdfs.pyx":468
 *                               entry.mLastMod,
 *                               entry.mSize,
 *                               entry.mReplication,             # <<<<<<<<<<<<<<
 *                               entry.mBlockSize,
 *                               entry.mOwner,
 */
      __pyx_t_7 = PyInt_FromLong(__pyx_v_entry.mReplication); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(__pyx_t_7);

      /* "cyhdfs.pyx":469
 *                               entry.mSize,
 *                               entry.mReplication,
 *                               entry.mBlockSize,             # <<<<<<<<<<<<<<
 *                               entry.mOwner,
 *                               entry.mGroup,
 */
      __pyx_t_8 = __Pyx_PyInt_to_py_int64_t(__pyx_v_entry.mBlockSize); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(__pyx_t_8);

      /* "cyhdfs.pyx":470
 *                               entry.mReplication,
 *                               entry.mBlockSize,
 *                               entry.mOwner,             # <<<<<<<<<<<<<<
 *                               entry.mGroup,
 *                               entry.mPermissions,
 */
      __pyx_t_9 = PyBytes_FromString(__pyx_v_entry.mOwner); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_9));

      /* "cyhdfs.pyx":471
 *                               entry.mBlockSize,
 *                               entry.mOwner,
 *                               entry.mGroup,             # <<<<<<<<<<<<<<
 *                               entry.mPermissions,
 *                               entry.mLastAccess)
 */
      __pyx_t_10 = PyBytes_FromString(__pyx_v_entry.mGroup); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_10));

      /* "cyhdfs.pyx":472
 *                               entry.mOwner,
 *                               entry.mGroup,
 *                               entry.mPermissions,             # <<<<<<<<<<<<<<
 *                               entry.mLastAccess)
 *                 ret_list.append(e)
 */
      __pyx_t_11 = PyInt_FromLong(__pyx_v_entry.mPermissions); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(__pyx_t_11);

      /* "cyhdfs.pyx":473
 *                               entry.mGroup,
 *                               entry.mPermissions,
 *                               entry.mLastAccess)             # <<<<<<<<<<<<<<
 *                 ret_list.append(e)
 *                 i += 1
 */
      __pyx_t_12 = __Pyx_PyInt_to_py_tTime(__pyx_v_entry.mLastAccess); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = PyTuple_New(10); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_13, 1, ((PyObject *)__pyx_t_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
      PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_13, 4, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_13, 5, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_13, 6, ((PyObject *)__pyx_t_9));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
      PyTuple_SET_ITEM(__pyx_t_13, 7, ((PyObject *)__pyx_t_10));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
      PyTuple_SET_ITEM(__pyx_t_13, 8, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_13, 9, __pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_12);
      __pyx_t_5 = 0;
      __pyx_t_1 = 0;
      __pyx_t_3 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_t_11 = 0;
      __pyx_t_12 = 0;
      __pyx_t_12 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_12;
      __pyx_t_12 = 0;

      /* "cyhdfs.pyx":474
 *                               entry.mPermissions,
 *                               entry.mLastAccess)
 *                 ret_list.append(e)             # <<<<<<<<<<<<<<
 *                 i += 1
 *         finally:
 */
      __pyx_t_14 = PyList_Append(__pyx_v_ret_list, __pyx_v_e); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L6;}

      /* "cyhdfs.pyx":475
 *                               entry.mLastAccess)
 *                 ret_list.append(e)
 *                 i += 1             # <<<<<<<<<<<<<<
 *         finally:
 *             hdfsFreeFileInfo(entry_list, num_entries)
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }
  }

  /* "cyhdfs.pyx":477
 *                 i += 1
 *         finally:
 *             hdfsFreeFileInfo(entry_list, num_entries)             # <<<<<<<<<<<<<<
 *         return ret_list
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L7;
    __pyx_L6: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L7;
    }
    __pyx_L7:;
    hdfsFreeFileInfo(__pyx_v_entry_list, __pyx_v_num_entries);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "cyhdfs.pyx":478
 *         finally:
 *             hdfsFreeFileInfo(entry_list, num_entries)
 *         return ret_list             # <<<<<<<<<<<<<<
 * 
 *     def path_info(self, char * path):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ret_list));
  __pyx_r = ((PyObject *)__pyx_v_ret_list);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.list_dir", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret_list);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_35path_info(PyObject *__pyx_v_self, PyObject *__pyx_arg_path); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_34path_info[] = "HDFSConnection.path_info(self, char *path)\n\n            Get information about a path.\n            :param path: The path of the file. \n            :rtype: list of EntryInfo instances\n\n            :Example:\n\n            conn.path_info('/tmp/cyhdfs/test.txt') ->\n            EntryInfo(kind=70, \n                      name='hdfs://foo.ru:54310/tmp/cyhdfs/test.txt', \n                      last_mod=1347653165, \n                      size=0, \n                      replication=3, \n                      blocksize=67108864, \n                      owner='hduser', \n                      group='supergroup', \n                      permissions=420, \n                      last_access=1347653165\n                    )\n\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_35path_info(PyObject *__pyx_v_self, PyObject *__pyx_arg_path) {
  char *__pyx_v_path;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("path_info (wrapper)", 0);
  assert(__pyx_arg_path); {
    __pyx_v_path = PyBytes_AsString(__pyx_arg_path); if (unlikely((!__pyx_v_path) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.path_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_34path_info(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self), ((char *)__pyx_v_path));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":480
 *         return ret_list
 * 
 *     def path_info(self, char * path):             # <<<<<<<<<<<<<<
 *         """
 *             Get information about a path.
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_34path_info(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path) {
  hdfsFileInfo *__pyx_v_entry;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("path_info", 0);

  /* "cyhdfs.pyx":504
 *         cdef hdfsFileInfo * entry
 * 
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         entry = hdfsGetPathInfo(self.fs, path)
 *         if entry is NULL:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":505
 * 
 *         self._complain_no_conn()
 *         entry = hdfsGetPathInfo(self.fs, path)             # <<<<<<<<<<<<<<
 *         if entry is NULL:
 *             raise HDFSError("hdfsGetPathInfo(path=%s) error in %s" % (path, repr(self)))
 */
  __pyx_v_entry = hdfsGetPathInfo(__pyx_v_self->fs, __pyx_v_path);

  /* "cyhdfs.pyx":506
 *         self._complain_no_conn()
 *         entry = hdfsGetPathInfo(self.fs, path)
 *         if entry is NULL:             # <<<<<<<<<<<<<<
 *             raise HDFSError("hdfsGetPathInfo(path=%s) error in %s" % (path, repr(self)))
 *         try:
 */
  __pyx_t_2 = (__pyx_v_entry == NULL);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":507
 *         entry = hdfsGetPathInfo(self.fs, path)
 *         if entry is NULL:
 *             raise HDFSError("hdfsGetPathInfo(path=%s) error in %s" % (path, repr(self)))             # <<<<<<<<<<<<<<
 *         try:
 *             e = EntryInfo(entry.mKind,
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyBytes_FromString(__pyx_v_path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_4 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":508
 *         if entry is NULL:
 *             raise HDFSError("hdfsGetPathInfo(path=%s) error in %s" % (path, repr(self)))
 *         try:             # <<<<<<<<<<<<<<
 *             e = EntryInfo(entry.mKind,
 *                           entry.mName,
 */
  /*try:*/ {

    /* "cyhdfs.pyx":509
 *             raise HDFSError("hdfsGetPathInfo(path=%s) error in %s" % (path, repr(self)))
 *         try:
 *             e = EntryInfo(entry.mKind,             # <<<<<<<<<<<<<<
 *                           entry.mName,
 *                           entry.mLastMod,
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__EntryInfo); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyInt_FromLong(__pyx_v_entry->mKind); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(__pyx_t_5);

    /* "cyhdfs.pyx":510
 *         try:
 *             e = EntryInfo(entry.mKind,
 *                           entry.mName,             # <<<<<<<<<<<<<<
 *                           entry.mLastMod,
 *                           entry.mSize,
 */
    __pyx_t_1 = PyBytes_FromString(__pyx_v_entry->mName); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));

    /* "cyhdfs.pyx":511
 *             e = EntryInfo(entry.mKind,
 *                           entry.mName,
 *                           entry.mLastMod,             # <<<<<<<<<<<<<<
 *                           entry.mSize,
 *                           entry.mReplication,
 */
    __pyx_t_3 = __Pyx_PyInt_to_py_tTime(__pyx_v_entry->mLastMod); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "cyhdfs.pyx":512
 *                           entry.mName,
 *                           entry.mLastMod,
 *                           entry.mSize,             # <<<<<<<<<<<<<<
 *                           entry.mReplication,
 *                           entry.mBlockSize,
 */
    __pyx_t_6 = __Pyx_PyInt_to_py_int64_t(__pyx_v_entry->mSize); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(__pyx_t_6);

    /* "cyhdfs.pyx":513
 *                           entry.mLastMod,
 *                           entry.mSize,
 *                           entry.mReplication,             # <<<<<<<<<<<<<<
 *                           entry.mBlockSize,
 *                           entry.mOwner,
 */
    __pyx_t_7 = PyInt_FromLong(__pyx_v_entry->mReplication); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(__pyx_t_7);

    /* "cyhdfs.pyx":514
 *                           entry.mSize,
 *                           entry.mReplication,
 *                           entry.mBlockSize,             # <<<<<<<<<<<<<<
 *                           entry.mOwner,
 *                           entry.mGroup,
 */
    __pyx_t_8 = __Pyx_PyInt_to_py_int64_t(__pyx_v_entry->mBlockSize); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(__pyx_t_8);

    /* "cyhdfs.pyx":515
 *                           entry.mReplication,
 *                           entry.mBlockSize,
 *                           entry.mOwner,             # <<<<<<<<<<<<<<
 *                           entry.mGroup,
 *                           entry.mPermissions,
 */
    __pyx_t_9 = PyBytes_FromString(__pyx_v_entry->mOwner); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));

    /* "cyhdfs.pyx":516
 *                           entry.mBlockSize,
 *                           entry.mOwner,
 *                           entry.mGroup,             # <<<<<<<<<<<<<<
 *                           entry.mPermissions,
 *                           entry.mLastAccess)
 */
    __pyx_t_10 = PyBytes_FromString(__pyx_v_entry->mGroup); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_10));

    /* "cyhdfs.pyx":517
 *                           entry.mOwner,
 *                           entry.mGroup,
 *                           entry.mPermissions,             # <<<<<<<<<<<<<<
 *                           entry.mLastAccess)
 *         finally:
 */
    __pyx_t_11 = PyInt_FromLong(__pyx_v_entry->mPermissions); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(__pyx_t_11);

    /* "cyhdfs.pyx":518
 *                           entry.mGroup,
 *                           entry.mPermissions,
 *                           entry.mLastAccess)             # <<<<<<<<<<<<<<
 *         finally:
 *             hdfsFreeFileInfo(entry, 1)
 */
    __pyx_t_12 = __Pyx_PyInt_to_py_tTime(__pyx_v_entry->mLastAccess); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = PyTuple_New(10); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_13, 1, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_13, 4, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_13, 5, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_13, 6, ((PyObject *)__pyx_t_9));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
    PyTuple_SET_ITEM(__pyx_t_13, 7, ((PyObject *)__pyx_t_10));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
    PyTuple_SET_ITEM(__pyx_t_13, 8, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_13, 9, __pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_12);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_t_11 = 0;
    __pyx_t_12 = 0;
    __pyx_t_12 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
    __pyx_v_e = __pyx_t_12;
    __pyx_t_12 = 0;
  }

  /* "cyhdfs.pyx":520
 *                           entry.mLastAccess)
 *         finally:
 *             hdfsFreeFileInfo(entry, 1)             # <<<<<<<<<<<<<<
 *         return e
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L6;
    __pyx_L5: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L6;
    }
    __pyx_L6:;
    hdfsFreeFileInfo(__pyx_v_entry, 1);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "cyhdfs.pyx":521
 *         finally:
 *             hdfsFreeFileInfo(entry, 1)
 *         return e             # <<<<<<<<<<<<<<
 * 
 *     def get_hosts(self, char * path, tOffset start, tOffset length):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_e);
  __pyx_r = __pyx_v_e;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.path_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_37get_hosts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_36get_hosts[] = "HDFSConnection.get_hosts(self, char *path, tOffset start, tOffset length)\n\n            Get hostnames where a particular block (determined by\n             pos & blocksize) of a file is stored. \n            :param path: The path of the file. \n            :param start: The start of the block.\n            :param length: The length of the block.\n\n            :Example:\n\n            conn.get_hosts(\"/tmp/cyhdfs/test.txt\", 0, 5) -> [['node1.foo.com', 'node2.foo.com']]\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_37get_hosts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  char *__pyx_v_path;
  tOffset __pyx_v_start;
  tOffset __pyx_v_length;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_hosts (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__start,&__pyx_n_s__length,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_hosts", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__length)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_hosts", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_hosts") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_path = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_path) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_start = __Pyx_PyInt_from_py_int64_t(values[1]); if (unlikely((__pyx_v_start == (tOffset)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_length = __Pyx_PyInt_from_py_int64_t(values[2]); if (unlikely((__pyx_v_length == (tOffset)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_hosts", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.get_hosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_36get_hosts(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self), __pyx_v_path, __pyx_v_start, __pyx_v_length);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":523
 *         return e
 * 
 *     def get_hosts(self, char * path, tOffset start, tOffset length):             # <<<<<<<<<<<<<<
 *         """
 *             Get hostnames where a particular block (determined by
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_36get_hosts(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self, char *__pyx_v_path, tOffset __pyx_v_start, tOffset __pyx_v_length) {
  int __pyx_v_block;
  int __pyx_v_host;
  char **__pyx_v__tmp_hosts;
  char ***__pyx_v_hosts;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_block_hosts = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_hosts", 0);

  /* "cyhdfs.pyx":536
 *         """
 *         cdef:
 *             int block = 0             # <<<<<<<<<<<<<<
 *             int host
 *             char ** _tmp_hosts
 */
  __pyx_v_block = 0;

  /* "cyhdfs.pyx":541
 *             char *** hosts
 * 
 *         self._complain_no_conn()             # <<<<<<<<<<<<<<
 *         hosts = hdfsGetHosts(self.fs, path, start, length)
 *         if hosts is NULL:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_complain_no_conn(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":542
 * 
 *         self._complain_no_conn()
 *         hosts = hdfsGetHosts(self.fs, path, start, length)             # <<<<<<<<<<<<<<
 *         if hosts is NULL:
 *             raise HDFSError("hdfsGetHosts(path=%s start=%s length=%s) error in %s" % (path, start, length, repr(self)))
 */
  __pyx_v_hosts = hdfsGetHosts(__pyx_v_self->fs, __pyx_v_path, __pyx_v_start, __pyx_v_length);

  /* "cyhdfs.pyx":543
 *         self._complain_no_conn()
 *         hosts = hdfsGetHosts(self.fs, path, start, length)
 *         if hosts is NULL:             # <<<<<<<<<<<<<<
 *             raise HDFSError("hdfsGetHosts(path=%s start=%s length=%s) error in %s" % (path, start, length, repr(self)))
 *         try:
 */
  __pyx_t_2 = (__pyx_v_hosts == NULL);
  if (__pyx_t_2) {

    /* "cyhdfs.pyx":544
 *         hosts = hdfsGetHosts(self.fs, path, start, length)
 *         if hosts is NULL:
 *             raise HDFSError("hdfsGetHosts(path=%s start=%s length=%s) error in %s" % (path, start, length, repr(self)))             # <<<<<<<<<<<<<<
 *         try:
 *             result = []
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyBytes_FromString(__pyx_v_path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_4 = __Pyx_PyInt_to_py_int64_t(__pyx_v_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_to_py_int64_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __Pyx_Raise(__pyx_t_6, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":545
 *         if hosts is NULL:
 *             raise HDFSError("hdfsGetHosts(path=%s start=%s length=%s) error in %s" % (path, start, length, repr(self)))
 *         try:             # <<<<<<<<<<<<<<
 *             result = []
 *             while 1:
 */
  /*try:*/ {

    /* "cyhdfs.pyx":546
 *             raise HDFSError("hdfsGetHosts(path=%s start=%s length=%s) error in %s" % (path, start, length, repr(self)))
 *         try:
 *             result = []             # <<<<<<<<<<<<<<
 *             while 1:
 *                 if hosts[block] is NULL:
 */
    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_result = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "cyhdfs.pyx":547
 *         try:
 *             result = []
 *             while 1:             # <<<<<<<<<<<<<<
 *                 if hosts[block] is NULL:
 *                     break
 */
    while (1) {
      if (!1) break;

      /* "cyhdfs.pyx":548
 *             result = []
 *             while 1:
 *                 if hosts[block] is NULL:             # <<<<<<<<<<<<<<
 *                     break
 *                 _tmp_hosts =  hosts[block]
 */
      __pyx_t_2 = ((__pyx_v_hosts[__pyx_v_block]) == NULL);
      if (__pyx_t_2) {

        /* "cyhdfs.pyx":549
 *             while 1:
 *                 if hosts[block] is NULL:
 *                     break             # <<<<<<<<<<<<<<
 *                 _tmp_hosts =  hosts[block]
 *                 block_hosts = []
 */
        goto __pyx_L8_break;
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "cyhdfs.pyx":550
 *                 if hosts[block] is NULL:
 *                     break
 *                 _tmp_hosts =  hosts[block]             # <<<<<<<<<<<<<<
 *                 block_hosts = []
 *                 result.append(block_hosts)
 */
      __pyx_v__tmp_hosts = (__pyx_v_hosts[__pyx_v_block]);

      /* "cyhdfs.pyx":551
 *                     break
 *                 _tmp_hosts =  hosts[block]
 *                 block_hosts = []             # <<<<<<<<<<<<<<
 *                 result.append(block_hosts)
 *                 host = 0
 */
      __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L5;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF(((PyObject *)__pyx_v_block_hosts));
      __pyx_v_block_hosts = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "cyhdfs.pyx":552
 *                 _tmp_hosts =  hosts[block]
 *                 block_hosts = []
 *                 result.append(block_hosts)             # <<<<<<<<<<<<<<
 *                 host = 0
 *                 while 1:
 */
      __pyx_t_8 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_v_block_hosts)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L5;}

      /* "cyhdfs.pyx":553
 *                 block_hosts = []
 *                 result.append(block_hosts)
 *                 host = 0             # <<<<<<<<<<<<<<
 *                 while 1:
 *                     if _tmp_hosts[host] is NULL:
 */
      __pyx_v_host = 0;

      /* "cyhdfs.pyx":554
 *                 result.append(block_hosts)
 *                 host = 0
 *                 while 1:             # <<<<<<<<<<<<<<
 *                     if _tmp_hosts[host] is NULL:
 *                         break
 */
      while (1) {
        if (!1) break;

        /* "cyhdfs.pyx":555
 *                 host = 0
 *                 while 1:
 *                     if _tmp_hosts[host] is NULL:             # <<<<<<<<<<<<<<
 *                         break
 *                     block_hosts.append(_tmp_hosts[host])
 */
        __pyx_t_2 = ((__pyx_v__tmp_hosts[__pyx_v_host]) == NULL);
        if (__pyx_t_2) {

          /* "cyhdfs.pyx":556
 *                 while 1:
 *                     if _tmp_hosts[host] is NULL:
 *                         break             # <<<<<<<<<<<<<<
 *                     block_hosts.append(_tmp_hosts[host])
 *                     host += 1
 */
          goto __pyx_L11_break;
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "cyhdfs.pyx":557
 *                     if _tmp_hosts[host] is NULL:
 *                         break
 *                     block_hosts.append(_tmp_hosts[host])             # <<<<<<<<<<<<<<
 *                     host += 1
 *                 block += 1
 */
        __pyx_t_6 = PyBytes_FromString((__pyx_v__tmp_hosts[__pyx_v_host])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L5;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
        __pyx_t_8 = PyList_Append(__pyx_v_block_hosts, ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L5;}
        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;

        /* "cyhdfs.pyx":558
 *                         break
 *                     block_hosts.append(_tmp_hosts[host])
 *                     host += 1             # <<<<<<<<<<<<<<
 *                 block += 1
 *         finally:
 */
        __pyx_v_host = (__pyx_v_host + 1);
      }
      __pyx_L11_break:;

      /* "cyhdfs.pyx":559
 *                     block_hosts.append(_tmp_hosts[host])
 *                     host += 1
 *                 block += 1             # <<<<<<<<<<<<<<
 *         finally:
 *             hdfsFreeHosts(hosts)
 */
      __pyx_v_block = (__pyx_v_block + 1);
    }
    __pyx_L8_break:;
  }

  /* "cyhdfs.pyx":561
 *                 block += 1
 *         finally:
 *             hdfsFreeHosts(hosts)             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L6;
    __pyx_L5: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L6;
    }
    __pyx_L6:;
    hdfsFreeHosts(__pyx_v_hosts);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "cyhdfs.pyx":562
 *         finally:
 *             hdfsFreeHosts(hosts)
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.get_hosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_block_hosts);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":565
 * 
 * 
 *     cdef _disconnect(self):             # <<<<<<<<<<<<<<
 *         cdef int ret
 * 
 */

static PyObject *__pyx_f_6cyhdfs_14HDFSConnection__disconnect(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self) {
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_disconnect", 0);

  /* "cyhdfs.pyx":568
 *         cdef int ret
 * 
 *         if self._connected:             # <<<<<<<<<<<<<<
 *             ret = hdfsDisconnect(self.fs)
 *             if ret < 0:
 */
  if (__pyx_v_self->_connected) {

    /* "cyhdfs.pyx":569
 * 
 *         if self._connected:
 *             ret = hdfsDisconnect(self.fs)             # <<<<<<<<<<<<<<
 *             if ret < 0:
 *                 raise HDFSConnectionError("hdfsDisconnect error in %s" % repr(self))
 */
    __pyx_v_ret = hdfsDisconnect(__pyx_v_self->fs);

    /* "cyhdfs.pyx":570
 *         if self._connected:
 *             ret = hdfsDisconnect(self.fs)
 *             if ret < 0:             # <<<<<<<<<<<<<<
 *                 raise HDFSConnectionError("hdfsDisconnect error in %s" % repr(self))
 *             else:
 */
    __pyx_t_1 = (__pyx_v_ret < 0);
    if (__pyx_t_1) {

      /* "cyhdfs.pyx":571
 *             ret = hdfsDisconnect(self.fs)
 *             if ret < 0:
 *                 raise HDFSConnectionError("hdfsDisconnect error in %s" % repr(self))             # <<<<<<<<<<<<<<
 *             else:
 *                 self._connected = 0
 */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSConnectionError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    /*else*/ {

      /* "cyhdfs.pyx":573
 *                 raise HDFSConnectionError("hdfsDisconnect error in %s" % repr(self))
 *             else:
 *                 self._connected = 0             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
 */
      __pyx_v_self->_connected = 0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection._disconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_39close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cyhdfs_14HDFSConnection_38close[] = "HDFSConnection.close(self)\n\n            Closes all opened with this connection object files.\n            Then calls hdfsDisconnect.\n            Any usage of files opened with this connection after this call will raise error.\n        ";
static PyObject *__pyx_pw_6cyhdfs_14HDFSConnection_39close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_14HDFSConnection_38close(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":575
 *                 self._connected = 0
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """
 *             Closes all opened with this connection object files.
 */

static PyObject *__pyx_pf_6cyhdfs_14HDFSConnection_38close(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "cyhdfs.pyx":581
 *             Any usage of files opened with this connection after this call will raise error.
 *         """
 *         self._close_fs_files()             # <<<<<<<<<<<<<<
 *         self._disconnect()
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_close_fs_files(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":582
 *         """
 *         self._close_fs_files()
 *         self._disconnect()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_disconnect(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static void __pyx_pw_6cyhdfs_14HDFSConnection_41__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6cyhdfs_14HDFSConnection_41__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_6cyhdfs_14HDFSConnection_40__dealloc__(((struct __pyx_obj_6cyhdfs_HDFSConnection *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
}

/* "cyhdfs.pyx":584
 *         self._disconnect()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self._close_fs_files()
 *         self._disconnect()
 */

static void __pyx_pf_6cyhdfs_14HDFSConnection_40__dealloc__(struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "cyhdfs.pyx":585
 * 
 *     def __dealloc__(self):
 *         self._close_fs_files()             # <<<<<<<<<<<<<<
 *         self._disconnect()
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_close_fs_files(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":586
 *     def __dealloc__(self):
 *         self._close_fs_files()
 *         self._disconnect()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_self->__pyx_vtab)->_disconnect(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cyhdfs.HDFSConnection.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_8HDFSFile_1get_stats(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cyhdfs_8HDFSFile_get_stats[] = "HDFSFile.get_stats(self)";
static PyObject *__pyx_pw_6cyhdfs_8HDFSFile_1get_stats(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_stats (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_8HDFSFile_get_stats(((struct __pyx_obj_6cyhdfs_HDFSFile *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":617
 *         cdef unsigned long long _read_bytes
 * 
 *         def get_stats(self):             # <<<<<<<<<<<<<<
 *             return Stats(self._write_ops, self._write_bytes, self._read_ops, self._read_bytes)
 * 
 */

static PyObject *__pyx_pf_6cyhdfs_8HDFSFile_get_stats(struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_stats", 0);

  /* "cyhdfs.pyx":618
 * 
 *         def get_stats(self):
 *             return Stats(self._write_ops, self._write_bytes, self._read_ops, self._read_bytes)             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__Stats); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyLong_FromUnsignedLongLong(__pyx_v_self->_write_ops); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyLong_FromUnsignedLongLong(__pyx_v_self->_write_bytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyLong_FromUnsignedLongLong(__pyx_v_self->_read_ops); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyLong_FromUnsignedLongLong(__pyx_v_self->_read_bytes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cyhdfs.HDFSFile.get_stats", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6cyhdfs_8HDFSFile_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6cyhdfs_8HDFSFile_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_6cyhdfs_8HDFSFile_2__init__(((struct __pyx_obj_6cyhdfs_HDFSFile *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":620
 *             return Stats(self._write_ops, self._write_bytes, self._read_ops, self._read_bytes)
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError("This class cannot be instantiated from Python")
 * 
 */

static int __pyx_pf_6cyhdfs_8HDFSFile_2__init__(CYTHON_UNUSED struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cyhdfs.pyx":621
 * 
 *     def __init__(self):
 *         raise TypeError("This class cannot be instantiated from Python")             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cyhdfs.HDFSFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_8HDFSFile_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6cyhdfs_8HDFSFile_5__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_8HDFSFile_4__repr__(((struct __pyx_obj_6cyhdfs_HDFSFile *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":623
 *         raise TypeError("This class cannot be instantiated from Python")
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return """<HDFSFile path="%s" is_open=%d flags=%d bufferSize=%d replication=%d blocksize=%d>""" % (self.path, self._open, self.flags, self.bufferSize, self.replication, self.blocksize)
 * 
 */

static PyObject *__pyx_pf_6cyhdfs_8HDFSFile_4__repr__(struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "cyhdfs.pyx":624
 * 
 *     def __repr__(self):
 *         return """<HDFSFile path="%s" is_open=%d flags=%d bufferSize=%d replication=%d blocksize=%d>""" % (self.path, self._open, self.flags, self.bufferSize, self.replication, self.blocksize)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_self->bufferSize); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_self->replication); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyInt_FromLong(__pyx_v_self->blocksize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_self->path);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self->path);
  __Pyx_GIVEREF(__pyx_v_self->path);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __pyx_r = ((PyObject *)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cyhdfs.HDFSFile.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_8HDFSFile_7tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cyhdfs_8HDFSFile_6tell[] = "HDFSFile.tell(self)\n\n            Get the current offset in the file, in bytes.\n            :rtype: int\n        ";
static PyObject *__pyx_pw_6cyhdfs_8HDFSFile_7tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tell (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_8HDFSFile_6tell(((struct __pyx_obj_6cyhdfs_HDFSFile *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":627
 * 
 * 
 *     def tell(self):             # <<<<<<<<<<<<<<
 *         """
 *             Get the current offset in the file, in bytes.
 */

static PyObject *__pyx_pf_6cyhdfs_8HDFSFile_6tell(struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_self) {
  tOffset __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tell", 0);

  /* "cyhdfs.pyx":633
 *         """
 *         cdef tOffset ret
 *         if not self._open:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         ret = hdfsTell(self.fs, self.h_file)
 */
  __pyx_t_1 = (!__pyx_v_self->_open);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":634
 *         cdef tOffset ret
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))             # <<<<<<<<<<<<<<
 *         ret = hdfsTell(self.fs, self.h_file)
 *         if ret < 0:
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":635
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         ret = hdfsTell(self.fs, self.h_file)             # <<<<<<<<<<<<<<
 *         if ret < 0:
 *             raise HDFSIOError("hdfsTell returned error code file: %s" % repr(self))
 */
  __pyx_v_ret = hdfsTell(__pyx_v_self->fs, __pyx_v_self->h_file);

  /* "cyhdfs.pyx":636
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         ret = hdfsTell(self.fs, self.h_file)
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsTell returned error code file: %s" % repr(self))
 *         return ret
 */
  __pyx_t_1 = (__pyx_v_ret < 0);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":637
 *         ret = hdfsTell(self.fs, self.h_file)
 *         if ret < 0:
 *             raise HDFSIOError("hdfsTell returned error code file: %s" % repr(self))             # <<<<<<<<<<<<<<
 *         return ret
 * 
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_30), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cyhdfs.pyx":638
 *         if ret < 0:
 *             raise HDFSIOError("hdfsTell returned error code file: %s" % repr(self))
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     cdef int _close(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSFile.tell", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":640
 *         return ret
 * 
 *     cdef int _close(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             int ret
 */

static int __pyx_f_6cyhdfs_8HDFSFile__close(struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_self) {
  int __pyx_v_ret;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_close", 0);

  /* "cyhdfs.pyx":643
 *         cdef:
 *             int ret
 *         if self._open:             # <<<<<<<<<<<<<<
 *             ret = hdfsCloseFile(self.fs, self.h_file)
 *             if ret == 0:
 */
  if (__pyx_v_self->_open) {

    /* "cyhdfs.pyx":644
 *             int ret
 *         if self._open:
 *             ret = hdfsCloseFile(self.fs, self.h_file)             # <<<<<<<<<<<<<<
 *             if ret == 0:
 *                 self._open = 0
 */
    __pyx_v_ret = hdfsCloseFile(__pyx_v_self->fs, __pyx_v_self->h_file);

    /* "cyhdfs.pyx":645
 *         if self._open:
 *             ret = hdfsCloseFile(self.fs, self.h_file)
 *             if ret == 0:             # <<<<<<<<<<<<<<
 *                 self._open = 0
 *             return ret
 */
    __pyx_t_1 = (__pyx_v_ret == 0);
    if (__pyx_t_1) {

      /* "cyhdfs.pyx":646
 *             ret = hdfsCloseFile(self.fs, self.h_file)
 *             if ret == 0:
 *                 self._open = 0             # <<<<<<<<<<<<<<
 *             return ret
 *         return 0
 */
      __pyx_v_self->_open = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "cyhdfs.pyx":647
 *             if ret == 0:
 *                 self._open = 0
 *             return ret             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_r = __pyx_v_ret;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":648
 *                 self._open = 0
 *             return ret
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_8HDFSFile_9close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cyhdfs_8HDFSFile_8close[] = "HDFSFile.close(self)\n\n            Closes file.\n\n            .. note::\n                may raise HDFSIOError error.\n        ";
static PyObject *__pyx_pw_6cyhdfs_8HDFSFile_9close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_8HDFSFile_8close(((struct __pyx_obj_6cyhdfs_HDFSFile *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":651
 * 
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """
 *             Closes file.
 */

static PyObject *__pyx_pf_6cyhdfs_8HDFSFile_8close(struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_self) {
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "cyhdfs.pyx":661
 *             int ret
 * 
 *         if not self._open:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("%s already closed" % repr(self))
 *         ret = self._close()
 */
  __pyx_t_1 = (!__pyx_v_self->_open);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":662
 * 
 *         if not self._open:
 *             raise HDFSIOError("%s already closed" % repr(self))             # <<<<<<<<<<<<<<
 *         ret = self._close()
 *         if ret < 0:
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":663
 *         if not self._open:
 *             raise HDFSIOError("%s already closed" % repr(self))
 *         ret = self._close()             # <<<<<<<<<<<<<<
 *         if ret < 0:
 *             raise HDFSIOError("Cant close: %s" % repr(self))
 */
  __pyx_v_ret = ((struct __pyx_vtabstruct_6cyhdfs_HDFSFile *)__pyx_v_self->__pyx_vtab)->_close(__pyx_v_self);

  /* "cyhdfs.pyx":664
 *             raise HDFSIOError("%s already closed" % repr(self))
 *         ret = self._close()
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("Cant close: %s" % repr(self))
 * 
 */
  __pyx_t_1 = (__pyx_v_ret < 0);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":665
 *         ret = self._close()
 *         if ret < 0:
 *             raise HDFSIOError("Cant close: %s" % repr(self))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_32), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSFile.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static void __pyx_pw_6cyhdfs_8HDFSFile_11__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6cyhdfs_8HDFSFile_11__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_6cyhdfs_8HDFSFile_10__dealloc__(((struct __pyx_obj_6cyhdfs_HDFSFile *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
}

/* "cyhdfs.pyx":668
 * 
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._open:
 *             self.close()
 */

static void __pyx_pf_6cyhdfs_8HDFSFile_10__dealloc__(struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "cyhdfs.pyx":669
 * 
 *     def __dealloc__(self):
 *         if self._open:             # <<<<<<<<<<<<<<
 *             self.close()
 * 
 */
  if (__pyx_v_self->_open) {

    /* "cyhdfs.pyx":670
 *     def __dealloc__(self):
 *         if self._open:
 *             self.close()             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cyhdfs.HDFSFile.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_12HDFSReadFile_1avail(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cyhdfs_12HDFSReadFile_avail[] = "HDFSReadFile.avail(self)\n\n            :return: Number of bytes that can be read from this input stream without blocking.\n            :rtype: int\n        ";
static PyObject *__pyx_pw_6cyhdfs_12HDFSReadFile_1avail(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("avail (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_12HDFSReadFile_avail(((struct __pyx_obj_6cyhdfs_HDFSReadFile *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":675
 * cdef class HDFSReadFile(HDFSFile):
 * 
 *     def avail(self):             # <<<<<<<<<<<<<<
 *         """
 *             :return: Number of bytes that can be read from this input stream without blocking.
 */

static PyObject *__pyx_pf_6cyhdfs_12HDFSReadFile_avail(struct __pyx_obj_6cyhdfs_HDFSReadFile *__pyx_v_self) {
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("avail", 0);

  /* "cyhdfs.pyx":681
 *         """
 *         cdef int ret
 *         if not self._open:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         ret = hdfsAvailable(self.fs, self.h_file)
 */
  __pyx_t_1 = (!__pyx_v_self->__pyx_base._open);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":682
 *         cdef int ret
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))             # <<<<<<<<<<<<<<
 *         ret = hdfsAvailable(self.fs, self.h_file)
 *         if ret < 0:
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":683
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         ret = hdfsAvailable(self.fs, self.h_file)             # <<<<<<<<<<<<<<
 *         if ret < 0:
 *             raise HDFSIOError("hdfsAvailable returned error code file: %s" % repr(self))
 */
  __pyx_v_ret = hdfsAvailable(__pyx_v_self->__pyx_base.fs, __pyx_v_self->__pyx_base.h_file);

  /* "cyhdfs.pyx":684
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         ret = hdfsAvailable(self.fs, self.h_file)
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsAvailable returned error code file: %s" % repr(self))
 *         return ret
 */
  __pyx_t_1 = (__pyx_v_ret < 0);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":685
 *         ret = hdfsAvailable(self.fs, self.h_file)
 *         if ret < 0:
 *             raise HDFSIOError("hdfsAvailable returned error code file: %s" % repr(self))             # <<<<<<<<<<<<<<
 *         return ret
 * 
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cyhdfs.pyx":686
 *         if ret < 0:
 *             raise HDFSIOError("hdfsAvailable returned error code file: %s" % repr(self))
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     def seek(self, tOffset pos):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSReadFile.avail", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_12HDFSReadFile_3seek(PyObject *__pyx_v_self, PyObject *__pyx_arg_pos); /*proto*/
static char __pyx_doc_6cyhdfs_12HDFSReadFile_2seek[] = "HDFSReadFile.seek(self, tOffset pos)\n\n            Seek to given offset in file. \n            This works only for files opened in read-only mode. \n            :param desiredPos: Offset into the file to seek into.\n            :return: None\n        ";
static PyObject *__pyx_pw_6cyhdfs_12HDFSReadFile_3seek(PyObject *__pyx_v_self, PyObject *__pyx_arg_pos) {
  tOffset __pyx_v_pos;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("seek (wrapper)", 0);
  assert(__pyx_arg_pos); {
    __pyx_v_pos = __Pyx_PyInt_from_py_int64_t(__pyx_arg_pos); if (unlikely((__pyx_v_pos == (tOffset)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSReadFile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_12HDFSReadFile_2seek(((struct __pyx_obj_6cyhdfs_HDFSReadFile *)__pyx_v_self), ((tOffset)__pyx_v_pos));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":688
 *         return ret
 * 
 *     def seek(self, tOffset pos):             # <<<<<<<<<<<<<<
 *         """
 *             Seek to given offset in file.
 */

static PyObject *__pyx_pf_6cyhdfs_12HDFSReadFile_2seek(struct __pyx_obj_6cyhdfs_HDFSReadFile *__pyx_v_self, tOffset __pyx_v_pos) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("seek", 0);

  /* "cyhdfs.pyx":695
 *             :return: None
 *         """
 *         if not self._open:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         if hdfsSeek(self.fs, self.h_file, pos) < 0:
 */
  __pyx_t_1 = (!__pyx_v_self->__pyx_base._open);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":696
 *         """
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))             # <<<<<<<<<<<<<<
 *         if hdfsSeek(self.fs, self.h_file, pos) < 0:
 *             raise HDFSIOError("hdfsSeek returned error code file: %s" % repr(self))
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":697
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         if hdfsSeek(self.fs, self.h_file, pos) < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("hdfsSeek returned error code file: %s" % repr(self))
 * 
 */
  __pyx_t_1 = (hdfsSeek(__pyx_v_self->__pyx_base.fs, __pyx_v_self->__pyx_base.h_file, __pyx_v_pos) < 0);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":698
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         if hdfsSeek(self.fs, self.h_file, pos) < 0:
 *             raise HDFSIOError("hdfsSeek returned error code file: %s" % repr(self))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_34), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSReadFile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_12HDFSReadFile_5read(PyObject *__pyx_v_self, PyObject *__pyx_arg_length); /*proto*/
static char __pyx_doc_6cyhdfs_12HDFSReadFile_4read[] = "HDFSReadFile.read(self, int length)\n\n            Read data from an open file.\n            :param length: desired length of read.\n            :return: the number of bytes actually read, possibly less than \n                    the @length and the read string\n            :rtype: tuple(bytes_read, read_data_string)\n        ";
static PyObject *__pyx_pw_6cyhdfs_12HDFSReadFile_5read(PyObject *__pyx_v_self, PyObject *__pyx_arg_length) {
  int __pyx_v_length;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  assert(__pyx_arg_length); {
    __pyx_v_length = __Pyx_PyInt_AsInt(__pyx_arg_length); if (unlikely((__pyx_v_length == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSReadFile.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_12HDFSReadFile_4read(((struct __pyx_obj_6cyhdfs_HDFSReadFile *)__pyx_v_self), ((int)__pyx_v_length));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":701
 * 
 * 
 *     def read(self, int length):             # <<<<<<<<<<<<<<
 *         """
 *             Read data from an open file.
 */

static PyObject *__pyx_pf_6cyhdfs_12HDFSReadFile_4read(struct __pyx_obj_6cyhdfs_HDFSReadFile *__pyx_v_self, int __pyx_v_length) {
  int __pyx_v_bytes_read;
  void *__pyx_v_buf;
  PyObject *__pyx_v_ret_string = NULL;
  int __pyx_v_bytes_read_py;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "cyhdfs.pyx":712
 *             int bytes_read
 *             void * buf
 *         if not self._open:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         buf = <void *>malloc( sizeof(char) * length)
 */
  __pyx_t_1 = (!__pyx_v_self->__pyx_base._open);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":713
 *             void * buf
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))             # <<<<<<<<<<<<<<
 *         buf = <void *>malloc( sizeof(char) * length)
 *         if buf is NULL:
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":714
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         buf = <void *>malloc( sizeof(char) * length)             # <<<<<<<<<<<<<<
 *         if buf is NULL:
 *             raise MemoryError("in read(): buf = <void *>malloc( sizeof(char) * length)")
 */
  __pyx_v_buf = ((void *)malloc(((sizeof(char)) * __pyx_v_length)));

  /* "cyhdfs.pyx":715
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         buf = <void *>malloc( sizeof(char) * length)
 *         if buf is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError("in read(): buf = <void *>malloc( sizeof(char) * length)")
 *         bytes_read = hdfsRead(self.fs, self.h_file, buf, length)
 */
  __pyx_t_1 = (__pyx_v_buf == NULL);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":716
 *         buf = <void *>malloc( sizeof(char) * length)
 *         if buf is NULL:
 *             raise MemoryError("in read(): buf = <void *>malloc( sizeof(char) * length)")             # <<<<<<<<<<<<<<
 *         bytes_read = hdfsRead(self.fs, self.h_file, buf, length)
 *         IF USE_STATS:
 */
    __pyx_t_4 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cyhdfs.pyx":717
 *         if buf is NULL:
 *             raise MemoryError("in read(): buf = <void *>malloc( sizeof(char) * length)")
 *         bytes_read = hdfsRead(self.fs, self.h_file, buf, length)             # <<<<<<<<<<<<<<
 *         IF USE_STATS:
 *             self._read_ops += 1
 */
  __pyx_v_bytes_read = hdfsRead(__pyx_v_self->__pyx_base.fs, __pyx_v_self->__pyx_base.h_file, __pyx_v_buf, __pyx_v_length);

  /* "cyhdfs.pyx":719
 *         bytes_read = hdfsRead(self.fs, self.h_file, buf, length)
 *         IF USE_STATS:
 *             self._read_ops += 1             # <<<<<<<<<<<<<<
 *         if bytes_read < 0:
 *             free(buf)
 */
  __pyx_v_self->__pyx_base._read_ops = (__pyx_v_self->__pyx_base._read_ops + 1);

  /* "cyhdfs.pyx":720
 *         IF USE_STATS:
 *             self._read_ops += 1
 *         if bytes_read < 0:             # <<<<<<<<<<<<<<
 *             free(buf)
 *             raise HDFSIOError("Io read error in %s" % repr(self))
 */
  __pyx_t_1 = (__pyx_v_bytes_read < 0);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":721
 *             self._read_ops += 1
 *         if bytes_read < 0:
 *             free(buf)             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("Io read error in %s" % repr(self))
 *         IF USE_STATS:
 */
    free(__pyx_v_buf);

    /* "cyhdfs.pyx":722
 *         if bytes_read < 0:
 *             free(buf)
 *             raise HDFSIOError("Io read error in %s" % repr(self))             # <<<<<<<<<<<<<<
 *         IF USE_STATS:
 *             self._read_bytes += bytes_read
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_37), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "cyhdfs.pyx":724
 *             raise HDFSIOError("Io read error in %s" % repr(self))
 *         IF USE_STATS:
 *             self._read_bytes += bytes_read             # <<<<<<<<<<<<<<
 *         try:
 *             ret_string = (<char *>buf)[:bytes_read]
 */
  __pyx_v_self->__pyx_base._read_bytes = (__pyx_v_self->__pyx_base._read_bytes + __pyx_v_bytes_read);

  /* "cyhdfs.pyx":725
 *         IF USE_STATS:
 *             self._read_bytes += bytes_read
 *         try:             # <<<<<<<<<<<<<<
 *             ret_string = (<char *>buf)[:bytes_read]
 *         finally:
 */
  /*try:*/ {

    /* "cyhdfs.pyx":726
 *             self._read_bytes += bytes_read
 *         try:
 *             ret_string = (<char *>buf)[:bytes_read]             # <<<<<<<<<<<<<<
 *         finally:
 *             free(buf)
 */
    __pyx_t_2 = PyBytes_FromStringAndSize(((const char*)((char *)__pyx_v_buf)) + 0, __pyx_v_bytes_read - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_v_ret_string = __pyx_t_2;
    __pyx_t_2 = 0;
  }

  /* "cyhdfs.pyx":728
 *             ret_string = (<char *>buf)[:bytes_read]
 *         finally:
 *             free(buf)             # <<<<<<<<<<<<<<
 *         bytes_read_py = bytes_read
 *         return (bytes_read_py, ret_string)
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    free(__pyx_v_buf);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "cyhdfs.pyx":729
 *         finally:
 *             free(buf)
 *         bytes_read_py = bytes_read             # <<<<<<<<<<<<<<
 *         return (bytes_read_py, ret_string)
 * 
 */
  __pyx_v_bytes_read_py = __pyx_v_bytes_read;

  /* "cyhdfs.pyx":730
 *             free(buf)
 *         bytes_read_py = bytes_read
 *         return (bytes_read_py, ret_string)             # <<<<<<<<<<<<<<
 * 
 *     def pread(self, tOffset position, tSize length):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_bytes_read_py); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_ret_string));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_ret_string));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_ret_string));
  __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSReadFile.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret_string);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_12HDFSReadFile_7pread(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cyhdfs_12HDFSReadFile_6pread[] = "HDFSReadFile.pread(self, tOffset position, tSize length)\n\n            Positional read of data from an open file.\n            :param position: Position from which to read\n            :param length: The length of the buffer.\n            :return: the number of bytes actually read, possibly less than \n                    the @length and the read string\n            :rtype: tuple(bytes_read, read_data_string)\n        ";
static PyObject *__pyx_pw_6cyhdfs_12HDFSReadFile_7pread(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  tOffset __pyx_v_position;
  tSize __pyx_v_length;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pread (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__position,&__pyx_n_s__length,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__position)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__length)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pread", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pread") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_position = __Pyx_PyInt_from_py_int64_t(values[0]); if (unlikely((__pyx_v_position == (tOffset)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_length = __Pyx_PyInt_from_py_int32_t(values[1]); if (unlikely((__pyx_v_length == (tSize)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pread", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.HDFSReadFile.pread", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cyhdfs_12HDFSReadFile_6pread(((struct __pyx_obj_6cyhdfs_HDFSReadFile *)__pyx_v_self), __pyx_v_position, __pyx_v_length);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":732
 *         return (bytes_read_py, ret_string)
 * 
 *     def pread(self, tOffset position, tSize length):             # <<<<<<<<<<<<<<
 *         """
 *             Positional read of data from an open file.
 */

static PyObject *__pyx_pf_6cyhdfs_12HDFSReadFile_6pread(struct __pyx_obj_6cyhdfs_HDFSReadFile *__pyx_v_self, tOffset __pyx_v_position, tSize __pyx_v_length) {
  tSize __pyx_v_bytes_read;
  void *__pyx_v_buf;
  PyObject *__pyx_v_ret_string = NULL;
  tSize __pyx_v_bytes_read_py;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pread", 0);

  /* "cyhdfs.pyx":742
 *         """
 *         cdef tSize bytes_read
 *         if not self._open:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         buf = <void *>malloc( sizeof(char) * length)
 */
  __pyx_t_1 = (!__pyx_v_self->__pyx_base._open);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":743
 *         cdef tSize bytes_read
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))             # <<<<<<<<<<<<<<
 *         buf = <void *>malloc( sizeof(char) * length)
 *         if buf is NULL:
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":744
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         buf = <void *>malloc( sizeof(char) * length)             # <<<<<<<<<<<<<<
 *         if buf is NULL:
 *             raise MemoryError("in read(): buf = <void *>malloc( sizeof(char) * length)")
 */
  __pyx_v_buf = ((void *)malloc(((sizeof(char)) * __pyx_v_length)));

  /* "cyhdfs.pyx":745
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         buf = <void *>malloc( sizeof(char) * length)
 *         if buf is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError("in read(): buf = <void *>malloc( sizeof(char) * length)")
 *         bytes_read = hdfsPread(self.fs, self.h_file, position, buf, length)
 */
  __pyx_t_1 = (__pyx_v_buf == NULL);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":746
 *         buf = <void *>malloc( sizeof(char) * length)
 *         if buf is NULL:
 *             raise MemoryError("in read(): buf = <void *>malloc( sizeof(char) * length)")             # <<<<<<<<<<<<<<
 *         bytes_read = hdfsPread(self.fs, self.h_file, position, buf, length)
 *         IF USE_STATS:
 */
    __pyx_t_4 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cyhdfs.pyx":747
 *         if buf is NULL:
 *             raise MemoryError("in read(): buf = <void *>malloc( sizeof(char) * length)")
 *         bytes_read = hdfsPread(self.fs, self.h_file, position, buf, length)             # <<<<<<<<<<<<<<
 *         IF USE_STATS:
 *             self._read_ops += 1
 */
  __pyx_v_bytes_read = hdfsPread(__pyx_v_self->__pyx_base.fs, __pyx_v_self->__pyx_base.h_file, __pyx_v_position, __pyx_v_buf, __pyx_v_length);

  /* "cyhdfs.pyx":749
 *         bytes_read = hdfsPread(self.fs, self.h_file, position, buf, length)
 *         IF USE_STATS:
 *             self._read_ops += 1             # <<<<<<<<<<<<<<
 *         if bytes_read < 0:
 *             free(buf)
 */
  __pyx_v_self->__pyx_base._read_ops = (__pyx_v_self->__pyx_base._read_ops + 1);

  /* "cyhdfs.pyx":750
 *         IF USE_STATS:
 *             self._read_ops += 1
 *         if bytes_read < 0:             # <<<<<<<<<<<<<<
 *             free(buf)
 *             raise HDFSIOError("Io read error in %s" % repr(self))
 */
  __pyx_t_1 = (__pyx_v_bytes_read < 0);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":751
 *             self._read_ops += 1
 *         if bytes_read < 0:
 *             free(buf)             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("Io read error in %s" % repr(self))
 *         IF USE_STATS:
 */
    free(__pyx_v_buf);

    /* "cyhdfs.pyx":752
 *         if bytes_read < 0:
 *             free(buf)
 *             raise HDFSIOError("Io read error in %s" % repr(self))             # <<<<<<<<<<<<<<
 *         IF USE_STATS:
 *             self._read_bytes += bytes_read
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_37), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "cyhdfs.pyx":754
 *             raise HDFSIOError("Io read error in %s" % repr(self))
 *         IF USE_STATS:
 *             self._read_bytes += bytes_read             # <<<<<<<<<<<<<<
 *         try:
 *             ret_string = (<char *>buf)[:bytes_read]
 */
  __pyx_v_self->__pyx_base._read_bytes = (__pyx_v_self->__pyx_base._read_bytes + __pyx_v_bytes_read);

  /* "cyhdfs.pyx":755
 *         IF USE_STATS:
 *             self._read_bytes += bytes_read
 *         try:             # <<<<<<<<<<<<<<
 *             ret_string = (<char *>buf)[:bytes_read]
 *         finally:
 */
  /*try:*/ {

    /* "cyhdfs.pyx":756
 *             self._read_bytes += bytes_read
 *         try:
 *             ret_string = (<char *>buf)[:bytes_read]             # <<<<<<<<<<<<<<
 *         finally:
 *             free(buf)
 */
    __pyx_t_2 = PyBytes_FromStringAndSize(((const char*)((char *)__pyx_v_buf)) + 0, __pyx_v_bytes_read - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_v_ret_string = __pyx_t_2;
    __pyx_t_2 = 0;
  }

  /* "cyhdfs.pyx":758
 *             ret_string = (<char *>buf)[:bytes_read]
 *         finally:
 *             free(buf)             # <<<<<<<<<<<<<<
 *         bytes_read_py = bytes_read
 *         return (bytes_read_py, ret_string)
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    free(__pyx_v_buf);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "cyhdfs.pyx":759
 *         finally:
 *             free(buf)
 *         bytes_read_py = bytes_read             # <<<<<<<<<<<<<<
 *         return (bytes_read_py, ret_string)
 * 
 */
  __pyx_v_bytes_read_py = __pyx_v_bytes_read;

  /* "cyhdfs.pyx":760
 *             free(buf)
 *         bytes_read_py = bytes_read
 *         return (bytes_read_py, ret_string)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_v_bytes_read_py); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_ret_string));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_ret_string));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_ret_string));
  __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSReadFile.pread", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret_string);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_13HDFSWriteFile_1write(PyObject *__pyx_v_self, PyObject *__pyx_v_w_data); /*proto*/
static char __pyx_doc_6cyhdfs_13HDFSWriteFile_write[] = "HDFSWriteFile.write(self, w_data)\n\n            Write data into an open file.\n            :return: Returns the number of bytes written\n        ";
static PyObject *__pyx_pw_6cyhdfs_13HDFSWriteFile_1write(PyObject *__pyx_v_self, PyObject *__pyx_v_w_data) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_13HDFSWriteFile_write(((struct __pyx_obj_6cyhdfs_HDFSWriteFile *)__pyx_v_self), ((PyObject *)__pyx_v_w_data));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":765
 * cdef class HDFSWriteFile(HDFSFile):
 * 
 *     def write(self, w_data):             # <<<<<<<<<<<<<<
 *         """
 *             Write data into an open file.
 */

static PyObject *__pyx_pf_6cyhdfs_13HDFSWriteFile_write(struct __pyx_obj_6cyhdfs_HDFSWriteFile *__pyx_v_self, PyObject *__pyx_v_w_data) {
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "cyhdfs.pyx":772
 *         cdef:
 *             int ret
 *         if not self._open:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         if not PyString_Check(w_data):
 */
  __pyx_t_1 = (!__pyx_v_self->__pyx_base._open);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":773
 *             int ret
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))             # <<<<<<<<<<<<<<
 *         if not PyString_Check(w_data):
 *             raise TypeError("expected string got: %s instead" % type(w_data))
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":774
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         if not PyString_Check(w_data):             # <<<<<<<<<<<<<<
 *             raise TypeError("expected string got: %s instead" % type(w_data))
 * 
 */
  __pyx_t_1 = (!PyString_Check(__pyx_v_w_data));
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":775
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         if not PyString_Check(w_data):
 *             raise TypeError("expected string got: %s instead" % type(w_data))             # <<<<<<<<<<<<<<
 * 
 *         ret = hdfsWrite(self.fs, self.h_file, PyString_AS_STRING(w_data), PyString_GET_SIZE(w_data))
 */
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_39), ((PyObject *)Py_TYPE(__pyx_v_w_data))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cyhdfs.pyx":777
 *             raise TypeError("expected string got: %s instead" % type(w_data))
 * 
 *         ret = hdfsWrite(self.fs, self.h_file, PyString_AS_STRING(w_data), PyString_GET_SIZE(w_data))             # <<<<<<<<<<<<<<
 *         IF USE_STATS:
 *             self._write_ops += 1
 */
  __pyx_v_ret = hdfsWrite(__pyx_v_self->__pyx_base.fs, __pyx_v_self->__pyx_base.h_file, PyString_AS_STRING(__pyx_v_w_data), PyString_GET_SIZE(__pyx_v_w_data));

  /* "cyhdfs.pyx":779
 *         ret = hdfsWrite(self.fs, self.h_file, PyString_AS_STRING(w_data), PyString_GET_SIZE(w_data))
 *         IF USE_STATS:
 *             self._write_ops += 1             # <<<<<<<<<<<<<<
 *         if ret < 0:
 *             raise HDFSIOError("write error in %s" % repr(self))
 */
  __pyx_v_self->__pyx_base._write_ops = (__pyx_v_self->__pyx_base._write_ops + 1);

  /* "cyhdfs.pyx":780
 *         IF USE_STATS:
 *             self._write_ops += 1
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("write error in %s" % repr(self))
 *         IF USE_STATS:
 */
  __pyx_t_1 = (__pyx_v_ret < 0);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":781
 *             self._write_ops += 1
 *         if ret < 0:
 *             raise HDFSIOError("write error in %s" % repr(self))             # <<<<<<<<<<<<<<
 *         IF USE_STATS:
 *             self._write_bytes += ret
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_40), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "cyhdfs.pyx":783
 *             raise HDFSIOError("write error in %s" % repr(self))
 *         IF USE_STATS:
 *             self._write_bytes += ret             # <<<<<<<<<<<<<<
 *         return ret
 * 
 */
  __pyx_v_self->__pyx_base._write_bytes = (__pyx_v_self->__pyx_base._write_bytes + __pyx_v_ret);

  /* "cyhdfs.pyx":784
 *         IF USE_STATS:
 *             self._write_bytes += ret
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     def write_all(self, w_data):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSWriteFile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_13HDFSWriteFile_3write_all(PyObject *__pyx_v_self, PyObject *__pyx_v_w_data); /*proto*/
static char __pyx_doc_6cyhdfs_13HDFSWriteFile_2write_all[] = "HDFSWriteFile.write_all(self, w_data)\n\n            Writes string @w_data using endless loop.\n            breaks loop when all data written or hdfsWrite \n            returns error.\n            :param w_data: string to write to file\n            :return: None\n        ";
static PyObject *__pyx_pw_6cyhdfs_13HDFSWriteFile_3write_all(PyObject *__pyx_v_self, PyObject *__pyx_v_w_data) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_all (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_13HDFSWriteFile_2write_all(((struct __pyx_obj_6cyhdfs_HDFSWriteFile *)__pyx_v_self), ((PyObject *)__pyx_v_w_data));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":786
 *         return ret
 * 
 *     def write_all(self, w_data):             # <<<<<<<<<<<<<<
 *         """
 *             Writes string @w_data using endless loop.
 */

static PyObject *__pyx_pf_6cyhdfs_13HDFSWriteFile_2write_all(struct __pyx_obj_6cyhdfs_HDFSWriteFile *__pyx_v_self, PyObject *__pyx_v_w_data) {
  int __pyx_v_ret;
  int __pyx_v_sent;
  int __pyx_v_must_send;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_all", 0);

  /* "cyhdfs.pyx":799
 *             int must_send
 * 
 *         if not self._open:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         if not PyString_Check(w_data):
 */
  __pyx_t_1 = (!__pyx_v_self->__pyx_base._open);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":800
 * 
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))             # <<<<<<<<<<<<<<
 *         if not PyString_Check(w_data):
 *             raise TypeError("expected string got: %s instead" % type(w_data))
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":801
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         if not PyString_Check(w_data):             # <<<<<<<<<<<<<<
 *             raise TypeError("expected string got: %s instead" % type(w_data))
 * 
 */
  __pyx_t_1 = (!PyString_Check(__pyx_v_w_data));
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":802
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         if not PyString_Check(w_data):
 *             raise TypeError("expected string got: %s instead" % type(w_data))             # <<<<<<<<<<<<<<
 * 
 *         sent = 0
 */
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_39), ((PyObject *)Py_TYPE(__pyx_v_w_data))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cyhdfs.pyx":804
 *             raise TypeError("expected string got: %s instead" % type(w_data))
 * 
 *         sent = 0             # <<<<<<<<<<<<<<
 *         must_send = <int>PyString_GET_SIZE(w_data)
 *         while must_send > 0:
 */
  __pyx_v_sent = 0;

  /* "cyhdfs.pyx":805
 * 
 *         sent = 0
 *         must_send = <int>PyString_GET_SIZE(w_data)             # <<<<<<<<<<<<<<
 *         while must_send > 0:
 *             ret = hdfsWrite(self.fs, self.h_file, PyString_AS_STRING(w_data) + sent, must_send)
 */
  __pyx_v_must_send = ((int)PyString_GET_SIZE(__pyx_v_w_data));

  /* "cyhdfs.pyx":806
 *         sent = 0
 *         must_send = <int>PyString_GET_SIZE(w_data)
 *         while must_send > 0:             # <<<<<<<<<<<<<<
 *             ret = hdfsWrite(self.fs, self.h_file, PyString_AS_STRING(w_data) + sent, must_send)
 *             IF USE_STATS:
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_must_send > 0);
    if (!__pyx_t_1) break;

    /* "cyhdfs.pyx":807
 *         must_send = <int>PyString_GET_SIZE(w_data)
 *         while must_send > 0:
 *             ret = hdfsWrite(self.fs, self.h_file, PyString_AS_STRING(w_data) + sent, must_send)             # <<<<<<<<<<<<<<
 *             IF USE_STATS:
 *                 self._write_ops += 1
 */
    __pyx_v_ret = hdfsWrite(__pyx_v_self->__pyx_base.fs, __pyx_v_self->__pyx_base.h_file, (PyString_AS_STRING(__pyx_v_w_data) + __pyx_v_sent), __pyx_v_must_send);

    /* "cyhdfs.pyx":809
 *             ret = hdfsWrite(self.fs, self.h_file, PyString_AS_STRING(w_data) + sent, must_send)
 *             IF USE_STATS:
 *                 self._write_ops += 1             # <<<<<<<<<<<<<<
 *             if ret < 0:
 *                 raise HDFSIOError("write error in %s" % repr(self))
 */
    __pyx_v_self->__pyx_base._write_ops = (__pyx_v_self->__pyx_base._write_ops + 1);

    /* "cyhdfs.pyx":810
 *             IF USE_STATS:
 *                 self._write_ops += 1
 *             if ret < 0:             # <<<<<<<<<<<<<<
 *                 raise HDFSIOError("write error in %s" % repr(self))
 *             IF USE_STATS:
 */
    __pyx_t_1 = (__pyx_v_ret < 0);
    if (__pyx_t_1) {

      /* "cyhdfs.pyx":811
 *                 self._write_ops += 1
 *             if ret < 0:
 *                 raise HDFSIOError("write error in %s" % repr(self))             # <<<<<<<<<<<<<<
 *             IF USE_STATS:
 *                 self._write_bytes += ret
 */
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_40), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "cyhdfs.pyx":813
 *                 raise HDFSIOError("write error in %s" % repr(self))
 *             IF USE_STATS:
 *                 self._write_bytes += ret             # <<<<<<<<<<<<<<
 *             sent += ret
 *             must_send -= ret
 */
    __pyx_v_self->__pyx_base._write_bytes = (__pyx_v_self->__pyx_base._write_bytes + __pyx_v_ret);

    /* "cyhdfs.pyx":814
 *             IF USE_STATS:
 *                 self._write_bytes += ret
 *             sent += ret             # <<<<<<<<<<<<<<
 *             must_send -= ret
 * 
 */
    __pyx_v_sent = (__pyx_v_sent + __pyx_v_ret);

    /* "cyhdfs.pyx":815
 *                 self._write_bytes += ret
 *             sent += ret
 *             must_send -= ret             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_must_send = (__pyx_v_must_send - __pyx_v_ret);
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSWriteFile.write_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_13HDFSWriteFile_5flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cyhdfs_13HDFSWriteFile_4flush[] = "HDFSWriteFile.flush(self)\n\n            Flush the data. calls hdfsFlush()\n            :return: None\n        ";
static PyObject *__pyx_pw_6cyhdfs_13HDFSWriteFile_5flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flush (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_13HDFSWriteFile_4flush(((struct __pyx_obj_6cyhdfs_HDFSWriteFile *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":818
 * 
 * 
 *     def flush(self):             # <<<<<<<<<<<<<<
 *         """
 *             Flush the data. calls hdfsFlush()
 */

static PyObject *__pyx_pf_6cyhdfs_13HDFSWriteFile_4flush(struct __pyx_obj_6cyhdfs_HDFSWriteFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("flush", 0);

  /* "cyhdfs.pyx":823
 *             :return: None
 *         """
 *         if not self._open:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         if hdfsFlush(self.fs, self.h_file) < 0:
 */
  __pyx_t_1 = (!__pyx_v_self->__pyx_base._open);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":824
 *         """
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))             # <<<<<<<<<<<<<<
 *         if hdfsFlush(self.fs, self.h_file) < 0:
 *             raise HDFSIOError("Can't flush %s" % repr(self))
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cyhdfs.pyx":825
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         if hdfsFlush(self.fs, self.h_file) < 0:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("Can't flush %s" % repr(self))
 * 
 */
  __pyx_t_1 = (hdfsFlush(__pyx_v_self->__pyx_base.fs, __pyx_v_self->__pyx_base.h_file) < 0);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":826
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         if hdfsFlush(self.fs, self.h_file) < 0:
 *             raise HDFSIOError("Can't flush %s" % repr(self))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_41), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSWriteFile.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_13HDFSWriteFile_7hflush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cyhdfs_13HDFSWriteFile_6hflush[] = "HDFSWriteFile.hflush(self)\n\n            Flush the data. calls hdfsHFlush() if defined.\n            :return: None\n\n            .. note::\n                if hdfsHFlush() is not defined in libhdfs \n                this functions does nothing.\n        ";
static PyObject *__pyx_pw_6cyhdfs_13HDFSWriteFile_7hflush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hflush (wrapper)", 0);
  __pyx_r = __pyx_pf_6cyhdfs_13HDFSWriteFile_6hflush(((struct __pyx_obj_6cyhdfs_HDFSWriteFile *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":829
 * 
 * 
 *     def hflush(self):             # <<<<<<<<<<<<<<
 *         """
 *             Flush the data. calls hdfsHFlush() if defined.
 */

static PyObject *__pyx_pf_6cyhdfs_13HDFSWriteFile_6hflush(struct __pyx_obj_6cyhdfs_HDFSWriteFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hflush", 0);

  /* "cyhdfs.pyx":838
 *                 this functions does nothing.
 *         """
 *         if not self._open:             # <<<<<<<<<<<<<<
 *             raise HDFSIOError("File %s is closed" % repr(self))
 *         IF HADOOP_HAS_HFLUSH:
 */
  __pyx_t_1 = (!__pyx_v_self->__pyx_base._open);
  if (__pyx_t_1) {

    /* "cyhdfs.pyx":839
 *         """
 *         if not self._open:
 *             raise HDFSIOError("File %s is closed" % repr(self))             # <<<<<<<<<<<<<<
 *         IF HADOOP_HAS_HFLUSH:
 *             if hdfsHFlush(self.fs, self.h_file) < 0:
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSIOError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cyhdfs.HDFSWriteFile.hflush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":845
 * 
 * 
 * cdef void hdfs_file_factory(HDFSFile hdfs_file, conn, path, hdfsFile h_file, hdfsFS fs, int flags, int bufferSize, short replication, int blocksize):             # <<<<<<<<<<<<<<
 *     hdfs_file.conn = conn
 *     hdfs_file.path = path
 */

static void __pyx_f_6cyhdfs_hdfs_file_factory(struct __pyx_obj_6cyhdfs_HDFSFile *__pyx_v_hdfs_file, PyObject *__pyx_v_conn, PyObject *__pyx_v_path, hdfsFile __pyx_v_h_file, hdfsFS __pyx_v_fs, int __pyx_v_flags, int __pyx_v_bufferSize, short __pyx_v_replication, int __pyx_v_blocksize) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hdfs_file_factory", 0);

  /* "cyhdfs.pyx":846
 * 
 * cdef void hdfs_file_factory(HDFSFile hdfs_file, conn, path, hdfsFile h_file, hdfsFS fs, int flags, int bufferSize, short replication, int blocksize):
 *     hdfs_file.conn = conn             # <<<<<<<<<<<<<<
 *     hdfs_file.path = path
 * 
 */
  __Pyx_INCREF(__pyx_v_conn);
  __Pyx_GIVEREF(__pyx_v_conn);
  __Pyx_GOTREF(__pyx_v_hdfs_file->conn);
  __Pyx_DECREF(__pyx_v_hdfs_file->conn);
  __pyx_v_hdfs_file->conn = __pyx_v_conn;

  /* "cyhdfs.pyx":847
 * cdef void hdfs_file_factory(HDFSFile hdfs_file, conn, path, hdfsFile h_file, hdfsFS fs, int flags, int bufferSize, short replication, int blocksize):
 *     hdfs_file.conn = conn
 *     hdfs_file.path = path             # <<<<<<<<<<<<<<
 * 
 *     hdfs_file.h_file = h_file
 */
  __Pyx_INCREF(__pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_GOTREF(__pyx_v_hdfs_file->path);
  __Pyx_DECREF(__pyx_v_hdfs_file->path);
  __pyx_v_hdfs_file->path = __pyx_v_path;

  /* "cyhdfs.pyx":849
 *     hdfs_file.path = path
 * 
 *     hdfs_file.h_file = h_file             # <<<<<<<<<<<<<<
 *     hdfs_file.fs = fs
 *     hdfs_file.flags = flags
 */
  __pyx_v_hdfs_file->h_file = __pyx_v_h_file;

  /* "cyhdfs.pyx":850
 * 
 *     hdfs_file.h_file = h_file
 *     hdfs_file.fs = fs             # <<<<<<<<<<<<<<
 *     hdfs_file.flags = flags
 *     hdfs_file.bufferSize = bufferSize
 */
  __pyx_v_hdfs_file->fs = __pyx_v_fs;

  /* "cyhdfs.pyx":851
 *     hdfs_file.h_file = h_file
 *     hdfs_file.fs = fs
 *     hdfs_file.flags = flags             # <<<<<<<<<<<<<<
 *     hdfs_file.bufferSize = bufferSize
 *     hdfs_file.replication = replication
 */
  __pyx_v_hdfs_file->flags = __pyx_v_flags;

  /* "cyhdfs.pyx":852
 *     hdfs_file.fs = fs
 *     hdfs_file.flags = flags
 *     hdfs_file.bufferSize = bufferSize             # <<<<<<<<<<<<<<
 *     hdfs_file.replication = replication
 *     hdfs_file.blocksize = blocksize
 */
  __pyx_v_hdfs_file->bufferSize = __pyx_v_bufferSize;

  /* "cyhdfs.pyx":853
 *     hdfs_file.flags = flags
 *     hdfs_file.bufferSize = bufferSize
 *     hdfs_file.replication = replication             # <<<<<<<<<<<<<<
 *     hdfs_file.blocksize = blocksize
 *     hdfs_file._open = 1
 */
  __pyx_v_hdfs_file->replication = __pyx_v_replication;

  /* "cyhdfs.pyx":854
 *     hdfs_file.bufferSize = bufferSize
 *     hdfs_file.replication = replication
 *     hdfs_file.blocksize = blocksize             # <<<<<<<<<<<<<<
 *     hdfs_file._open = 1
 *     IF USE_STATS:
 */
  __pyx_v_hdfs_file->blocksize = __pyx_v_blocksize;

  /* "cyhdfs.pyx":855
 *     hdfs_file.replication = replication
 *     hdfs_file.blocksize = blocksize
 *     hdfs_file._open = 1             # <<<<<<<<<<<<<<
 *     IF USE_STATS:
 *         hdfs_file._write_ops = 0
 */
  __pyx_v_hdfs_file->_open = 1;

  /* "cyhdfs.pyx":857
 *     hdfs_file._open = 1
 *     IF USE_STATS:
 *         hdfs_file._write_ops = 0             # <<<<<<<<<<<<<<
 *         hdfs_file._write_bytes = 0
 *         hdfs_file._read_ops = 0
 */
  __pyx_v_hdfs_file->_write_ops = 0;

  /* "cyhdfs.pyx":858
 *     IF USE_STATS:
 *         hdfs_file._write_ops = 0
 *         hdfs_file._write_bytes = 0             # <<<<<<<<<<<<<<
 *         hdfs_file._read_ops = 0
 *         hdfs_file._read_bytes = 0
 */
  __pyx_v_hdfs_file->_write_bytes = 0;

  /* "cyhdfs.pyx":859
 *         hdfs_file._write_ops = 0
 *         hdfs_file._write_bytes = 0
 *         hdfs_file._read_ops = 0             # <<<<<<<<<<<<<<
 *         hdfs_file._read_bytes = 0
 * 
 */
  __pyx_v_hdfs_file->_read_ops = 0;

  /* "cyhdfs.pyx":860
 *         hdfs_file._write_bytes = 0
 *         hdfs_file._read_ops = 0
 *         hdfs_file._read_bytes = 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_hdfs_file->_read_bytes = 0;

  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_1copy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cyhdfs_copy[] = "copy(HDFSConnection src_conn, char *src, HDFSConnection dst_conn, char *dst)\n\n       Copy file from one filesystem to another.\n       :param src_conn: The handle to source filesystem.\n       :param src: The path of source file. \n       :param dst_conn: The handle to destination filesystem.\n       :param dst: The path of destination file. \n       :return: Returns 0 on success, -1 on error\n       :rtype: int\n    ";
static PyMethodDef __pyx_mdef_6cyhdfs_1copy = {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_6cyhdfs_1copy, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_copy)};
static PyObject *__pyx_pw_6cyhdfs_1copy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_src_conn = 0;
  char *__pyx_v_src;
  struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_dst_conn = 0;
  char *__pyx_v_dst;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__src_conn,&__pyx_n_s__src,&__pyx_n_s__dst_conn,&__pyx_n_s__dst,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__src_conn)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__src)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dst_conn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dst)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_src_conn = ((struct __pyx_obj_6cyhdfs_HDFSConnection *)values[0]);
    __pyx_v_src = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_src) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_dst_conn = ((struct __pyx_obj_6cyhdfs_HDFSConnection *)values[2]);
    __pyx_v_dst = PyBytes_AsString(values[3]); if (unlikely((!__pyx_v_dst) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src_conn), __pyx_ptype_6cyhdfs_HDFSConnection, 1, "src_conn", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dst_conn), __pyx_ptype_6cyhdfs_HDFSConnection, 1, "dst_conn", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6cyhdfs_copy(__pyx_self, __pyx_v_src_conn, __pyx_v_src, __pyx_v_dst_conn, __pyx_v_dst);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":863
 * 
 * 
 * def copy(HDFSConnection src_conn, char * src, HDFSConnection dst_conn, char * dst):             # <<<<<<<<<<<<<<
 *     """
 *        Copy file from one filesystem to another.
 */

static PyObject *__pyx_pf_6cyhdfs_copy(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_src_conn, char *__pyx_v_src, struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_dst_conn, char *__pyx_v_dst) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "cyhdfs.pyx":873
 *        :rtype: int
 *     """
 *     src_conn._complain_no_conn()             # <<<<<<<<<<<<<<
 *     dst_conn._complain_no_conn()
 *     return hdfsCopy(src_conn.fs, src, dst_conn.fs, dst)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_src_conn->__pyx_vtab)->_complain_no_conn(__pyx_v_src_conn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":874
 *     """
 *     src_conn._complain_no_conn()
 *     dst_conn._complain_no_conn()             # <<<<<<<<<<<<<<
 *     return hdfsCopy(src_conn.fs, src, dst_conn.fs, dst)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_dst_conn->__pyx_vtab)->_complain_no_conn(__pyx_v_dst_conn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":875
 *     src_conn._complain_no_conn()
 *     dst_conn._complain_no_conn()
 *     return hdfsCopy(src_conn.fs, src, dst_conn.fs, dst)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(hdfsCopy(__pyx_v_src_conn->fs, __pyx_v_src, __pyx_v_dst_conn->fs, __pyx_v_dst)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cyhdfs.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cyhdfs_3move(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cyhdfs_2move[] = "move(HDFSConnection src_conn, char *src, HDFSConnection dst_conn, char *dst)\n\n       Move file from one filesystem to another.\n       :param src_conn: The handle to source filesystem.\n       :param src: The path of source file. \n       :param dst_conn: The handle to destination filesystem.\n       :param dst: The path of destination file. \n       :return: Returns 0 on success, -1 on error\n       :rtype: int\n    ";
static PyMethodDef __pyx_mdef_6cyhdfs_3move = {__Pyx_NAMESTR("move"), (PyCFunction)__pyx_pw_6cyhdfs_3move, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_2move)};
static PyObject *__pyx_pw_6cyhdfs_3move(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_src_conn = 0;
  char *__pyx_v_src;
  struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_dst_conn = 0;
  char *__pyx_v_dst;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("move (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__src_conn,&__pyx_n_s__src,&__pyx_n_s__dst_conn,&__pyx_n_s__dst,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__src_conn)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__src)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("move", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dst_conn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("move", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dst)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("move", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "move") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_src_conn = ((struct __pyx_obj_6cyhdfs_HDFSConnection *)values[0]);
    __pyx_v_src = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_src) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_dst_conn = ((struct __pyx_obj_6cyhdfs_HDFSConnection *)values[2]);
    __pyx_v_dst = PyBytes_AsString(values[3]); if (unlikely((!__pyx_v_dst) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("move", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cyhdfs.move", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src_conn), __pyx_ptype_6cyhdfs_HDFSConnection, 1, "src_conn", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dst_conn), __pyx_ptype_6cyhdfs_HDFSConnection, 1, "dst_conn", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6cyhdfs_2move(__pyx_self, __pyx_v_src_conn, __pyx_v_src, __pyx_v_dst_conn, __pyx_v_dst);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cyhdfs.pyx":878
 * 
 * 
 * def move(HDFSConnection src_conn, char * src, HDFSConnection dst_conn, char * dst):             # <<<<<<<<<<<<<<
 *     """
 *        Move file from one filesystem to another.
 */

static PyObject *__pyx_pf_6cyhdfs_2move(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_src_conn, char *__pyx_v_src, struct __pyx_obj_6cyhdfs_HDFSConnection *__pyx_v_dst_conn, char *__pyx_v_dst) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("move", 0);

  /* "cyhdfs.pyx":888
 *        :rtype: int
 *     """
 *     src_conn._complain_no_conn()             # <<<<<<<<<<<<<<
 *     dst_conn._complain_no_conn()
 *     return hdfsMove(src_conn.fs, src, dst_conn.fs, dst)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_src_conn->__pyx_vtab)->_complain_no_conn(__pyx_v_src_conn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":889
 *     """
 *     src_conn._complain_no_conn()
 *     dst_conn._complain_no_conn()             # <<<<<<<<<<<<<<
 *     return hdfsMove(src_conn.fs, src, dst_conn.fs, dst)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6cyhdfs_HDFSConnection *)__pyx_v_dst_conn->__pyx_vtab)->_complain_no_conn(__pyx_v_dst_conn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":890
 *     src_conn._complain_no_conn()
 *     dst_conn._complain_no_conn()
 *     return hdfsMove(src_conn.fs, src, dst_conn.fs, dst)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(hdfsMove(__pyx_v_src_conn->fs, __pyx_v_src, __pyx_v_dst_conn->fs, __pyx_v_dst)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cyhdfs.move", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_6cyhdfs_HDFSConnection __pyx_vtable_6cyhdfs_HDFSConnection;

static PyObject *__pyx_tp_new_6cyhdfs_HDFSConnection(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6cyhdfs_HDFSConnection *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6cyhdfs_HDFSConnection *)o);
  p->__pyx_vtab = __pyx_vtabptr_6cyhdfs_HDFSConnection;
  p->host = Py_None; Py_INCREF(Py_None);
  p->user = Py_None; Py_INCREF(Py_None);
  p->open_files = Py_None; Py_INCREF(Py_None);
  p->__weakref__ = 0;
  if (__pyx_pw_6cyhdfs_14HDFSConnection_3__cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6cyhdfs_HDFSConnection(PyObject *o) {
  struct __pyx_obj_6cyhdfs_HDFSConnection *p = (struct __pyx_obj_6cyhdfs_HDFSConnection *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_6cyhdfs_14HDFSConnection_41__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  if (p->__weakref__) PyObject_ClearWeakRefs(o);
  Py_CLEAR(p->host);
  Py_CLEAR(p->user);
  Py_CLEAR(p->open_files);
  Py_CLEAR(p->__weakref__);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6cyhdfs_HDFSConnection(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6cyhdfs_HDFSConnection *p = (struct __pyx_obj_6cyhdfs_HDFSConnection *)o;
  if (p->host) {
    e = (*v)(p->host, a); if (e) return e;
  }
  if (p->user) {
    e = (*v)(p->user, a); if (e) return e;
  }
  if (p->open_files) {
    e = (*v)(p->open_files, a); if (e) return e;
  }
  if (p->__weakref__) {
    e = (*v)(p->__weakref__, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6cyhdfs_HDFSConnection(PyObject *o) {
  struct __pyx_obj_6cyhdfs_HDFSConnection *p = (struct __pyx_obj_6cyhdfs_HDFSConnection *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->host);
  p->host = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->user);
  p->user = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->open_files);
  p->open_files = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_6cyhdfs_HDFSConnection[] = {
  {__Pyx_NAMESTR("utime"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_5utime, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_4utime)},
  {__Pyx_NAMESTR("chmod"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_7chmod, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_6chmod)},
  {__Pyx_NAMESTR("chown"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_9chown, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_8chown)},
  {__Pyx_NAMESTR("used"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_11used, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_10used)},
  {__Pyx_NAMESTR("capacity"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_13capacity, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_12capacity)},
  {__Pyx_NAMESTR("get_default_blocksize"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_15get_default_blocksize, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_14get_default_blocksize)},
  {__Pyx_NAMESTR("open_file"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_17open_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_16open_file)},
  {__Pyx_NAMESTR("exists"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_19exists, METH_O, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_18exists)},
  {__Pyx_NAMESTR("delete"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_21delete, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_20delete)},
  {__Pyx_NAMESTR("rename"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_23rename, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_22rename)},
  {__Pyx_NAMESTR("get_cwd"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_25get_cwd, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_24get_cwd)},
  {__Pyx_NAMESTR("set_cwd"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_27set_cwd, METH_O, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_26set_cwd)},
  {__Pyx_NAMESTR("set_replication"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_29set_replication, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_28set_replication)},
  {__Pyx_NAMESTR("mkdir"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_31mkdir, METH_O, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_30mkdir)},
  {__Pyx_NAMESTR("list_dir"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_33list_dir, METH_O, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_32list_dir)},
  {__Pyx_NAMESTR("path_info"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_35path_info, METH_O, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_34path_info)},
  {__Pyx_NAMESTR("get_hosts"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_37get_hosts, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_36get_hosts)},
  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_6cyhdfs_14HDFSConnection_39close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_14HDFSConnection_38close)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_HDFSConnection = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_HDFSConnection = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_HDFSConnection = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_HDFSConnection = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6cyhdfs_HDFSConnection = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("cyhdfs.HDFSConnection"), /*tp_name*/
  sizeof(struct __pyx_obj_6cyhdfs_HDFSConnection), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6cyhdfs_HDFSConnection, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_6cyhdfs_14HDFSConnection_1__repr__, /*tp_repr*/
  &__pyx_tp_as_number_HDFSConnection, /*tp_as_number*/
  &__pyx_tp_as_sequence_HDFSConnection, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_HDFSConnection, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_HDFSConnection, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n        HDFSConnection.__init__(host = 'default', unsigned short port = 0, user = '')\n         * @param host A string containing either a host name, or an ip address\n         * of the namenode of a hdfs cluster. host should be passed as empry string '' if\n         * you want to connect to local filesystem. host should be passed as\n         * 'default' (and port as 0) to used the 'configured' filesystem\n         * (core-site/core-default.xml).\n         * @param port The port on which the server is listening.\n         * @param user the user name (this is hadoop domain user). Or empry string '' is equivelant to hhdfsConnect(host, port)\n\n        :Example:\n\n        import os\n        conn = HDFSConnection(\"1.1.1.1\", 54310, 'hduser')\n        conn.mkdir(\"/tmp/cyhdfs\")\n\n        test_file = conn.open_file(\"/tmp/cyhdfs/hello_world.txt\", os.O_WRONLY)\n        test_file.write(\"hello world\")\n        test_file.flush()\n        test_file.close()\n\n        print conn.list_dir(\"/tmp/cyhdfs\")\n\n        conn.delete(\"/tmp/cyhdfs\")\n        conn.close()\n\n    "), /*tp_doc*/
  __pyx_tp_traverse_6cyhdfs_HDFSConnection, /*tp_traverse*/
  __pyx_tp_clear_6cyhdfs_HDFSConnection, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6cyhdfs_HDFSConnection, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6cyhdfs_HDFSConnection, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_6cyhdfs_HDFSFile __pyx_vtable_6cyhdfs_HDFSFile;

static PyObject *__pyx_tp_new_6cyhdfs_HDFSFile(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6cyhdfs_HDFSFile *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6cyhdfs_HDFSFile *)o);
  p->__pyx_vtab = __pyx_vtabptr_6cyhdfs_HDFSFile;
  p->conn = Py_None; Py_INCREF(Py_None);
  p->path = Py_None; Py_INCREF(Py_None);
  p->__weakref__ = 0;
  return o;
}

static void __pyx_tp_dealloc_6cyhdfs_HDFSFile(PyObject *o) {
  struct __pyx_obj_6cyhdfs_HDFSFile *p = (struct __pyx_obj_6cyhdfs_HDFSFile *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_6cyhdfs_8HDFSFile_11__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  if (p->__weakref__) PyObject_ClearWeakRefs(o);
  Py_CLEAR(p->conn);
  Py_CLEAR(p->path);
  Py_CLEAR(p->__weakref__);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6cyhdfs_HDFSFile(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6cyhdfs_HDFSFile *p = (struct __pyx_obj_6cyhdfs_HDFSFile *)o;
  if (p->conn) {
    e = (*v)(p->conn, a); if (e) return e;
  }
  if (p->path) {
    e = (*v)(p->path, a); if (e) return e;
  }
  if (p->__weakref__) {
    e = (*v)(p->__weakref__, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6cyhdfs_HDFSFile(PyObject *o) {
  struct __pyx_obj_6cyhdfs_HDFSFile *p = (struct __pyx_obj_6cyhdfs_HDFSFile *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->conn);
  p->conn = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->path);
  p->path = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_6cyhdfs_HDFSFile[] = {
  {__Pyx_NAMESTR("get_stats"), (PyCFunction)__pyx_pw_6cyhdfs_8HDFSFile_1get_stats, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_8HDFSFile_get_stats)},
  {__Pyx_NAMESTR("tell"), (PyCFunction)__pyx_pw_6cyhdfs_8HDFSFile_7tell, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_8HDFSFile_6tell)},
  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_6cyhdfs_8HDFSFile_9close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_8HDFSFile_8close)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_HDFSFile = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_HDFSFile = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_HDFSFile = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_HDFSFile = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6cyhdfs_HDFSFile = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("cyhdfs.HDFSFile"), /*tp_name*/
  sizeof(struct __pyx_obj_6cyhdfs_HDFSFile), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6cyhdfs_HDFSFile, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_6cyhdfs_8HDFSFile_5__repr__, /*tp_repr*/
  &__pyx_tp_as_number_HDFSFile, /*tp_as_number*/
  &__pyx_tp_as_sequence_HDFSFile, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_HDFSFile, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_HDFSFile, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("HDFSFile()\n\n        This is a base class for \n        HDFSWriteFile and HDFSReadFile and is not meant\n        to be instantinated from python.\n    "), /*tp_doc*/
  __pyx_tp_traverse_6cyhdfs_HDFSFile, /*tp_traverse*/
  __pyx_tp_clear_6cyhdfs_HDFSFile, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6cyhdfs_HDFSFile, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6cyhdfs_8HDFSFile_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6cyhdfs_HDFSFile, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_6cyhdfs_HDFSReadFile __pyx_vtable_6cyhdfs_HDFSReadFile;

static PyObject *__pyx_tp_new_6cyhdfs_HDFSReadFile(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6cyhdfs_HDFSReadFile *p;
  PyObject *o = __pyx_tp_new_6cyhdfs_HDFSFile(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_6cyhdfs_HDFSReadFile *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6cyhdfs_HDFSFile*)__pyx_vtabptr_6cyhdfs_HDFSReadFile;
  return o;
}

static PyMethodDef __pyx_methods_6cyhdfs_HDFSReadFile[] = {
  {__Pyx_NAMESTR("avail"), (PyCFunction)__pyx_pw_6cyhdfs_12HDFSReadFile_1avail, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_12HDFSReadFile_avail)},
  {__Pyx_NAMESTR("seek"), (PyCFunction)__pyx_pw_6cyhdfs_12HDFSReadFile_3seek, METH_O, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_12HDFSReadFile_2seek)},
  {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pw_6cyhdfs_12HDFSReadFile_5read, METH_O, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_12HDFSReadFile_4read)},
  {__Pyx_NAMESTR("pread"), (PyCFunction)__pyx_pw_6cyhdfs_12HDFSReadFile_7pread, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_12HDFSReadFile_6pread)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_HDFSReadFile = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_HDFSReadFile = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_HDFSReadFile = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_HDFSReadFile = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6cyhdfs_HDFSReadFile = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("cyhdfs.HDFSReadFile"), /*tp_name*/
  sizeof(struct __pyx_obj_6cyhdfs_HDFSReadFile), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6cyhdfs_HDFSFile, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_6cyhdfs_8HDFSFile_5__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  &__pyx_tp_as_number_HDFSReadFile, /*tp_as_number*/
  &__pyx_tp_as_sequence_HDFSReadFile, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_HDFSReadFile, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_HDFSReadFile, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6cyhdfs_HDFSFile, /*tp_traverse*/
  __pyx_tp_clear_6cyhdfs_HDFSFile, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6cyhdfs_HDFSReadFile, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_6cyhdfs_8HDFSFile_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_6cyhdfs_HDFSReadFile, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_6cyhdfs_HDFSWriteFile __pyx_vtable_6cyhdfs_HDFSWriteFile;

static PyObject *__pyx_tp_new_6cyhdfs_HDFSWriteFile(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6cyhdfs_HDFSWriteFile *p;
  PyObject *o = __pyx_tp_new_6cyhdfs_HDFSFile(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_6cyhdfs_HDFSWriteFile *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6cyhdfs_HDFSFile*)__pyx_vtabptr_6cyhdfs_HDFSWriteFile;
  return o;
}

static PyMethodDef __pyx_methods_6cyhdfs_HDFSWriteFile[] = {
  {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_6cyhdfs_13HDFSWriteFile_1write, METH_O, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_13HDFSWriteFile_write)},
  {__Pyx_NAMESTR("write_all"), (PyCFunction)__pyx_pw_6cyhdfs_13HDFSWriteFile_3write_all, METH_O, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_13HDFSWriteFile_2write_all)},
  {__Pyx_NAMESTR("flush"), (PyCFunction)__pyx_pw_6cyhdfs_13HDFSWriteFile_5flush, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_13HDFSWriteFile_4flush)},
  {__Pyx_NAMESTR("hflush"), (PyCFunction)__pyx_pw_6cyhdfs_13HDFSWriteFile_7hflush, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cyhdfs_13HDFSWriteFile_6hflush)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_HDFSWriteFile = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_HDFSWriteFile = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_HDFSWriteFile = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_HDFSWriteFile = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6cyhdfs_HDFSWriteFile = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("cyhdfs.HDFSWriteFile"), /*tp_name*/
  sizeof(struct __pyx_obj_6cyhdfs_HDFSWriteFile), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6cyhdfs_HDFSFile, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_6cyhdfs_8HDFSFile_5__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  &__pyx_tp_as_number_HDFSWriteFile, /*tp_as_number*/
  &__pyx_tp_as_sequence_HDFSWriteFile, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_HDFSWriteFile, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_HDFSWriteFile, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6cyhdfs_HDFSFile, /*tp_traverse*/
  __pyx_tp_clear_6cyhdfs_HDFSFile, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6cyhdfs_HDFSWriteFile, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_6cyhdfs_8HDFSFile_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_6cyhdfs_HDFSWriteFile, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("cyhdfs"),
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
  {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
  {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
  {&__pyx_kp_b_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0, 0},
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
  {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
  {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
  {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
  {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
  {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
  {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
  {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
  {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
  {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
  {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
  {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
  {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
  {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
  {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
  {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
  {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0},
  {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
  {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
  {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
  {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
  {&__pyx_n_s__CLASSPATH, __pyx_k__CLASSPATH, sizeof(__pyx_k__CLASSPATH), 0, 0, 1, 1},
  {&__pyx_n_s__ENTRY_KIND_DIR, __pyx_k__ENTRY_KIND_DIR, sizeof(__pyx_k__ENTRY_KIND_DIR), 0, 0, 1, 1},
  {&__pyx_n_s__ENTRY_KIND_FILE, __pyx_k__ENTRY_KIND_FILE, sizeof(__pyx_k__ENTRY_KIND_FILE), 0, 0, 1, 1},
  {&__pyx_n_s__EntryInfo, __pyx_k__EntryInfo, sizeof(__pyx_k__EntryInfo), 0, 0, 1, 1},
  {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
  {&__pyx_n_s__HDFSConnectionError, __pyx_k__HDFSConnectionError, sizeof(__pyx_k__HDFSConnectionError), 0, 0, 1, 1},
  {&__pyx_n_s__HDFSError, __pyx_k__HDFSError, sizeof(__pyx_k__HDFSError), 0, 0, 1, 1},
  {&__pyx_n_s__HDFSIOError, __pyx_k__HDFSIOError, sizeof(__pyx_k__HDFSIOError), 0, 0, 1, 1},
  {&__pyx_n_s__MemoryError, __pyx_k__MemoryError, sizeof(__pyx_k__MemoryError), 0, 0, 1, 1},
  {&__pyx_n_s__Stats, __pyx_k__Stats, sizeof(__pyx_k__Stats), 0, 0, 1, 1},
  {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
  {&__pyx_n_s__WeakSet, __pyx_k__WeakSet, sizeof(__pyx_k__WeakSet), 0, 0, 1, 1},
  {&__pyx_n_s__WriteStats, __pyx_k__WriteStats, sizeof(__pyx_k__WriteStats), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s__add, __pyx_k__add, sizeof(__pyx_k__add), 0, 0, 1, 1},
  {&__pyx_n_s__atime, __pyx_k__atime, sizeof(__pyx_k__atime), 0, 0, 1, 1},
  {&__pyx_n_s__blocksize, __pyx_k__blocksize, sizeof(__pyx_k__blocksize), 0, 0, 1, 1},
  {&__pyx_n_s__bufferSize, __pyx_k__bufferSize, sizeof(__pyx_k__bufferSize), 0, 0, 1, 1},
  {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
  {&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1},
  {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1},
  {&__pyx_n_s__cyhdfs, __pyx_k__cyhdfs, sizeof(__pyx_k__cyhdfs), 0, 0, 1, 1},
  {&__pyx_n_s__default, __pyx_k__default, sizeof(__pyx_k__default), 0, 0, 1, 1},
  {&__pyx_n_s__dst, __pyx_k__dst, sizeof(__pyx_k__dst), 0, 0, 1, 1},
  {&__pyx_n_s__dst_conn, __pyx_k__dst_conn, sizeof(__pyx_k__dst_conn), 0, 0, 1, 1},
  {&__pyx_n_s__environ, __pyx_k__environ, sizeof(__pyx_k__environ), 0, 0, 1, 1},
  {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1},
  {&__pyx_n_s__group, __pyx_k__group, sizeof(__pyx_k__group), 0, 0, 1, 1},
  {&__pyx_n_s__host, __pyx_k__host, sizeof(__pyx_k__host), 0, 0, 1, 1},
  {&__pyx_n_s__kind, __pyx_k__kind, sizeof(__pyx_k__kind), 0, 0, 1, 1},
  {&__pyx_n_s__last_access, __pyx_k__last_access, sizeof(__pyx_k__last_access), 0, 0, 1, 1},
  {&__pyx_n_s__last_mod, __pyx_k__last_mod, sizeof(__pyx_k__last_mod), 0, 0, 1, 1},
  {&__pyx_n_s__length, __pyx_k__length, sizeof(__pyx_k__length), 0, 0, 1, 1},
  {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
  {&__pyx_n_s__move, __pyx_k__move, sizeof(__pyx_k__move), 0, 0, 1, 1},
  {&__pyx_n_s__mtime, __pyx_k__mtime, sizeof(__pyx_k__mtime), 0, 0, 1, 1},
  {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
  {&__pyx_n_s__namedtuple, __pyx_k__namedtuple, sizeof(__pyx_k__namedtuple), 0, 0, 1, 1},
  {&__pyx_n_s__new_path, __pyx_k__new_path, sizeof(__pyx_k__new_path), 0, 0, 1, 1},
  {&__pyx_n_s__old_path, __pyx_k__old_path, sizeof(__pyx_k__old_path), 0, 0, 1, 1},
  {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1},
  {&__pyx_n_s__owner, __pyx_k__owner, sizeof(__pyx_k__owner), 0, 0, 1, 1},
  {&__pyx_n_s__path, __pyx_k__path, sizeof(__pyx_k__path), 0, 0, 1, 1},
  {&__pyx_n_s__permissions, __pyx_k__permissions, sizeof(__pyx_k__permissions), 0, 0, 1, 1},
  {&__pyx_n_s__port, __pyx_k__port, sizeof(__pyx_k__port), 0, 0, 1, 1},
  {&__pyx_n_s__position, __pyx_k__position, sizeof(__pyx_k__position), 0, 0, 1, 1},
  {&__pyx_n_s__read_bytes, __pyx_k__read_bytes, sizeof(__pyx_k__read_bytes), 0, 0, 1, 1},
  {&__pyx_n_s__read_ops, __pyx_k__read_ops, sizeof(__pyx_k__read_ops), 0, 0, 1, 1},
  {&__pyx_n_s__recursive, __pyx_k__recursive, sizeof(__pyx_k__recursive), 0, 0, 1, 1},
  {&__pyx_n_s__replication, __pyx_k__replication, sizeof(__pyx_k__replication), 0, 0, 1, 1},
  {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
  {&__pyx_n_s__src, __pyx_k__src, sizeof(__pyx_k__src), 0, 0, 1, 1},
  {&__pyx_n_s__src_conn, __pyx_k__src_conn, sizeof(__pyx_k__src_conn), 0, 0, 1, 1},
  {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
  {&__pyx_n_s__tTime, __pyx_k__tTime, sizeof(__pyx_k__tTime), 0, 0, 1, 1},
  {&__pyx_n_s__user, __pyx_k__user, sizeof(__pyx_k__user), 0, 0, 1, 1},
  {&__pyx_n_s__weakref, __pyx_k__weakref, sizeof(__pyx_k__weakref), 0, 0, 1, 1},
  {&__pyx_n_s__write_bytes, __pyx_k__write_bytes, sizeof(__pyx_k__write_bytes), 0, 0, 1, 1},
  {&__pyx_n_s__write_ops, __pyx_k__write_ops, sizeof(__pyx_k__write_ops), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "cyhdfs.pyx":621
 * 
 *     def __init__(self):
 *         raise TypeError("This class cannot be instantiated from Python")             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_27);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_26));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_s_26));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_26));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));

  /* "cyhdfs.pyx":716
 *         buf = <void *>malloc( sizeof(char) * length)
 *         if buf is NULL:
 *             raise MemoryError("in read(): buf = <void *>malloc( sizeof(char) * length)")             # <<<<<<<<<<<<<<
 *         bytes_read = hdfsRead(self.fs, self.h_file, buf, length)
 *         IF USE_STATS:
 */
  __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_36);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_35));
  PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_35));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));

  /* "cyhdfs.pyx":746
 *         buf = <void *>malloc( sizeof(char) * length)
 *         if buf is NULL:
 *             raise MemoryError("in read(): buf = <void *>malloc( sizeof(char) * length)")             # <<<<<<<<<<<<<<
 *         bytes_read = hdfsPread(self.fs, self.h_file, position, buf, length)
 *         IF USE_STATS:
 */
  __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_38);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_35));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_s_35));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));

  /* "cyhdfs.pyx":146
 *         os.environ['CLASSPATH'] = _CLASSPATH
 *     else:
 *         raise HDFSError("environmnet variable CLASSPATH not set")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_k_tuple_43 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_43);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_42));
  PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_kp_s_42));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_42));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));

  /* "cyhdfs.pyx":863
 * 
 * 
 * def copy(HDFSConnection src_conn, char * src, HDFSConnection dst_conn, char * dst):             # <<<<<<<<<<<<<<
 *     """
 *        Copy file from one filesystem to another.
 */
  __pyx_k_tuple_44 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_44);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__src_conn));
  PyTuple_SET_ITEM(__pyx_k_tuple_44, 0, ((PyObject *)__pyx_n_s__src_conn));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__src_conn));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__src));
  PyTuple_SET_ITEM(__pyx_k_tuple_44, 1, ((PyObject *)__pyx_n_s__src));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__src));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dst_conn));
  PyTuple_SET_ITEM(__pyx_k_tuple_44, 2, ((PyObject *)__pyx_n_s__dst_conn));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dst_conn));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dst));
  PyTuple_SET_ITEM(__pyx_k_tuple_44, 3, ((PyObject *)__pyx_n_s__dst));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dst));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
  __pyx_k_codeobj_45 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_46, __pyx_n_s__copy, 863, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cyhdfs.pyx":878
 * 
 * 
 * def move(HDFSConnection src_conn, char * src, HDFSConnection dst_conn, char * dst):             # <<<<<<<<<<<<<<
 *     """
 *        Move file from one filesystem to another.
 */
  __pyx_k_tuple_47 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_47);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__src_conn));
  PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_n_s__src_conn));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__src_conn));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__src));
  PyTuple_SET_ITEM(__pyx_k_tuple_47, 1, ((PyObject *)__pyx_n_s__src));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__src));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dst_conn));
  PyTuple_SET_ITEM(__pyx_k_tuple_47, 2, ((PyObject *)__pyx_n_s__dst_conn));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dst_conn));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dst));
  PyTuple_SET_ITEM(__pyx_k_tuple_47, 3, ((PyObject *)__pyx_n_s__dst));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dst));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
  __pyx_k_codeobj_48 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_46, __pyx_n_s__move, 878, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initcyhdfs(void); /*proto*/
PyMODINIT_FUNC initcyhdfs(void)
#else
PyMODINIT_FUNC PyInit_cyhdfs(void); /*proto*/
PyMODINIT_FUNC PyInit_cyhdfs(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_cyhdfs(void)", 0);
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("cyhdfs"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_cyhdfs) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_6cyhdfs_HDFSConnection = &__pyx_vtable_6cyhdfs_HDFSConnection;
  __pyx_vtable_6cyhdfs_HDFSConnection._complain_no_conn = (PyObject *(*)(struct __pyx_obj_6cyhdfs_HDFSConnection *))__pyx_f_6cyhdfs_14HDFSConnection__complain_no_conn;
  __pyx_vtable_6cyhdfs_HDFSConnection._close_fs_files = (PyObject *(*)(struct __pyx_obj_6cyhdfs_HDFSConnection *))__pyx_f_6cyhdfs_14HDFSConnection__close_fs_files;
  __pyx_vtable_6cyhdfs_HDFSConnection._disconnect = (PyObject *(*)(struct __pyx_obj_6cyhdfs_HDFSConnection *))__pyx_f_6cyhdfs_14HDFSConnection__disconnect;
  if (PyType_Ready(&__pyx_type_6cyhdfs_HDFSConnection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_6cyhdfs_HDFSConnection.tp_dict, __pyx_vtabptr_6cyhdfs_HDFSConnection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "HDFSConnection", (PyObject *)&__pyx_type_6cyhdfs_HDFSConnection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_type_6cyhdfs_HDFSConnection.tp_weaklistoffset == 0) __pyx_type_6cyhdfs_HDFSConnection.tp_weaklistoffset = offsetof(struct __pyx_obj_6cyhdfs_HDFSConnection, __weakref__);
  __pyx_ptype_6cyhdfs_HDFSConnection = &__pyx_type_6cyhdfs_HDFSConnection;
  __pyx_vtabptr_6cyhdfs_HDFSFile = &__pyx_vtable_6cyhdfs_HDFSFile;
  __pyx_vtable_6cyhdfs_HDFSFile._close = (int (*)(struct __pyx_obj_6cyhdfs_HDFSFile *))__pyx_f_6cyhdfs_8HDFSFile__close;
  if (PyType_Ready(&__pyx_type_6cyhdfs_HDFSFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_6cyhdfs_HDFSFile.tp_dict, __pyx_vtabptr_6cyhdfs_HDFSFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "HDFSFile", (PyObject *)&__pyx_type_6cyhdfs_HDFSFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_type_6cyhdfs_HDFSFile.tp_weaklistoffset == 0) __pyx_type_6cyhdfs_HDFSFile.tp_weaklistoffset = offsetof(struct __pyx_obj_6cyhdfs_HDFSFile, __weakref__);
  __pyx_ptype_6cyhdfs_HDFSFile = &__pyx_type_6cyhdfs_HDFSFile;
  __pyx_vtabptr_6cyhdfs_HDFSReadFile = &__pyx_vtable_6cyhdfs_HDFSReadFile;
  __pyx_vtable_6cyhdfs_HDFSReadFile.__pyx_base = *__pyx_vtabptr_6cyhdfs_HDFSFile;
  __pyx_type_6cyhdfs_HDFSReadFile.tp_base = __pyx_ptype_6cyhdfs_HDFSFile;
  if (PyType_Ready(&__pyx_type_6cyhdfs_HDFSReadFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_6cyhdfs_HDFSReadFile.tp_dict, __pyx_vtabptr_6cyhdfs_HDFSReadFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "HDFSReadFile", (PyObject *)&__pyx_type_6cyhdfs_HDFSReadFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_type_6cyhdfs_HDFSReadFile.tp_weaklistoffset == 0) __pyx_type_6cyhdfs_HDFSReadFile.tp_weaklistoffset = offsetof(struct __pyx_obj_6cyhdfs_HDFSReadFile, __pyx_base.__weakref__);
  __pyx_ptype_6cyhdfs_HDFSReadFile = &__pyx_type_6cyhdfs_HDFSReadFile;
  __pyx_vtabptr_6cyhdfs_HDFSWriteFile = &__pyx_vtable_6cyhdfs_HDFSWriteFile;
  __pyx_vtable_6cyhdfs_HDFSWriteFile.__pyx_base = *__pyx_vtabptr_6cyhdfs_HDFSFile;
  __pyx_type_6cyhdfs_HDFSWriteFile.tp_base = __pyx_ptype_6cyhdfs_HDFSFile;
  if (PyType_Ready(&__pyx_type_6cyhdfs_HDFSWriteFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_6cyhdfs_HDFSWriteFile.tp_dict, __pyx_vtabptr_6cyhdfs_HDFSWriteFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "HDFSWriteFile", (PyObject *)&__pyx_type_6cyhdfs_HDFSWriteFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_type_6cyhdfs_HDFSWriteFile.tp_weaklistoffset == 0) __pyx_type_6cyhdfs_HDFSWriteFile.tp_weaklistoffset = offsetof(struct __pyx_obj_6cyhdfs_HDFSWriteFile, __pyx_base.__weakref__);
  __pyx_ptype_6cyhdfs_HDFSWriteFile = &__pyx_type_6cyhdfs_HDFSWriteFile;
  /*--- Type import code ---*/
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
  #if CYTHON_COMPILING_IN_PYPY
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "cyhdfs.pyx":19
 * 
 * # python imports
 * import weakref             # <<<<<<<<<<<<<<
 * import os
 * from collections import namedtuple
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__weakref), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__weakref, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":20
 * # python imports
 * import weakref
 * import os             # <<<<<<<<<<<<<<
 * from collections import namedtuple
 * 
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":21
 * import weakref
 * import os
 * from collections import namedtuple             # <<<<<<<<<<<<<<
 * 
 * DEF USE_STATS = 1
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__namedtuple));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__namedtuple));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__namedtuple));
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__namedtuple);
  if (__pyx_t_1 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__namedtuple);
    if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__namedtuple, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cyhdfs.pyx":122
 * # Module level constants
 * # hadoop object kinds
 * ENTRY_KIND_DIR = kObjectKindDirectory             # <<<<<<<<<<<<<<
 * ENTRY_KIND_FILE = kObjectKindFile
 * 
 */
  __pyx_t_2 = PyInt_FromLong(kObjectKindDirectory); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ENTRY_KIND_DIR, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cyhdfs.pyx":123
 * # hadoop object kinds
 * ENTRY_KIND_DIR = kObjectKindDirectory
 * ENTRY_KIND_FILE = kObjectKindFile             # <<<<<<<<<<<<<<
 * 
 * # struct hdfsFileInfo
 */
  __pyx_t_2 = PyInt_FromLong(kObjectKindFile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ENTRY_KIND_FILE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cyhdfs.pyx":127
 * # struct hdfsFileInfo
 * # returned by hdfsListDirectory and hdfsGetPathInfo
 * EntryInfo = namedtuple('EntryInfo', ['kind', 'name', 'last_mod', 'size', 'replication', 'blocksize', 'owner', 'group', 'permissions', 'last_access'])             # <<<<<<<<<<<<<<
 * 
 * Stats = namedtuple('WriteStats', ['write_ops', 'write_bytes', 'read_ops', 'read_bytes'])
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__namedtuple); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyList_New(10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__kind));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__kind));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__kind));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__name));
  PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__name));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__name));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__last_mod));
  PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__last_mod));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__last_mod));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
  PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__size));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__replication));
  PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__replication));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__replication));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__blocksize));
  PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__blocksize));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__blocksize));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__owner));
  PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__owner));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__owner));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__group));
  PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__group));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__group));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__permissions));
  PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s__permissions));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__permissions));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__last_access));
  PyList_SET_ITEM(__pyx_t_1, 9, ((PyObject *)__pyx_n_s__last_access));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__last_access));
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__EntryInfo));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__EntryInfo));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__EntryInfo));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EntryInfo, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cyhdfs.pyx":129
 * EntryInfo = namedtuple('EntryInfo', ['kind', 'name', 'last_mod', 'size', 'replication', 'blocksize', 'owner', 'group', 'permissions', 'last_access'])
 * 
 * Stats = namedtuple('WriteStats', ['write_ops', 'write_bytes', 'read_ops', 'read_bytes'])             # <<<<<<<<<<<<<<
 * 
 * # Module exceptions
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__namedtuple); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyList_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__write_ops));
  PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__write_ops));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__write_ops));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__write_bytes));
  PyList_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__write_bytes));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__write_bytes));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__read_ops));
  PyList_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_n_s__read_ops));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__read_ops));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__read_bytes));
  PyList_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_n_s__read_bytes));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__read_bytes));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__WriteStats));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__WriteStats));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__WriteStats));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Stats, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cyhdfs.pyx":132
 * 
 * # Module exceptions
 * class HDFSError(Exception):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3), __pyx_n_s__HDFSError, __pyx_n_s__cyhdfs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HDFSError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "cyhdfs.pyx":135
 *     pass
 * 
 * class HDFSConnectionError(HDFSError):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3), __pyx_n_s__HDFSConnectionError, __pyx_n_s__cyhdfs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HDFSConnectionError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "cyhdfs.pyx":138
 *     pass
 * 
 * class HDFSIOError(HDFSError):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3), __pyx_n_s__HDFSIOError, __pyx_n_s__cyhdfs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HDFSIOError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "cyhdfs.pyx":141
 *     pass
 * 
 * if 'CLASSPATH' not in os.environ:             # <<<<<<<<<<<<<<
 *     # set compile time classpath if not set
 *     if _CLASSPATH != b"":
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__environ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__CLASSPATH), __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "cyhdfs.pyx":143
 * if 'CLASSPATH' not in os.environ:
 *     # set compile time classpath if not set
 *     if _CLASSPATH != b"":             # <<<<<<<<<<<<<<
 *         os.environ['CLASSPATH'] = _CLASSPATH
 *     else:
 */
    __pyx_t_1 = PyBytes_FromString(_CLASSPATH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b_2), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "cyhdfs.pyx":144
 *     # set compile time classpath if not set
 *     if _CLASSPATH != b"":
 *         os.environ['CLASSPATH'] = _CLASSPATH             # <<<<<<<<<<<<<<
 *     else:
 *         raise HDFSError("environmnet variable CLASSPATH not set")
 */
      __pyx_t_3 = PyBytes_FromString(_CLASSPATH); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__environ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PyObject_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__CLASSPATH), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      goto __pyx_L3;
    }
    /*else*/ {

      /* "cyhdfs.pyx":146
 *         os.environ['CLASSPATH'] = _CLASSPATH
 *     else:
 *         raise HDFSError("environmnet variable CLASSPATH not set")             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__HDFSError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L3:;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "cyhdfs.pyx":863
 * 
 * 
 * def copy(HDFSConnection src_conn, char * src, HDFSConnection dst_conn, char * dst):             # <<<<<<<<<<<<<<
 *     """
 *        Copy file from one filesystem to another.
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6cyhdfs_1copy, NULL, __pyx_n_s__cyhdfs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__copy, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cyhdfs.pyx":878
 * 
 * 
 * def move(HDFSConnection src_conn, char * src, HDFSConnection dst_conn, char * dst):             # <<<<<<<<<<<<<<
 *     """
 *        Move file from one filesystem to another.
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6cyhdfs_3move, NULL, __pyx_n_s__cyhdfs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__move, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cyhdfs.pyx":1
 * #cython: embedsignature=True             # <<<<<<<<<<<<<<
 * 
 * # cython imports
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__pyx_m) {
    __Pyx_AddTraceback("init cyhdfs", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init cyhdfs");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result) {
        if (dict != __pyx_b) {
            PyErr_Clear();
            result = PyObject_GetAttr(__pyx_b, name);
        }
        if (!result) {
            PyErr_SetObject(PyExc_NameError, name);
        }
    }
    return result;
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    #if PY_VERSION_HEX < 0x02050000
    if (PyClass_Check(type)) {
    #else
    if (PyType_Check(type)) {
    #endif
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else /* Python 3+ */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *args;
        if (!value)
            args = PyTuple_New(0);
        else if (PyTuple_Check(value)) {
            Py_INCREF(value);
            args = value;
        }
        else
            args = PyTuple_Pack(1, value);
        if (!args)
            goto bad;
        owned_instance = PyEval_CallObject(type, args);
        Py_DECREF(args);
        if (!owned_instance)
            goto bad;
        value = owned_instance;
        if (!PyExceptionInstance_Check(value)) {
            PyErr_Format(PyExc_TypeError,
                         "calling %R should have returned an instance of "
                         "BaseException, not %R",
                         type, Py_TYPE(value));
            goto bad;
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause && cause != Py_None) {
        PyObject *fixed_cause;
        if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        }
        else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        }
        else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CPYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
    PyObject *py_import = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!py_import)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                /* try package relative import first */
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0; /* try absolute import on failure */
        }
        #endif
        if (!module) {
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
        }
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) {
#if PY_MAJOR_VERSION < 3
    PyErr_Format(PyExc_ImportError, "cannot import name %.230s",
                 PyString_AsString(name));
#else
    PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
#endif
}

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
    PyObject *metaclass;
#if PY_MAJOR_VERSION < 3
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = PyObject_GetAttrString(base, (char *)"__class__");
        if (!metaclass) {
            PyErr_Clear();
            metaclass = (PyObject*) Py_TYPE(base);
        }
    } else {
        metaclass = (PyObject *) &PyClass_Type;
    }
#else
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = (PyObject*) Py_TYPE(base);
    } else {
        metaclass = (PyObject *) &PyType_Type;
    }
#endif
    Py_INCREF(metaclass);
    return metaclass;
}

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *modname) {
    PyObject *result;
    PyObject *metaclass;
    if (PyDict_SetItemString(dict, "__module__", modname) < 0)
        return NULL;
    metaclass = PyDict_GetItemString(dict, "__metaclass__");
    if (metaclass) {
        Py_INCREF(metaclass);
    } else {
        metaclass = __Pyx_FindPy2Metaclass(bases);
    }
    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
    Py_DECREF(metaclass);
    return result;
}

static CYTHON_INLINE tTime __Pyx_PyInt_from_py_tTime(PyObject* x) {
    const tTime neg_one = (tTime)-1, const_zero = (tTime)0;
    const int is_unsigned = const_zero < neg_one;
    if (sizeof(tTime) == sizeof(char)) {
        if (is_unsigned)
            return (tTime)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (tTime)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(tTime) == sizeof(short)) {
        if (is_unsigned)
            return (tTime)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (tTime)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(tTime) == sizeof(int)) {
        if (is_unsigned)
            return (tTime)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (tTime)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(tTime) == sizeof(long)) {
        if (is_unsigned)
            return (tTime)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (tTime)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(tTime) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (tTime)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (tTime)__Pyx_PyInt_AsSignedLongLong(x);
    }  else {
        tTime val;
        PyObject *v = __Pyx_PyNumber_Int(x);
        #if PY_VERSION_HEX < 0x03000000
        if (likely(v) && !PyLong_Check(v)) {
            PyObject *tmp = v;
            v = PyNumber_Long(tmp);
            Py_DECREF(tmp);
        }
        #endif
        if (likely(v)) {
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                          bytes, sizeof(val),
                                          is_little, !is_unsigned);
            Py_DECREF(v);
            if (likely(!ret))
                return val;
        }
        return (tTime)-1;
    }
}

static CYTHON_INLINE int16_t __Pyx_PyInt_from_py_int16_t(PyObject* x) {
    const int16_t neg_one = (int16_t)-1, const_zero = (int16_t)0;
    const int is_unsigned = const_zero < neg_one;
    if (sizeof(int16_t) == sizeof(char)) {
        if (is_unsigned)
            return (int16_t)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (int16_t)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(int16_t) == sizeof(short)) {
        if (is_unsigned)
            return (int16_t)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (int16_t)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(int16_t) == sizeof(int)) {
        if (is_unsigned)
            return (int16_t)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (int16_t)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(int16_t) == sizeof(long)) {
        if (is_unsigned)
            return (int16_t)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (int16_t)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(int16_t) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (int16_t)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (int16_t)__Pyx_PyInt_AsSignedLongLong(x);
    }  else {
        int16_t val;
        PyObject *v = __Pyx_PyNumber_Int(x);
        #if PY_VERSION_HEX < 0x03000000
        if (likely(v) && !PyLong_Check(v)) {
            PyObject *tmp = v;
            v = PyNumber_Long(tmp);
            Py_DECREF(tmp);
        }
        #endif
        if (likely(v)) {
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                          bytes, sizeof(val),
                                          is_little, !is_unsigned);
            Py_DECREF(v);
            if (likely(!ret))
                return val;
        }
        return (int16_t)-1;
    }
}

static CYTHON_INLINE int64_t __Pyx_PyInt_from_py_int64_t(PyObject* x) {
    const int64_t neg_one = (int64_t)-1, const_zero = (int64_t)0;
    const int is_unsigned = const_zero < neg_one;
    if (sizeof(int64_t) == sizeof(char)) {
        if (is_unsigned)
            return (int64_t)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (int64_t)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(int64_t) == sizeof(short)) {
        if (is_unsigned)
            return (int64_t)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (int64_t)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(int64_t) == sizeof(int)) {
        if (is_unsigned)
            return (int64_t)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (int64_t)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(int64_t) == sizeof(long)) {
        if (is_unsigned)
            return (int64_t)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (int64_t)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(int64_t) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (int64_t)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (int64_t)__Pyx_PyInt_AsSignedLongLong(x);
    }  else {
        int64_t val;
        PyObject *v = __Pyx_PyNumber_Int(x);
        #if PY_VERSION_HEX < 0x03000000
        if (likely(v) && !PyLong_Check(v)) {
            PyObject *tmp = v;
            v = PyNumber_Long(tmp);
            Py_DECREF(tmp);
        }
        #endif
        if (likely(v)) {
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                          bytes, sizeof(val),
                                          is_little, !is_unsigned);
            Py_DECREF(v);
            if (likely(!ret))
                return val;
        }
        return (int64_t)-1;
    }
}

static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) {
    const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0;
    const int is_unsigned = const_zero < neg_one;
    if (sizeof(int32_t) == sizeof(char)) {
        if (is_unsigned)
            return (int32_t)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (int32_t)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(int32_t) == sizeof(short)) {
        if (is_unsigned)
            return (int32_t)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (int32_t)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(int32_t) == sizeof(int)) {
        if (is_unsigned)
            return (int32_t)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (int32_t)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(int32_t) == sizeof(long)) {
        if (is_unsigned)
            return (int32_t)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (int32_t)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(int32_t) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (int32_t)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (int32_t)__Pyx_PyInt_AsSignedLongLong(x);
    }  else {
        int32_t val;
        PyObject *v = __Pyx_PyNumber_Int(x);
        #if PY_VERSION_HEX < 0x03000000
        if (likely(v) && !PyLong_Check(v)) {
            PyObject *tmp = v;
            v = PyNumber_Long(tmp);
            Py_DECREF(tmp);
        }
        #endif
        if (likely(v)) {
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                          bytes, sizeof(val),
                                          is_little, !is_unsigned);
            Py_DECREF(v);
            if (likely(!ret))
                return val;
        }
        return (int32_t)-1;
    }
}

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int64_t(int64_t val) {
    const int64_t neg_one = (int64_t)-1, const_zero = (int64_t)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(int64_t) == sizeof(char))  ||
        (sizeof(int64_t) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(int64_t) == sizeof(int)) ||
               (sizeof(int64_t) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(int64_t) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(int64_t),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_tTime(tTime val) {
    const tTime neg_one = (tTime)-1, const_zero = (tTime)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(tTime) == sizeof(char))  ||
        (sizeof(tTime) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(tTime) == sizeof(int)) ||
               (sizeof(tTime) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(tTime) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(tTime),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t val) {
    const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(int32_t) == sizeof(char))  ||
        (sizeof(int32_t) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(int32_t) == sizeof(int)) ||
               (sizeof(int32_t) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(int32_t) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(int32_t),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
    if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        #if PY_VERSION_HEX < 0x02050000
        if (PyErr_Warn(NULL, warning) < 0) goto bad;
        #else
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
        #endif
    }
    else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%s.%s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = (start + end) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,            /*int argcount,*/
        0,            /*int kwonlyargcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,      /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_globals = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}


/* Type Conversion Functions */

static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}

static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
