1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

feat: named arguments handling in Python interface

This commit is contained in:
Vadim Levin
2023-02-06 16:41:20 +03:00
parent 9eb78eeb18
commit b07031b594
5 changed files with 250 additions and 60 deletions
+13 -1
View File
@@ -259,6 +259,10 @@ class CppHeaderParser(object):
if "CV_EXPORTS_W_SIMPLE" in l:
l = l.replace("CV_EXPORTS_W_SIMPLE", "")
modlist.append("/Simple")
if "CV_EXPORTS_W_PARAMS" in l:
l = l.replace("CV_EXPORTS_W_PARAMS", "")
modlist.append("/Map")
modlist.append("/Params")
npos = l.find("CV_EXPORTS_AS")
if npos < 0:
npos = l.find('CV_WRAP_AS')
@@ -776,7 +780,15 @@ class CppHeaderParser(object):
var_list = [var_name1] + [i.strip() for i in var_list[1:]]
for v in var_list:
class_decl[3].append([var_type, v, "", var_modlist])
prop_definition = v.split('=')
prop_name = prop_definition[0].strip()
if len(prop_definition) == 1:
# default value is not provided
prop_default_value = ''
else:
prop_default_value = prop_definition[-1]
class_decl[3].append([var_type, prop_name, prop_default_value,
var_modlist])
return stmt_type, "", False, None
# something unknown