def _ScopeInspector_GetFunctionAttributes(definitions): if type(definitions) != dict: return [] from mantid.simpleapi import _get_function_spec keywords = [] for name, obj in definitions.iteritems(): if name.startswith('_'): continue if inspect.isclass(obj) or inspect.ismodule(obj): continue if inspect.isfunction(obj) or inspect.isbuiltin(obj): keywords.append(name + _get_function_spec(obj)) continue # Object could be a proxy so check and use underlying object if hasattr(obj, "_getHeldObject"): obj = obj._getHeldObject() attrs = dir(obj) for att in attrs: try: fattr = getattr(obj, att) except Exception: continue # not much we do if not even calling it causes an exception if att.startswith('_'): continue if inspect.isfunction(fattr) or inspect.ismethod(fattr) or \ hasattr(fattr,'im_func'): keywords.append(name + '.' + att + _get_function_spec(fattr)) return keywords
def _ScopeInspector_GetFunctionAttributes(definitions): if type(definitions) != dict: return [] from mantid.simpleapi import _get_function_spec keywords = [] for name,obj in _iteritems(definitions): if name.startswith('_') : continue if _inspect.isclass(obj) or _inspect.ismodule(obj): continue if _inspect.isfunction(obj) or _inspect.isbuiltin(obj): keywords.append(name + _get_function_spec(obj)) continue # Object could be a proxy so check and use underlying object if hasattr(obj,"_getHeldObject"): obj = obj._getHeldObject() attrs = dir(obj) for att in attrs: try: fattr = getattr(obj,att) except Exception: continue # not much we do if not even calling it causes an exception if att.startswith('_'): continue if _inspect.isfunction(fattr) or _inspect.ismethod(fattr) or \ hasattr(fattr,'im_func'): keywords.append(name + '.' + att + _get_function_spec(fattr)) return keywords;