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_rna_id_collection.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_rna_id_collection.c')
-rw-r--r-- | source/blender/python/intern/bpy_rna_id_collection.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c index 792e33f03a5..766c74c0bbc 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.c +++ b/source/blender/python/intern/bpy_rna_id_collection.c @@ -158,7 +158,15 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject * IDUserMapData data_cb = {NULL}; static const char *_keywords[] = {"subset", "key_types", "value_types", NULL}; - static _PyArg_Parser _parser = {"|$OO!O!:user_map", _keywords, 0}; + static _PyArg_Parser _parser = { + "|$" /* Optional keyword only arguments. */ + "O" /* `subset` */ + "O!" /* `key_types` */ + "O!" /* `value_types` */ + ":user_map", + _keywords, + 0, + }; if (!_PyArg_ParseTupleAndKeywordsFast( args, kwds, &_parser, &subset, &PySet_Type, &key_types, &PySet_Type, &val_types)) { return NULL; @@ -291,7 +299,12 @@ static PyObject *bpy_batch_remove(PyObject *UNUSED(self), PyObject *args, PyObje PyObject *ret = NULL; static const char *_keywords[] = {"ids", NULL}; - static _PyArg_Parser _parser = {"O:batch_remove", _keywords, 0}; + static _PyArg_Parser _parser = { + "O" /* `ids` */ + ":batch_remove", + _keywords, + 0, + }; if (!_PyArg_ParseTupleAndKeywordsFast(args, kwds, &_parser, &ids)) { return ret; } @@ -364,7 +377,15 @@ static PyObject *bpy_orphans_purge(PyObject *UNUSED(self), PyObject *args, PyObj bool do_recursive_cleanup = false; static const char *_keywords[] = {"do_local_ids", "do_linked_ids", "do_recursive", NULL}; - static _PyArg_Parser _parser = {"|O&O&O&:orphans_purge", _keywords, 0}; + static _PyArg_Parser _parser = { + "|" /* Optional arguments. */ + "O&" /* `do_local_ids` */ + "O&" /* `do_linked_ids` */ + "O&" /* `do_recursive` */ + ":orphans_purge", + _keywords, + 0, + }; if (!_PyArg_ParseTupleAndKeywordsFast(args, kwds, &_parser, |