Cleanup: separate format-units for Python argument parsing

Recent addition to the Python API [0] didn't follow this convention.
See [1] for the rationale behind this change.

[0]: 9bc678969a
[1]: 982aea88e0
This commit is contained in:
Campbell Barton 2022-04-14 11:21:51 +10:00
parent f076493dbb
commit 927cb5bfac
1 changed files with 30 additions and 3 deletions

View File

@ -483,7 +483,16 @@ static PyObject *pygpu_shader_info_fragment_out(BPyGPUShaderCreateInfo *self,
struct PyC_StringEnum blend_type = {pygpu_dualblend_items, (int)DualBlend::NONE};
static const char *_keywords[] = {"slot", "type", "name", "blend", nullptr};
static _PyArg_Parser _parser = {"iO&s|$O&:fragment_out", _keywords, nullptr};
static _PyArg_Parser _parser = {
"i" /* `slot` */
"O&" /* `type` */
"s" /* `name` */
"|$" /* Optional keyword only arguments. */
"O&" /* `blend` */
":fragment_out",
_keywords,
nullptr,
};
if (!_PyArg_ParseTupleAndKeywordsFast(args,
kwds,
&_parser,
@ -577,7 +586,17 @@ static PyObject *pygpu_shader_info_image(BPyGPUShaderCreateInfo *self,
Qualifier qualifier = Qualifier::NO_RESTRICT;
static const char *_keywords[] = {"slot", "format", "type", "name", "qualifiers", nullptr};
static _PyArg_Parser _parser = {"iO&O&s|$O:image", _keywords, 0};
static _PyArg_Parser _parser = {
"i" /* `slot` */
"O&" /* `format` */
"O&" /* `type` */
"s" /* `name` */
"|$" /* Optional keyword only arguments. */
"O" /* `qualifiers` */
":image",
_keywords,
nullptr,
};
if (!_PyArg_ParseTupleAndKeywordsFast(args,
kwds,
&_parser,
@ -733,7 +752,15 @@ static PyObject *pygpu_shader_info_push_constant(BPyGPUShaderCreateInfo *self,
int array_size = 0;
static const char *_keywords[] = {"type", "name", "size", nullptr};
static _PyArg_Parser _parser = {"O&s|I:push_constant", _keywords, nullptr};
static _PyArg_Parser _parser = {
"O&" /* `type` */
"s" /* `name` */
"|" /* Optional arguments. */
"I" /* `size` */
":push_constant",
_keywords,
nullptr,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kwds, &_parser, PyC_ParseStringEnum, &pygpu_type, &name, &array_size)) {
return nullptr;