Skip to content

Commit

Permalink
use list comprehension instead of loop
Browse files Browse the repository at this point in the history
Co-authored-by: Max Fischer <[email protected]>
  • Loading branch information
swozniewski and maxfischer2781 authored Feb 28, 2024
1 parent 4f93e96 commit 1c9cd84
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tardis/adapters/sites/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ async def squeue(
else:
# Not all lines returned in slurm_status.stdout belong to the actual squeue output
# Only keep lines containing the delimiter
cleaned_stdout = []
for row in slurm_status.stdout.splitlines():
if "|" in row:
cleaned_stdout.append(row)
cleaned_stdout = [
row for row in slurm_status.stdout.splitlines() if "|" in row
]
for row in csv_parser(
"\n".join(cleaned_stdout), fieldnames=tuple(attributes.keys()), delimiter="|"
):
Expand Down

0 comments on commit 1c9cd84

Please sign in to comment.