MCPcopy Create free account
hub / github.com/StackStorm/st2 / _get_plugin_methods

Function _get_plugin_methods

st2common/st2common/util/loader.py:80–104  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

78
79
80def _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
107def _validate_methods(plugin_base_class, plugin_klass):

Callers 1

_validate_methodsFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected