style cleanup: python api
[blender.git] / source / blender / python / generic / idprop_py_api.c
index b9785fc375c5be13eaf42068888e8ce2a9a13cb6..63b8d90b5100c8ff6fd66c530ccd9cfdb21b50ab 100644 (file)
@@ -88,7 +88,7 @@ static PyObject *idprop_py_from_idp_group(ID *id, IDProperty *prop, IDProperty *
        group->id = id;
        group->prop = prop;
        group->parent = parent; /* can be NULL */
-       return (PyObject*)group;
+       return (PyObject *)group;
 }
 
 static PyObject *idprop_py_from_idp_array(ID *id, IDProperty *prop)
@@ -96,7 +96,7 @@ static PyObject *idprop_py_from_idp_array(ID *id, IDProperty *prop)
        BPy_IDProperty *array = PyObject_New(BPy_IDProperty, &BPy_IDArray_Type);
        array->id = id;
        array->prop = prop;
-       return (PyObject*)array;
+       return (PyObject *)array;
 }
 
 static PyObject *idprop_py_from_idp_idparray(ID *id, IDProperty *prop)
@@ -178,7 +178,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
                        }
 #else
                        st = _PyUnicode_AsString(value);
-                       IDP_ResizeArray(prop, strlen(st)+1);
+                       IDP_ResizeArray(prop, strlen(st) + 1);
                        strcpy(IDP_Array(prop), st);
 #endif
 
@@ -258,7 +258,7 @@ static PyObject *BPy_IDGroup_GetType(BPy_IDProperty *self)
 
 static PyGetSetDef BPy_IDGroup_getseters[] = {
        {(char *)"name", (getter)BPy_IDGroup_GetName, (setter)BPy_IDGroup_SetName, (char *)"The name of this Group.", NULL},
-        {NULL, NULL, NULL, NULL, NULL}
+       {NULL, NULL, NULL, NULL, NULL}
 };
 
 static Py_ssize_t BPy_IDGroup_Map_Len(BPy_IDProperty *self)
@@ -530,7 +530,7 @@ static PyObject *BPy_IDGroup_iter(BPy_IDProperty *self)
        iter->mode = IDPROP_ITER_KEYS;
        iter->cur = self->prop->data.group.first;
        Py_XINCREF(iter);
-       return (PyObject*)iter;
+       return (PyObject *)iter;
 }
 
 /* for simple, non nested types this is the same as BPy_IDGroup_WrapData */
@@ -679,7 +679,7 @@ static PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
        iter->mode = IDPROP_ITER_ITEMS;
        iter->cur = self->prop->data.group.first;
        Py_XINCREF(iter);
-       return (PyObject*)iter;
+       return (PyObject *)iter;
 }
 
 /* utility function */
@@ -793,7 +793,7 @@ static int BPy_IDGroup_Contains(BPy_IDProperty *self, PyObject *value)
                return -1;
        }
 
-       return IDP_GetPropertyFromGroup(self->prop, name) ? 1:0;
+       return IDP_GetPropertyFromGroup(self->prop, name) ? 1 : 0;
 }
 
 static PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *value)
