/* Generated by Cython 0.17pre on Sun Sep 30 02:52:58 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 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"
#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__kivy___event
#define __PYX_HAVE_API__kivy___event
#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*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#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[] = {
  "_event.pyx",
  "_event.pxd",
  "properties.pxd",
};

/*--- Type declarations ---*/
struct __pyx_obj_4kivy_10properties_Property;
struct __pyx_obj_4kivy_6_event_EventDispatcher;
struct __pyx_obj_4kivy_10properties_NumericProperty;
struct __pyx_obj_4kivy_10properties_ReferenceListProperty;
struct __pyx_obj_4kivy_10properties_AliasProperty;
struct __pyx_obj_4kivy_10properties_DictProperty;
struct __pyx_obj_4kivy_10properties_ObjectProperty;
struct __pyx_obj_4kivy_10properties_StringProperty;
struct __pyx_obj_4kivy_10properties_BoundedNumericProperty;
struct __pyx_obj_4kivy_10properties_OptionProperty;
struct __pyx_obj_4kivy_10properties_ListProperty;
struct __pyx_obj_4kivy_10properties_BooleanProperty;

/* "kivy\properties.pxd":3
 * from kivy._event cimport EventDispatcher
 * 
 * cdef class Property:             # <<<<<<<<<<<<<<
 *     cdef str _name
 *     cdef int allownone
 */
struct __pyx_obj_4kivy_10properties_Property {
  PyObject_HEAD
  struct __pyx_vtabstruct_4kivy_10properties_Property *__pyx_vtab;
  PyObject *_name;
  int allownone;
  PyObject *defaultvalue;
};


/* "kivy\_event.pxd":2
 * 
 * cdef class EventDispatcher(object):             # <<<<<<<<<<<<<<
 *     cdef dict __event_stack
 *     cdef dict __properties
 */
struct __pyx_obj_4kivy_6_event_EventDispatcher {
  PyObject_HEAD
  struct __pyx_vtabstruct_4kivy_6_event_EventDispatcher *__pyx_vtab;
  PyObject *__pyx___event_stack;
  PyObject *__pyx___properties;
  PyObject *__pyx___storage;
  int uid;
};


/* "kivy\properties.pxd":19
 *     cpdef dispatch(self, EventDispatcher obj)
 * 
 * cdef class NumericProperty(Property):             # <<<<<<<<<<<<<<
 *     cdef float parse_str(self, EventDispatcher obj, value)
 *     cdef float parse_list(self, EventDispatcher obj, value, str ext)
 */
struct __pyx_obj_4kivy_10properties_NumericProperty {
  struct __pyx_obj_4kivy_10properties_Property __pyx_base;
};


/* "kivy\properties.pxd":47
 *     cdef list options
 * 
 * cdef class ReferenceListProperty(Property):             # <<<<<<<<<<<<<<
 *     cdef list properties
 *     cpdef trigger_change(self, EventDispatcher obj, value)
 */
struct __pyx_obj_4kivy_10properties_ReferenceListProperty {
  struct __pyx_obj_4kivy_10properties_Property __pyx_base;
  PyObject *properties;
};


/* "kivy\properties.pxd":51
 *     cpdef trigger_change(self, EventDispatcher obj, value)
 * 
 * cdef class AliasProperty(Property):             # <<<<<<<<<<<<<<
 *     cdef object getter
 *     cdef object setter
 */
struct __pyx_obj_4kivy_10properties_AliasProperty {
  struct __pyx_obj_4kivy_10properties_Property __pyx_base;
  PyObject *getter;
  PyObject *setter;
  PyObject *bind_objects;
  int use_cache;
};


/* "kivy\properties.pxd":29
 *     pass
 * 
 * cdef class DictProperty(Property):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4kivy_10properties_DictProperty {
  struct __pyx_obj_4kivy_10properties_Property __pyx_base;
};


/* "kivy\properties.pxd":32
 *     pass
 * 
 * cdef class ObjectProperty(Property):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4kivy_10properties_ObjectProperty {
  struct __pyx_obj_4kivy_10properties_Property __pyx_base;
};


/* "kivy\properties.pxd":23
 *     cdef float parse_list(self, EventDispatcher obj, value, str ext)
 * 
 * cdef class StringProperty(Property):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4kivy_10properties_StringProperty {
  struct __pyx_obj_4kivy_10properties_Property __pyx_base;
};


/* "kivy\properties.pxd":38
 *     pass
 * 
 * cdef class BoundedNumericProperty(Property):             # <<<<<<<<<<<<<<
 *     cdef int use_min
 *     cdef int use_max
 */
struct __pyx_obj_4kivy_10properties_BoundedNumericProperty {
  struct __pyx_obj_4kivy_10properties_Property __pyx_base;
  int use_min;
  int use_max;
  long min;
  long max;
};


/* "kivy\properties.pxd":44
 *     cdef long max
 * 
 * cdef class OptionProperty(Property):             # <<<<<<<<<<<<<<
 *     cdef list options
 * 
 */
struct __pyx_obj_4kivy_10properties_OptionProperty {
  struct __pyx_obj_4kivy_10properties_Property __pyx_base;
  PyObject *options;
};


/* "kivy\properties.pxd":26
 *     pass
 * 
 * cdef class ListProperty(Property):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4kivy_10properties_ListProperty {
  struct __pyx_obj_4kivy_10properties_Property __pyx_base;
};


/* "kivy\properties.pxd":35
 *     pass
 * 
 * cdef class BooleanProperty(Property):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4kivy_10properties_BooleanProperty {
  struct __pyx_obj_4kivy_10properties_Property __pyx_base;
};



/* "kivy\properties.pxd":3
 * from kivy._event cimport EventDispatcher
 * 
 * cdef class Property:             # <<<<<<<<<<<<<<
 *     cdef str _name
 *     cdef int allownone
 */

