From ff73e3abd9ea54bfc27d639fa7bb49ded53ac84a Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 27 Aug 2021 14:53:41 -0400 Subject: [PATCH] Linted --- Adafruit_MAX98357/I2S_Test_Script/code.py | 9 ++++----- CircuitPython_TVBGone/cpx_main/code.py | 1 - CircuitPython_TVBGone/gemma_main/code.py | 1 - PyPortal_Electioncal_US/electioncal/code.py | 2 +- PyPortal_Electioncal_US/electioncal_graphics/code.py | 12 ++++++------ 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Adafruit_MAX98357/I2S_Test_Script/code.py b/Adafruit_MAX98357/I2S_Test_Script/code.py index 5bf8b9d2f..27e382c30 100644 --- a/Adafruit_MAX98357/I2S_Test_Script/code.py +++ b/Adafruit_MAX98357/I2S_Test_Script/code.py @@ -30,9 +30,8 @@ for bit_clock_pin in get_unique_pins(): if bit_clock_pin is word_select_pin or bit_clock_pin is data_pin or word_select_pin\ is data_pin: continue + if is_hardware_i2s(bit_clock_pin, word_select_pin, data_pin): + print("Bit clock pin:", bit_clock_pin, "\t Word select pin:", word_select_pin, + "\t Data pin:", data_pin) else: - if is_hardware_i2s(bit_clock_pin, word_select_pin, data_pin): - print("Bit clock pin:", bit_clock_pin, "\t Word select pin:", word_select_pin, - "\t Data pin:", data_pin) - else: - pass + pass diff --git a/CircuitPython_TVBGone/cpx_main/code.py b/CircuitPython_TVBGone/cpx_main/code.py index d59623d4f..24c151ead 100644 --- a/CircuitPython_TVBGone/cpx_main/code.py +++ b/CircuitPython_TVBGone/cpx_main/code.py @@ -4,7 +4,6 @@ import time import board import pwmio import pulseio -import pwmio from digitalio import DigitalInOut, Direction, Pull # pylint: disable=eval-used # Switch to select 'stealth-mode' diff --git a/CircuitPython_TVBGone/gemma_main/code.py b/CircuitPython_TVBGone/gemma_main/code.py index ef2385c7c..c5c8bb8d9 100644 --- a/CircuitPython_TVBGone/gemma_main/code.py +++ b/CircuitPython_TVBGone/gemma_main/code.py @@ -6,7 +6,6 @@ import adafruit_dotstar import board import pwmio import pulseio -import pwmio from digitalio import DigitalInOut, Direction # pylint: disable=eval-used diff --git a/PyPortal_Electioncal_US/electioncal/code.py b/PyPortal_Electioncal_US/electioncal/code.py index 0e633d0b4..8249a700b 100644 --- a/PyPortal_Electioncal_US/electioncal/code.py +++ b/PyPortal_Electioncal_US/electioncal/code.py @@ -8,7 +8,7 @@ import electioncal_graphics # pylint: disable=wrong-import-position # Get wifi details and more from a secrets.py file try: - from secrets import secrets + from secrets import secrets # pylint: disable=unused-import except ImportError: print("WiFi secrets are kept in secrets.py, please add them there!") raise diff --git a/PyPortal_Electioncal_US/electioncal_graphics/code.py b/PyPortal_Electioncal_US/electioncal_graphics/code.py index e1d5af2d2..b358972d6 100644 --- a/PyPortal_Electioncal_US/electioncal_graphics/code.py +++ b/PyPortal_Electioncal_US/electioncal_graphics/code.py @@ -69,10 +69,10 @@ class Electioncal_Graphics(displayio.Group): def load_data(self, election_data): try: - self.electioncal = json.loads(election_data) - self.state_text.text = self.electioncal["dates"][1]["county"] + ", " + self.electioncal["dates"][0]["state"] + self.electioncal = json.loads(election_data) # pylint: disable=attribute-defined-outside-init + self.state_text.text = self.electioncal["dates"][1]["county"] + ", " + self.electioncal["dates"][0]["state"] # pylint: disable=line-too-long except ValueError: - print("Error loading JSON data: Please check the configuration of county and state, in code.py") + print("Error loading JSON data: Please check the configuration of county and state, in code.py") # pylint: disable=line-too-long raise def elections_cycle(self): @@ -83,7 +83,7 @@ class Electioncal_Graphics(displayio.Group): if self.date_text.text[10:] < self.electioncal["dates"][i]["date"]: self.election_date_text.text = self.electioncal["dates"][i]["date"] # splitting the line at around 40 chars seems ok for regular PyPortal - self.election_name_text_line2.text, self.election_name_text.text = self.paragrapher(self.electioncal["dates"][i]["name"], 40) + self.election_name_text_line2.text, self.election_name_text.text = self.paragrapher(self.electioncal["dates"][i]["name"], 40) # pylint: disable=line-too-long time.sleep(30) def update_time(self): @@ -104,11 +104,11 @@ class Electioncal_Graphics(displayio.Group): time_format_str = time_format_str+" AM" if hour == 0: hour = 12 - time_str = time_format_str % (hour, minute) + time_str = time_format_str % (hour, minute) # pylint: disable=unused-variable date_str = date_format_str % (year, month, day) self.date_text.text = "Today is: " + date_str - def paragrapher(self, text, cut): + def paragrapher(self, text, cut): # pylint: disable=no-self-use """ Cuts a long line into two, having spaces in mind. Note we return line2 first as it looks better to clear the line2 before printing a line1 with empty line2