@@ -845,64 +845,64 @@ static PyObject *BPy_IDGroup_Get(BPy_IDProperty *self, PyObject *args)
 
 static struct PyMethodDef BPy_IDGroup_methods[] = {
        {"pop", (PyCFunction)BPy_IDGroup_Pop, METH_O,
-               "pop an item from the group; raises KeyError if the item doesn't exist"},
+        "pop an item from the group; raises KeyError if the item doesn't exist"},
        {"iteritems", (PyCFunction)BPy_IDGroup_IterItems, METH_NOARGS,
-               "iterate through the items in the dict; behaves like dictionary method iteritems"},
+        "iterate through the items in the dict; behaves like dictionary method iteritems"},
        {"keys", (PyCFunction)BPy_IDGroup_GetKeys, METH_NOARGS,
-               "get the keys associated with this group as a list of strings"},
+        "get the keys associated with this group as a list of strings"},
        {"values", (PyCFunction)BPy_IDGroup_GetValues, METH_NOARGS,
-               "get the values associated with this group"},
+        "get the values associated with this group"},
        {"items", (PyCFunction)BPy_IDGroup_GetItems, METH_NOARGS,
-               "get the items associated with this group"},
+        "get the items associated with this group"},
        {"update", (PyCFunction)BPy_IDGroup_Update, METH_O,
-               "updates the values in the group with the values of another or a dict"},
+        "updates the values in the group with the values of another or a dict"},
        {"get", (PyCFunction)BPy_IDGroup_Get, METH_VARARGS,
-               "idprop.get(k[,d]) -> idprop[k] if k in idprop, else d.  d defaults to None"},
+        "idprop.get(k[,d]) -> idprop[k] if k in idprop, else d.  d defaults to None"},
        {"to_dict", (PyCFunction)BPy_IDGroup_to_dict, METH_NOARGS,
-               "return a purely python version of the group"},
+        "return a purely python version of the group"},
        {NULL, NULL, 0, NULL}
 };
 
 static PySequenceMethods BPy_IDGroup_Seq = {
-       (lenfunc) BPy_IDGroup_Map_Len,          /* lenfunc sq_length */
-       NULL,                                                           /* binaryfunc sq_concat */
-       NULL,                                                           /* ssizeargfunc sq_repeat */
-       NULL,                                                           /* ssizeargfunc sq_item */ /* TODO - setting this will allow PySequence_Check to return True */
-       NULL,                                                           /* intintargfunc ***was_sq_slice*** */
-       NULL,                                                           /* intobjargproc sq_ass_item */
-       NULL,                                                           /* ssizeobjargproc ***was_sq_ass_slice*** */
-       (objobjproc) BPy_IDGroup_Contains,      /* objobjproc sq_contains */
-       NULL,                                                           /* binaryfunc sq_inplace_concat */
-       NULL,                                                           /* ssizeargfunc sq_inplace_repeat */
+       (lenfunc) BPy_IDGroup_Map_Len,      /* lenfunc sq_length */
+       NULL,                               /* binaryfunc sq_concat */
+       NULL,                               /* ssizeargfunc sq_repeat */
+       NULL,                               /* ssizeargfunc sq_item */ /* TODO - setting this will allow PySequence_Check to return True */
+       NULL,                               /* intintargfunc ***was_sq_slice*** */
+       NULL,                               /* intobjargproc sq_ass_item */
+       NULL,                               /* ssizeobjargproc ***was_sq_ass_slice*** */
+       (objobjproc) BPy_IDGroup_Contains,  /* objobjproc sq_contains */
+       NULL,                               /* binaryfunc sq_inplace_concat */
+       NULL,                               /* ssizeargfunc sq_inplace_repeat */
 };
 
 static PyMappingMethods BPy_IDGroup_Mapping = {
-       (lenfunc)BPy_IDGroup_Map_Len,           /*inquiry mp_length */
-       (binaryfunc)BPy_IDGroup_Map_GetItem,/*binaryfunc mp_subscript */
-       (objobjargproc)BPy_IDGroup_Map_SetItem, /*objobjargproc mp_ass_subscript */
+       (lenfunc)BPy_IDGroup_Map_Len,           /*inquiry mp_length */
+       (binaryfunc)BPy_IDGroup_Map_GetItem,    /*binaryfunc mp_subscript */
+       (objobjargproc)BPy_IDGroup_Map_SetItem, /*objobjargproc mp_ass_subscript */
 };
 
 PyTypeObject BPy_IDGroup_Type = {
        PyVarObject_HEAD_INIT(NULL, 0)
        /*  For printing, in format "<module>.<name>" */
-       "Blender IDProperty",           /* char *tp_name; */
-       sizeof(BPy_IDProperty),         /* int tp_basicsize; */
+       "Blender IDProperty",       /* char *tp_name; */
+       sizeof(BPy_IDProperty),     /* int tp_basicsize; */
        0,                          /* tp_itemsize;  For allocation */
 
        /* Methods to implement standard operations */
 
-       NULL,                                           /* destructor tp_dealloc; */
+       NULL,                       /* destructor tp_dealloc; */
        NULL,                       /* printfunc tp_print; */
-       NULL,     /* getattrfunc tp_getattr; */
-       NULL,     /* setattrfunc tp_setattr; */
+       NULL,                       /* getattrfunc tp_getattr; */
+       NULL,                       /* setattrfunc tp_setattr; */
        NULL,                       /* cmpfunc tp_compare; */
        (reprfunc)BPy_IDGroup_repr,     /* reprfunc tp_repr; */
 
        /* Method suites for standard classes */
 
        NULL,                       /* PyNumberMethods *tp_as_number; */
-       &BPy_IDGroup_Seq,                       /* PySequenceMethods *tp_as_sequence; */
-       &BPy_IDGroup_Mapping,           /* PyMappingMethods *tp_as_mapping; */
+       &BPy_IDGroup_Seq,           /* PySequenceMethods *tp_as_sequence; */
+       &BPy_IDGroup_Mapping,       /* PyMappingMethods *tp_as_mapping; */
 
        /* More standard operations (here for binary compatibility) */
 
@@ -915,29 +915,29 @@ PyTypeObject BPy_IDGroup_Type = {
        /* Functions to access object as input/output buffer */
        NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+       /*** Flags to define presence of optional/expanded features ***/
        Py_TPFLAGS_DEFAULT,         /* long tp_flags; */
 
        NULL,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+       /*** Assigned meaning in release 2.0 ***/
        /* call function for all accessible objects */
        NULL,                       /* traverseproc tp_traverse; */
 
        /* delete references to contained objects */
        NULL,                       /* inquiry tp_clear; */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
+       /***  Assigned meaning in release 2.1 ***/
+       /*** rich comparisons ***/
        NULL,                       /* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+       /***  weak reference enabler ***/
        0,                          /* long tp_weaklistoffset; */
 
-  /*** Added in release 2.2 ***/
+       /*** Added in release 2.2 ***/
        /*   Iterators */
        (getiterfunc)BPy_IDGroup_iter, /* getiterfunc tp_iter; */
        NULL,                       /* iternextfunc tp_iternext; */
-  /*** Attribute descriptor and subclassing stuff ***/
+       /*** Attribute descriptor and subclassing stuff ***/
        BPy_IDGroup_methods,        /* struct PyMethodDef *tp_methods; */
        NULL,                       /* struct PyMemberDef *tp_members; */
        BPy_IDGroup_getseters,       /* struct PyGetSetDef *tp_getset; */
@@ -984,7 +984,7 @@ static PyObject *BPy_IDArray_GetType(BPy_IDArray *self)
 }
 
 static PyGetSetDef BPy_IDArray_getseters[] = {
-    /* matches pythons array.typecode */
+       /* matches pythons array.typecode */
        {(char *)"typecode", (getter)BPy_IDArray_GetType, (setter)NULL, (char *)"The type of the data in the array, is an int.", NULL},
        {NULL, NULL, NULL, NULL, NULL},
 };
@@ -996,7 +996,7 @@ static PyObject *BPy_IDArray_to_list(BPy_IDArray *self)
 
 static PyMethodDef BPy_IDArray_methods[] = {
        {"to_list", (PyCFunction)BPy_IDArray_to_list, METH_NOARGS,
-               "return the array as a list"},
+        "return the array as a list"},
        {NULL, NULL, 0, NULL}
 };
 
