From e6b89eafa3b86d2e8e405450377d459600a30cd6 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 1 Sep 2023 00:17:28 +1000 Subject: [PATCH] all: Remove unnecessary start argument in range. To satisfy Ruff. Signed-off-by: Damien George --- micropython/drivers/imu/bmi270/bmi270.py | 4 ++-- micropython/drivers/imu/bmm150/bmm150.py | 2 +- micropython/drivers/imu/lsm6dsox/lsm6dsox.py | 2 +- micropython/espflash/espflash.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/micropython/drivers/imu/bmi270/bmi270.py b/micropython/drivers/imu/bmi270/bmi270.py index db95658ff..64f819ec2 100644 --- a/micropython/drivers/imu/bmi270/bmi270.py +++ b/micropython/drivers/imu/bmi270/bmi270.py @@ -598,7 +598,7 @@ def _write_reg(self, reg, val): def _write_burst(self, reg, data, chunk=16): self._write_reg(_INIT_ADDR_0, 0) self._write_reg(_INIT_ADDR_1, 0) - for i in range(0, len(data) // chunk): + for i in range(len(data) // chunk): offs = i * chunk self._write_reg(reg, data[offs : offs + chunk]) init_addr = ((i + 1) * chunk) // 2 @@ -606,7 +606,7 @@ def _write_burst(self, reg, data, chunk=16): self._write_reg(_INIT_ADDR_1, (init_addr >> 4) & 0xFF) def _poll_reg(self, reg, mask, retry=10, delay=100): - for i in range(0, retry): + for i in range(retry): if self._read_reg(reg) & mask: return True time.sleep_ms(delay) diff --git a/micropython/drivers/imu/bmm150/bmm150.py b/micropython/drivers/imu/bmm150/bmm150.py index 036b2b258..a4845c961 100644 --- a/micropython/drivers/imu/bmm150/bmm150.py +++ b/micropython/drivers/imu/bmm150/bmm150.py @@ -166,7 +166,7 @@ def _compensate_z(self, raw, hall): return z def magnet_raw(self): - for i in range(0, 10): + for i in range(10): self._read_reg_into(_DATA, self.scratch) if self.scratch[3] & 0x1: return ( diff --git a/micropython/drivers/imu/lsm6dsox/lsm6dsox.py b/micropython/drivers/imu/lsm6dsox/lsm6dsox.py index 1952c5bb1..ca1397c66 100644 --- a/micropython/drivers/imu/lsm6dsox/lsm6dsox.py +++ b/micropython/drivers/imu/lsm6dsox/lsm6dsox.py @@ -197,7 +197,7 @@ def _read_reg_into(self, reg, buf): def reset(self): self._write_reg(_CTRL3_C, self._read_reg(_CTRL3_C) | 0x1) - for i in range(0, 10): + for i in range(10): if (self._read_reg(_CTRL3_C) & 0x01) == 0: return time.sleep_ms(10) diff --git a/micropython/espflash/espflash.py b/micropython/espflash/espflash.py index 700309bd9..cc025836c 100644 --- a/micropython/espflash/espflash.py +++ b/micropython/espflash/espflash.py @@ -104,7 +104,7 @@ def _write_reg(self, addr, data, mask=0xFFFFFFFF, delay=0): raise Exception("Command ESP_WRITE_REG failed.") def _poll_reg(self, addr, flag, retry=10, delay=0.050): - for i in range(0, retry): + for i in range(retry): reg = self._read_reg(addr) if (reg & flag) == 0: break