Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -214,6 +214,16 @@ simple_argtype_mapping = {
|
||||
"Stream": ArgTypeInfo("Stream", FormatStrings.object, 'Stream::Null()', True),
|
||||
}
|
||||
|
||||
# Set of reserved keywords for Python. Can be acquired via the following call
|
||||
# $ python -c "help('keywords')"
|
||||
# Keywords that are reserved in C/C++ are excluded because they can not be
|
||||
# used as variables identifiers
|
||||
python_reserved_keywords = {
|
||||
"True", "None", "False", "as", "assert", "def", "del", "elif", "except", "exec",
|
||||
"finally", "from", "global", "import", "in", "is", "lambda", "nonlocal",
|
||||
"pass", "print", "raise", "with", "yield"
|
||||
}
|
||||
|
||||
|
||||
def normalize_class_name(name):
|
||||
return re.sub(r"^cv\.", "", name).replace(".", "_")
|
||||
@@ -371,6 +381,8 @@ class ArgInfo(object):
|
||||
def __init__(self, arg_tuple):
|
||||
self.tp = handle_ptr(arg_tuple[0])
|
||||
self.name = arg_tuple[1]
|
||||
if self.name in python_reserved_keywords:
|
||||
self.name += "_"
|
||||
self.defval = arg_tuple[2]
|
||||
self.isarray = False
|
||||
self.arraylen = 0
|
||||
|
||||
@@ -979,7 +979,8 @@ class CppHeaderParser(object):
|
||||
has_mat = len(list(filter(lambda x: x[0] in {"Mat", "vector_Mat"}, args))) > 0
|
||||
if has_mat:
|
||||
_, _, _, gpumat_decl = self.parse_stmt(stmt, token, mat="cuda::GpuMat", docstring=docstring)
|
||||
decls.append(gpumat_decl)
|
||||
if gpumat_decl != decl:
|
||||
decls.append(gpumat_decl)
|
||||
|
||||
if self._generate_umat_decls:
|
||||
# If function takes as one of arguments Mat or vector<Mat> - we want to create the
|
||||
@@ -988,7 +989,8 @@ class CppHeaderParser(object):
|
||||
has_mat = len(list(filter(lambda x: x[0] in {"Mat", "vector_Mat"}, args))) > 0
|
||||
if has_mat:
|
||||
_, _, _, umat_decl = self.parse_stmt(stmt, token, mat="UMat", docstring=docstring)
|
||||
decls.append(umat_decl)
|
||||
if umat_decl != decl:
|
||||
decls.append(umat_decl)
|
||||
|
||||
docstring = ""
|
||||
if stmt_type == "namespace":
|
||||
|
||||
Reference in New Issue
Block a user