Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobranco777 committed Nov 8, 2023
1 parent 0292e79 commit 77be530
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 15 deletions.
5 changes: 1 addition & 4 deletions services/bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,12 @@ def close(self):
pass

def _get_user_issues(self, query: dict[str, Any], **kwargs) -> list[Issue]:
closed = kwargs.get("closed", False)
try:
issues = self.client.query(query)
except (AttributeError, BugzillaError, RequestException) as exc:
logging.error("Bugzilla: %s: get_user_issues(): %s", self.url, exc)
return []
if not closed:
issues = [issue for issue in issues if issue.is_open]
return [self._to_issue(issue) for issue in issues]
return [self._to_issue(issue) for issue in issues if issue.is_open]

def get_user_issues(self, username: str = "", **kwargs) -> list[Issue]:
try:
Expand Down
3 changes: 1 addition & 2 deletions services/gitea.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ def get_page(page: int) -> list[dict]:
return entries

def _get_user_issues(self, query: dict[str, Any], **kwargs) -> list[Issue]:
closed = kwargs.get("closed", False)
query["state"] = "closed" if closed else "open"
query["state"] = "open"
issues = self._get_paginated(
f"{self.url}/api/v1/repos/issues/search", params=query
)
Expand Down
6 changes: 2 additions & 4 deletions services/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@ def close(self):
except (AttributeError, GithubException):
pass

def get_user_issues(self, username: str = "", **kwargs) -> list[Issue]:
state = kwargs.get("state", "open")
filters = f"state:{state} involves:"
def get_user_issues(self, username: str = "", **_) -> list[Issue]:
try:
user = (
self.client.get_user(username) if username else self.client.get_user()
)
filters += user.login
filters = f"state:open involves:{user.login}"
issues = self.client.search_issues(filters)
except (GithubException, RequestException) as exc:
logging.error("Github: get_user_issues(%s): %s", username, exc)
Expand Down
2 changes: 1 addition & 1 deletion services/gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _get_user_issues(self, query: dict[str, Any], **kwargs) -> list[Issue]:
issues: list[Any] = []
query |= {
"all": True, # No pagination
"state": kwargs.get("state", "opened"),
"state": "opened",
}
pull_requests = query.pop("pull_requests")
try:
Expand Down
1 change: 0 additions & 1 deletion services/pagure.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ def _get_pullrequests(
)

def _get_user_issues(self, query: dict[str, Any], **kwargs) -> list[Issue]:
query["status"] = kwargs.get("state", "Open")
pull_requests = query.pop("pull_requests")
username = kwargs.pop("username")
try:
Expand Down
3 changes: 0 additions & 3 deletions services/redmine.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ def close(self):
pass

def _get_user_issues(self, query: dict[str, Any], **kwargs) -> list[Issue]:
closed = kwargs.get("closed", False)
if closed:
query["status_id"] = "closed"
try:
issues = self.client.issue.filter(**query)
except (BaseRedmineError, RequestException) as exc:
Expand Down

0 comments on commit 77be530

Please sign in to comment.