diff options
author | Campbell Barton <campbell@blender.org> | 2022-04-08 02:41:28 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-04-08 04:49:50 +0300 |
commit | 982aea88e0d74020c62c2054a45eeafa56c8ca30 (patch) | |
tree | 6215fe088028a0943ace5ea80e256b7a42132420 /source/blender/python/intern/bpy_app_icons.c | |
parent | 87a3bf33564b035e4c2400098ea4932d5dfdba5d (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/intern/bpy_app_icons.c')
-rw-r--r-- | source/blender/python/intern/bpy_app_icons.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/source/blender/python/intern/bpy_app_icons.c b/source/blender/python/intern/bpy_app_icons.c index 48e3072008c..3f884338bbb 100644 --- a/source/blender/python/intern/bpy_app_icons.c +++ b/source/blender/python/intern/bpy_app_icons.c @@ -40,7 +40,14 @@ static PyObject *bpy_app_icons_new_triangles(PyObject *UNUSED(self), PyObject *a PyObject *py_coords, *py_colors; static const char *_keywords[] = {"range", "coords", "colors", NULL}; - static _PyArg_Parser _parser = {"(BB)SS:new_triangles", _keywords, 0}; + static _PyArg_Parser _parser = { + "(BB)" /* `range` */ + "S" /* `coords` */ + "S" /* `colors` */ + ":new_triangles", + _keywords, + 0, + }; if (!_PyArg_ParseTupleAndKeywordsFast( args, kw, &_parser, &coords_range[0], &coords_range[1], &py_coords, &py_colors)) { return NULL; @@ -93,7 +100,12 @@ static PyObject *bpy_app_icons_new_triangles_from_file(PyObject *UNUSED(self), char *filename; static const char *_keywords[] = {"filename", NULL}; - static _PyArg_Parser _parser = {"s:new_triangles_from_file", _keywords, 0}; + static _PyArg_Parser _parser = { + "s" /* `filename` */ + ":new_triangles_from_file", + _keywords, + 0, + }; if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, &filename)) { return NULL; } @@ -115,7 +127,12 @@ static PyObject *bpy_app_icons_release(PyObject *UNUSED(self), PyObject *args, P { int icon_id; static const char *_keywords[] = {"icon_id", NULL}; - static _PyArg_Parser _parser = {"i:release", _keywords, 0}; + static _PyArg_Parser _parser = { + "i" /* `icon_id` */ + ":release", + _keywords, + 0, + }; if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, &icon_id)) { return NULL; } |