Skip to content

Sourcery Starbot ⭐ refactored umadesai/nyt-cli#2

Open
SourceryAI wants to merge 1 commit into
umadesai:masterfrom
SourceryAI:master
Open

Sourcery Starbot ⭐ refactored umadesai/nyt-cli#2
SourceryAI wants to merge 1 commit into
umadesai:masterfrom
SourceryAI:master

Conversation

@SourceryAI
Copy link
Copy Markdown

@SourceryAI SourceryAI commented Nov 30, 2020

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch https://github.com/sourcery-ai-bot/nyt-cli master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Comment thread nyt_cli.py
Comment on lines -19 to +26
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)
]
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function top_stories refactored with the following changes:

  • Replace range(0, x) with range(x) (remove-zero-from-range)
  • Convert for loop into list comprehension (list-comprehension)
  • Inline variable that is immediately returned (inline-immediately-returned-variable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant