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

Merge pull request #23705 from asmorkalov:as/cxx-named-arguments

Re-implement named parameters bindings for Python #23705

Reverted named argument handling from #19156.
Ported new solution from #23224
The port is required to harmonize 4.x -> 5.x merges.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Alexander Smorkalov
2023-05-30 17:41:41 +03:00
committed by GitHub
parent 67a3d35b4e
commit d24ffe9a65
4 changed files with 257 additions and 125 deletions
+12 -9
View File
@@ -258,13 +258,13 @@ class CppHeaderParser(object):
if "CV_EXPORTS_W_MAP" in l:
l = l.replace("CV_EXPORTS_W_MAP", "")
modlist.append("/Map")
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")
if "CV_EXPORTS_W_SIMPLE" in l:
l = l.replace("CV_EXPORTS_W_SIMPLE", "")
modlist.append("/Simple")
npos = l.find("CV_EXPORTS_AS")
if npos < 0:
npos = l.find('CV_WRAP_AS')
@@ -782,12 +782,15 @@ class CppHeaderParser(object):
var_list = [var_name1] + [i.strip() for i in var_list[1:]]
for v in var_list:
vv = v.split("=")
vname = vv[0].strip()
vdefval = ""
if len(vv) > 1:
vdefval = vv[1].strip()
class_decl[3].append([var_type, vname, vdefval, 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