Fixes #2828 - Changes from pep8 to pycodestyle#2829
Fixes #2828 - Changes from pep8 to pycodestyle#2829miketaylr merged 7 commits intowebcompat:masterfrom
Conversation
The project has been renamed and pycodestyle is the new version. It will also means a bump into the checking that will need to be fixed. We will do that in the subsequent commits.
This is the new keyword for removing the check for a specific line.
This was initially triggered by pycodestyle W504. It kinds of force you to choose your style in between W503 and W504. Breaking before binary operators or after. To avoid it altogether, I switched to ''.join() which is more effective anyway in performance. https://wiki.python.org/moin/PythonSpeed/PerformanceTips#String_Concatenation
We will ignore W504 for most of the cases.
Basically pycostyle forces you to choose in between W504 or W503
| **URL**: https://example.com/foobar | ||
| """ | ||
| url_pattern = re.compile('\*\*URL\*\*\: (.+)\n') | ||
| url_pattern = re.compile(r'\*\*URL\*\*\: (.+)') |
There was a problem hiding this comment.
just explaining here the why. This was W605 invalid escape sequence ‘x’
The explanation is https://lintlyci.github.io/Flake8Rules/rules/W605.html
https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
Both string and bytes literals may optionally be prefixed with a letter 'r' or 'R'; such strings are called raw strings and treat backslashes as literal characters. As a result, in string literals, '\U' and '\u' escapes in raw strings are not treated specially. Given that Python 2.x’s raw unicode literals behave differently than Python 3.x’s the 'ur' syntax is not supported.
| "report-uri /csp-report" | ||
| ) | ||
| ] | ||
| response.headers['Content-Security-Policy'] = (''.join(csp_params)) |
There was a problem hiding this comment.
I was not forced to do that as I chose to ignore W504, but this is more performant. So this is a win-win change.
|
@miketaylr could we merge this? |
This PR fixes issue #2828
Proposed PR background
pep8 has changed name and is deprecated. We need to switch to pycodestyle (new name for pep8). This created a version bump with a couple of things to fix, choose.
This adjusts the
The tests are running on my local computer.
The biggest change in the code is probably
cba1193
that I have singled out. The rest is following basically the recommendation of pycodestyle.
It will also make it possible to test the code on #2825 project, where circleci requires pycodestyle #2825 (comment)
r? @miketaylr