Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-04-08 02:41:28 +0300
committerCampbell Barton <campbell@blender.org>2022-04-08 04:49:50 +0300
commit982aea88e0d74020c62c2054a45eeafa56c8ca30 (patch)
tree6215fe088028a0943ace5ea80e256b7a42132420 /source/blender/python/generic
parent87a3bf33564b035e4c2400098ea4932d5dfdba5d (diff)
Cleanup: separate format-units for Python argument parsing
With the increased use of multi-character format units and keyword-only arguments these are increasingly difficult to make sense of. Split the string onto multiple lines, one per argument. While verbose it's easier to understand and add new arguments.
Diffstat (limited to 'source/blender/python/generic')
-rw-r--r--source/blender/python/generic/imbuf_py_api.c40
1 files changed, 35 insertions, 5 deletions
diff --git a/source/blender/python/generic/imbuf_py_api.c b/source/blender/python/generic/imbuf_py_api.c
index bfe25435eab..ef11d1ab32d 100644
--- a/source/blender/python/generic/imbuf_py_api.c
+++ b/source/blender/python/generic/imbuf_py_api.c
@@ -92,7 +92,14 @@ static PyObject *py_imbuf_resize(Py_ImBuf *self, PyObject *args, PyObject *kw)
struct PyC_StringEnum method = {method_items, FAST};
static const char *_keywords[] = {"size", "method", NULL};
- static _PyArg_Parser _parser = {"(ii)|$O&:resize", _keywords, 0};
+ static _PyArg_Parser _parser = {
+ "(ii)" /* `size` */
+ "|$" /* Optional keyword only arguments. */
+ "O&" /* `method` */
+ ":resize",
+ _keywords,
+ 0,
+ };
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kw, &_parser, &size[0], &size[1], PyC_ParseStringEnum, &method)) {
return NULL;
@@ -130,7 +137,13 @@ static PyObject *py_imbuf_crop(Py_ImBuf *self, PyObject *args, PyObject *kw)
rcti crop;
static const char *_keywords[] = {"min", "max", NULL};
- static _PyArg_Parser _parser = {"(II)(II):crop", _keywords, 0};
+ static _PyArg_Parser _parser = {
+ "(II)" /* `min` */
+ "(II)" /* `max` */
+ ":crop",
+ _keywords,
+ 0,
+ };
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kw, &_parser, &crop.xmin, &crop.ymin, &crop.xmax, &crop.ymax)) {
return NULL;
@@ -420,7 +433,12 @@ static PyObject *M_imbuf_new(PyObject *UNUSED(self), PyObject *args, PyObject *k
{
int size[2];
static const char *_keywords[] = {"size", NULL};
- static _PyArg_Parser _parser = {"(ii):new", _keywords, 0};
+ static _PyArg_Parser _parser = {
+ "(ii)" /* `size` */
+ ":new",
+ _keywords,
+ 0,
+ };
if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, &size[0], &size[1])) {
return NULL;
}
@@ -455,7 +473,12 @@ static PyObject *M_imbuf_load(PyObject *UNUSED(self), PyObject *args, PyObject *
const char *filepath;
static const char *_keywords[] = {"filepath", NULL};
- static _PyArg_Parser _parser = {"s:load", _keywords, 0};
+ static _PyArg_Parser _parser = {
+ "s" /* `filepath` */
+ ":load",
+ _keywords,
+ 0,
+ };
if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, &filepath)) {
return NULL;
}
@@ -497,7 +520,14 @@ static PyObject *M_imbuf_write(PyObject *UNUSED(self), PyObject *args, PyObject
const char *filepath = NULL;
static const char *_keywords[] = {"image", "filepath", NULL};
- static _PyArg_Parser _parser = {"O!|$s:write", _keywords, 0};
+ static _PyArg_Parser _parser = {
+ "O!" /* `image` */
+ "|$" /* Optional keyword only arguments. */
+ "s" /* `filepath` */
+ ":write",
+ _keywords,
+ 0,
+ };
if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, &Py_ImBuf_Type, &py_imb, &filepath)) {
return NULL;
}