Skip to content

Commit

Permalink
improve code readability
Browse files Browse the repository at this point in the history
  • Loading branch information
JT committed Mar 15, 2024
1 parent 109c6b1 commit 7cffdea
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions bugbot/rules/not_landed.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def attachment_handler(attachments, data):

return data

def get_bz_userid(self, phids):
def get_bz_users(self, phids):
if not phids:
return {}

Expand All @@ -263,7 +263,7 @@ def get_bz_userid(self, phids):
return {}

def handler(user, data):
data[str(user["id"])] = (user["name"], user["nick"])
data[str(user["id"])] = user

data = {}
BugzillaUser(
Expand Down Expand Up @@ -311,15 +311,15 @@ def get_bugs(self, date="today", bug_ids=[]):
res = {}

reviewers_phid = set()
nicknames = {}
bug_assignee_map = {}
for bugid, data in bugs_patch.items():
reviewers_phid |= data["reviewers_phid"]
assignee = bugs[bugid]["assigned_to"]
if not assignee:
assignee = max(data["author"], key=data["author"].get)
nicknames[bugid] = assignee
bug_assignee_map[bugid] = assignee

bz_reviewers = self.get_bz_userid(reviewers_phid)
bz_reviewers = self.get_bz_users(reviewers_phid)
all_reviewers = set(bz_reviewers.keys())

for bugid, data in bugs_patch.items():
Expand All @@ -329,7 +329,8 @@ def get_bugs(self, date="today", bug_ids=[]):
nickname = d["nickname"]

if not assignee:
assignee, nickname = bz_reviewers[nicknames[bugid]]
assignee_id = bug_assignee_map[bugid]
assignee, nickname = bz_reviewers[assignee_id]

if not assignee:
continue
Expand Down

0 comments on commit 7cffdea

Please sign in to comment.