def __getJSFunctionsStr(cls, class_): funcStrings = [] functions = inspect.getmembers(class_.__class__, predicate=isNewFunction) for name, method in functions: defaults = getDefaults(method) args = getArgs(method) defaultsArray = [] for i, d in reversed(list(enumerate(defaults))): defaultsArray.insert(0,cls.ARGS_COOK_TEMPLATE.format(iter = i, name = args[i], default=d)) defaultsStr = "\n\t\t\t".join(defaultsArray) funcStrings.append(cls.FUNCTION_TEMPLATE.format(name=name, args=", ".join(args), cook=defaultsStr)) return funcStrings
def __getFunctionStr(cls, class_): funcStrings = [] functions = inspect.getmembers(class_, predicate=isNewFunction) for name, method in functions: args = getArgs(method) defaults = getDefaults(method) formattedArgs = [] for i, arg in enumerate(reversed(args)): if i >= len(defaults): formattedArgs.insert(0, arg) else: formattedArgs.insert(0, arg + "=" + str(defaults[-i - 1])) appendInArgs = ("\n" + cls.TAB * 4).join([cls.ARGS_COOK_TEMPLATE.format(name=arg) for arg in args]) funcStrings.append( cls.FUNCTION_TEMPLATE.format(name=name, args=", ".join(formattedArgs), cook=appendInArgs)) return funcStrings