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

[MRG+1] Update _monkeypatches.py #3907

Merged
merged 4 commits into from Aug 1, 2019
Merged

[MRG+1] Update _monkeypatches.py #3907

merged 4 commits into from Aug 1, 2019

Conversation

sbs2001
Copy link
Contributor

@sbs2001 sbs2001 commented Jul 27, 2019

The workarounds are not required assuming the bugs regarding urlparse are absent in Python versions >2.7. We already exit the program if Python version<2.7 in the init.py(line 17).The monkeypatches are deployed after this check at line 27 in the init.py .

The workarounds are not required assuming the bugs regarding urlparse are absent in  Python versions >2.7. We already exit the program if Python  version<2.7 in the __init__.py(line 17).The monkeypatches are deployed after this check at line 27  in  the __init__.py .
if six.PY2:
from urlparse import urlparse

# workaround for https://bugs.python.org/issue7904 - Python < 2.7
Copy link
Member

Choose a reason for hiding this comment

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

👍

from urlparse import uses_netloc
uses_netloc.append('s3')

# workaround for https://bugs.python.org/issue9374 - Python < 2.7.4
Copy link
Member

Choose a reason for hiding this comment

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

I think we shouldn't remove the second workaround, as it may be needed in 2.7 < Python < 2.7.4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep my bad, python 2.7.4 is still permitted . I am newbie to the whole project so this may sound stupid but why is the Travis CI build is failing? I noticed it with other pull requests too.

Copy link
Contributor Author

@sbs2001 sbs2001 Jul 28, 2019

Choose a reason for hiding this comment

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

Added the second workaround in the new commit.Could you review the new code?

Copy link
Member

Choose a reason for hiding this comment

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

why is the Travis CI build is failing? I noticed it with other pull requests too.

At the moment #3913 and #3917. If you stick around, though, I’m sure you’ll have the opportunity to see it start failing for other reasons; it happens now and then 🙂

Added the second workaround.
@codecov
Copy link

codecov bot commented Jul 28, 2019

Codecov Report

Merging #3907 into master will decrease coverage by 0.54%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3907      +/-   ##
==========================================
- Coverage   85.47%   84.92%   -0.55%     
==========================================
  Files         165      165              
  Lines        9624     9615       -9     
  Branches     1446     1443       -3     
==========================================
- Hits         8226     8166      -60     
- Misses       1145     1189      +44     
- Partials      253      260       +7
Impacted Files Coverage Δ
scrapy/_monkeypatches.py 100% <ø> (+42.85%) ⬆️
scrapy/core/downloader/handlers/s3.py 62.9% <0%> (-32.26%) ⬇️
scrapy/utils/boto.py 46.66% <0%> (-26.67%) ⬇️
scrapy/core/downloader/tls.py 75.92% <0%> (-12.97%) ⬇️
scrapy/utils/ssl.py 51.42% <0%> (-5.72%) ⬇️
scrapy/extensions/feedexport.py 78.44% <0%> (-5.05%) ⬇️
scrapy/core/downloader/handlers/http11.py 89.92% <0%> (-2.62%) ⬇️
scrapy/core/scraper.py 86.48% <0%> (-2.03%) ⬇️
scrapy/pipelines/files.py 65.38% <0%> (-1.16%) ⬇️

@codecov
Copy link

codecov bot commented Jul 28, 2019

Codecov Report

Merging #3907 into master will increase coverage by <.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3907      +/-   ##
==========================================
+ Coverage   85.47%   85.48%   +<.01%     
==========================================
  Files         165      165              
  Lines        9624     9622       -2     
  Branches     1446     1446              
==========================================
- Hits         8226     8225       -1     
+ Misses       1145     1144       -1     
  Partials      253      253
Impacted Files Coverage Δ
scrapy/_monkeypatches.py 72.72% <ø> (+15.58%) ⬆️
scrapy/utils/ssl.py 52.77% <0%> (-4.37%) ⬇️
scrapy/pipelines/files.py 66.53% <0%> (ø) ⬆️

Copy link
Member

@Gallaecio Gallaecio left a comment

Choose a reason for hiding this comment

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

Thanks for your patch, but looking at the changes I see a few unrelated format changes, some of them for the worse. Could you please make your changes only remove the unnecessary workaround?

@sbs2001
Copy link
Contributor Author

sbs2001 commented Jul 30, 2019

Thanks for your patch, but looking at the changes I see a few unrelated format changes, some of them for the worse. Could you please make your changes only remove the unnecessary workaround?

Sorry for the formatting. Anyway I have updated the code accordingly.Please review.

# workaround for https://bugs.python.org/issue9374 - Python < 2.7.4
if urlparse('s3://bucket/key?key=value').query != 'key=value':
from urlparse import uses_query
uses_query.append('s3')


Copy link
Member

Choose a reason for hiding this comment

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

You missed a spot 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed I hope.

@Gallaecio Gallaecio changed the title Update _monkeypatches.py [MRG+1] Update _monkeypatches.py Aug 1, 2019
@kmike kmike merged commit 783d61d into scrapy:master Aug 1, 2019
@kmike
Copy link
Member

kmike commented Aug 1, 2019

Thanks @sbs2001, and thanks @Gallaecio for the review!

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