Return a list of names of all the methods in the provided class. Note: Abstract methods which are not implemented are excluded from the list. :rtype: ``list`` of ``str``
(plugin_klass)
| 78 | |
| 79 | |
| 80 | def _get_plugin_methods(plugin_klass): |
| 81 | """ |
| 82 | Return a list of names of all the methods in the provided class. |
| 83 | |
| 84 | Note: Abstract methods which are not implemented are excluded from the |
| 85 | list. |
| 86 | |
| 87 | :rtype: ``list`` of ``str`` |
| 88 | """ |
| 89 | if six.PY3: |
| 90 | methods = inspect.getmembers(plugin_klass, inspect.isfunction) |
| 91 | else: |
| 92 | methods = inspect.getmembers(plugin_klass, inspect.ismethod) |
| 93 | |
| 94 | # Exclude inherited abstract methods from the parent class |
| 95 | method_names = [] |
| 96 | for name, method in methods: |
| 97 | method_properties = method.__dict__ |
| 98 | is_abstract = method_properties.get("__isabstractmethod__", False) |
| 99 | |
| 100 | if is_abstract: |
| 101 | continue |
| 102 | |
| 103 | method_names.append(name) |
| 104 | return method_names |
| 105 | |
| 106 | |
| 107 | def _validate_methods(plugin_base_class, plugin_klass): |
no test coverage detected