From 4bbb0b3878970d2c8ed4dd9183af9a293900909a Mon Sep 17 00:00:00 2001 From: Nyakku Shigure Date: Wed, 12 Oct 2022 10:29:50 +0800 Subject: [PATCH] [CodeStyle][F401] update flake8 F401 config (unittests/npu,xpu,mlu,ipu) (#46792) * exclude python code that auto-generated by protoc * [CodeStyle][F401] update flake8 F401 config (unittests/npu,xpu,mlu,ipu) * add npu, mlu to `exclude` field * empty commit, test=document_fix --- .flake8 | 14 +++++++++----- .pre-commit-config.yaml | 7 +++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.flake8 b/.flake8 index 04362f87da7..75731783483 100644 --- a/.flake8 +++ b/.flake8 @@ -5,7 +5,15 @@ exclude = # A trick to exclude fluid/ but keep fluid/tests/, see more at # https://github.com/PaddlePaddle/Paddle/pull/46290#discussion_r976392010 ./python/paddle/fluid/[!t]**, - ./python/paddle/fluid/tra** + ./python/paddle/fluid/tra**, + # Exclude auto-generated files + *_pb2.py, + # Exclude third-party libraries + ./python/paddle/utils/gast/**, + # Exclude files that will be removed in the future, see more at + # https://github.com/PaddlePaddle/Paddle/pull/46782#issuecomment-1273033731 + ./python/paddle/fluid/tests/unittests/npu/**, + ./python/paddle/fluid/tests/unittests/mlu/** ignore = # E, see https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes E121,E122,E123,E125,E126,E127,E128,E129,E131, @@ -60,11 +68,7 @@ per-file-ignores = python/paddle/metric/*:F401 python/paddle/fluid/tests/unittests/ir/*:F401 python/paddle/fluid/tests/unittests/tokenizer/*:F401 - python/paddle/fluid/tests/unittests/xpu/*:F401 python/paddle/fluid/tests/unittests/distribution/*:F401 - python/paddle/fluid/tests/unittests/mlu/*:F401 - python/paddle/fluid/tests/unittests/npu/*:F401 - python/paddle/fluid/tests/unittests/ipu/*:F401 python/paddle/fluid/tests/unittests/distributed_passes/*:F401 python/paddle/fluid/tests/unittests/auto_parallel/*:F401 python/paddle/fluid/tests/unittests/dygraph_to_static/*:F401 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 55c1f98a5be..fda8a37c2ec 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,10 +1,13 @@ -# Exclude all third-party libraries globally +# Exclude all third-party libraries and auto-generated files globally exclude: | (?x)^( patches/.+| paddle/fluid/framework/fleet/heter_ps/cudf/.+| paddle/fluid/distributed/ps/thirdparty/round_robin.h| - python/paddle/utils/gast/.+ + python/paddle/utils/gast/.+| + .+_py2\.py| + python/paddle/fluid/tests/unittests/npu/.+| + python/paddle/fluid/tests/unittests/mlu/.+ )$ repos: - repo: https://github.com/Lucas-C/pre-commit-hooks.git -- GitLab