Skip to content

Commit

Permalink
lint: address PERF402
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Jul 8, 2024
1 parent 2f43b4e commit b188a44
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cylc/flow/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from contextlib import suppress
from pathlib import Path
from random import shuffle
from random import choice
import shutil
import sys
from typing import Optional
Expand Down Expand Up @@ -205,12 +205,9 @@ def get_api_key() -> str:
load over a larger number of keys to prevent hitting the cap with group
sessions.
"""
keys = []
with open((TUTORIAL_DIR / 'api-keys'), 'r') as api_keys:
for api_key in api_keys:
keys.append(api_key)
shuffle(keys)
return keys[0].strip()
return choice(list(api_keys)).strip() # nosec
# (the randomness of this choice is not a security concern)


def set_api_key(tgt):
Expand Down

0 comments on commit b188a44

Please sign in to comment.