diff --git a/adafruit_featherwing/alphanum_featherwing.py b/adafruit_featherwing/alphanum_featherwing.py index c458641..aa798c9 100755 --- a/adafruit_featherwing/alphanum_featherwing.py +++ b/adafruit_featherwing/alphanum_featherwing.py @@ -15,7 +15,7 @@ __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FeatherWing.git" import board -import adafruit_ht16k33.segments as segments +from adafruit_ht16k33 import segments from adafruit_featherwing.led_segments import Segments diff --git a/adafruit_featherwing/gps_featherwing.py b/adafruit_featherwing/gps_featherwing.py index 1b43153..5a924a0 100644 --- a/adafruit_featherwing/gps_featherwing.py +++ b/adafruit_featherwing/gps_featherwing.py @@ -36,8 +36,7 @@ def __init__(self, update_period=1000, baudrate=9600): if update_period < 250: raise ValueError("Update Frequency be at least 250 milliseconds") timeout = update_period // 1000 + 2 - if timeout < 3: - timeout = 3 + timeout = max(timeout, 3) self._uart = busio.UART(board.TX, board.RX, baudrate=baudrate, timeout=timeout) self._gps = adafruit_gps.GPS(self._uart, debug=False) diff --git a/adafruit_featherwing/matrix_featherwing.py b/adafruit_featherwing/matrix_featherwing.py index 066525e..e671ab6 100755 --- a/adafruit_featherwing/matrix_featherwing.py +++ b/adafruit_featherwing/matrix_featherwing.py @@ -16,7 +16,7 @@ __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FeatherWing.git" import board -import adafruit_ht16k33.matrix as matrix +from adafruit_ht16k33 import matrix from adafruit_featherwing.auto_writeable import AutoWriteable diff --git a/adafruit_featherwing/sevensegment_featherwing.py b/adafruit_featherwing/sevensegment_featherwing.py index c685e8d..6474472 100755 --- a/adafruit_featherwing/sevensegment_featherwing.py +++ b/adafruit_featherwing/sevensegment_featherwing.py @@ -15,7 +15,7 @@ __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FeatherWing.git" import board -import adafruit_ht16k33.segments as segments +from adafruit_ht16k33 import segments from adafruit_featherwing.led_segments import Segments diff --git a/examples/featherwing_keyboard_featherwing.py b/examples/featherwing_keyboard_featherwing.py index 643f443..5e0b217 100644 --- a/examples/featherwing_keyboard_featherwing.py +++ b/examples/featherwing_keyboard_featherwing.py @@ -20,13 +20,12 @@ kbd_featherwing.neopixel[0] = 0x002244 try: - f = open("/sd/tft_featherwing.txt", "w") - f.write("Blinka\nBlackberry Q10 Keyboard") - f.close() + with open("/sd/tft_featherwing.txt", "w") as f: + f.write("Blinka\nBlackberry Q10 Keyboard") + + with open("/sd/tft_featherwing.txt", "r") as f: + print(f.read()) - f = open("/sd/tft_featherwing.txt", "r") - print(f.read()) - f.close() except OSError as error: print("Unable to write to SD Card.") diff --git a/examples/featherwing_tft24_simpletest.py b/examples/featherwing_tft24_simpletest.py index 7f11eac..2aee653 100644 --- a/examples/featherwing_tft24_simpletest.py +++ b/examples/featherwing_tft24_simpletest.py @@ -13,13 +13,12 @@ tft_featherwing = tft_featherwing_24.TFTFeatherWing24() try: - f = open("/sd/tft_featherwing.txt", "w") - f.write("Blinka\nBlackberry Q10 Keyboard") - f.close() + with open("/sd/tft_featherwing.txt", "w") as f: + f.write("Blinka\nBlackberry Q10 Keyboard") + + with open("/sd/tft_featherwing.txt", "r") as f: + print(f.read()) - f = open("/sd/tft_featherwing.txt", "r") - print(f.read()) - f.close() except OSError as error: print("Unable to write to SD Card.") diff --git a/examples/featherwing_tft35_simpletest.py b/examples/featherwing_tft35_simpletest.py index 475073a..d23f956 100644 --- a/examples/featherwing_tft35_simpletest.py +++ b/examples/featherwing_tft35_simpletest.py @@ -13,13 +13,15 @@ tft_featherwing = tft_featherwing_35.TFTFeatherWing35() try: - f = open("/sd/tft_featherwing.txt", "w") - f.write("Blinka\nBlackberry Q10 Keyboard") - f.close() + with open( # pylint: disable=unspecified-encoding + "/sd/tft_featherwing.txt", "w" + ) as f: + f.write("Blinka\nBlackberry Q10 Keyboard") - f = open("/sd/tft_featherwing.txt", "r") - print(f.read()) - f.close() + with open( # pylint: disable=unspecified-encoding + "/sd/tft_featherwing.txt", "r" + ) as f: + print(f.read()) except OSError as error: print("Unable to write to SD Card.")