Enforce PEP263 for PyTorch python codebase#55346
Enforce PEP263 for PyTorch python codebase#55346malfet wants to merge 10 commits intopytorch:masterfrom
Conversation
All python files containing non-ASCII characters should be correctly annotated with `# -*- coding: utf-8 -*-` comment
💊 CI failures summary and remediationsAs of commit 763aa65 (more details on the Dr. CI page):
2 failures not recognized by patterns:
This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions to the (internal) Dr. CI Users group. |
|
@malfet has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Codecov Report
@@ Coverage Diff @@
## master #55346 +/- ##
=======================================
Coverage 77.47% 77.48%
=======================================
Files 1895 1895
Lines 187205 187205
=======================================
+ Hits 145041 145049 +8
+ Misses 42164 42156 -8 |
|
@albanD , for the time being forked the plugin to make it optional for files that do not have utf-8 |
|
@samestep I found a good example to add to trailing whitespace linter: pytorch/torch/onnx/__init__.py Line 85 in da7a27b It ends with number of non-breakable whitespaces U+00A0 |
Interesting! I'm very curious how those got there 🤔 I'll see if I can modify the regex to catch that sort of thing |
|
@malfet has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: malfet found a couple of these in #55346; this PR removes the rest and adds a lint that prevents them from being accidentally added again in the future. It also removes the `-o` flag added in #53733 (which was unnecessarily hiding context without reducing the number of lines of output), and updates the lint error messages to reflect that the individual line numbers are shown in the logs. Pull Request resolved: #55465 Test Plan: The "Lint / quick-checks" job in GitHub Actions should succeed on this PR. To verify that the lint does correctly find and error on non-breaking spaces, checkout ece0751 and run it locally: ```sh (! git --no-pager grep -In $'\u00a0' -- . || (echo "The above lines have non-breaking spaces (U+00A0); please convert them to spaces (U+0020)"; false)) ``` It should print over a hundred lines of output and exit with status 1. Reviewed By: janeyx99 Differential Revision: D27622136 Pulled By: samestep fbshipit-source-id: e7ffd5a9519093e7a0ffdf55e9291f63e21ce841
Summary: All python files containing non-ASCII characters should be correctly annotated with `# -*- coding: utf-8 -*-` comment Delete number of superfluous UTF-8 characters, most commonly UTF-8 opening closing quotation mark U+2019 (’) instead of ascii apostrophe ', for example `Module’s`->`Module's` Pull Request resolved: pytorch#55346 Reviewed By: samestep Differential Revision: D27582044 Pulled By: malfet fbshipit-source-id: c1cd89655915858ff3a41f675cdfffff795a8e44
Summary: malfet found a couple of these in pytorch#55346; this PR removes the rest and adds a lint that prevents them from being accidentally added again in the future. It also removes the `-o` flag added in pytorch#53733 (which was unnecessarily hiding context without reducing the number of lines of output), and updates the lint error messages to reflect that the individual line numbers are shown in the logs. Pull Request resolved: pytorch#55465 Test Plan: The "Lint / quick-checks" job in GitHub Actions should succeed on this PR. To verify that the lint does correctly find and error on non-breaking spaces, checkout 695699d and run it locally: ```sh (! git --no-pager grep -In $'\u00a0' -- . || (echo "The above lines have non-breaking spaces (U+00A0); please convert them to spaces (U+0020)"; false)) ``` It should print over a hundred lines of output and exit with status 1. Reviewed By: janeyx99 Differential Revision: D27622136 Pulled By: samestep fbshipit-source-id: e7ffd5a9519093e7a0ffdf55e9291f63e21ce841
All python files containing non-ASCII characters should be correctly annotated with
# -*- coding: utf-8 -*-commentDelete number of superfluous UTF-8 characters, most commonly UTF-8 opening closing quotation mark U+2019 (’) instead of ascii apostrophe ', for example
Module’s->Module's