Skip to content

Commit

Permalink
Fixup #2. Missing key value and wrong TypeHint for return type
Browse files Browse the repository at this point in the history
Also, since we only get the first element, no need to sort the whole
list, just get the first element if the list were sorted.
  • Loading branch information
cvicentiu committed Jan 9, 2025
1 parent c349728 commit eeb23f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def fnmatch_any(branch: str, patterns: list[str]) -> bool:


# Priority filter based on saved package branches
def nextBuild(builder: Builder, requests: list[BuildRequest]) -> str:
def nextBuild(builder: Builder, requests: list[BuildRequest]) -> BuildRequest:
def build_request_sort_key(request: BuildRequest):
branch = request.sources[""].branch
# Booleans are sorted False first.
Expand All @@ -283,7 +283,7 @@ def build_request_sort_key(request: BuildRequest):
request.getSubmitTime(),
)

return sorted(requests, build_request_sort_key)[0]
return min(requests, key=build_request_sort_key)


def canStartBuild(
Expand Down

0 comments on commit eeb23f3

Please sign in to comment.