Skip to content

Commit

Permalink
add indent_lines skill
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartManoj committed Jan 30, 2025
1 parent 8a0c066 commit 2ea4e01
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions openhands/runtime/plugins/agent_skills/file_ops/file_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,20 @@ def print_function_code(node):

print(f'No function found for line {line_number} in the file.')

def indent_lines(text, level=1):
"""
Indents each line of the given text by the specified number of indentation levels.
Args:
text (str): The input text to be indented.
level (int, optional): The number of indentation levels to apply (default is 1).
Returns:
str: The indented text.
"""
return '\n'.join([' ' * level + line for line in text.split('\n')])



__all__ = [
'search_function',
Expand All @@ -1316,6 +1330,7 @@ def print_function_code(node):
'goto_line',
'scroll_down',
'scroll_up',
'indent_lines',
'create_file',
'find_and_replace',
'delete_line',
Expand Down

0 comments on commit 2ea4e01

Please sign in to comment.