def get_initial_implementation(definition): """ Always starts implementation with definition :param definition: function definition. :return: code """ signature = get_signature(definition) indent = helpers.get_indent_from_definition(definition) return [indent + "def " + signature + ":"]
def add_code_to_implementation(current_implementation, bool_expression, definition, the_output): """ Given definition and expression gets the function implementation. :param bool_expression: a boolean expression that can be evaluated. :param definition: def function(input1, input2, ...). :return: string list with implementation. """ signature = get_signature(definition) indent = helpers.get_indent_from_definition(definition) if bool_expression and len(bool_expression) > 0: new_code = get_code_piece(bool_expression, indent, the_output) return current_implementation + new_code else: warnings.warn('Function: ' + signature + ' has no boolean expression; cannot be implemented', UserWarning) return current_implementation