Skip to content

Commit

Permalink
Utilize list comprehension
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielZhangDP committed Aug 28, 2024
1 parent 7f2fa57 commit 6bce804
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cfmtoolbox/plugins/random_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def random_sampling(model: CFM | None, amount: int = 1) -> CFM | None:
print("No model loaded.")
return None

all_samples = []
for _ in range(amount):
all_samples.append(asdict(RandomSampler(model).random_sampling()))
all_samples = [
asdict(RandomSampler(model).random_sampling()) for _ in range(amount)
]

print(json.dumps(all_samples, indent=2))

Expand Down

0 comments on commit 6bce804

Please sign in to comment.