Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use chain.from_iterable in python.py #4635

Merged
merged 1 commit into from Jun 17, 2020
Merged

Use chain.from_iterable in python.py #4635

merged 1 commit into from Jun 17, 2020

Conversation

cool-RR
Copy link
Contributor

@cool-RR cool-RR commented Jun 17, 2020

This is a faster and more idiomatic way of using itertools.chain. Instead of computing all the items in the iterable and storing them in memory, they are computed one-by-one and never stored as a huge list. This can save on both runtime and memory space.

@codecov
Copy link

codecov bot commented Jun 17, 2020

Codecov Report

Merging #4635 into master will increase coverage by 0.03%.
The diff coverage is 91.46%.

@@            Coverage Diff             @@
##           master    #4635      +/-   ##
==========================================
+ Coverage   84.76%   84.79%   +0.03%     
==========================================
  Files         163      163              
  Lines        9978     9985       +7     
  Branches     1489     1487       -2     
==========================================
+ Hits         8458     8467       +9     
  Misses       1254     1254              
+ Partials      266      264       -2     
Impacted Files Coverage Δ
scrapy/spiders/feed.py 66.15% <ø> (ø)
scrapy/commands/parse.py 20.21% <33.33%> (ø)
scrapy/contracts/default.py 84.61% <80.00%> (+0.30%) ⬆️
scrapy/core/scraper.py 87.97% <80.00%> (ø)
scrapy/shell.py 67.96% <80.00%> (-0.25%) ⬇️
scrapy/exporters.py 100.00% <100.00%> (ø)
scrapy/item.py 98.73% <100.00%> (ø)
scrapy/loader/__init__.py 95.54% <100.00%> (-0.03%) ⬇️
scrapy/pipelines/files.py 60.64% <100.00%> (+0.71%) ⬆️
scrapy/pipelines/images.py 91.81% <100.00%> (+1.16%) ⬆️
... and 2 more

wRAR
wRAR approved these changes Jun 17, 2020
Copy link
Member

@elacuesta elacuesta left a comment

Good catch, thanks!

@wRAR wRAR merged commit 89e900e into scrapy:master Jun 17, 2020
2 checks passed
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.

None yet

3 participants