@@ -1070,17 +1070,17 @@ static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value)
 }
 
 static PySequenceMethods BPy_IDArray_Seq = {
-       (lenfunc) BPy_IDArray_Len,                      /* inquiry sq_length */
-       NULL,                                                           /* binaryfunc sq_concat */
-       NULL,                                                           /* intargfunc sq_repeat */
-       (ssizeargfunc)BPy_IDArray_GetItem,      /* intargfunc sq_item */
-       NULL,                                                           /* intintargfunc sq_slice */
-       (ssizeobjargproc)BPy_IDArray_SetItem,/* intobjargproc sq_ass_item */
-       NULL,                                                           /* intintobjargproc sq_ass_slice */
-       NULL,                                                           /* objobjproc sq_contains */
-                               /* Added in release 2.0 */
-       NULL,                                                           /* binaryfunc sq_inplace_concat */
-       NULL,                                                           /* intargfunc sq_inplace_repeat */
+       (lenfunc) BPy_IDArray_Len,          /* inquiry sq_length */
+       NULL,                               /* binaryfunc sq_concat */
+       NULL,                               /* intargfunc sq_repeat */
+       (ssizeargfunc)BPy_IDArray_GetItem,  /* intargfunc sq_item */
+       NULL,                               /* intintargfunc sq_slice */
+       (ssizeobjargproc)BPy_IDArray_SetItem, /* intobjargproc sq_ass_item */
+       NULL,                               /* intintobjargproc sq_ass_slice */
+       NULL,                               /* objobjproc sq_contains */
+       /* Added in release 2.0 */
+       NULL,                               /* binaryfunc sq_inplace_concat */
+       NULL,                               /* intargfunc sq_inplace_repeat */
 };
 
 
