From 866e2dd530bbc049291c10277e62364bd9b0e6f1 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Tue, 28 May 2024 15:52:43 +0900 Subject: [PATCH] fix(python): fix comparison to True/False from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators. Change-Id: I710d64c380eaf420f0ad29e65623ee677b094051 Signed-off-by: Galantsev, Dmitrii --- amdsmi_cli/amdsmi_commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amdsmi_cli/amdsmi_commands.py b/amdsmi_cli/amdsmi_commands.py index 82964f47..3b6cd1cc 100644 --- a/amdsmi_cli/amdsmi_commands.py +++ b/amdsmi_cli/amdsmi_commands.py @@ -3954,9 +3954,9 @@ def set_value(self, args, multiple_devices=False, gpu=None, fan=None, perf_level break # Only allow one device's arguments to be set at a time - if gpu_args_enabled == cpu_args_enabled == core_args_enabled == False: + if not any([gpu_args_enabled, cpu_args_enabled, core_args_enabled]): raise ValueError('No GPU, CPU, or CORE arguments provided, specific arguments are needed') - elif gpu_args_enabled == cpu_args_enabled == core_args_enabled == True: + elif all([gpu_args_enabled, cpu_args_enabled, core_args_enabled]): raise ValueError('Cannot set GPU, CPU, and CORE arguments at the same time') elif not (gpu_args_enabled ^ cpu_args_enabled ^ core_args_enabled): raise ValueError('Cannot set GPU, CPU, or CORE arguments at the same time')