|
|
|
@ -212,6 +212,16 @@ simple_argtype_mapping = { |
|
|
|
|
"c_string": ArgTypeInfo("char*", FormatStrings.string, '(char*)""') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# 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(".", "_") |
|
|
|
@ -369,6 +379,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 |
|
|
|
|