Skip to content

Commit

Permalink
set comprehension
Browse files Browse the repository at this point in the history
  • Loading branch information
MVarshini committed Jan 9, 2025
1 parent eaebe65 commit fb2bd9f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion backend/app/api/v1/commons/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Define the keywords for sorting.
# numeric values take no .keyword
DIRECTIONS = ("asc", "desc")
FIELDS = (
"ciSystem.keyword",
Expand All @@ -21,7 +22,6 @@
"infraNodesCount",
"totalNodesCount",
)

OCP_FIELD_CONSTANT_DICT = {
"ciSystem": "ciSystem.keyword",
"platform": "platform.keyword",
Expand Down
11 changes: 2 additions & 9 deletions backend/app/api/v1/commons/ocp.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,9 @@ async def getFilterData(start_datetime: date, end_datetime: date, configpath: st

def getJobType(upstreamList: list):
return list(
set(
[
"periodic" if "periodic" in item else "pull-request"
for item in upstreamList
]
)
{"periodic" if "periodic" in item else "pull-request" for item in upstreamList}
)


def getIsRehearse(upstreamList: list):
return list(
set(["True" if "rehearse" in item else "False" for item in upstreamList])
)
return list({"True" if "rehearse" in item else "False" for item in upstreamList})
6 changes: 1 addition & 5 deletions backend/app/api/v1/commons/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ def getBuild(job):

def getReleaseStream(row):
releaseStream = next(
(
value
for key, value in RELEASE_STREAM_DICT.items()
if key in row["releaseStream"]
),
(v for k, v in RELEASE_STREAM_DICT.items() if k in row["releaseStream"]),
"Stable",
)
return releaseStream
Expand Down

0 comments on commit fb2bd9f

Please sign in to comment.