Skip to content

Commit

Permalink
Lifetime Model: Ignore empty lines rucio#7444
Browse files Browse the repository at this point in the history
The `dids` variable is only iterated over, so there is no need to
convert it from a set into a list.

Also ensure the file ends with a newline.
  • Loading branch information
dchristidis committed Feb 26, 2025
1 parent 5dcf2f9 commit a42bbdf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/rucio/client/commands/bin_legacy/rucio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1987,7 +1987,8 @@ def add_lifetime_exception(args, client, logger, console, spinner):
logger.error('inputfile is mandatory')
return FAILURE
with open(args.inputfile) as infile:
dids = list(set(line.strip() for line in infile))
# Deduplicate the content of the input file and ignore empty lines.
dids = set(did for line in infile if (did := line.strip()))

dids_list = []
containers = []
Expand Down Expand Up @@ -2821,3 +2822,4 @@ def main():

if __name__ == '__main__':
main()

0 comments on commit a42bbdf

Please sign in to comment.