Skip to content

Commit

Permalink
refactor(resolver): Improve formatting of attachment context handling
Browse files Browse the repository at this point in the history
- Enhance code readability by using multi-line string formatting
- Consistently use single quotes for string literals
- Improve line breaks and indentation in attachment context processing
  • Loading branch information
oconnorjoseph committed Jan 24, 2025
1 parent 27dc150 commit eab97af
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions openhands/resolver/issue_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ def _get_attachments_context(self, issue_body: str) -> str:
for file_url, file_name in attachments:
content = self._download_attachment(file_url)
if content:
attachment_contexts.append(f"Content of attached file '{file_name}':\n{content}")
attachment_contexts.append(
f"Content of attached file '{file_name}':\n{content}"
)

return '\n\n'.join(attachment_contexts)

Expand Down Expand Up @@ -279,7 +281,7 @@ def get_instruction(
# Format issues string with both the issue body and attachments
issues_str = issue.body
if attachments_context:
issues_str += f"\n\nAttached Files:\n{attachments_context}"
issues_str += f'\n\nAttached Files:\n{attachments_context}'

# Add attachments from closing issues if any
if issue.closing_issues:
Expand All @@ -289,7 +291,9 @@ def get_instruction(
for closing_issue in issue.closing_issues:
closing_attachments = self._get_attachments_context(closing_issue)
if closing_attachments:
closing_issues_str += f"\n\nAttached Files from Referenced Issue:\n{closing_attachments}"
closing_issues_str += (
f'\n\nAttached Files from Referenced Issue:\n{closing_attachments}'
)
issues_str += f'\n\n{closing_issues_str}'

template = jinja2.Template(prompt_template)
Expand Down

0 comments on commit eab97af

Please sign in to comment.