From f4a5fe95144f616d8c607541f58b6cd254c8609b Mon Sep 17 00:00:00 2001 From: Nyakku Shigure Date: Thu, 13 Oct 2022 10:03:11 +0800 Subject: [PATCH] [CodeStyle][F401] fix incremental flake8 F401 and F541 issues (#46926) --- .../distributed/communication/stream/reduce_scatter.py | 5 ++--- python/paddle/distributed/communication/stream/scatter.py | 4 ++-- .../collective/communication_stream_alltoall_api_dygraph.py | 2 -- .../communication_stream_alltoall_single_api_dygraph.py | 2 -- .../collective/test_communication_stream_alltoall_api.py | 2 -- .../test_communication_stream_alltoall_single_api.py | 2 -- .../collective/test_communication_stream_broadcast_api.py | 2 -- .../collective/test_communication_stream_reduce_api.py | 2 -- .../test_communication_stream_reduce_scatter_api.py | 2 -- .../collective/test_communication_stream_scatter_api.py | 2 -- .../fluid/tests/unittests/xpu/test_lookup_table_v2_op_xpu.py | 1 - python/paddle/nn/layer/rnn.py | 1 - python/paddle/tests/test_callback_visualdl.py | 1 - tools/prune_for_jetson.py | 1 - tools/remove_grad_op_and_kernel.py | 1 - 15 files changed, 4 insertions(+), 26 deletions(-) diff --git a/python/paddle/distributed/communication/stream/reduce_scatter.py b/python/paddle/distributed/communication/stream/reduce_scatter.py index a4aeae6312a..68ba8e18e40 100644 --- a/python/paddle/distributed/communication/stream/reduce_scatter.py +++ b/python/paddle/distributed/communication/stream/reduce_scatter.py @@ -13,7 +13,6 @@ # limitations under the License. import paddle -import paddle.distributed as dist import paddle.fluid.framework as framework from paddle.distributed.communication.group import _get_global_group from paddle.distributed.communication.reduce import _get_reduce_op, ReduceOp @@ -30,11 +29,11 @@ def _check_tensor_shape(tensor, shape, nranks=1): def _check_tensor_list_shape(tensor_list, shape, nranks=1): if len(tensor_list) != nranks: raise RuntimeError( - f"The tensor_list for reduce_scatter is not correctly-sized.") + "The tensor_list for reduce_scatter is not correctly-sized.") for tensor in tensor_list: if tensor.shape != shape: raise RuntimeError( - f"The tensor_list for reduce_scatter is not correctly-sized.") + "The tensor_list for reduce_scatter is not correctly-sized.") def _reduce_scatter_tensor_in_dygraph(out_tensor, diff --git a/python/paddle/distributed/communication/stream/scatter.py b/python/paddle/distributed/communication/stream/scatter.py index 3a3fb005347..9b0fcaf4b08 100644 --- a/python/paddle/distributed/communication/stream/scatter.py +++ b/python/paddle/distributed/communication/stream/scatter.py @@ -28,11 +28,11 @@ def _check_tensor_shape(tensor, shape, nranks=1): def _check_tensor_list_shape(tensor_list, shape, nranks=1): if len(tensor_list) != nranks: raise RuntimeError( - f"The tensor_list for scatter is not correctly-sized.") + "The tensor_list for scatter is not correctly-sized.") for tensor in tensor_list: if tensor.shape != shape: raise RuntimeError( - f"The tensor_list for scatter is not correctly-sized.") + "The tensor_list for scatter is not correctly-sized.") def _scatter_tensor_in_dygraph(out_tensor, in_tensor, src, group, sync_op, diff --git a/python/paddle/fluid/tests/unittests/collective/communication_stream_alltoall_api_dygraph.py b/python/paddle/fluid/tests/unittests/collective/communication_stream_alltoall_api_dygraph.py index 8e65ea8d8ae..8842bcd08b6 100644 --- a/python/paddle/fluid/tests/unittests/collective/communication_stream_alltoall_api_dygraph.py +++ b/python/paddle/fluid/tests/unittests/collective/communication_stream_alltoall_api_dygraph.py @@ -15,9 +15,7 @@ import os import numpy as np import paddle -import paddle.fluid as fluid import paddle.distributed as dist -import test_communication_api_base as test_base import test_collective_api_base as test_collective_base diff --git a/python/paddle/fluid/tests/unittests/collective/communication_stream_alltoall_single_api_dygraph.py b/python/paddle/fluid/tests/unittests/collective/communication_stream_alltoall_single_api_dygraph.py index 9bdfe124b0b..bb36693b0fb 100644 --- a/python/paddle/fluid/tests/unittests/collective/communication_stream_alltoall_single_api_dygraph.py +++ b/python/paddle/fluid/tests/unittests/collective/communication_stream_alltoall_single_api_dygraph.py @@ -15,9 +15,7 @@ import os import numpy as np import paddle -import paddle.fluid as fluid import paddle.distributed as dist -import test_communication_api_base as test_base import test_collective_api_base as test_collective_base diff --git a/python/paddle/fluid/tests/unittests/collective/test_communication_stream_alltoall_api.py b/python/paddle/fluid/tests/unittests/collective/test_communication_stream_alltoall_api.py index 4fa55d86840..b6094d69321 100644 --- a/python/paddle/fluid/tests/unittests/collective/test_communication_stream_alltoall_api.py +++ b/python/paddle/fluid/tests/unittests/collective/test_communication_stream_alltoall_api.py @@ -13,8 +13,6 @@ # limitations under the License. import unittest -import paddle -import itertools import test_communication_api_base as test_base diff --git a/python/paddle/fluid/tests/unittests/collective/test_communication_stream_alltoall_single_api.py b/python/paddle/fluid/tests/unittests/collective/test_communication_stream_alltoall_single_api.py index f1f099b9571..81836dbc131 100644 --- a/python/paddle/fluid/tests/unittests/collective/test_communication_stream_alltoall_single_api.py +++ b/python/paddle/fluid/tests/unittests/collective/test_communication_stream_alltoall_single_api.py @@ -13,8 +13,6 @@ # limitations under the License. import unittest -import paddle -import itertools import test_communication_api_base as test_base diff --git a/python/paddle/fluid/tests/unittests/collective/test_communication_stream_broadcast_api.py b/python/paddle/fluid/tests/unittests/collective/test_communication_stream_broadcast_api.py index 07537a480e8..693ef95a204 100644 --- a/python/paddle/fluid/tests/unittests/collective/test_communication_stream_broadcast_api.py +++ b/python/paddle/fluid/tests/unittests/collective/test_communication_stream_broadcast_api.py @@ -13,8 +13,6 @@ # limitations under the License. import unittest -import paddle -import itertools import test_communication_api_base as test_base diff --git a/python/paddle/fluid/tests/unittests/collective/test_communication_stream_reduce_api.py b/python/paddle/fluid/tests/unittests/collective/test_communication_stream_reduce_api.py index c8a04c8d893..e0b50f6056f 100644 --- a/python/paddle/fluid/tests/unittests/collective/test_communication_stream_reduce_api.py +++ b/python/paddle/fluid/tests/unittests/collective/test_communication_stream_reduce_api.py @@ -13,8 +13,6 @@ # limitations under the License. import unittest -import paddle -import itertools import test_communication_api_base as test_base diff --git a/python/paddle/fluid/tests/unittests/collective/test_communication_stream_reduce_scatter_api.py b/python/paddle/fluid/tests/unittests/collective/test_communication_stream_reduce_scatter_api.py index a90e634860d..1f6522d4362 100644 --- a/python/paddle/fluid/tests/unittests/collective/test_communication_stream_reduce_scatter_api.py +++ b/python/paddle/fluid/tests/unittests/collective/test_communication_stream_reduce_scatter_api.py @@ -13,8 +13,6 @@ # limitations under the License. import unittest -import paddle -import itertools import test_communication_api_base as test_base diff --git a/python/paddle/fluid/tests/unittests/collective/test_communication_stream_scatter_api.py b/python/paddle/fluid/tests/unittests/collective/test_communication_stream_scatter_api.py index d96d931f43f..2de99b40e73 100644 --- a/python/paddle/fluid/tests/unittests/collective/test_communication_stream_scatter_api.py +++ b/python/paddle/fluid/tests/unittests/collective/test_communication_stream_scatter_api.py @@ -13,8 +13,6 @@ # limitations under the License. import unittest -import paddle -import itertools import test_communication_api_base as test_base diff --git a/python/paddle/fluid/tests/unittests/xpu/test_lookup_table_v2_op_xpu.py b/python/paddle/fluid/tests/unittests/xpu/test_lookup_table_v2_op_xpu.py index 6bb54c8f74e..35df3c244bd 100644 --- a/python/paddle/fluid/tests/unittests/xpu/test_lookup_table_v2_op_xpu.py +++ b/python/paddle/fluid/tests/unittests/xpu/test_lookup_table_v2_op_xpu.py @@ -22,7 +22,6 @@ import paddle import paddle.fluid.core as core import paddle.fluid as fluid from paddle.fluid.op import Operator -import paddle.compat as cpt import paddle.fluid as fluid from paddle.fluid import Program, program_guard diff --git a/python/paddle/nn/layer/rnn.py b/python/paddle/nn/layer/rnn.py index f4e70f2bd16..cbd8b5e6493 100644 --- a/python/paddle/nn/layer/rnn.py +++ b/python/paddle/nn/layer/rnn.py @@ -14,7 +14,6 @@ import six import math -import sys from functools import reduce import numpy as np diff --git a/python/paddle/tests/test_callback_visualdl.py b/python/paddle/tests/test_callback_visualdl.py index 0cca89fa7cd..a1fc1cbadad 100644 --- a/python/paddle/tests/test_callback_visualdl.py +++ b/python/paddle/tests/test_callback_visualdl.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys import unittest import tempfile import shutil diff --git a/tools/prune_for_jetson.py b/tools/prune_for_jetson.py index 5625618f3ce..e91b3b840d3 100644 --- a/tools/prune_for_jetson.py +++ b/tools/prune_for_jetson.py @@ -17,7 +17,6 @@ when cmake ON_INFER=ON, which can greatly reduce the volume of the prediction li """ import os -import sys import re import glob diff --git a/tools/remove_grad_op_and_kernel.py b/tools/remove_grad_op_and_kernel.py index 8b434e17cb2..08f52fc6049 100644 --- a/tools/remove_grad_op_and_kernel.py +++ b/tools/remove_grad_op_and_kernel.py @@ -17,7 +17,6 @@ when cmake ON_INFER=ON, which can greatly reduce the volume of the prediction li """ import os -import sys import re import glob -- GitLab