From 0551ee36e8e87fac3cf6cbd3d614aa7fa2fc0ba0 Mon Sep 17 00:00:00 2001 From: Christoph Holtermann Date: Fri, 7 Sep 2018 00:07:29 +0200 Subject: [PATCH] add option to exclude specified methods an exclude option is being added to add_constructor_and_methods_with_prefix and add_methods_with_prefix --- bindings/python/function_class.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bindings/python/function_class.py b/bindings/python/function_class.py index db159ff83e..b0c41d73c5 100644 --- a/bindings/python/function_class.py +++ b/bindings/python/function_class.py @@ -125,19 +125,23 @@ class ClassFromFunctions(object): return method_function @classmethod - def add_methods_with_prefix(cls, prefix): - """Add a group of functions with the same prefix + def add_methods_with_prefix(cls, prefix, exclude=[]): + """Add a group of functions with the same prefix, exclude methods + in array exclude. """ for function_name, function_value, after_prefix in \ - extract_attributes_with_prefix(cls._module, prefix): + extract_attributes_with_prefix(cls._module, prefix): + + if not (function_name in exclude): cls.add_method(function_name, after_prefix) @classmethod - def add_constructor_and_methods_with_prefix(cls, prefix, constructor): + def add_constructor_and_methods_with_prefix(cls, prefix, constructor, exclude=[]): """Add a group of functions with the same prefix, and set the - _new_instance attribute to prefix + constructor + _new_instance attribute to prefix + constructor. Don't add methods + in array exclude. """ - cls.add_methods_with_prefix(prefix) + cls.add_methods_with_prefix(prefix, exclude=exclude) cls._new_instance = prefix + constructor @classmethod