From ab4a6f9c4fa7648a639ee15e35de5c3a5c3ac928 Mon Sep 17 00:00:00 2001 From: ooo oo <106524776+ooooo-create@users.noreply.github.com> Date: Wed, 20 Sep 2023 10:17:48 +0800 Subject: [PATCH] [CodeStyle][task 14] enable Ruff PLR1722 rule in python/paddle/base (#57401) --- pyproject.toml | 1 - python/paddle/base/device_worker.py | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 45d96b8631b9d..e11ab2108c2be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -110,7 +110,6 @@ ignore = [ "UP030", "F522", "F403", - "PLR1722", "C405", "C417", "PLR0402", diff --git a/python/paddle/base/device_worker.py b/python/paddle/base/device_worker.py index b5ea7dab355d3..706febd44ba0e 100644 --- a/python/paddle/base/device_worker.py +++ b/python/paddle/base/device_worker.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """Definition of device workers.""" +import sys __all__ = [ 'DeviceWorker', @@ -111,7 +112,7 @@ def _gen_worker_desc(self, trainer_desc): print("device worker program id:", program_id) if self._program is None: print("program of current device worker is not configured") - exit(-1) + sys.exit(-1) opt_info = self._program._fleet_opt # when opt_info is None or empty dict, it should return if not opt_info: @@ -261,7 +262,7 @@ def _gen_worker_desc(self, trainer_desc): print("device worker program id:", program_id) if self._program is None: print("program of current device worker is not configured") - exit(-1) + sys.exit(-1) opt_info = self._program._fleet_opt # when opt_info is None or empty dict, it should return if not opt_info: @@ -394,7 +395,7 @@ def _gen_worker_desc(self, trainer_desc): program_id = str(id(self._program)) if self._program is None: print("program of current device worker is not configured") - exit(-1) + sys.exit(-1) opt_info = self._program._fleet_opt program_configs = opt_info["program_configs"] downpour = trainer_desc.downpour_param @@ -513,7 +514,7 @@ def _gen_worker_desc(self, trainer_desc): program_id = str(id(self._program)) if self._program is None: print("program of current device worker is not configured") - exit(-1) + sys.exit(-1) opt_info = self._program._fleet_opt program_configs = opt_info["program_configs"] downpour = trainer_desc.downpour_param