diff --git a/pyproject.toml b/pyproject.toml index ab849770c1c645fd15f9358d5a67f9a0a66b7918..68887b9df0812edbb566614ce24cfd566666d343 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -120,7 +120,7 @@ select = [ # "B904", # Pylint - # "PLC0414", + "PLC0414", # "PLC1901", "PLC3002", "PLE0100", diff --git a/python/paddle/__init__.py b/python/paddle/__init__.py index d6c6a150cadb48ee1f8d35619ad3e76a4f55ee7d..87ff8e39ebe7c23e5317cec26e76b185d0c5f72f 100755 --- a/python/paddle/__init__.py +++ b/python/paddle/__init__.py @@ -42,7 +42,7 @@ from .fluid.lazy_init import LazyGuard # noqa: F401 from .framework.dtype import iinfo # noqa: F401 from .framework.dtype import finfo # noqa: F401 -from .framework.dtype import dtype as dtype # noqa: F401 +from .framework.dtype import dtype # noqa: F401 from .framework.dtype import uint8 # noqa: F401 from .framework.dtype import int8 # noqa: F401 from .framework.dtype import int16 # noqa: F401 diff --git a/python/paddle/autograd/__init__.py b/python/paddle/autograd/__init__.py index f5435b081e37f54e3dd6d8bd867782466d66b458..16dbef6ae44b4886c58a721e26166ad11aa2f8f8 100644 --- a/python/paddle/autograd/__init__.py +++ b/python/paddle/autograd/__init__.py @@ -19,8 +19,8 @@ from ..fluid.dygraph.base import is_grad_enabled # noqa: F401 from ..fluid.dygraph.base import set_grad_enabled # noqa: F401 from . import backward_mode # noqa: F401 from .backward_mode import backward # noqa: F401 -from .py_layer import PyLayer as PyLayer # noqa: F401 -from .py_layer import PyLayerContext as PyLayerContext # noqa: F401 +from .py_layer import PyLayer # noqa: F401 +from .py_layer import PyLayerContext # noqa: F401 from .saved_tensors_hooks import saved_tensors_hooks __all__ = [ # noqa diff --git a/python/paddle/distributed/fleet/meta_optimizers/parameter_server_optimizer.py b/python/paddle/distributed/fleet/meta_optimizers/parameter_server_optimizer.py index ec3472a7b6976b4d13fe32eec3beffd90699437d..a897760d41faa1544e1e18890abf10e74bf3d020 100644 --- a/python/paddle/distributed/fleet/meta_optimizers/parameter_server_optimizer.py +++ b/python/paddle/distributed/fleet/meta_optimizers/parameter_server_optimizer.py @@ -371,9 +371,7 @@ class ParameterServerOptimizer(MetaOptimizerBase): _origin_main_program = loss.block.program _origin_startup_program = startup_program - from paddle.incubate.distributed.fleet.parameter_server.ir import ( - public as public, - ) + from paddle.incubate.distributed.fleet.parameter_server.ir import public compiled_config = public.CompileTimeStrategy( _origin_main_program, diff --git a/python/paddle/distribution/gumbel.py b/python/paddle/distribution/gumbel.py index 067f87ca8375af29ef5b2d6270ee618e39a3812b..7513046212c56ac3e4a1a5022057c49296294d76 100644 --- a/python/paddle/distribution/gumbel.py +++ b/python/paddle/distribution/gumbel.py @@ -19,7 +19,7 @@ import numpy as np import paddle from paddle.distribution.transformed_distribution import TransformedDistribution -from paddle.fluid import framework as framework +from paddle.fluid import framework class Gumbel(TransformedDistribution): diff --git a/python/paddle/distribution/laplace.py b/python/paddle/distribution/laplace.py index 5c047aebfd9b21d0880ca7d061424149a2323a98..fee7335538e6b8b0d348d5e0ee702e8297d92b3f 100644 --- a/python/paddle/distribution/laplace.py +++ b/python/paddle/distribution/laplace.py @@ -18,7 +18,7 @@ import numpy as np import paddle from paddle.distribution import distribution -from paddle.fluid import framework as framework +from paddle.fluid import framework class Laplace(distribution.Distribution): diff --git a/python/paddle/fluid/tests/unittests/ps/ps_dnn_trainer.py b/python/paddle/fluid/tests/unittests/ps/ps_dnn_trainer.py index 96f00f81121d2b56fbcdc7ad80c2bd4a3b73b9e4..2b28aa1c687ecb0c0a72300f7c69548840b803ab 100755 --- a/python/paddle/fluid/tests/unittests/ps/ps_dnn_trainer.py +++ b/python/paddle/fluid/tests/unittests/ps/ps_dnn_trainer.py @@ -445,7 +445,7 @@ class DnnTrainer: "entering run {} - old".format(str(config["applied_pass_name"])) ) from paddle.incubate.distributed.fleet.parameter_server.ir import ( - public as public, + public, ) dist_strategy = get_distributed_strategy(user_defined_strategy) diff --git a/python/paddle/fluid/tests/unittests/test_get_set_flags.py b/python/paddle/fluid/tests/unittests/test_get_set_flags.py index 268c13aad4020524ae9bea15381c608fa9b28c4c..8b30db14333384ac0a9dd8bc700f0c72270ee6c2 100644 --- a/python/paddle/fluid/tests/unittests/test_get_set_flags.py +++ b/python/paddle/fluid/tests/unittests/test_get_set_flags.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest as unittest +import unittest from paddle import fluid diff --git a/python/paddle/fluid/tests/unittests/test_global_var_getter_setter.py b/python/paddle/fluid/tests/unittests/test_global_var_getter_setter.py index b6650e659e19a8ba8e8f6f7e8cf769e1105ab377..3da1e85dc22cfc9f4d8312bcdc81144f6ef6335e 100644 --- a/python/paddle/fluid/tests/unittests/test_global_var_getter_setter.py +++ b/python/paddle/fluid/tests/unittests/test_global_var_getter_setter.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest as unittest +import unittest from paddle import fluid diff --git a/python/paddle/incubate/autograd/primx.py b/python/paddle/incubate/autograd/primx.py index 920ca699d91a7304547e07b3fa060341bec5377f..352101a7fd1f6ce33aac4a48226d8254ad47e87d 100644 --- a/python/paddle/incubate/autograd/primx.py +++ b/python/paddle/incubate/autograd/primx.py @@ -17,7 +17,7 @@ import typing from collections import OrderedDict import paddle -from paddle.fluid import framework as framework +from paddle.fluid import framework from paddle.fluid.core import prim_config from paddle.fluid.framework import Operator, default_main_program from paddle.incubate.autograd.utils import as_tensors diff --git a/python/paddle/incubate/autograd/utils.py b/python/paddle/incubate/autograd/utils.py index 233ad3c7f2d91b4e22dcd176e4fd7bc3008b7e1c..e79c27f30e1d000aa5d1f69ed610fcfb005995d1 100644 --- a/python/paddle/incubate/autograd/utils.py +++ b/python/paddle/incubate/autograd/utils.py @@ -15,7 +15,7 @@ import typing import paddle import paddle.framework.dtype as dtypes -from paddle.fluid import framework as framework +from paddle.fluid import framework from .phi_ops_map import op_info, op_map diff --git a/python/paddle/incubate/distributed/fleet/parameter_server/distribute_transpiler/__init__.py b/python/paddle/incubate/distributed/fleet/parameter_server/distribute_transpiler/__init__.py index f50e2e798ba066520a7f009442d39222ae86199c..21accdb344a2145655a9292ca067adf8bfcda96c 100644 --- a/python/paddle/incubate/distributed/fleet/parameter_server/distribute_transpiler/__init__.py +++ b/python/paddle/incubate/distributed/fleet/parameter_server/distribute_transpiler/__init__.py @@ -75,7 +75,7 @@ from paddle.incubate.distributed.fleet.parameter_server.ir import ( pserver_pass as server, ) from paddle.incubate.distributed.fleet.parameter_server.ir import ( - public as public, + public, ) diff --git a/setup.py b/setup.py index 1435065aa906e3d1a73fb23773eb7c9fb00324ed..87c223f42b4c6255a6e6ec7c16bd17504e9743ec 100644 --- a/setup.py +++ b/setup.py @@ -1485,7 +1485,7 @@ def main(): else: env_dict_path = TOP_DIR + "/build/python/" sys.path.insert(1, env_dict_path) - from env_dict import env_dict as env_dict + from env_dict import env_dict global env_dict global paddle_binary_dir, paddle_source_dir