From 628cd8fbfff4c844bcba814ec4ea14133da46597 Mon Sep 17 00:00:00 2001 From: Sourcery AI Date: Mon, 30 Nov 2020 17:02:00 +0000 Subject: [PATCH] 'Refactored by Sourcery' --- nyt_cli.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/nyt_cli.py b/nyt_cli.py index 92308fd..bcfc467 100644 --- a/nyt_cli.py +++ b/nyt_cli.py @@ -16,12 +16,14 @@ def top_stories(section, api_key, count): } response = requests.get(url, params=query_params) - stories = [] - for i in range(0, count if count <= 10 else 10): - stories.append((response.json()['results'][i]['title'], - response.json()['results'][i]['byline'], - response.json()['results'][i]['url'])) - return stories + return [ + ( + response.json()['results'][i]['title'], + response.json()['results'][i]['byline'], + response.json()['results'][i]['url'], + ) + for i in range(count if count <= 10 else 10) + ] @click.command()