struct __pyx_vtabstruct_4kivy_10properties_Property {
  PyObject *(*init_storage)(struct __pyx_obj_4kivy_10properties_Property *, struct __pyx_obj_4kivy_6_event_EventDispatcher *, PyObject *);
  PyObject *(*link)(struct __pyx_obj_4kivy_10properties_Property *, struct __pyx_obj_4kivy_6_event_EventDispatcher *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*link_deps)(struct __pyx_obj_4kivy_10properties_Property *, struct __pyx_obj_4kivy_6_event_EventDispatcher *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*bind)(struct __pyx_obj_4kivy_10properties_Property *, struct __pyx_obj_4kivy_6_event_EventDispatcher *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*unbind)(struct __pyx_obj_4kivy_10properties_Property *, struct __pyx_obj_4kivy_6_event_EventDispatcher *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*compare_value)(struct __pyx_obj_4kivy_10properties_Property *, PyObject *, PyObject *);
  PyObject *(*set)(struct __pyx_obj_4kivy_10properties_Property *, struct __pyx_obj_4kivy_6_event_EventDispatcher *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*get)(struct __pyx_obj_4kivy_10properties_Property *, struct __pyx_obj_4kivy_6_event_EventDispatcher *, int __pyx_skip_dispatch);
  PyObject *(*check)(struct __pyx_obj_4kivy_10properties_Property *, struct __pyx_obj_4kivy_6_event_EventDispatcher *, PyObject *);
  PyObject *(*convert)(struct __pyx_obj_4kivy_10properties_Property *, struct __pyx_obj_4kivy_6_event_EventDispatcher *, PyObject *);
  PyObject *(*dispatch)(struct __pyx_obj_4kivy_10properties_Property *, struct __pyx_obj_4kivy_6_event_EventDispatcher *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4kivy_10properties_Property *__pyx_vtabptr_4kivy_10properties_Property;


/* "kivy\properties.pxd":35
 *     pass
 * 
 * cdef class BooleanProperty(Property):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4kivy_10properties_BooleanProperty {
  struct __pyx_vtabstruct_4kivy_10properties_Property __pyx_base;
};
static struct __pyx_vtabstruct_4kivy_10properties_BooleanProperty *__pyx_vtabptr_4kivy_10properties_BooleanProperty;


/* "kivy\properties.pxd":38
 *     pass
 * 
 * cdef class BoundedNumericProperty(Property):             # <<<<<<<<<<<<<<
 *     cdef int use_min
 *     cdef int use_max
 */

struct __pyx_vtabstruct_4kivy_10properties_BoundedNumericProperty {
  struct __pyx_vtabstruct_4kivy_10properties_Property __pyx_base;
};
static struct __pyx_vtabstruct_4kivy_10properties_BoundedNumericProperty *__pyx_vtabptr_4kivy_10properties_BoundedNumericProperty;


/* "kivy\properties.pxd":44
 *     cdef long max
 * 
 * cdef class OptionProperty(Property):             # <<<<<<<<<<<<<<
 *     cdef list options
 * 
 */

struct __pyx_vtabstruct_4kivy_10properties_OptionProperty {
  struct __pyx_vtabstruct_4kivy_10properties_Property __pyx_base;
};
static struct __pyx_vtabstruct_4kivy_10properties_OptionProperty *__pyx_vtabptr_4kivy_10properties_OptionProperty;


/* "kivy\properties.pxd":47
 *     cdef list options
 * 
 * cdef class ReferenceListProperty(Property):             # <<<<<<<<<<<<<<
 *     cdef list properties
 *     cpdef trigger_change(self, EventDispatcher obj, value)
 */

struct __pyx_vtabstruct_4kivy_10properties_ReferenceListProperty {
  struct __pyx_vtabstruct_4kivy_10properties_Property __pyx_base;
  PyObject *(*trigger_change)(struct __pyx_obj_4kivy_10properties_ReferenceListProperty *, struct __pyx_obj_4kivy_6_event_EventDispatcher *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4kivy_10properties_ReferenceListProperty *__pyx_vtabptr_4kivy_10properties_ReferenceListProperty;


/* "kivy\properties.pxd":32
 *     pass
 * 
 * cdef class ObjectProperty(Property):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4kivy_10properties_ObjectProperty {
  struct __pyx_vtabstruct_4kivy_10properties_Property __pyx_base;
};
static struct __pyx_vtabstruct_4kivy_10properties_ObjectProperty *__pyx_vtabptr_4kivy_10properties_ObjectProperty;


/* "kivy\properties.pxd":26
 *     pass
 * 
 * cdef class ListProperty(Property):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4kivy_10properties_ListProperty {
  struct __pyx_vtabstruct_4kivy_10properties_Property __pyx_base;
};
static struct __pyx_vtabstruct_4kivy_10properties_ListProperty *__pyx_vtabptr_4kivy_10properties_ListProperty;


/* "kivy\properties.pxd":19
 *     cpdef dispatch(self, EventDispatcher obj)
 * 
 * cdef class NumericProperty(Property):             # <<<<<<<<<<<<<<
 *     cdef float parse_str(self, EventDispatcher obj, value)
 *     cdef float parse_list(self, EventDispatcher obj, value, str ext)
 */

struct __pyx_vtabstruct_4kivy_10properties_NumericProperty {
  struct __pyx_vtabstruct_4kivy_10properties_Property __pyx_base;
  float (*parse_str)(struct __pyx_obj_4kivy_10properties_NumericProperty *, struct __pyx_obj_4kivy_6_event_EventDispatcher *, PyObject *);
  float (*parse_list)(struct __pyx_obj_4kivy_10properties_NumericProperty *, struct __pyx_obj_4kivy_6_event_EventDispatcher *, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_4kivy_10properties_NumericProperty *__pyx_vtabptr_4kivy_10properties_NumericProperty;


/* "kivy\properties.pxd":51
 *     cpdef trigger_change(self, EventDispatcher obj, value)
 * 
 * cdef class AliasProperty(Property):             # <<<<<<<<<<<<<<
 *     cdef object getter
 *     cdef object setter
 */

struct __pyx_vtabstruct_4kivy_10properties_AliasProperty {
  struct __pyx_vtabstruct_4kivy_10properties_Property __pyx_base;
  PyObject *(*trigger_change)(struct __pyx_obj_4kivy_10properties_AliasProperty *, struct __pyx_obj_4kivy_6_event_EventDispatcher *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4kivy_10properties_AliasProperty *__pyx_vtabptr_4kivy_10properties_AliasProperty;


/* "kivy\properties.pxd":29
 *     pass
 * 
 * cdef class DictProperty(Property):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4kivy_10properties_DictProperty {
  struct __pyx_vtabstruct_4kivy_10properties_Property __pyx_base;
};
static struct __pyx_vtabstruct_4kivy_10properties_DictProperty *__pyx_vtabptr_4kivy_10properties_DictProperty;


/* "kivy\_event.pyx":25
 * cdef dict cache_properties = {}
 * 
 * cdef class EventDispatcher(object):             # <<<<<<<<<<<<<<
 *     '''Generic event dispatcher interface
 * 
 */

struct __pyx_vtabstruct_4kivy_6_event_EventDispatcher {
  PyObject *(*properties)(struct __pyx_obj_4kivy_6_event_EventDispatcher *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4kivy_6_event_EventDispatcher *__pyx_vtabptr_4kivy_6_event_EventDispatcher;


/* "kivy\properties.pxd":23
 *     cdef float parse_list(self, EventDispatcher obj, value, str ext)
 * 
 * cdef class StringProperty(Property):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4kivy_10properties_StringProperty {
  struct __pyx_vtabstruct_4kivy_10properties_Property __pyx_base;
};
static struct __pyx_vtabstruct_4kivy_10properties_StringProperty *__pyx_vtabptr_4kivy_10properties_StringProperty;
#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 CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/

static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) {
    return unlikely(b < 0) ? b : !b;
}
static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
    return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
}

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*/

#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred())
            PyErr_SetObject(PyExc_KeyError, key);
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/

static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** value1, PyObject** value2,
                                             int is_tuple, int has_known_size, int decref_tuple);

static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*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 int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr,
                                     Py_ssize_t start, Py_ssize_t end, int direction) {
    if (unlikely(PyTuple_Check(substr))) {
        int result;
        Py_ssize_t i;
        for (i = 0; i < PyTuple_GET_SIZE(substr); i++) {
            result = PyUnicode_Tailmatch(s, PyTuple_GET_ITEM(substr, i),
                                         start, end, direction);
            if (result) {
                return result;
            }
        }
        return 0;
    }
    return PyUnicode_Tailmatch(s, substr, start, end, direction);
}

static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize_t start,
                                         Py_ssize_t end, int direction)
{
    const char* self_ptr = PyBytes_AS_STRING(self);
    Py_ssize_t self_len = PyBytes_GET_SIZE(self);
    const char* sub_ptr;
    Py_ssize_t sub_len;
    int retval;
#if PY_VERSION_HEX >= 0x02060000
    Py_buffer view;
    view.obj = NULL;
#endif
    if ( PyBytes_Check(arg) ) {
        sub_ptr = PyBytes_AS_STRING(arg);
        sub_len = PyBytes_GET_SIZE(arg);
    }
#if PY_MAJOR_VERSION < 3
    else if ( PyUnicode_Check(arg) ) {
        return PyUnicode_Tailmatch(self, arg, start, end, direction);
    }
#endif
    else {
#if PY_VERSION_HEX < 0x02060000
        if (unlikely(PyObject_AsCharBuffer(arg, &sub_ptr, &sub_len)))
            return -1;
#else
        if (unlikely(PyObject_GetBuffer(self, &view, PyBUF_SIMPLE) == -1))
            return -1;
        sub_ptr = (const char*) view.buf;
        sub_len = view.len;
#endif
    }
    if (end > self_len)
        end = self_len;
    else if (end < 0)
        end += self_len;
    if (end < 0)
        end = 0;
    if (start < 0)
        start += self_len;
    if (start < 0)
        start = 0;
    if (direction > 0) {
        if (end-sub_len > start)
            start = end - sub_len;
    }
    if (start + sub_len <= end)
        retval = !memcmp(self_ptr+start, sub_ptr, sub_len);
    else
        retval = 0;
#if PY_VERSION_HEX >= 0x02060000
    if (view.obj)
        PyBuffer_Release(&view);
#endif
    return retval;
}
static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr, Py_ssize_t start,
                                   Py_ssize_t end, int direction)
{
    if (unlikely(PyTuple_Check(substr))) {
        int result;
        Py_ssize_t i;
        for (i = 0; i < PyTuple_GET_SIZE(substr); i++) {
            result = __Pyx_PyBytes_SingleTailmatch(self, PyTuple_GET_ITEM(substr, i),
                                                   start, end, direction);
            if (result) {
                return result;
            }
        }
        return 0;
    }
    return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction);
}

static CYTHON_INLINE int __Pyx_PyStr_Tailmatch(PyObject* self, PyObject* arg, Py_ssize_t start,
                                               Py_ssize_t end, int direction);

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

static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(PyList_Append(L, x) < 0)) return NULL;
        Py_INCREF(Py_None);
        return Py_None; /* this is just to have an accurate signature */
    } else {
        PyObject *r, *m;
        m = __Pyx_GetAttrString(L, "append");
        if (!m) return NULL;
        r = PyObject_CallFunctionObjArgs(m, x, NULL);
        Py_DECREF(m);
        return r;
    }
}

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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name);

static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/

#include <string.h>

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/

#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

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 PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/

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

static void* __Pyx_GetVtable(PyObject *dict); /*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 'kivy.properties' */
static PyTypeObject *__pyx_ptype_4kivy_10properties_Property = 0;
static PyTypeObject *__pyx_ptype_4kivy_10properties_NumericProperty = 0;
static PyTypeObject *__pyx_ptype_4kivy_10properties_StringProperty = 0;
static PyTypeObject *__pyx_ptype_4kivy_10properties_ListProperty = 0;
static PyTypeObject *__pyx_ptype_4kivy_10properties_DictProperty = 0;
static PyTypeObject *__pyx_ptype_4kivy_10properties_ObjectProperty = 0;
static PyTypeObject *__pyx_ptype_4kivy_10properties_BooleanProperty = 0;
static PyTypeObject *__pyx_ptype_4kivy_10properties_BoundedNumericProperty = 0;
static PyTypeObject *__pyx_ptype_4kivy_10properties_OptionProperty = 0;
static PyTypeObject *__pyx_ptype_4kivy_10properties_ReferenceListProperty = 0;
static PyTypeObject *__pyx_ptype_4kivy_10properties_AliasProperty = 0;

/* Module declarations from 'kivy._event' */
static PyTypeObject *__pyx_ptype_4kivy_6_event_EventDispatcher = 0;
static int __pyx_v_4kivy_6_event_widget_uid;
static PyObject *__pyx_v_4kivy_6_event_cache_properties = 0;
#define __Pyx_MODULE_NAME "kivy._event"
int __pyx_module_is_main_kivy___event = 0;

/* Implementation of 'kivy._event' */
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_super;
static int __pyx_pf_4kivy_6_event_15EventDispatcher___cinit__(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_largs, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static int __pyx_pf_4kivy_6_event_15EventDispatcher_2__init__(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_4register_event_type(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_event_type); /* proto */
static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_6unregister_event_types(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_event_type); /* proto */
static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_8is_event_type(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_event_type); /* proto */
static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_10bind(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_12unbind(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_14dispatch(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_event_type, PyObject *__pyx_v_largs); /* proto */
static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_16__proxy_setter(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_dstinstance, PyObject *__pyx_v_name, CYTHON_UNUSED PyObject *__pyx_v_instance, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_18__proxy_getter(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_dstinstance, PyObject *__pyx_v_name, CYTHON_UNUSED PyObject *__pyx_v_instance); /* proto */
static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_20setter(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_22getter(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_24property(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_26properties(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_28create_property(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_3uid___get__(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self); /* proto */
static char __pyx_k_1[] = "The property <%s> have a forbidden name";
static char __pyx_k_2[] = "A new event must start with \"on_\"";
static char __pyx_k_4[] = "Missing default handler <%s> in <%s>";
static char __pyx_k_6[] = "\nEvent dispatcher\n================\n\nAll objects that produce events in Kivy implement :class:`EventDispatcher`,\nproviding a consistent interface for registering and manipulating event\nhandlers.\n\n.. versionchanged:: 1.0.9\n    Properties discovering and methods have been moved from\n    :class:`~kivy.uix.widget.Widget` to :class:`EventDispatcher`\n\n";
static char __pyx_k_8[] = "kivy.weakmethod";
static char __pyx_k_9[] = "EventDispatcher.create_property (line 280)";
static char __pyx_k_10[] = "Create a new property at runtime.\n\n        .. versionadded:: 1.0.9\n\n        .. warning::\n\n            This function is designed for the Kivy language, don't use it in\n            your code. You should declare the property in your class instead of\n            using this method.\n\n        :Parameters:\n            `name`: string\n                Name of the property\n\n        The class of the property cannot be specified, it will always be an\n        :class:`~kivy.properties.ObjectProperty` class. The default value of the\n        property will be None, until you set a new value.\n\n        >>> mywidget = Widget()\n        >>> mywidget.create_property('custom')\n        >>> mywidget.custom = True\n        >>> print mywidget.custom\n        True\n        ";
static char __pyx_k__on_[] = "on_";
static char __pyx_k__bind[] = "bind";
static char __pyx_k__name[] = "name";
static char __pyx_k__super[] = "super";
static char __pyx_k__value[] = "value";
static char __pyx_k__remove[] = "remove";
static char __pyx_k____all__[] = "__all__";
static char __pyx_k__partial[] = "partial";
static char __pyx_k____init__[] = "__init__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____name__[] = "__name__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__instance[] = "instance";
static char __pyx_k__touch_up[] = "touch_up";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k____class__[] = "__class__";
static char __pyx_k__functools[] = "functools";
static char __pyx_k__iteritems[] = "iteritems";
static char __pyx_k__WeakMethod[] = "WeakMethod";
static char __pyx_k__event_type[] = "event_type";
static char __pyx_k__properties[] = "properties";
static char __pyx_k__touch_down[] = "touch_down";
static char __pyx_k__touch_move[] = "touch_move";
static char __pyx_k__dstinstance[] = "dstinstance";
static char __pyx_k____proxy_getter[] = "__proxy_getter";
static char __pyx_k____proxy_setter[] = "__proxy_setter";
static char __pyx_k__EventDispatcher[] = "EventDispatcher";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_u_10;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_n_s_8;
static PyObject *__pyx_kp_u_9;
static PyObject *__pyx_n_s__EventDispatcher;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__WeakMethod;
static PyObject *__pyx_n_s____all__;
static PyObject *__pyx_n_s____class__;
static PyObject *__pyx_n_s____init__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____name__;
static PyObject *__pyx_n_s____proxy_getter;
static PyObject *__pyx_n_s____proxy_setter;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s__bind;
static PyObject *__pyx_n_s__dstinstance;
static PyObject *__pyx_n_s__event_type;
static PyObject *__pyx_n_s__functools;
static PyObject *__pyx_n_s__instance;
static PyObject *__pyx_n_s__iteritems;
static PyObject *__pyx_n_s__name;
static PyObject *__pyx_n_s__on_;
static PyObject *__pyx_n_s__partial;
static PyObject *__pyx_n_s__properties;
static PyObject *__pyx_n_s__remove;
static PyObject *__pyx_n_s__super;
static PyObject *__pyx_n_s__touch_down;
static PyObject *__pyx_n_s__touch_move;
static PyObject *__pyx_n_s__touch_up;
static PyObject *__pyx_n_s__value;
static PyObject *__pyx_k_tuple_3;
static PyObject *__pyx_k_tuple_5;
static PyObject *__pyx_k_tuple_7;

/* Python wrapper */
static int __pyx_pw_4kivy_6_event_15EventDispatcher_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4kivy_6_event_15EventDispatcher_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_largs = 0;
  CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
  if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_largs = __pyx_args;
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher___cinit__(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self), __pyx_v_largs, __pyx_v_kwargs);
  __Pyx_XDECREF(__pyx_v_largs);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":31
 *     '''
 * 
 *     def __cinit__(self, *largs, **kwargs):             # <<<<<<<<<<<<<<
 *         global widget_uid, cache_properties
 *         cdef dict cp = cache_properties
 */

static int __pyx_pf_4kivy_6_event_15EventDispatcher___cinit__(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_largs, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_cp = 0;
  PyObject *__pyx_v_attrs_found = 0;
  PyObject *__pyx_v_attrs = 0;
  struct __pyx_obj_4kivy_10properties_Property *__pyx_v_attr = 0;
  PyObject *__pyx_v_k = 0;
  PyObject *__pyx_v___cls__ = NULL;
  PyObject *__pyx_v_uattr = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "kivy\_event.pyx":33
 *     def __cinit__(self, *largs, **kwargs):
 *         global widget_uid, cache_properties
 *         cdef dict cp = cache_properties             # <<<<<<<<<<<<<<
 *         cdef dict attrs_found
 *         cdef list attrs
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_4kivy_6_event_cache_properties));
  __pyx_v_cp = __pyx_v_4kivy_6_event_cache_properties;

  /* "kivy\_event.pyx":39
 *         cdef str k
 * 
 *         self.__event_stack = {}             # <<<<<<<<<<<<<<
 *         self.__storage = {}
 * 
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_v_self->__pyx___event_stack);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx___event_stack));
  __pyx_v_self->__pyx___event_stack = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "kivy\_event.pyx":40
 * 
 *         self.__event_stack = {}
 *         self.__storage = {}             # <<<<<<<<<<<<<<
 * 
 *         __cls__ = self.__class__
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_v_self->__pyx___storage);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx___storage));
  __pyx_v_self->__pyx___storage = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "kivy\_event.pyx":42
 *         self.__storage = {}
 * 
 *         __cls__ = self.__class__             # <<<<<<<<<<<<<<
 * 
 *         # XXX for the moment, we need to create a uniq id for properties.
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v___cls__ = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "kivy\_event.pyx":48
 *         # are longer than using a custom __uid. I hope we can figure out a way
 *         # of doing that without require any python code. :)
 *         widget_uid += 1             # <<<<<<<<<<<<<<
 *         self.uid = widget_uid
 * 
 */
  __pyx_v_4kivy_6_event_widget_uid = (__pyx_v_4kivy_6_event_widget_uid + 1);

  /* "kivy\_event.pyx":49
 *         # of doing that without require any python code. :)
 *         widget_uid += 1
 *         self.uid = widget_uid             # <<<<<<<<<<<<<<
 * 
 *         if __cls__ not in cp:
 */
  __pyx_v_self->uid = __pyx_v_4kivy_6_event_widget_uid;

  /* "kivy\_event.pyx":51
 *         self.uid = widget_uid
 * 
 *         if __cls__ not in cp:             # <<<<<<<<<<<<<<
 *             attrs_found = cp[__cls__] = {}
 *             attrs = dir(__cls__)
 */
  if (unlikely(((PyObject *)__pyx_v_cp) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_cp), __pyx_v___cls__))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "kivy\_event.pyx":52
 * 
 *         if __cls__ not in cp:
 *             attrs_found = cp[__cls__] = {}             # <<<<<<<<<<<<<<
 *             attrs = dir(__cls__)
 *             for k in attrs:
 */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(((PyObject *)__pyx_t_1));
    __pyx_v_attrs_found = __pyx_t_1;
    if (unlikely(((PyObject *)__pyx_v_cp) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (PyDict_SetItem(((PyObject *)__pyx_v_cp), __pyx_v___cls__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

    /* "kivy\_event.pyx":53
 *         if __cls__ not in cp:
 *             attrs_found = cp[__cls__] = {}
 *             attrs = dir(__cls__)             # <<<<<<<<<<<<<<
 *             for k in attrs:
 *                 uattr = getattr(__cls__, k)
 */
    __pyx_t_1 = PyObject_Dir(__pyx_v___cls__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_attrs = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "kivy\_event.pyx":54
 *             attrs_found = cp[__cls__] = {}
 *             attrs = dir(__cls__)
 *             for k in attrs:             # <<<<<<<<<<<<<<
 *                 uattr = getattr(__cls__, k)
 *                 if not isinstance(uattr, Property):
 */
    if (unlikely(((PyObject *)__pyx_v_attrs) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = ((PyObject *)__pyx_v_attrs); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
      if (!(likely(PyString_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_k));
      __pyx_v_k = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "kivy\_event.pyx":55
 *             attrs = dir(__cls__)
 *             for k in attrs:
 *                 uattr = getattr(__cls__, k)             # <<<<<<<<<<<<<<
 *                 if not isinstance(uattr, Property):
 *                     continue
 */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v___cls__, ((PyObject *)__pyx_v_k)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_v_uattr);
      __pyx_v_uattr = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "kivy\_event.pyx":56
 *             for k in attrs:
 *                 uattr = getattr(__cls__, k)
 *                 if not isinstance(uattr, Property):             # <<<<<<<<<<<<<<
 *                     continue
 *                 if k == 'touch_down' or k == 'touch_move' or k == 'touch_up':
 */
      __pyx_t_4 = ((PyObject *)((PyObject*)__pyx_ptype_4kivy_10properties_Property));
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_uattr, __pyx_t_4); 
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = (!__pyx_t_2);
      if (__pyx_t_5) {

        /* "kivy\_event.pyx":57
 *                 uattr = getattr(__cls__, k)
 *                 if not isinstance(uattr, Property):
 *                     continue             # <<<<<<<<<<<<<<
 *                 if k == 'touch_down' or k == 'touch_move' or k == 'touch_up':
 *                     raise Exception('The property <%s> have a forbidden name' % k)
 */
        goto __pyx_L4_continue;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "kivy\_event.pyx":58
 *                 if not isinstance(uattr, Property):
 *                     continue
 *                 if k == 'touch_down' or k == 'touch_move' or k == 'touch_up':             # <<<<<<<<<<<<<<
 *                     raise Exception('The property <%s> have a forbidden name' % k)
 *                 attrs_found[k] = uattr
 */
      __pyx_t_5 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_k), ((PyObject *)__pyx_n_s__touch_down), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_k), ((PyObject *)__pyx_n_s__touch_move), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (!__pyx_t_2) {
          __pyx_t_6 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_k), ((PyObject *)__pyx_n_s__touch_up), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_7 = __pyx_t_6;
        } else {
          __pyx_t_7 = __pyx_t_2;
        }
        __pyx_t_2 = __pyx_t_7;
      } else {
        __pyx_t_2 = __pyx_t_5;
      }
      if (__pyx_t_2) {

        /* "kivy\_event.pyx":59
 *                     continue
 *                 if k == 'touch_down' or k == 'touch_move' or k == 'touch_up':
 *                     raise Exception('The property <%s> have a forbidden name' % k)             # <<<<<<<<<<<<<<
 *                 attrs_found[k] = uattr
 *         else:
 */
        __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_v_k)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_4));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
        __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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 = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "kivy\_event.pyx":60
 *                 if k == 'touch_down' or k == 'touch_move' or k == 'touch_up':
 *                     raise Exception('The property <%s> have a forbidden name' % k)
 *                 attrs_found[k] = uattr             # <<<<<<<<<<<<<<
 *         else:
 *             attrs_found = cp[__cls__]
 */
      if (PyDict_SetItem(((PyObject *)__pyx_v_attrs_found), ((PyObject *)__pyx_v_k), __pyx_v_uattr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L4_continue:;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "kivy\_event.pyx":62
 *                 attrs_found[k] = uattr
 *         else:
 *             attrs_found = cp[__cls__]             # <<<<<<<<<<<<<<
 * 
 *         # First loop, link all the properties storage to our instance
 */
    if (unlikely(((PyObject *)__pyx_v_cp) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_cp), __pyx_v___cls__); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_attrs_found = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "kivy\_event.pyx":65
 * 
 *         # First loop, link all the properties storage to our instance
 *         for k in attrs_found:             # <<<<<<<<<<<<<<
 *             attr = attrs_found[k]
 *             attr.link(self, k)
 */
  __pyx_t_3 = 0;
  if (unlikely(((PyObject *)__pyx_v_attrs_found) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = __Pyx_dict_iterator(((PyObject *)__pyx_v_attrs_found), 1, ((PyObject *)NULL), (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_4;
  __pyx_t_4 = 0;
  while (1) {
    __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_9, &__pyx_t_3, &__pyx_t_4, NULL, NULL, __pyx_t_10);
    if (unlikely(__pyx_t_11 == 0)) break;
    if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(PyString_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_k));
    __pyx_v_k = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "kivy\_event.pyx":66
 *         # First loop, link all the properties storage to our instance
 *         for k in attrs_found:
 *             attr = attrs_found[k]             # <<<<<<<<<<<<<<
 *             attr.link(self, k)
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_attrs_found) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_attrs_found), ((PyObject *)__pyx_v_k)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4kivy_10properties_Property))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_attr));
    __pyx_v_attr = ((struct __pyx_obj_4kivy_10properties_Property *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "kivy\_event.pyx":67
 *         for k in attrs_found:
 *             attr = attrs_found[k]
 *             attr.link(self, k)             # <<<<<<<<<<<<<<
 * 
 *         # Second loop, resolve all the reference
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_4kivy_10properties_Property *)__pyx_v_attr->__pyx_vtab)->link(__pyx_v_attr, __pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "kivy\_event.pyx":70
 * 
 *         # Second loop, resolve all the reference
 *         for k in attrs_found:             # <<<<<<<<<<<<<<
 *             attr = attrs_found[k]
 *             attr.link_deps(self, k)
 */
  __pyx_t_9 = 0;
  if (unlikely(((PyObject *)__pyx_v_attrs_found) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = __Pyx_dict_iterator(((PyObject *)__pyx_v_attrs_found), 1, ((PyObject *)NULL), (&__pyx_t_3), (&__pyx_t_10)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_4;
  __pyx_t_4 = 0;
  while (1) {
    __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_9, &__pyx_t_4, NULL, NULL, __pyx_t_10);
    if (unlikely(__pyx_t_11 == 0)) break;
    if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(PyString_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_k));
    __pyx_v_k = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "kivy\_event.pyx":71
 *         # Second loop, resolve all the reference
 *         for k in attrs_found:
 *             attr = attrs_found[k]             # <<<<<<<<<<<<<<
 *             attr.link_deps(self, k)
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_attrs_found) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_attrs_found), ((PyObject *)__pyx_v_k)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4kivy_10properties_Property))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_attr));
    __pyx_v_attr = ((struct __pyx_obj_4kivy_10properties_Property *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "kivy\_event.pyx":72
 *         for k in attrs_found:
 *             attr = attrs_found[k]
 *             attr.link_deps(self, k)             # <<<<<<<<<<<<<<
 * 
 *         self.__properties = attrs_found
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_4kivy_10properties_Property *)__pyx_v_attr->__pyx_vtab)->link_deps(__pyx_v_attr, __pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "kivy\_event.pyx":74
 *             attr.link_deps(self, k)
 * 
 *         self.__properties = attrs_found             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, **kwargs):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_attrs_found));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_attrs_found));
  __Pyx_GOTREF(__pyx_v_self->__pyx___properties);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx___properties));
  __pyx_v_self->__pyx___properties = __pyx_v_attrs_found;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("kivy._event.EventDispatcher.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cp);
  __Pyx_XDECREF(__pyx_v_attrs_found);
  __Pyx_XDECREF(__pyx_v_attrs);
  __Pyx_XDECREF((PyObject *)__pyx_v_attr);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v___cls__);
  __Pyx_XDECREF(__pyx_v_uattr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_4kivy_6_event_15EventDispatcher_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4kivy_6_event_15EventDispatcher_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kwargs = 0;
  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 (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 1))) return -1;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
  if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_2__init__(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self), __pyx_v_kwargs);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":76
 *         self.__properties = attrs_found
 * 
 *     def __init__(self, **kwargs):             # <<<<<<<<<<<<<<
 *         cdef str func, name, key
 *         cdef dict properties
 */

static int __pyx_pf_4kivy_6_event_15EventDispatcher_2__init__(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_func = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_properties = 0;
  PyObject *__pyx_v_value = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "kivy\_event.pyx":79
 *         cdef str func, name, key
 *         cdef dict properties
 *         super(EventDispatcher, self).__init__()             # <<<<<<<<<<<<<<
 * 
 *         # Auto bind on own handler if exist
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4kivy_6_event_EventDispatcher)));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_4kivy_6_event_EventDispatcher)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4kivy_6_event_EventDispatcher)));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __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____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __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 = 79; __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;

  /* "kivy\_event.pyx":82
 * 
 *         # Auto bind on own handler if exist
 *         properties = self.properties()             # <<<<<<<<<<<<<<
 *         for func in dir(self):
 *             if not func.startswith('on_'):
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4kivy_6_event_EventDispatcher *)__pyx_v_self->__pyx_vtab)->properties(__pyx_v_self, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_properties = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "kivy\_event.pyx":83
 *         # Auto bind on own handler if exist
 *         properties = self.properties()
 *         for func in dir(self):             # <<<<<<<<<<<<<<
 *             if not func.startswith('on_'):
 *                 continue
 */
  __pyx_t_2 = PyObject_Dir(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_func));
    __pyx_v_func = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "kivy\_event.pyx":84
 *         properties = self.properties()
 *         for func in dir(self):
 *             if not func.startswith('on_'):             # <<<<<<<<<<<<<<
 *                 continue
 *             name = func[3:]
 */
    if (unlikely(((PyObject *)__pyx_v_func) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "startswith");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = __Pyx_PyStr_Tailmatch(((PyObject *)__pyx_v_func), ((PyObject *)__pyx_n_s__on_), 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (!__pyx_t_5);
    if (__pyx_t_6) {

      /* "kivy\_event.pyx":85
 *         for func in dir(self):
 *             if not func.startswith('on_'):
 *                 continue             # <<<<<<<<<<<<<<
 *             name = func[3:]
 *             if name in properties:
 */
      goto __pyx_L3_continue;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "kivy\_event.pyx":86
 *             if not func.startswith('on_'):
 *                 continue
 *             name = func[3:]             # <<<<<<<<<<<<<<
 *             if name in properties:
 *                 self.bind(**{name: getattr(self, func)})
 */
    __pyx_t_2 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_func), 3, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_XDECREF(((PyObject *)__pyx_v_name));
    __pyx_v_name = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "kivy\_event.pyx":87
 *                 continue
 *             name = func[3:]
 *             if name in properties:             # <<<<<<<<<<<<<<
 *                 self.bind(**{name: getattr(self, func)})
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_properties) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = ((PyDict_Contains(((PyObject *)__pyx_v_properties), ((PyObject *)__pyx_v_name)))); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_6) {

      /* "kivy\_event.pyx":88
 *             name = func[3:]
 *             if name in properties:
 *                 self.bind(**{name: getattr(self, func)})             # <<<<<<<<<<<<<<
 * 
 *         # Apply the existing arguments to our widget
 */
      __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__bind); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
      __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_func)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_v_name), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_7 = ((PyObject *)__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "kivy\_event.pyx":91
 * 
 *         # Apply the existing arguments to our widget
 *         for key, value in kwargs.iteritems():             # <<<<<<<<<<<<<<
 *             if key in properties:
 *                 setattr(self, key, value)
 */
  __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_dict_iterator(((PyObject *)__pyx_v_kwargs), 1, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_10), (&__pyx_t_11)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_8;
  __pyx_t_8 = 0;
  while (1) {
    __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_10, &__pyx_t_3, &__pyx_t_8, &__pyx_t_7, NULL, __pyx_t_11);
    if (unlikely(__pyx_t_12 == 0)) break;
    if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    if (!(likely(PyString_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_8)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_XDECREF(((PyObject *)__pyx_v_key));
    __pyx_v_key = ((PyObject*)__pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "kivy\_event.pyx":92
 *         # Apply the existing arguments to our widget
 *         for key, value in kwargs.iteritems():
 *             if key in properties:             # <<<<<<<<<<<<<<
 *                 setattr(self, key, value)
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_properties) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = ((PyDict_Contains(((PyObject *)__pyx_v_properties), ((PyObject *)__pyx_v_key)))); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_6) {

      /* "kivy\_event.pyx":93
 *         for key, value in kwargs.iteritems():
 *             if key in properties:
 *                 setattr(self, key, value)             # <<<<<<<<<<<<<<
 * 
 *     def register_event_type(self, str event_type):
 */
      __pyx_t_13 = PyObject_SetAttr(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_key), __pyx_v_value); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L9;
    }
    __pyx_L9:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("kivy._event.EventDispatcher.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_func);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_properties);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_5register_event_type(PyObject *__pyx_v_self, PyObject *__pyx_v_event_type); /*proto*/
static char __pyx_doc_4kivy_6_event_15EventDispatcher_4register_event_type[] = "Register an event type with the dispatcher.\n\n        Registering event types allows the dispatcher to validate event handler\n        names as they are attached, and to search attached objects for suitable\n        handlers. Each event type declaration must :\n\n            1. start with the prefix `on_`\n            2. have a default handler in the class\n\n        Example of creating custom event::\n\n            class MyWidget(Widget):\n                def __init__(self, **kwargs):\n                    super(MyWidget, self).__init__(**kwargs)\n                    self.register_event_type('on_swipe')\n\n                def on_swipe(self):\n                    pass\n\n            def on_swipe_callback(*largs):\n                print 'my swipe is called', largs\n            w = MyWidget()\n            w.dispatch('on_swipe')\n        ";
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_5register_event_type(PyObject *__pyx_v_self, PyObject *__pyx_v_event_type) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("register_event_type (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_event_type), (&PyString_Type), 1, "event_type", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_4register_event_type(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self), ((PyObject*)__pyx_v_event_type));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":95
 *                 setattr(self, key, value)
 * 
 *     def register_event_type(self, str event_type):             # <<<<<<<<<<<<<<
 *         '''Register an event type with the dispatcher.
 * 
 */

static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_4register_event_type(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_event_type) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("register_event_type", 0);

  /* "kivy\_event.pyx":121
 *         '''
 * 
 *         if not event_type.startswith('on_'):             # <<<<<<<<<<<<<<
 *             raise Exception('A new event must start with "on_"')
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_event_type) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "startswith");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyStr_Tailmatch(((PyObject *)__pyx_v_event_type), ((PyObject *)__pyx_n_s__on_), 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "kivy\_event.pyx":122
 * 
 *         if not event_type.startswith('on_'):
 *             raise Exception('A new event must start with "on_"')             # <<<<<<<<<<<<<<
 * 
 *         # Ensure the user have at least declare the default handler
 */
    __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "kivy\_event.pyx":125
 * 
 *         # Ensure the user have at least declare the default handler
 *         if not hasattr(self, event_type):             # <<<<<<<<<<<<<<
 *             raise Exception(
 *                 'Missing default handler <%s> in <%s>' % (
 */
  __pyx_t_2 = PyObject_HasAttr(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_event_type)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (!__pyx_t_2);
  if (__pyx_t_1) {

    /* "kivy\_event.pyx":128
 *             raise Exception(
 *                 'Missing default handler <%s> in <%s>' % (
 *                 event_type, self.__class__.__name__))             # <<<<<<<<<<<<<<
 * 
 *         # Add the event type to the stack
 */
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____name__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_event_type));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_event_type));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_event_type));
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__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 = 126; __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_Exception, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __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 = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "kivy\_event.pyx":131
 * 
 *         # Add the event type to the stack
 *         if not event_type in self.__event_stack:             # <<<<<<<<<<<<<<
 *             self.__event_stack[event_type] = []
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self->__pyx___event_stack) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_self->__pyx___event_stack), ((PyObject *)__pyx_v_event_type)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "kivy\_event.pyx":132
 *         # Add the event type to the stack
 *         if not event_type in self.__event_stack:
 *             self.__event_stack[event_type] = []             # <<<<<<<<<<<<<<
 * 
 *     def unregister_event_types(self, str event_type):
 */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(((PyObject *)__pyx_v_self->__pyx___event_stack) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (PyDict_SetItem(((PyObject *)__pyx_v_self->__pyx___event_stack), ((PyObject *)__pyx_v_event_type), ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("kivy._event.EventDispatcher.register_event_type", __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_4kivy_6_event_15EventDispatcher_7unregister_event_types(PyObject *__pyx_v_self, PyObject *__pyx_v_event_type); /*proto*/
static char __pyx_doc_4kivy_6_event_15EventDispatcher_6unregister_event_types[] = "Unregister an event type in the dispatcher\n        ";
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_7unregister_event_types(PyObject *__pyx_v_self, PyObject *__pyx_v_event_type) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unregister_event_types (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_event_type), (&PyString_Type), 1, "event_type", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_6unregister_event_types(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self), ((PyObject*)__pyx_v_event_type));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":134
 *             self.__event_stack[event_type] = []
 * 
 *     def unregister_event_types(self, str event_type):             # <<<<<<<<<<<<<<
 *         '''Unregister an event type in the dispatcher
 *         '''
 */

static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_6unregister_event_types(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_event_type) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unregister_event_types", 0);

  /* "kivy\_event.pyx":137
 *         '''Unregister an event type in the dispatcher
 *         '''
 *         if event_type in self.__event_stack:             # <<<<<<<<<<<<<<
 *             del self.__event_stack[event_type]
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self->__pyx___event_stack) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_self->__pyx___event_stack), ((PyObject *)__pyx_v_event_type)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "kivy\_event.pyx":138
 *         '''
 *         if event_type in self.__event_stack:
 *             del self.__event_stack[event_type]             # <<<<<<<<<<<<<<
 * 
 *     def is_event_type(self, str event_type):
 */
    if (unlikely(((PyObject *)__pyx_v_self->__pyx___event_stack) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (PyDict_DelItem(((PyObject *)__pyx_v_self->__pyx___event_stack), ((PyObject *)__pyx_v_event_type)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __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_AddTraceback("kivy._event.EventDispatcher.unregister_event_types", __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_4kivy_6_event_15EventDispatcher_9is_event_type(PyObject *__pyx_v_self, PyObject *__pyx_v_event_type); /*proto*/
static char __pyx_doc_4kivy_6_event_15EventDispatcher_8is_event_type[] = "Return True if the event_type is already registered.\n\n        .. versionadded:: 1.0.4\n        ";
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_9is_event_type(PyObject *__pyx_v_self, PyObject *__pyx_v_event_type) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_event_type (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_event_type), (&PyString_Type), 1, "event_type", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_8is_event_type(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self), ((PyObject*)__pyx_v_event_type));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":140
 *             del self.__event_stack[event_type]
 * 
 *     def is_event_type(self, str event_type):             # <<<<<<<<<<<<<<
 *         '''Return True if the event_type is already registered.
 * 
 */

static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_8is_event_type(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_event_type) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_event_type", 0);

  /* "kivy\_event.pyx":145
 *         .. versionadded:: 1.0.4
 *         '''
 *         return event_type in self.__event_stack             # <<<<<<<<<<<<<<
 * 
 *     def bind(self, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(((PyObject *)__pyx_v_self->__pyx___event_stack) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_self->__pyx___event_stack), ((PyObject *)__pyx_v_event_type)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __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_AddTraceback("kivy._event.EventDispatcher.is_event_type", __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_4kivy_6_event_15EventDispatcher_11bind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4kivy_6_event_15EventDispatcher_10bind[] = "Bind an event type or a property to a callback\n\n        Usage::\n\n            # With properties\n            def my_x_callback(obj, value):\n                print 'on object', obj, 'x changed to', value\n            def my_width_callback(obj, value):\n                print 'on object', obj, 'width changed to', value\n            self.bind(x=my_x_callback, width=my_width_callback)\n\n            # With event\n            self.bind(on_press=self.my_press_callback)\n\n        Usage in a class::\n\n            class MyClass(BoxLayout):\n                def __init__(self):\n                    super(MyClass, self).__init__(**kwargs)\n                    btn = Button(text='click on')\n                    btn.bind(on_press=self.my_callback) #bind event\n                    self.add_widget(btn)\n\n                def my_callback(self,obj,value):\n                    print 'press on button', obj, 'with date:', value\n\n        ";
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_11bind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bind (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("bind", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "bind", 1))) return NULL;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
  if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_10bind(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self), __pyx_v_kwargs);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":147
 *         return event_type in self.__event_stack
 * 
 *     def bind(self, **kwargs):             # <<<<<<<<<<<<<<
 *         '''Bind an event type or a property to a callback
 * 
 */

static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_10bind(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  struct __pyx_obj_4kivy_10properties_Property *__pyx_v_prop = 0;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_handler = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bind", 0);

  /* "kivy\_event.pyx":176
 *         '''
 *         cdef Property prop
 *         for key, value in kwargs.iteritems():             # <<<<<<<<<<<<<<
 *             if key[:3] == 'on_':
 *                 if key not in self.__event_stack:
 */
  __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_dict_iterator(((PyObject *)__pyx_v_kwargs), 1, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_v_key);
    __pyx_v_key = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "kivy\_event.pyx":177
 *         cdef Property prop
 *         for key, value in kwargs.iteritems():
 *             if key[:3] == 'on_':             # <<<<<<<<<<<<<<
 *                 if key not in self.__event_stack:
 *                     continue
 */
    __pyx_t_6 = __Pyx_PySequence_GetSlice(__pyx_v_key, 0, 3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyString_Equals(__pyx_t_6, ((PyObject *)__pyx_n_s__on_), Py_EQ); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_8) {

      /* "kivy\_event.pyx":178
 *         for key, value in kwargs.iteritems():
 *             if key[:3] == 'on_':
 *                 if key not in self.__event_stack:             # <<<<<<<<<<<<<<
 *                     continue
 *                 # convert the handler to a weak method
 */
      if (unlikely(((PyObject *)__pyx_v_self->__pyx___event_stack) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_8 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_self->__pyx___event_stack), __pyx_v_key))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_8) {

        /* "kivy\_event.pyx":179
 *             if key[:3] == 'on_':
 *                 if key not in self.__event_stack:
 *                     continue             # <<<<<<<<<<<<<<
 *                 # convert the handler to a weak method
 *                 handler = WeakMethod(value)
 */
        goto __pyx_L3_continue;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "kivy\_event.pyx":181
 *                     continue
 *                 # convert the handler to a weak method
 *                 handler = WeakMethod(value)             # <<<<<<<<<<<<<<
 *                 self.__event_stack[key].append(handler)
 *             else:
 */
      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__WeakMethod); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      __pyx_t_9 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_v_handler);
      __pyx_v_handler = __pyx_t_9;
      __pyx_t_9 = 0;

      /* "kivy\_event.pyx":182
 *                 # convert the handler to a weak method
 *                 handler = WeakMethod(value)
 *                 self.__event_stack[key].append(handler)             # <<<<<<<<<<<<<<
 *             else:
 *                 prop = self.__properties[key]
 */
      if (unlikely(((PyObject *)__pyx_v_self->__pyx___event_stack) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->__pyx___event_stack), __pyx_v_key); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = __Pyx_PyObject_Append(__pyx_t_9, __pyx_v_handler); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "kivy\_event.pyx":184
 *                 self.__event_stack[key].append(handler)
 *             else:
 *                 prop = self.__properties[key]             # <<<<<<<<<<<<<<
 *                 prop.bind(self, value)
 * 
 */
      if (unlikely(((PyObject *)__pyx_v_self->__pyx___properties) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->__pyx___properties), __pyx_v_key); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4kivy_10properties_Property))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_prop));
      __pyx_v_prop = ((struct __pyx_obj_4kivy_10properties_Property *)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "kivy\_event.pyx":185
 *             else:
 *                 prop = self.__properties[key]
 *                 prop.bind(self, value)             # <<<<<<<<<<<<<<
 * 
 *     def unbind(self, **kwargs):
 */
      __pyx_t_5 = ((struct __pyx_vtabstruct_4kivy_10properties_Property *)__pyx_v_prop->__pyx_vtab)->bind(__pyx_v_prop, __pyx_v_self, __pyx_v_value, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_L5:;
    __pyx_L3_continue:;
  }
  __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_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("kivy._event.EventDispatcher.bind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_prop);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_13unbind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4kivy_6_event_15EventDispatcher_12unbind[] = "Unbind properties from callback functions.\n\n        Same usage as :func:`bind`.\n        ";
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_13unbind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unbind (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("unbind", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "unbind", 1))) return NULL;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
  if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_12unbind(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self), __pyx_v_kwargs);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":187
 *                 prop.bind(self, value)
 * 
 *     def unbind(self, **kwargs):             # <<<<<<<<<<<<<<
 *         '''Unbind properties from callback functions.
 * 
 */

static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_12unbind(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  struct __pyx_obj_4kivy_10properties_Property *__pyx_v_prop = 0;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_handler = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unbind", 0);

  /* "kivy\_event.pyx":193
 *         '''
 *         cdef Property prop
 *         for key, value in kwargs.iteritems():             # <<<<<<<<<<<<<<
 *             if key[:3] == 'on_':
 *                 if key not in self.__event_stack:
 */
  __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_dict_iterator(((PyObject *)__pyx_v_kwargs), 1, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_v_key);
    __pyx_v_key = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "kivy\_event.pyx":194
 *         cdef Property prop
 *         for key, value in kwargs.iteritems():
 *             if key[:3] == 'on_':             # <<<<<<<<<<<<<<
 *                 if key not in self.__event_stack:
 *                     continue
 */
    __pyx_t_6 = __Pyx_PySequence_GetSlice(__pyx_v_key, 0, 3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyString_Equals(__pyx_t_6, ((PyObject *)__pyx_n_s__on_), Py_EQ); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_8) {

      /* "kivy\_event.pyx":195
 *         for key, value in kwargs.iteritems():
 *             if key[:3] == 'on_':
 *                 if key not in self.__event_stack:             # <<<<<<<<<<<<<<
 *                     continue
 *                 # we need to execute weak method to be able to compare
 */
      if (unlikely(((PyObject *)__pyx_v_self->__pyx___event_stack) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_8 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_self->__pyx___event_stack), __pyx_v_key))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_8) {

        /* "kivy\_event.pyx":196
 *             if key[:3] == 'on_':
 *                 if key not in self.__event_stack:
 *                     continue             # <<<<<<<<<<<<<<
 *                 # we need to execute weak method to be able to compare
 *                 for handler in self.__event_stack[key]:
 */
        goto __pyx_L3_continue;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "kivy\_event.pyx":198
 *                     continue
 *                 # we need to execute weak method to be able to compare
 *                 for handler in self.__event_stack[key]:             # <<<<<<<<<<<<<<
 *                     if handler() != value:
 *                         continue
 */
      if (unlikely(((PyObject *)__pyx_v_self->__pyx___event_stack) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->__pyx___event_stack), __pyx_v_key); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
        __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0;
        __pyx_t_10 = NULL;
      } else {
        __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      for (;;) {
        if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_5)) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break;
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++;
        } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_5)) {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++;
        } else {
          __pyx_t_6 = __pyx_t_10(__pyx_t_5);
          if (unlikely(!__pyx_t_6)) {
            if (PyErr_Occurred()) {
              if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_XDECREF(__pyx_v_handler);
        __pyx_v_handler = __pyx_t_6;
        __pyx_t_6 = 0;

        /* "kivy\_event.pyx":199
 *                 # we need to execute weak method to be able to compare
 *                 for handler in self.__event_stack[key]:
 *                     if handler() != value:             # <<<<<<<<<<<<<<
 *                         continue
 *                     self.__event_stack[key].remove(handler)
 */
        __pyx_t_6 = PyObject_Call(__pyx_v_handler, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_11 = PyObject_RichCompare(__pyx_t_6, __pyx_v_value, Py_NE); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (__pyx_t_8) {

          /* "kivy\_event.pyx":200
 *                 for handler in self.__event_stack[key]:
 *                     if handler() != value:
 *                         continue             # <<<<<<<<<<<<<<
 *                     self.__event_stack[key].remove(handler)
 *                     break
 */
          goto __pyx_L7_continue;
          goto __pyx_L9;
        }
        __pyx_L9:;

        /* "kivy\_event.pyx":201
 *                     if handler() != value:
 *                         continue
 *                     self.__event_stack[key].remove(handler)             # <<<<<<<<<<<<<<
 *                     break
 *             else:
 */
        if (unlikely(((PyObject *)__pyx_v_self->__pyx___event_stack) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_11 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->__pyx___event_stack), __pyx_v_key); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_6 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__remove); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_v_handler);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_handler);
        __Pyx_GIVEREF(__pyx_v_handler);
        __pyx_t_12 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "kivy\_event.pyx":202
 *                         continue
 *                     self.__event_stack[key].remove(handler)
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 prop = self.__properties[key]
 */
        goto __pyx_L8_break;
        __pyx_L7_continue:;
      }
      __pyx_L8_break:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "kivy\_event.pyx":204
 *                     break
 *             else:
 *                 prop = self.__properties[key]             # <<<<<<<<<<<<<<
 *                 prop.unbind(self, value)
 * 
 */
      if (unlikely(((PyObject *)__pyx_v_self->__pyx___properties) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->__pyx___properties), __pyx_v_key); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4kivy_10properties_Property))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_prop));
      __pyx_v_prop = ((struct __pyx_obj_4kivy_10properties_Property *)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "kivy\_event.pyx":205
 *             else:
 *                 prop = self.__properties[key]
 *                 prop.unbind(self, value)             # <<<<<<<<<<<<<<
 * 
 *     def dispatch(self, str event_type, *largs):
 */
      __pyx_t_5 = ((struct __pyx_vtabstruct_4kivy_10properties_Property *)__pyx_v_prop->__pyx_vtab)->unbind(__pyx_v_prop, __pyx_v_self, __pyx_v_value, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_L5:;
    __pyx_L3_continue:;
  }
  __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_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("kivy._event.EventDispatcher.unbind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_prop);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_15dispatch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4kivy_6_event_15EventDispatcher_14dispatch[] = "Dispatch an event across all the handler added in bind().\n        As soon as a handler return True, the dispatching stop\n        ";
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_15dispatch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_event_type = 0;
  PyObject *__pyx_v_largs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dispatch (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_largs = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_largs)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_largs);
  } else {
    __pyx_v_largs = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__event_type,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__event_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "dispatch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_event_type = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dispatch", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_largs); __pyx_v_largs = 0;
  __Pyx_AddTraceback("kivy._event.EventDispatcher.dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_event_type), (&PyString_Type), 1, "event_type", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_14dispatch(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self), __pyx_v_event_type, __pyx_v_largs);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_largs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":207
 *                 prop.unbind(self, value)
 * 
 *     def dispatch(self, str event_type, *largs):             # <<<<<<<<<<<<<<
 *         '''Dispatch an event across all the handler added in bind().
 *         As soon as a handler return True, the dispatching stop
 */

static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_14dispatch(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_event_type, PyObject *__pyx_v_largs) {
  PyObject *__pyx_v_event_stack = 0;
  PyObject *__pyx_v_remove = 0;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_handler = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  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("dispatch", 0);

  /* "kivy\_event.pyx":211
 *         As soon as a handler return True, the dispatching stop
 *         '''
 *         cdef list event_stack = self.__event_stack[event_type]             # <<<<<<<<<<<<<<
 *         cdef object remove = event_stack.remove
 *         for value in event_stack[:]:
 */
  if (unlikely(((PyObject *)__pyx_v_self->__pyx___event_stack) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->__pyx___event_stack), ((PyObject *)__pyx_v_event_type)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_event_stack = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "kivy\_event.pyx":212
 *         '''
 *         cdef list event_stack = self.__event_stack[event_type]
 *         cdef object remove = event_stack.remove             # <<<<<<<<<<<<<<
 *         for value in event_stack[:]:
 *             handler = value()
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_event_stack), __pyx_n_s__remove); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_remove = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "kivy\_event.pyx":213
 *         cdef list event_stack = self.__event_stack[event_type]
 *         cdef object remove = event_stack.remove
 *         for value in event_stack[:]:             # <<<<<<<<<<<<<<
 *             handler = value()
 *             if handler is None:
 */
  __pyx_t_1 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_event_stack), 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (unlikely(((PyObject *)__pyx_t_1) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = ((PyObject *)__pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    __Pyx_XDECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "kivy\_event.pyx":214
 *         cdef object remove = event_stack.remove
 *         for value in event_stack[:]:
 *             handler = value()             # <<<<<<<<<<<<<<
 *             if handler is None:
 *                 # handler have gone, must be removed
 */
    __pyx_t_1 = PyObject_Call(__pyx_v_value, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_handler);
    __pyx_v_handler = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "kivy\_event.pyx":215
 *         for value in event_stack[:]:
 *             handler = value()
 *             if handler is None:             # <<<<<<<<<<<<<<
 *                 # handler have gone, must be removed
 *                 remove(value)
 */
    __pyx_t_4 = (__pyx_v_handler == Py_None);
    if (__pyx_t_4) {

      /* "kivy\_event.pyx":217
 *             if handler is None:
 *                 # handler have gone, must be removed
 *                 remove(value)             # <<<<<<<<<<<<<<
 *                 continue
 *             if handler(self, *largs):
 */
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      __pyx_t_5 = PyObject_Call(__pyx_v_remove, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "kivy\_event.pyx":218
 *                 # handler have gone, must be removed
 *                 remove(value)
 *                 continue             # <<<<<<<<<<<<<<
 *             if handler(self, *largs):
 *                 return True
 */
      goto __pyx_L3_continue;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "kivy\_event.pyx":219
 *                 remove(value)
 *                 continue
 *             if handler(self, *largs):             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    __pyx_t_1 = PySequence_Tuple(((PyObject *)__pyx_v_largs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_v_handler, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "kivy\_event.pyx":220
 *                 continue
 *             if handler(self, *largs):
 *                 return True             # <<<<<<<<<<<<<<
 * 
 *         handler = getattr(self, event_type)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "kivy\_event.pyx":222
 *                 return True
 * 
 *         handler = getattr(self, event_type)             # <<<<<<<<<<<<<<
 *         return handler(*largs)
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_event_type)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_v_handler);
  __pyx_v_handler = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "kivy\_event.pyx":223
 * 
 *         handler = getattr(self, event_type)
 *         return handler(*largs)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PySequence_Tuple(((PyObject *)__pyx_v_largs)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_1 = PyObject_Call(__pyx_v_handler, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __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_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("kivy._event.EventDispatcher.dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_event_stack);
  __Pyx_XDECREF(__pyx_v_remove);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_17__proxy_setter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_17__proxy_setter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_dstinstance = 0;
  PyObject *__pyx_v_name = 0;
  CYTHON_UNUSED PyObject *__pyx_v_instance = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__proxy_setter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dstinstance,&__pyx_n_s__name,&__pyx_n_s__instance,&__pyx_n_s__value,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__dstinstance)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__proxy_setter", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__instance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__proxy_setter", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__proxy_setter", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__proxy_setter") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __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_dstinstance = ((struct __pyx_obj_4kivy_6_event_EventDispatcher *)values[0]);
    __pyx_v_name = values[1];
    __pyx_v_instance = values[2];
    __pyx_v_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__proxy_setter", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("kivy._event.EventDispatcher.__proxy_setter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dstinstance), __pyx_ptype_4kivy_6_event_EventDispatcher, 1, "dstinstance", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_16__proxy_setter(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self), __pyx_v_dstinstance, __pyx_v_name, __pyx_v_instance, __pyx_v_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":228
 *     # Properties
 *     #
 *     def __proxy_setter(self, EventDispatcher dstinstance, name, instance, value):             # <<<<<<<<<<<<<<
 *         cdef Property prop = self.__properties[name]
 *         prop.set(dstinstance, value)
 */

static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_16__proxy_setter(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_dstinstance, PyObject *__pyx_v_name, CYTHON_UNUSED PyObject *__pyx_v_instance, PyObject *__pyx_v_value) {
  struct __pyx_obj_4kivy_10properties_Property *__pyx_v_prop = 0;
  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("__proxy_setter", 0);

  /* "kivy\_event.pyx":229
 *     #
 *     def __proxy_setter(self, EventDispatcher dstinstance, name, instance, value):
 *         cdef Property prop = self.__properties[name]             # <<<<<<<<<<<<<<
 *         prop.set(dstinstance, value)
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self->__pyx___properties) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->__pyx___properties), __pyx_v_name); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4kivy_10properties_Property))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_prop = ((struct __pyx_obj_4kivy_10properties_Property *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "kivy\_event.pyx":230
 *     def __proxy_setter(self, EventDispatcher dstinstance, name, instance, value):
 *         cdef Property prop = self.__properties[name]
 *         prop.set(dstinstance, value)             # <<<<<<<<<<<<<<
 * 
 *     def __proxy_getter(self, EventDispatcher dstinstance, name, instance):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4kivy_10properties_Property *)__pyx_v_prop->__pyx_vtab)->set(__pyx_v_prop, __pyx_v_dstinstance, __pyx_v_value, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __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("kivy._event.EventDispatcher.__proxy_setter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_prop);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_19__proxy_getter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_19__proxy_getter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_dstinstance = 0;
  PyObject *__pyx_v_name = 0;
  CYTHON_UNUSED PyObject *__pyx_v_instance = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__proxy_getter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dstinstance,&__pyx_n_s__name,&__pyx_n_s__instance,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__dstinstance)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__proxy_getter", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__instance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__proxy_getter", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__proxy_getter") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __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_dstinstance = ((struct __pyx_obj_4kivy_6_event_EventDispatcher *)values[0]);
    __pyx_v_name = values[1];
    __pyx_v_instance = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__proxy_getter", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("kivy._event.EventDispatcher.__proxy_getter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dstinstance), __pyx_ptype_4kivy_6_event_EventDispatcher, 1, "dstinstance", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_18__proxy_getter(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self), __pyx_v_dstinstance, __pyx_v_name, __pyx_v_instance);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":232
 *         prop.set(dstinstance, value)
 * 
 *     def __proxy_getter(self, EventDispatcher dstinstance, name, instance):             # <<<<<<<<<<<<<<
 *         cdef Property prop = self.__properties[name]
 *         return prop.get(dstinstance)
 */

static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_18__proxy_getter(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_dstinstance, PyObject *__pyx_v_name, CYTHON_UNUSED PyObject *__pyx_v_instance) {
  struct __pyx_obj_4kivy_10properties_Property *__pyx_v_prop = 0;
  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("__proxy_getter", 0);

  /* "kivy\_event.pyx":233
 * 
 *     def __proxy_getter(self, EventDispatcher dstinstance, name, instance):
 *         cdef Property prop = self.__properties[name]             # <<<<<<<<<<<<<<
 *         return prop.get(dstinstance)
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self->__pyx___properties) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->__pyx___properties), __pyx_v_name); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4kivy_10properties_Property))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_prop = ((struct __pyx_obj_4kivy_10properties_Property *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "kivy\_event.pyx":234
 *     def __proxy_getter(self, EventDispatcher dstinstance, name, instance):
 *         cdef Property prop = self.__properties[name]
 *         return prop.get(dstinstance)             # <<<<<<<<<<<<<<
 * 
 *     def setter(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4kivy_10properties_Property *)__pyx_v_prop->__pyx_vtab)->get(__pyx_v_prop, __pyx_v_dstinstance, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __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("kivy._event.EventDispatcher.__proxy_getter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_prop);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_21setter(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static char __pyx_doc_4kivy_6_event_15EventDispatcher_20setter[] = "Return the setter of a property. Useful if you want to directly bind\n        a property to another.\n\n        .. versionadded:: 1.0.9\n\n        For example, if you want to position one widget next to you::\n\n            self.bind(right=nextchild.setter('x'))\n        ";
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_21setter(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setter (wrapper)", 0);
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_20setter(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self), ((PyObject *)__pyx_v_name));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":236
 *         return prop.get(dstinstance)
 * 
 *     def setter(self, name):             # <<<<<<<<<<<<<<
 *         '''Return the setter of a property. Useful if you want to directly bind
 *         a property to another.
 */

static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_20setter(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_name) {
  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("setter", 0);

  /* "kivy\_event.pyx":246
 *             self.bind(right=nextchild.setter('x'))
 *         '''
 *         return partial(self.__proxy_setter, self, name)             # <<<<<<<<<<<<<<
 * 
 *     def getter(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__partial); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____proxy_setter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __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_self));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __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_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("kivy._event.EventDispatcher.setter", __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_4kivy_6_event_15EventDispatcher_23getter(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static char __pyx_doc_4kivy_6_event_15EventDispatcher_22getter[] = "Return the getter of a property.\n\n        .. versionadded:: 1.0.9\n        ";
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_23getter(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getter (wrapper)", 0);
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_22getter(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self), ((PyObject *)__pyx_v_name));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":248
 *         return partial(self.__proxy_setter, self, name)
 * 
 *     def getter(self, name):             # <<<<<<<<<<<<<<
 *         '''Return the getter of a property.
 * 
 */

static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_22getter(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_name) {
  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("getter", 0);

  /* "kivy\_event.pyx":253
 *         .. versionadded:: 1.0.9
 *         '''
 *         return partial(self.__proxy_getter, self, name)             # <<<<<<<<<<<<<<
 * 
 *     def property(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__partial); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____proxy_getter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __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_self));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __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_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("kivy._event.EventDispatcher.getter", __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_4kivy_6_event_15EventDispatcher_25property(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static char __pyx_doc_4kivy_6_event_15EventDispatcher_24property[] = "Get a property instance from the name.\n\n        .. versionadded:: 1.0.9\n\n        :return:\n\n            A :class:`~kivy.properties.Property` derivated instance corresponding\n            to the name.\n        ";
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_25property(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("property (wrapper)", 0);
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_24property(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self), ((PyObject *)__pyx_v_name));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":255
 *         return partial(self.__proxy_getter, self, name)
 * 
 *     def property(self, name):             # <<<<<<<<<<<<<<
 *         '''Get a property instance from the name.
 * 
 */

static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_24property(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_name) {
  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("property", 0);

  /* "kivy\_event.pyx":265
 *             to the name.
 *         '''
 *         return self.__properties[name]             # <<<<<<<<<<<<<<
 * 
 *     cpdef dict properties(EventDispatcher self):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(((PyObject *)__pyx_v_self->__pyx___properties) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->__pyx___properties), __pyx_v_name); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __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("kivy._event.EventDispatcher.property", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":267
 *         return self.__properties[name]
 * 
 *     cpdef dict properties(EventDispatcher self):             # <<<<<<<<<<<<<<
 *         '''Return all the properties in that class in a dictionnary of
 *         key/property class. Can be used for introspection.
 */

static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_27properties(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_4kivy_6_event_15EventDispatcher_properties(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_ret = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("properties", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__properties); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4kivy_6_event_15EventDispatcher_27properties)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __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 = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "kivy\_event.pyx":274
 *         '''
 *         cdef dict ret, p
 *         ret = {}             # <<<<<<<<<<<<<<
 *         p = self.__properties
 *         for x in self.__storage:
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_ret = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "kivy\_event.pyx":275
 *         cdef dict ret, p
 *         ret = {}
 *         p = self.__properties             # <<<<<<<<<<<<<<
 *         for x in self.__storage:
 *             ret[x] = p[x]
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx___properties));
  __pyx_v_p = __pyx_v_self->__pyx___properties;

  /* "kivy\_event.pyx":276
 *         ret = {}
 *         p = self.__properties
 *         for x in self.__storage:             # <<<<<<<<<<<<<<
 *             ret[x] = p[x]
 *         return ret
 */
  __pyx_t_3 = 0;
  if (unlikely(((PyObject *)__pyx_v_self->__pyx___storage) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_dict_iterator(((PyObject *)__pyx_v_self->__pyx___storage), 1, ((PyObject *)NULL), (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_2;
  __pyx_t_2 = 0;
  while (1) {
    __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_4, &__pyx_t_3, &__pyx_t_2, NULL, NULL, __pyx_t_5);
    if (unlikely(__pyx_t_6 == 0)) break;
    if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF(__pyx_v_x);
    __pyx_v_x = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "kivy\_event.pyx":277
 *         p = self.__properties
 *         for x in self.__storage:
 *             ret[x] = p[x]             # <<<<<<<<<<<<<<
 *         return ret
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_p) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_p), __pyx_v_x); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(((PyObject *)__pyx_v_ret), __pyx_v_x, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "kivy\_event.pyx":278
 *         for x in self.__storage:
 *             ret[x] = p[x]
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     def create_property(self, name):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ret));
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("kivy._event.EventDispatcher.properties", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_27properties(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4kivy_6_event_15EventDispatcher_26properties[] = "Return all the properties in that class in a dictionnary of\n        key/property class. Can be used for introspection.\n\n        .. versionadded:: 1.0.9\n        ";
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_27properties(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("properties (wrapper)", 0);
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_26properties(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":267
 *         return self.__properties[name]
 * 
 *     cpdef dict properties(EventDispatcher self):             # <<<<<<<<<<<<<<
 *         '''Return all the properties in that class in a dictionnary of
 *         key/property class. Can be used for introspection.
 */

static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_26properties(struct __pyx_obj_4kivy_6_event_EventDispatcher *__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("properties", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4kivy_6_event_EventDispatcher *)__pyx_v_self->__pyx_vtab)->properties(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __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("kivy._event.EventDispatcher.properties", __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_4kivy_6_event_15EventDispatcher_29create_property(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static char __pyx_doc_4kivy_6_event_15EventDispatcher_28create_property[] = "Create a new property at runtime.\n\n        .. versionadded:: 1.0.9\n\n        .. warning::\n\n            This function is designed for the Kivy language, don't use it in\n            your code. You should declare the property in your class instead of\n            using this method.\n\n        :Parameters:\n            `name`: string\n                Name of the property\n\n        The class of the property cannot be specified, it will always be an\n        :class:`~kivy.properties.ObjectProperty` class. The default value of the\n        property will be None, until you set a new value.\n\n        >>> mywidget = Widget()\n        >>> mywidget.create_property('custom')\n        >>> mywidget.custom = True\n        >>> print mywidget.custom\n        True\n        ";
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_29create_property(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_property (wrapper)", 0);
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_28create_property(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self), ((PyObject *)__pyx_v_name));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pyx":280
 *         return ret
 * 
 *     def create_property(self, name):             # <<<<<<<<<<<<<<
 *         '''Create a new property at runtime.
 * 
 */

static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_28create_property(struct __pyx_obj_4kivy_6_event_EventDispatcher *__pyx_v_self, PyObject *__pyx_v_name) {
  struct __pyx_obj_4kivy_10properties_ObjectProperty *__pyx_v_prop = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create_property", 0);

  /* "kivy\_event.pyx":305
 *         True
 *         '''
 *         prop = ObjectProperty(None)             # <<<<<<<<<<<<<<
 *         prop.link(self, name)
 *         prop.link_deps(self, name)
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4kivy_10properties_ObjectProperty)), ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_prop = ((struct __pyx_obj_4kivy_10properties_ObjectProperty *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "kivy\_event.pyx":306
 *         '''
 *         prop = ObjectProperty(None)
 *         prop.link(self, name)             # <<<<<<<<<<<<<<
 *         prop.link_deps(self, name)
 *         self.__properties[name] = prop
 */
  if (!(likely(PyString_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_name)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4kivy_10properties_ObjectProperty *)__pyx_v_prop->__pyx_base.__pyx_vtab)->__pyx_base.link(((struct __pyx_obj_4kivy_10properties_Property *)__pyx_v_prop), __pyx_v_self, ((PyObject*)__pyx_t_1), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __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;

  /* "kivy\_event.pyx":307
 *         prop = ObjectProperty(None)
 *         prop.link(self, name)
 *         prop.link_deps(self, name)             # <<<<<<<<<<<<<<
 *         self.__properties[name] = prop
 *         setattr(self.__class__, name, prop)
 */
  if (!(likely(PyString_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_name)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4kivy_10properties_ObjectProperty *)__pyx_v_prop->__pyx_base.__pyx_vtab)->__pyx_base.link_deps(((struct __pyx_obj_4kivy_10properties_Property *)__pyx_v_prop), __pyx_v_self, ((PyObject*)__pyx_t_2), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "kivy\_event.pyx":308
 *         prop.link(self, name)
 *         prop.link_deps(self, name)
 *         self.__properties[name] = prop             # <<<<<<<<<<<<<<
 *         setattr(self.__class__, name, prop)
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self->__pyx___properties) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (PyDict_SetItem(((PyObject *)__pyx_v_self->__pyx___properties), __pyx_v_name, ((PyObject *)__pyx_v_prop)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "kivy\_event.pyx":309
 *         prop.link_deps(self, name)
 *         self.__properties[name] = prop
 *         setattr(self.__class__, name, prop)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_SetAttr(__pyx_t_1, __pyx_v_name, ((PyObject *)__pyx_v_prop)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __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_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("kivy._event.EventDispatcher.create_property", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_prop);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_3uid_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4kivy_6_event_15EventDispatcher_3uid_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4kivy_6_event_15EventDispatcher_3uid___get__(((struct __pyx_obj_4kivy_6_event_EventDispatcher *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "kivy\_event.pxd":7
 *     cdef dict __storage
 *     cpdef dict properties(self)
 *     cdef readonly int uid             # <<<<<<<<<<<<<<
 */

static PyObject *__pyx_pf_4kivy_6_event_15EventDispatcher_3uid___get__(struct __pyx_obj_4kivy_6_event_EventDispatcher *__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("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->uid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 7; __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("kivy._event.EventDispatcher.uid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_4kivy_6_event_EventDispatcher __pyx_vtable_4kivy_6_event_EventDispatcher;

static PyObject *__pyx_tp_new_4kivy_6_event_EventDispatcher(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4kivy_6_event_EventDispatcher *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4kivy_6_event_EventDispatcher *)o);
  p->__pyx_vtab = __pyx_vtabptr_4kivy_6_event_EventDispatcher;
  p->__pyx___event_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->__pyx___properties = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->__pyx___storage = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (__pyx_pw_4kivy_6_event_15EventDispatcher_1__cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4kivy_6_event_EventDispatcher(PyObject *o) {
  struct __pyx_obj_4kivy_6_event_EventDispatcher *p = (struct __pyx_obj_4kivy_6_event_EventDispatcher *)o;
  Py_XDECREF(((PyObject *)p->__pyx___event_stack));
  Py_XDECREF(((PyObject *)p->__pyx___properties));
  Py_XDECREF(((PyObject *)p->__pyx___storage));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4kivy_6_event_EventDispatcher(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4kivy_6_event_EventDispatcher *p = (struct __pyx_obj_4kivy_6_event_EventDispatcher *)o;
  if (p->__pyx___event_stack) {
    e = (*v)(p->__pyx___event_stack, a); if (e) return e;
  }
  if (p->__pyx___properties) {
    e = (*v)(p->__pyx___properties, a); if (e) return e;
  }
  if (p->__pyx___storage) {
    e = (*v)(p->__pyx___storage, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4kivy_6_event_EventDispatcher(PyObject *o) {
  struct __pyx_obj_4kivy_6_event_EventDispatcher *p = (struct __pyx_obj_4kivy_6_event_EventDispatcher *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->__pyx___event_stack);
  p->__pyx___event_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx___properties);
  p->__pyx___properties = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx___storage);
  p->__pyx___storage = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4kivy_6_event_15EventDispatcher_uid(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4kivy_6_event_15EventDispatcher_3uid_1__get__(o);
}

static PyMethodDef __pyx_methods_4kivy_6_event_EventDispatcher[] = {
  {__Pyx_NAMESTR("register_event_type"), (PyCFunction)__pyx_pw_4kivy_6_event_15EventDispatcher_5register_event_type, METH_O, __Pyx_DOCSTR(__pyx_doc_4kivy_6_event_15EventDispatcher_4register_event_type)},
  {__Pyx_NAMESTR("unregister_event_types"), (PyCFunction)__pyx_pw_4kivy_6_event_15EventDispatcher_7unregister_event_types, METH_O, __Pyx_DOCSTR(__pyx_doc_4kivy_6_event_15EventDispatcher_6unregister_event_types)},
  {__Pyx_NAMESTR("is_event_type"), (PyCFunction)__pyx_pw_4kivy_6_event_15EventDispatcher_9is_event_type, METH_O, __Pyx_DOCSTR(__pyx_doc_4kivy_6_event_15EventDispatcher_8is_event_type)},
  {__Pyx_NAMESTR("bind"), (PyCFunction)__pyx_pw_4kivy_6_event_15EventDispatcher_11bind, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4kivy_6_event_15EventDispatcher_10bind)},
  {__Pyx_NAMESTR("unbind"), (PyCFunction)__pyx_pw_4kivy_6_event_15EventDispatcher_13unbind, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4kivy_6_event_15EventDispatcher_12unbind)},
  {__Pyx_NAMESTR("dispatch"), (PyCFunction)__pyx_pw_4kivy_6_event_15EventDispatcher_15dispatch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4kivy_6_event_15EventDispatcher_14dispatch)},
  {__Pyx_NAMESTR("__proxy_setter"), (PyCFunction)__pyx_pw_4kivy_6_event_15EventDispatcher_17__proxy_setter, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__proxy_getter"), (PyCFunction)__pyx_pw_4kivy_6_event_15EventDispatcher_19__proxy_getter, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("setter"), (PyCFunction)__pyx_pw_4kivy_6_event_15EventDispatcher_21setter, METH_O, __Pyx_DOCSTR(__pyx_doc_4kivy_6_event_15EventDispatcher_20setter)},
  {__Pyx_NAMESTR("getter"), (PyCFunction)__pyx_pw_4kivy_6_event_15EventDispatcher_23getter, METH_O, __Pyx_DOCSTR(__pyx_doc_4kivy_6_event_15EventDispatcher_22getter)},
  {__Pyx_NAMESTR("property"), (PyCFunction)__pyx_pw_4kivy_6_event_15EventDispatcher_25property, METH_O, __Pyx_DOCSTR(__pyx_doc_4kivy_6_event_15EventDispatcher_24property)},
  {__Pyx_NAMESTR("properties"), (PyCFunction)__pyx_pw_4kivy_6_event_15EventDispatcher_27properties, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4kivy_6_event_15EventDispatcher_26properties)},
  {__Pyx_NAMESTR("create_property"), (PyCFunction)__pyx_pw_4kivy_6_event_15EventDispatcher_29create_property, METH_O, __Pyx_DOCSTR(__pyx_doc_4kivy_6_event_15EventDispatcher_28create_property)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4kivy_6_event_EventDispatcher[] = {
  {(char *)"uid", __pyx_getprop_4kivy_6_event_15EventDispatcher_uid, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_EventDispatcher = {
  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_EventDispatcher = {
  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_EventDispatcher = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_EventDispatcher = {
  #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_4kivy_6_event_EventDispatcher = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("kivy._event.EventDispatcher"), /*tp_name*/
  sizeof(struct __pyx_obj_4kivy_6_event_EventDispatcher), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4kivy_6_event_EventDispatcher, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_EventDispatcher, /*tp_as_number*/
  &__pyx_tp_as_sequence_EventDispatcher, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_EventDispatcher, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_EventDispatcher, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Generic event dispatcher interface\n\n    See the module docstring for usage.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4kivy_6_event_EventDispatcher, /*tp_traverse*/
  __pyx_tp_clear_4kivy_6_event_EventDispatcher, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4kivy_6_event_EventDispatcher, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4kivy_6_event_EventDispatcher, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4kivy_6_event_15EventDispatcher_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4kivy_6_event_EventDispatcher, /*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("_event"),
    __Pyx_DOCSTR(__pyx_k_6), /* 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_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0},
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_n_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 1},
  {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
  {&__pyx_n_s__EventDispatcher, __pyx_k__EventDispatcher, sizeof(__pyx_k__EventDispatcher), 0, 0, 1, 1},
  {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
  {&__pyx_n_s__WeakMethod, __pyx_k__WeakMethod, sizeof(__pyx_k__WeakMethod), 0, 0, 1, 1},
  {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1},
  {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
  {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
  {&__pyx_n_s____proxy_getter, __pyx_k____proxy_getter, sizeof(__pyx_k____proxy_getter), 0, 0, 1, 1},
  {&__pyx_n_s____proxy_setter, __pyx_k____proxy_setter, sizeof(__pyx_k____proxy_setter), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s__bind, __pyx_k__bind, sizeof(__pyx_k__bind), 0, 0, 1, 1},
  {&__pyx_n_s__dstinstance, __pyx_k__dstinstance, sizeof(__pyx_k__dstinstance), 0, 0, 1, 1},
  {&__pyx_n_s__event_type, __pyx_k__event_type, sizeof(__pyx_k__event_type), 0, 0, 1, 1},
  {&__pyx_n_s__functools, __pyx_k__functools, sizeof(__pyx_k__functools), 0, 0, 1, 1},
  {&__pyx_n_s__instance, __pyx_k__instance, sizeof(__pyx_k__instance), 0, 0, 1, 1},
  {&__pyx_n_s__iteritems, __pyx_k__iteritems, sizeof(__pyx_k__iteritems), 0, 0, 1, 1},
  {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
  {&__pyx_n_s__on_, __pyx_k__on_, sizeof(__pyx_k__on_), 0, 0, 1, 1},
  {&__pyx_n_s__partial, __pyx_k__partial, sizeof(__pyx_k__partial), 0, 0, 1, 1},
  {&__pyx_n_s__properties, __pyx_k__properties, sizeof(__pyx_k__properties), 0, 0, 1, 1},
  {&__pyx_n_s__remove, __pyx_k__remove, sizeof(__pyx_k__remove), 0, 0, 1, 1},
  {&__pyx_n_s__super, __pyx_k__super, sizeof(__pyx_k__super), 0, 0, 1, 1},
  {&__pyx_n_s__touch_down, __pyx_k__touch_down, sizeof(__pyx_k__touch_down), 0, 0, 1, 1},
  {&__pyx_n_s__touch_move, __pyx_k__touch_move, sizeof(__pyx_k__touch_move), 0, 0, 1, 1},
  {&__pyx_n_s__touch_up, __pyx_k__touch_up, sizeof(__pyx_k__touch_up), 0, 0, 1, 1},
  {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 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 = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_super = __Pyx_GetName(__pyx_b, __pyx_n_s__super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __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);

  /* "kivy\_event.pyx":122
 * 
 *         if not event_type.startswith('on_'):
 *             raise Exception('A new event must start with "on_"')             # <<<<<<<<<<<<<<
 * 
 *         # Ensure the user have at least declare the default handler
 */
  __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
  PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));

  /* "kivy\_event.pyx":305
 *         True
 *         '''
 *         prop = ObjectProperty(None)             # <<<<<<<<<<<<<<
 *         prop.link(self, name)
 *         prop.link_deps(self, name)
 */
  __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_5);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));

  /* "kivy\_event.pyx":15
 * '''
 * 
 * __all__ = ('EventDispatcher', )             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_7);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__EventDispatcher));
  PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_n_s__EventDispatcher));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__EventDispatcher));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
  __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 init_event(void); /*proto*/
PyMODINIT_FUNC init_event(void)
#else
PyMODINIT_FUNC PyInit__event(void); /*proto*/
PyMODINIT_FUNC PyInit__event(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __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__event(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("_event"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_6), 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__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_kivy___event) {
    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 ---*/
  __pyx_v_4kivy_6_event_cache_properties = ((PyObject*)Py_None); Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_4kivy_6_event_EventDispatcher = &__pyx_vtable_4kivy_6_event_EventDispatcher;
  __pyx_vtable_4kivy_6_event_EventDispatcher.properties = (PyObject *(*)(struct __pyx_obj_4kivy_6_event_EventDispatcher *, int __pyx_skip_dispatch))__pyx_f_4kivy_6_event_15EventDispatcher_properties;
  if (PyType_Ready(&__pyx_type_4kivy_6_event_EventDispatcher) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4kivy_6_event_EventDispatcher.tp_dict, __pyx_vtabptr_4kivy_6_event_EventDispatcher) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "EventDispatcher", (PyObject *)&__pyx_type_4kivy_6_event_EventDispatcher) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4kivy_6_event_EventDispatcher = &__pyx_type_4kivy_6_event_EventDispatcher;
  /*--- Type import code ---*/
  __pyx_ptype_4kivy_10properties_Property = __Pyx_ImportType("kivy.properties", "Property", sizeof(struct __pyx_obj_4kivy_10properties_Property), 1); if (unlikely(!__pyx_ptype_4kivy_10properties_Property)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_4kivy_10properties_Property = (struct __pyx_vtabstruct_4kivy_10properties_Property*)__Pyx_GetVtable(__pyx_ptype_4kivy_10properties_Property->tp_dict); if (unlikely(!__pyx_vtabptr_4kivy_10properties_Property)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4kivy_10properties_NumericProperty = __Pyx_ImportType("kivy.properties", "NumericProperty", sizeof(struct __pyx_obj_4kivy_10properties_NumericProperty), 1); if (unlikely(!__pyx_ptype_4kivy_10properties_NumericProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_4kivy_10properties_NumericProperty = (struct __pyx_vtabstruct_4kivy_10properties_NumericProperty*)__Pyx_GetVtable(__pyx_ptype_4kivy_10properties_NumericProperty->tp_dict); if (unlikely(!__pyx_vtabptr_4kivy_10properties_NumericProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4kivy_10properties_StringProperty = __Pyx_ImportType("kivy.properties", "StringProperty", sizeof(struct __pyx_obj_4kivy_10properties_StringProperty), 1); if (unlikely(!__pyx_ptype_4kivy_10properties_StringProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_4kivy_10properties_StringProperty = (struct __pyx_vtabstruct_4kivy_10properties_StringProperty*)__Pyx_GetVtable(__pyx_ptype_4kivy_10properties_StringProperty->tp_dict); if (unlikely(!__pyx_vtabptr_4kivy_10properties_StringProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4kivy_10properties_ListProperty = __Pyx_ImportType("kivy.properties", "ListProperty", sizeof(struct __pyx_obj_4kivy_10properties_ListProperty), 1); if (unlikely(!__pyx_ptype_4kivy_10properties_ListProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_4kivy_10properties_ListProperty = (struct __pyx_vtabstruct_4kivy_10properties_ListProperty*)__Pyx_GetVtable(__pyx_ptype_4kivy_10properties_ListProperty->tp_dict); if (unlikely(!__pyx_vtabptr_4kivy_10properties_ListProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4kivy_10properties_DictProperty = __Pyx_ImportType("kivy.properties", "DictProperty", sizeof(struct __pyx_obj_4kivy_10properties_DictProperty), 1); if (unlikely(!__pyx_ptype_4kivy_10properties_DictProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_4kivy_10properties_DictProperty = (struct __pyx_vtabstruct_4kivy_10properties_DictProperty*)__Pyx_GetVtable(__pyx_ptype_4kivy_10properties_DictProperty->tp_dict); if (unlikely(!__pyx_vtabptr_4kivy_10properties_DictProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4kivy_10properties_ObjectProperty = __Pyx_ImportType("kivy.properties", "ObjectProperty", sizeof(struct __pyx_obj_4kivy_10properties_ObjectProperty), 1); if (unlikely(!__pyx_ptype_4kivy_10properties_ObjectProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_4kivy_10properties_ObjectProperty = (struct __pyx_vtabstruct_4kivy_10properties_ObjectProperty*)__Pyx_GetVtable(__pyx_ptype_4kivy_10properties_ObjectProperty->tp_dict); if (unlikely(!__pyx_vtabptr_4kivy_10properties_ObjectProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4kivy_10properties_BooleanProperty = __Pyx_ImportType("kivy.properties", "BooleanProperty", sizeof(struct __pyx_obj_4kivy_10properties_BooleanProperty), 1); if (unlikely(!__pyx_ptype_4kivy_10properties_BooleanProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_4kivy_10properties_BooleanProperty = (struct __pyx_vtabstruct_4kivy_10properties_BooleanProperty*)__Pyx_GetVtable(__pyx_ptype_4kivy_10properties_BooleanProperty->tp_dict); if (unlikely(!__pyx_vtabptr_4kivy_10properties_BooleanProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4kivy_10properties_BoundedNumericProperty = __Pyx_ImportType("kivy.properties", "BoundedNumericProperty", sizeof(struct __pyx_obj_4kivy_10properties_BoundedNumericProperty), 1); if (unlikely(!__pyx_ptype_4kivy_10properties_BoundedNumericProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_4kivy_10properties_BoundedNumericProperty = (struct __pyx_vtabstruct_4kivy_10properties_BoundedNumericProperty*)__Pyx_GetVtable(__pyx_ptype_4kivy_10properties_BoundedNumericProperty->tp_dict); if (unlikely(!__pyx_vtabptr_4kivy_10properties_BoundedNumericProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4kivy_10properties_OptionProperty = __Pyx_ImportType("kivy.properties", "OptionProperty", sizeof(struct __pyx_obj_4kivy_10properties_OptionProperty), 1); if (unlikely(!__pyx_ptype_4kivy_10properties_OptionProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_4kivy_10properties_OptionProperty = (struct __pyx_vtabstruct_4kivy_10properties_OptionProperty*)__Pyx_GetVtable(__pyx_ptype_4kivy_10properties_OptionProperty->tp_dict); if (unlikely(!__pyx_vtabptr_4kivy_10properties_OptionProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4kivy_10properties_ReferenceListProperty = __Pyx_ImportType("kivy.properties", "ReferenceListProperty", sizeof(struct __pyx_obj_4kivy_10properties_ReferenceListProperty), 1); if (unlikely(!__pyx_ptype_4kivy_10properties_ReferenceListProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_4kivy_10properties_ReferenceListProperty = (struct __pyx_vtabstruct_4kivy_10properties_ReferenceListProperty*)__Pyx_GetVtable(__pyx_ptype_4kivy_10properties_ReferenceListProperty->tp_dict); if (unlikely(!__pyx_vtabptr_4kivy_10properties_ReferenceListProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4kivy_10properties_AliasProperty = __Pyx_ImportType("kivy.properties", "AliasProperty", sizeof(struct __pyx_obj_4kivy_10properties_AliasProperty), 1); if (unlikely(!__pyx_ptype_4kivy_10properties_AliasProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_4kivy_10properties_AliasProperty = (struct __pyx_vtabstruct_4kivy_10properties_AliasProperty*)__Pyx_GetVtable(__pyx_ptype_4kivy_10properties_AliasProperty->tp_dict); if (unlikely(!__pyx_vtabptr_4kivy_10properties_AliasProperty)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "kivy\_event.pyx":15
 * '''
 * 
 * __all__ = ('EventDispatcher', )             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_k_tuple_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "kivy\_event.pyx":18
 * 
 * 
 * from functools import partial             # <<<<<<<<<<<<<<
 * from kivy.weakmethod import WeakMethod
 * from kivy.properties cimport Property, ObjectProperty
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__partial));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__partial));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__partial));
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__functools), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __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__partial);
  if (__pyx_t_1 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__partial);
    if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__partial, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __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;

  /* "kivy\_event.pyx":19
 * 
 * from functools import partial
 * from kivy.weakmethod import WeakMethod             # <<<<<<<<<<<<<<
 * from kivy.properties cimport Property, ObjectProperty
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__WeakMethod));
  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__WeakMethod));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__WeakMethod));
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_8), ((PyObject *)__pyx_t_2), -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);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__WeakMethod);
  if (__pyx_t_2 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__WeakMethod);
    if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__WeakMethod, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "kivy\_event.pyx":22
 * from kivy.properties cimport Property, ObjectProperty
 * 
 * cdef int widget_uid = 0             # <<<<<<<<<<<<<<
 * cdef dict cache_properties = {}
 * 
 */
  __pyx_v_4kivy_6_event_widget_uid = 0;

  /* "kivy\_event.pyx":23
 * 
 * cdef int widget_uid = 0
 * cdef dict cache_properties = {}             # <<<<<<<<<<<<<<
 * 
 * cdef class EventDispatcher(object):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_XGOTREF(((PyObject *)__pyx_v_4kivy_6_event_cache_properties));
  __Pyx_DECREF(((PyObject *)__pyx_v_4kivy_6_event_cache_properties));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_v_4kivy_6_event_cache_properties = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "kivy\_event.pyx":1
 * '''             # <<<<<<<<<<<<<<
 * Event dispatcher
 * ================
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_9), ((PyObject *)__pyx_kp_u_10)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__pyx_m) {
    __Pyx_AddTraceback("init kivy._event", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init kivy._event");
  }
  __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 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)))
        #else
        if (unlikely(!PyUnicode_Check(key)))
        #endif
            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 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);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        Py_DECREF(value);
        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) {
    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)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        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;
        }
        if (!value) {
            value = PyObject_CallObject(type, NULL);
        }
        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:
    return;
}
#endif

static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" PY_FORMAT_SIZE_T "d)", expected);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" PY_FORMAT_SIZE_T "d value%s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                             int is_tuple, int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    if (!is_tuple && unlikely(!PyTuple_Check(tuple))) {
        iternextfunc iternext;
        iter = PyObject_GetIter(tuple);
        if (unlikely(!iter)) goto bad;
        if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
        iternext = Py_TYPE(iter)->tp_iternext;
        value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
        value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
        if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
        Py_DECREF(iter);
    } else {
        if (!has_known_size && unlikely(PyTuple_GET_SIZE(tuple) != 2)) {
            __Pyx_UnpackTupleError(tuple, 2);
            goto bad;
        }
#if CYTHON_COMPILING_IN_PYPY
        value1 = PySequence_GetItem(tuple, 0);
        if (unlikely(!value1)) goto bad;
        value2 = PySequence_GetItem(tuple, 1);
        if (unlikely(!value2)) goto bad;
#else
        value1 = PyTuple_GET_ITEM(tuple, 0);
        value2 = PyTuple_GET_ITEM(tuple, 1);
        Py_INCREF(value1);
        Py_INCREF(value2);
#endif
        if (decref_tuple) { Py_DECREF(tuple); }
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
#if !CYTHON_COMPILING_IN_PYPY
    if (is_dict) {
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
    }
#endif
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = PyObject_CallMethodObjArgs(iterable, method_name, NULL);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* iter_obj, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

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 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 %" PY_FORMAT_SIZE_T "d positional argument%s (%" PY_FORMAT_SIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static CYTHON_INLINE int __Pyx_PyStr_Tailmatch(PyObject* self, PyObject* arg, Py_ssize_t start,
                                               Py_ssize_t end, int direction)
{
    if (PY_MAJOR_VERSION < 3)
        return __Pyx_PyBytes_Tailmatch(self, arg, start, end, direction);
    else
        return __Pyx_PyUnicode_Tailmatch(self, arg, start, end, direction);
}

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 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_AS_STRING(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;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    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 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 CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = PyObject_GetAttr(o, n);
    if (!r) {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError))
            goto bad;
        PyErr_Clear();
        r = d;
        Py_INCREF(d);
    }
    return r;
bad:
    return NULL;
}

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
            return (equals == Py_NE);
        } else if (PyBytes_GET_SIZE(s1) == 1) {
            if (equals == Py_EQ)
                return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
            else
                return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
        } else {
            int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
        #if CYTHON_PEP393_ENABLED
        if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0))
            return -1;
        if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) {
            return (equals == Py_NE);
        } else if (PyUnicode_GET_LENGTH(s1) == 1) {
            Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0);
            Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0);
            return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
        #else
        if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
            return (equals == Py_NE);
        } else if (PyUnicode_GET_SIZE(s1) == 1) {
            Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0];
            Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0];
            return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
        #endif
        } else {
            int result = PyUnicode_Compare(s1, s2);
            if ((result == -1) && unlikely(PyErr_Occurred()))
                return -1;
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

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_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

#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

static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__");
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

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 */
