From ceec424c3590b01764465e9efeae5ef16c1547f0 Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Mon, 7 Nov 2022 20:28:57 -0500 Subject: [PATCH 1/2] Fixed pylint errors --- adafruit_avrprog.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/adafruit_avrprog.py b/adafruit_avrprog.py index a25798d..2c900e6 100644 --- a/adafruit_avrprog.py +++ b/adafruit_avrprog.py @@ -114,6 +114,7 @@ def verify_sig(self, chip, verbose=False): return False return True + # pylint: disable=too-many-branches def program_file(self, chip, file_name, verbose=False, verify=True): """ Perform a chip erase and program from a file that @@ -243,25 +244,22 @@ def read_fuses(self, chip): self.end() return (low, high, ext, lock) - # pylint: disable=unused-argument,expression-not-assigned + # pylint: disable=unused-argument,too-many-arguments def write_fuses(self, chip, low=None, high=None, ext=None, lock=None): """ Write any of the 4 fuses. If the kwarg low/high/ext/lock is not passed in or is None, that fuse is skipped """ + transaction_comp = (0xE0, 0xA0, 0xA8, 0xA4) + fuses = (lock, low, high, ext) self.begin(clock=_SLOW_CLOCK) - lock and self._transaction((0xAC, 0xE0, 0, lock)) - self._busy_wait() - low and self._transaction((0xAC, 0xA0, 0, low)) - self._busy_wait() - high and self._transaction((0xAC, 0xA8, 0, high)) - self._busy_wait() - ext and self._transaction((0xAC, 0xA4, 0, ext)) - self._busy_wait() + for fuse, comp in zip (fuses, transaction_comp): + if fuse: + self._transaction((0xAC, comp, 0, fuse)) + self._busy_wait() self.end() - # pylint: enable=unused-argument,expression-not-assigned - + # pylint: disable=too-many-arguments def verify_fuses(self, chip, low=None, high=None, ext=None, lock=None): """ Verify the 4 fuses. If the kwarg low/high/ext/lock is not From fbc6a25765a6dc5df8b25ce08e6edd7f6af9e1ef Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Mon, 7 Nov 2022 20:36:01 -0500 Subject: [PATCH 2/2] Reformatted per pre-commit --- adafruit_avrprog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_avrprog.py b/adafruit_avrprog.py index 2c900e6..704a258 100644 --- a/adafruit_avrprog.py +++ b/adafruit_avrprog.py @@ -253,7 +253,7 @@ def write_fuses(self, chip, low=None, high=None, ext=None, lock=None): transaction_comp = (0xE0, 0xA0, 0xA8, 0xA4) fuses = (lock, low, high, ext) self.begin(clock=_SLOW_CLOCK) - for fuse, comp in zip (fuses, transaction_comp): + for fuse, comp in zip(fuses, transaction_comp): if fuse: self._transaction((0xAC, comp, 0, fuse)) self._busy_wait()