From 7e6f89c46197f95a7f9391970219492221a45164 Mon Sep 17 00:00:00 2001 From: Nyakku Shigure Date: Fri, 17 Mar 2023 12:04:39 +0800 Subject: [PATCH] [CodeStyle][UP010] remove future imports and use ruff to replace ci checks (#51772) --- pyproject.toml | 1 + .../tests/unittests/dygraph_to_static/test_fallback.py | 1 - .../unittests/dygraph_to_static/test_load_transformer.py | 1 - .../fluid/tests/unittests/ps/static_gpubox_trainer.py | 1 - tools/check_file_diff_approvals.sh | 6 ------ 5 files changed, 1 insertion(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index da0f272d46..164ff042a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,7 @@ select = [ "UP001", "UP003", "UP007", + "UP010", "UP011", "UP013", "UP014", diff --git a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_fallback.py b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_fallback.py index a2638f3a42..6da8602e60 100644 --- a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_fallback.py +++ b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_fallback.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function import unittest diff --git a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_load_transformer.py b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_load_transformer.py index c7acf7f60a..5d1b4c1fbd 100644 --- a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_load_transformer.py +++ b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_load_transformer.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function import unittest diff --git a/python/paddle/fluid/tests/unittests/ps/static_gpubox_trainer.py b/python/paddle/fluid/tests/unittests/ps/static_gpubox_trainer.py index dd030a9a6f..6b4a17a9f9 100755 --- a/python/paddle/fluid/tests/unittests/ps/static_gpubox_trainer.py +++ b/python/paddle/fluid/tests/unittests/ps/static_gpubox_trainer.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function import logging import os diff --git a/tools/check_file_diff_approvals.sh b/tools/check_file_diff_approvals.sh index 37f07940e9..1c8d1b4840 100644 --- a/tools/check_file_diff_approvals.sh +++ b/tools/check_file_diff_approvals.sh @@ -335,12 +335,6 @@ if [ "${INVALID_UNITTEST_ASSERT_CHECK}" != "" ] && [ "${GIT_PR_ID}" != "" ]; the check_approval 1 16605440 6836917 fi -UNNECESSARY_FUTURE_IMPORT=`echo "$ALL_ADDED_LINES" | grep -E '\+\s*from __future__ import .+(nested_scopes|generators|division|absolute_import|with_statement|print_function|unicode_literals|generator_stop)' || true` -if [ "${UNNECESSARY_FUTURE_IMPORT}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then - echo_line="This feature is already mandatory in the Python3.7+, no need to import it from __future__.\nPlease modify the code below. If anything is unclear, please read the Python __future__ module docs [ https://docs.python.org/3/library/__future__.html ]. If it is a mismatch, please request luotao1 (Recommend) or jzhang533 review and approve.\nThe code that do not meet the specification are as follows:\n${UNNECESSARY_FUTURE_IMPORT}\n" - check_approval 1 luotao1 jzhang533 -fi - HAS_MODIFIED_PHI_FILES=`git diff --name-only upstream/$BRANCH | grep "paddle/phi/" || true` PHI_INCLUDE_FLUID_FILES="" for CHANGE_FILE in ${HAS_MODIFIED_PHI_FILES}; do -- GitLab