@@ -1241,7 +1241,7 @@ PyTypeObject BPy_IDArray_Type = {
 
        /* Methods to implement standard operations */
 
-       NULL,                                           /* destructor tp_dealloc; */
+       NULL,                       /* destructor tp_dealloc; */
        NULL,                       /* printfunc tp_print; */
        NULL,     /* getattrfunc tp_getattr; */
        NULL,     /* setattrfunc tp_setattr; */
@@ -1251,12 +1251,12 @@ PyTypeObject BPy_IDArray_Type = {
        /* Method suites for standard classes */
 
        NULL,                       /* PyNumberMethods *tp_as_number; */
-       &BPy_IDArray_Seq,               /* PySequenceMethods *tp_as_sequence; */
+       &BPy_IDArray_Seq,           /* PySequenceMethods *tp_as_sequence; */
        &BPy_IDArray_AsMapping,     /* PyMappingMethods *tp_as_mapping; */
 
        /* More standard operations (here for binary compatibility) */
 
-       NULL,                                           /* hashfunc tp_hash; */
+       NULL,                       /* hashfunc tp_hash; */
        NULL,                       /* ternaryfunc tp_call; */
        NULL,                       /* reprfunc tp_str; */
        NULL,                       /* getattrofunc tp_getattro; */
@@ -1265,31 +1265,31 @@ PyTypeObject BPy_IDArray_Type = {
        /* Functions to access object as input/output buffer */
        NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+       /*** Flags to define presence of optional/expanded features ***/
        Py_TPFLAGS_DEFAULT,         /* long tp_flags; */
 
        NULL,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+       /*** Assigned meaning in release 2.0 ***/
        /* call function for all accessible objects */
        NULL,                       /* traverseproc tp_traverse; */
 
        /* delete references to contained objects */
        NULL,                       /* inquiry tp_clear; */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
+       /***  Assigned meaning in release 2.1 ***/
+       /*** rich comparisons ***/
        NULL,                       /* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+       /***  weak reference enabler ***/
        0,                          /* long tp_weaklistoffset; */
 
-  /*** Added in release 2.2 ***/
+       /*** Added in release 2.2 ***/
        /*   Iterators */
        NULL,                       /* getiterfunc tp_iter; */
        NULL,                       /* iternextfunc tp_iternext; */
 
-  /*** Attribute descriptor and subclassing stuff ***/
-       BPy_IDArray_methods,            /* struct PyMethodDef *tp_methods; */
+       /*** Attribute descriptor and subclassing stuff ***/
+       BPy_IDArray_methods,        /* struct PyMethodDef *tp_methods; */
        NULL,                       /* struct PyMemberDef *tp_members; */
        BPy_IDArray_getseters,       /* struct PyGetSetDef *tp_getset; */
        NULL,                       /* struct _typeobject *tp_base; */
@@ -1355,7 +1355,7 @@ PyTypeObject BPy_IDGroup_Iter_Type = {
 
        /* Methods to implement standard operations */
 
-       NULL,                                           /* destructor tp_dealloc; */
+       NULL,                       /* destructor tp_dealloc; */
        NULL,                       /* printfunc tp_print; */
        NULL,     /* getattrfunc tp_getattr; */
        NULL,     /* setattrfunc tp_setattr; */
@@ -1365,7 +1365,7 @@ PyTypeObject BPy_IDGroup_Iter_Type = {
        /* Method suites for standard classes */
 
        NULL,                       /* PyNumberMethods *tp_as_number; */
-       NULL,                                           /* PySequenceMethods *tp_as_sequence; */
+       NULL,                       /* PySequenceMethods *tp_as_sequence; */
        NULL,                       /* PyMappingMethods *tp_as_mapping; */
 
        /* More standard operations (here for binary compatibility) */
@@ -1379,25 +1379,25 @@ PyTypeObject BPy_IDGroup_Iter_Type = {
        /* Functions to access object as input/output buffer */
        NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+       /*** Flags to define presence of optional/expanded features ***/
        Py_TPFLAGS_DEFAULT,         /* long tp_flags; */
 
        NULL,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+       /*** Assigned meaning in release 2.0 ***/
        /* call function for all accessible objects */
        NULL,                       /* traverseproc tp_traverse; */
 
        /* delete references to contained objects */
        NULL,                       /* inquiry tp_clear; */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
+       /***  Assigned meaning in release 2.1 ***/
+       /*** rich comparisons ***/
        NULL,                       /* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+       /***  weak reference enabler ***/
        0,                          /* long tp_weaklistoffset; */
 
-  /*** Added in release 2.2 ***/
+       /*** Added in release 2.2 ***/
        /*   Iterators */
        PyObject_SelfIter,                  /* getiterfunc tp_iter; */
        (iternextfunc) BPy_Group_Iter_Next, /* iternextfunc tp_iternext; */