From f5d8ece3b7cadb25616117cc30771fad3abfb2b3 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Mon, 2 Sep 2019 15:59:48 +0200 Subject: [PATCH] west: nrfjprog.py: Remove len() from conditional to fix pylint warning Empty sequences are falsy in Python, so len() can be skipped. Fixing pylint warnings for a CI check. Signed-off-by: Ulf Magnusson --- scripts/west_commands/runners/nrfjprog.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/west_commands/runners/nrfjprog.py b/scripts/west_commands/runners/nrfjprog.py index d501d09ed63..8912f1c5ffa 100644 --- a/scripts/west_commands/runners/nrfjprog.py +++ b/scripts/west_commands/runners/nrfjprog.py @@ -58,10 +58,11 @@ class NrfJprogBinaryRunner(ZephyrBinaryRunner): snrs = self.check_output(['nrfjprog', '--ids']) snrs = snrs.decode(sys.getdefaultencoding()).strip().splitlines() - if len(snrs) == 0: + if not snrs: raise RuntimeError('"nrfjprog --ids" did not find a board; ' 'is the board connected?') - elif len(snrs) == 1: + + if len(snrs) == 1: board_snr = snrs[0] if board_snr == '0': raise RuntimeError('"nrfjprog --ids" returned 0; '