mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 00:20:18 +01:00
Fix accidental Flake8 excludes (#55178)
Summary:
[Currently](faa4da49ff/.flake8 (L22)), our `.flake8` config file has the `exclude` pattern `scripts`. I'm guessing that this is just meant to exclude the top-level `scripts` dir from Flake8, but it also applies to the following (apparently erroneously):
- `.circleci/scripts`
- `.github/scripts`
- `test/scripts`
This PR corrects the problem by making all the `exclude` patterns (except for the wildcard `*.pyi` pattern) relative to the repository root. Also, since this PR already touches all the `exclude` lines, it also sorts them to help reduce merge conflicts when `.flake8` is edited in the future. This sorting happened to reveal that the `build` pattern was previously present twice, so now it has been deduplicated.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55178
Test Plan:
Locally:
```
flake8
```
And also [in CI](https://github.com/pytorch/pytorch/pull/55178/checks?check_run_id=2249949511).
Reviewed By: janeyx99
Differential Revision: D27520412
Pulled By: samestep
fbshipit-source-id: 359275c10ca600ee4ce7906e3a7587ffaa4ae1ed
This commit is contained in:
parent
3575e71be8
commit
047a487b07
|
|
@ -17,7 +17,7 @@ def get_size(file_dir):
|
|||
# we should only expect one file, if no, something is wrong
|
||||
file_name = glob.glob(os.path.join(file_dir, "*"))[0]
|
||||
return os.stat(file_name).st_size
|
||||
except:
|
||||
except Exception:
|
||||
logging.exception(f"error getting file from: {file_dir}")
|
||||
return 0
|
||||
|
||||
|
|
@ -145,5 +145,5 @@ if __name__ == "__main__":
|
|||
if size != 0:
|
||||
try:
|
||||
send_message([build_message(size)])
|
||||
except:
|
||||
except Exception:
|
||||
logging.exception("can't send message")
|
||||
|
|
|
|||
32
.flake8
32
.flake8
|
|
@ -14,20 +14,18 @@ ignore =
|
|||
C400,C401,C402,C403,C404,C405,C407,C411,C413,C414,C415
|
||||
per-file-ignores = __init__.py: F401 torch/utils/cpp_extension.py: B950
|
||||
exclude =
|
||||
docs/src,
|
||||
docs/cpp/src,
|
||||
venv,
|
||||
third_party,
|
||||
caffe2,
|
||||
scripts,
|
||||
docs/caffe2,
|
||||
torch/lib/include,
|
||||
torch/lib/tmp_install,
|
||||
build,
|
||||
torch/include,
|
||||
*.pyi,
|
||||
.git,
|
||||
build,
|
||||
build_test_custom_build,
|
||||
build_code_analyzer,
|
||||
test/generated_type_hints_smoketest.py
|
||||
./.git,
|
||||
./build_code_analyzer,
|
||||
./build_test_custom_build,
|
||||
./build,
|
||||
./caffe2,
|
||||
./docs/caffe2,
|
||||
./docs/cpp/src,
|
||||
./docs/src,
|
||||
./scripts,
|
||||
./test/generated_type_hints_smoketest.py,
|
||||
./third_party,
|
||||
./torch/include,
|
||||
./torch/lib,
|
||||
./venv,
|
||||
*.pyi
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ else:
|
|||
|
||||
# create a fake progress bar that does not display anything
|
||||
class ProgressbarStub:
|
||||
def update(*args):
|
||||
def update(self, *args):
|
||||
return
|
||||
progressbar = ProgressbarStub()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user