Skip to content

Commit

Permalink
Fix python lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wtiger9218 committed Feb 13, 2025
1 parent 9cac804 commit 448178b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions openhands/resolver/interfaces/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def __init__(self, owner: str, repo: str, token: str, username: str | None = Non
self.clone_url = self.get_clone_url()
self.headers = self.get_headers()

def set_owner(self, owner: str):
self.owner = owner

def get_headers(self):
return {
'Authorization': f'token {self.token}',
Expand Down
3 changes: 3 additions & 0 deletions openhands/resolver/interfaces/gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ def __init__(self, owner: str, repo: str, token: str, username: str | None = Non
self.clone_url = self.get_clone_url()
self.headers = self.get_headers()

def set_owner(self, owner: str):
self.owner = owner

def get_headers(self):
return {
'Authorization': f'Bearer {self.token}',
Expand Down
12 changes: 12 additions & 0 deletions openhands/resolver/interfaces/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ class Issue(BaseModel):


class IssueHandlerInterface(ABC):
@abstractmethod
def set_owner(self, owner: str):
pass

@abstractmethod
def download_issues(self) -> list[Any]:
pass
Expand All @@ -51,6 +55,10 @@ def get_download_url(self):
def get_clone_url(self):
pass

@abstractmethod
def get_pull_url(self, pr_number: int):
pass

@abstractmethod
def get_graphql_url(self):
pass
Expand All @@ -67,6 +75,10 @@ def get_compare_url(self, branch_name):
def get_branch_name(self, base_branch_name: str):
pass

@abstractmethod
def get_default_branch_name(self):
pass

@abstractmethod
def branch_exists(self, branch_name: str) -> bool:
pass
Expand Down
2 changes: 1 addition & 1 deletion openhands/resolver/interfaces/issue_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def _check_review_comments(
class ServiceContextIssue(ServiceContext):
issue_type: ClassVar[str] = 'issue'

def __init__(self, strategy, llm_config: LLMConfig | None):
def __init__(self, strategy: IssueHandlerInterface, llm_config: LLMConfig | None):
super().__init__(strategy, llm_config)

def get_base_url(self):
Expand Down
2 changes: 1 addition & 1 deletion openhands/resolver/send_pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def send_pull_request(
# Determine the repository to push to (original or fork)
push_owner = fork_owner if fork_owner else issue.owner

handler._strategy.owner = push_owner
handler._strategy.set_owner(push_owner)

print('Pushing changes...')
push_url = handler.get_clone_url()
Expand Down

0 comments on commit 448178b

Please sign in to comment.