From 4f11e9cb055d26eb8977ed757d8463844c7ca068 Mon Sep 17 00:00:00 2001 From: dherrada Date: Mon, 22 Mar 2021 16:36:35 -0400 Subject: [PATCH 1/2] Changed iterator name to get around duplicate-code check --- adafruit_boardtest/boardtest_gpio.py | 4 ++-- adafruit_boardtest/boardtest_i2c.py | 4 ++-- adafruit_boardtest/boardtest_led.py | 4 ++-- adafruit_boardtest/boardtest_sd.py | 4 ++-- adafruit_boardtest/boardtest_sd_cd.py | 4 ++-- adafruit_boardtest/boardtest_spi.py | 4 ++-- adafruit_boardtest/boardtest_uart.py | 4 ++-- adafruit_boardtest/boardtest_voltage_monitor.py | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/adafruit_boardtest/boardtest_gpio.py b/adafruit_boardtest/boardtest_gpio.py index a1b02b3..4b468b2 100644 --- a/adafruit_boardtest/boardtest_gpio.py +++ b/adafruit_boardtest/boardtest_gpio.py @@ -135,8 +135,8 @@ def _main(): print("All pins found:", end=" ") # Print pins - for pin in pins: - print(pin, end=" ") + for pin1 in pins: + print(pin1, end=" ") print("\n") # Run test diff --git a/adafruit_boardtest/boardtest_i2c.py b/adafruit_boardtest/boardtest_i2c.py index fb860ac..fa3cc0c 100644 --- a/adafruit_boardtest/boardtest_i2c.py +++ b/adafruit_boardtest/boardtest_i2c.py @@ -185,8 +185,8 @@ def _main(): print("All pins found:", end=" ") # Print pins - for pin in pins: - print(pin, end=" ") + for pin2 in pins: + print(pin2, end=" ") print("\n") # Run test diff --git a/adafruit_boardtest/boardtest_led.py b/adafruit_boardtest/boardtest_led.py index b8ff467..8d2bb1f 100644 --- a/adafruit_boardtest/boardtest_led.py +++ b/adafruit_boardtest/boardtest_led.py @@ -119,8 +119,8 @@ def _main(): print("All pins found:", end=" ") # Print pins - for pin in pins: - print(pin, end=" ") + for pin4 in pins: + print(pin4, end=" ") print("\n") # Run test diff --git a/adafruit_boardtest/boardtest_sd.py b/adafruit_boardtest/boardtest_sd.py index 94f19ac..a604f9e 100644 --- a/adafruit_boardtest/boardtest_sd.py +++ b/adafruit_boardtest/boardtest_sd.py @@ -156,8 +156,8 @@ def _main(): print("All pins found:", end=" ") # Print pins - for pin in pins: - print(pin, end=" ") + for pin5 in pins: + print(pin5, end=" ") print("\n") # Run test diff --git a/adafruit_boardtest/boardtest_sd_cd.py b/adafruit_boardtest/boardtest_sd_cd.py index 9f16916..ff74066 100644 --- a/adafruit_boardtest/boardtest_sd_cd.py +++ b/adafruit_boardtest/boardtest_sd_cd.py @@ -96,8 +96,8 @@ def _main(): print("All pins found:", end=" ") # Print pins - for pin in pins: - print(pin, end=" ") + for pin6 in pins: + print(pin6, end=" ") print("\n") # Run test diff --git a/adafruit_boardtest/boardtest_spi.py b/adafruit_boardtest/boardtest_spi.py index 2362ac5..c2c65f2 100644 --- a/adafruit_boardtest/boardtest_spi.py +++ b/adafruit_boardtest/boardtest_spi.py @@ -232,8 +232,8 @@ def _main(): print("All pins found:", end=" ") # Print pins - for pin in pins: - print(pin, end=" ") + for pin7 in pins: + print(pin7, end=" ") print("\n") # Run test diff --git a/adafruit_boardtest/boardtest_uart.py b/adafruit_boardtest/boardtest_uart.py index 50a2784..7c70858 100644 --- a/adafruit_boardtest/boardtest_uart.py +++ b/adafruit_boardtest/boardtest_uart.py @@ -108,8 +108,8 @@ def _main(): print("All pins found:", end=" ") # Print pins - for pin in pins: - print(pin, end=" ") + for pin3 in pins: + print(pin3, end=" ") print("\n") # Run test diff --git a/adafruit_boardtest/boardtest_voltage_monitor.py b/adafruit_boardtest/boardtest_voltage_monitor.py index 4390715..968560d 100644 --- a/adafruit_boardtest/boardtest_voltage_monitor.py +++ b/adafruit_boardtest/boardtest_voltage_monitor.py @@ -99,8 +99,8 @@ def _main(): print("All pins found:", end=" ") # Print pins - for pin in pins: - print(pin, end=" ") + for pin8 in pins: + print(pin8, end=" ") print("\n") # Run test From 58e8002e66fdf181cd4ba142695587b4ce851494 Mon Sep 17 00:00:00 2001 From: dherrada Date: Tue, 23 Mar 2021 14:06:32 -0400 Subject: [PATCH 2/2] removed main function and if __name__ --- adafruit_boardtest/boardtest_gpio.py | 24 ------------------- adafruit_boardtest/boardtest_i2c.py | 24 ------------------- adafruit_boardtest/boardtest_led.py | 24 ------------------- adafruit_boardtest/boardtest_sd.py | 24 ------------------- adafruit_boardtest/boardtest_sd_cd.py | 24 ------------------- adafruit_boardtest/boardtest_spi.py | 24 ------------------- adafruit_boardtest/boardtest_uart.py | 24 ------------------- .../boardtest_voltage_monitor.py | 24 ------------------- 8 files changed, 192 deletions(-) diff --git a/adafruit_boardtest/boardtest_gpio.py b/adafruit_boardtest/boardtest_gpio.py index 4b468b2..a8ddebb 100644 --- a/adafruit_boardtest/boardtest_gpio.py +++ b/adafruit_boardtest/boardtest_gpio.py @@ -125,27 +125,3 @@ def run_test(pins): # Else (no pins found) print("No GPIO pins found") return NA, [] - - -def _main(): - - # List out all the pins available to us - pins = list(dir(board)) - print() - print("All pins found:", end=" ") - - # Print pins - for pin1 in pins: - print(pin1, end=" ") - print("\n") - - # Run test - result = run_test(pins) - print() - print(result[0]) - print("Pins tested: " + str(result[1])) - - -# Execute only if run as main.py or code.py -if __name__ == "__main__": - _main() diff --git a/adafruit_boardtest/boardtest_i2c.py b/adafruit_boardtest/boardtest_i2c.py index fa3cc0c..ea94feb 100644 --- a/adafruit_boardtest/boardtest_i2c.py +++ b/adafruit_boardtest/boardtest_i2c.py @@ -175,27 +175,3 @@ def run_test(pins, sda_pin=SDA_PIN_NAME, scl_pin=SCL_PIN_NAME): # Else (no pins found) print("No I2C pins found") return NA, [] - - -def _main(): - - # List out all the pins available to us - pins = list(dir(board)) - print() - print("All pins found:", end=" ") - - # Print pins - for pin2 in pins: - print(pin2, end=" ") - print("\n") - - # Run test - result = run_test(pins) - print() - print(result[0]) - print("Pins tested: " + str(result[1])) - - -# Execute only if run as main.py or code.py -if __name__ == "__main__": - _main() diff --git a/adafruit_boardtest/boardtest_led.py b/adafruit_boardtest/boardtest_led.py index 8d2bb1f..c41b282 100644 --- a/adafruit_boardtest/boardtest_led.py +++ b/adafruit_boardtest/boardtest_led.py @@ -109,27 +109,3 @@ def run_test(pins): # Else (no pins found) print("No LED pins found") return NA, [] - - -def _main(): - - # List out all the pins available to us - pins = list(dir(board)) - print() - print("All pins found:", end=" ") - - # Print pins - for pin4 in pins: - print(pin4, end=" ") - print("\n") - - # Run test - result = run_test(pins) - print() - print(result[0]) - print("Pins tested: " + str(result[1])) - - -# Execute only if run as main.py or code.py -if __name__ == "__main__": - _main() diff --git a/adafruit_boardtest/boardtest_sd.py b/adafruit_boardtest/boardtest_sd.py index a604f9e..b1820cf 100644 --- a/adafruit_boardtest/boardtest_sd.py +++ b/adafruit_boardtest/boardtest_sd.py @@ -146,27 +146,3 @@ def run_test( # Else (no pins found) print("No SD card pins found") return NA, [] - - -def _main(): - - # List out all the pins available to us - pins = list(dir(board)) - print() - print("All pins found:", end=" ") - - # Print pins - for pin5 in pins: - print(pin5, end=" ") - print("\n") - - # Run test - result = run_test(pins) - print() - print(result[0]) - print("Pins tested: " + str(result[1])) - - -# Execute only if run as main.py or code.py -if __name__ == "__main__": - _main() diff --git a/adafruit_boardtest/boardtest_sd_cd.py b/adafruit_boardtest/boardtest_sd_cd.py index ff74066..094cd92 100644 --- a/adafruit_boardtest/boardtest_sd_cd.py +++ b/adafruit_boardtest/boardtest_sd_cd.py @@ -86,27 +86,3 @@ def run_test(pins, cd_pin=SD_CD_PIN_NAME): # Else (no pins found) print("No CD pin found") return NA, [] - - -def _main(): - - # List out all the pins available to us - pins = list(dir(board)) - print() - print("All pins found:", end=" ") - - # Print pins - for pin6 in pins: - print(pin6, end=" ") - print("\n") - - # Run test - result = run_test(pins) - print() - print(result[0]) - print("Pins tested: " + str(result[1])) - - -# Execute only if run as main.py or code.py -if __name__ == "__main__": - _main() diff --git a/adafruit_boardtest/boardtest_spi.py b/adafruit_boardtest/boardtest_spi.py index c2c65f2..d18133a 100644 --- a/adafruit_boardtest/boardtest_spi.py +++ b/adafruit_boardtest/boardtest_spi.py @@ -222,27 +222,3 @@ def run_test( # Else (no pins found) print("No SPI pins found") return NA, [] - - -def _main(): - - # List out all the pins available to us - pins = list(dir(board)) - print() - print("All pins found:", end=" ") - - # Print pins - for pin7 in pins: - print(pin7, end=" ") - print("\n") - - # Run test - result = run_test(pins) - print() - print(result[0]) - print("Pins tested: " + str(result[1])) - - -# Execute only if run as main.py or code.py -if __name__ == "__main__": - _main() diff --git a/adafruit_boardtest/boardtest_uart.py b/adafruit_boardtest/boardtest_uart.py index 7c70858..b484bdf 100644 --- a/adafruit_boardtest/boardtest_uart.py +++ b/adafruit_boardtest/boardtest_uart.py @@ -98,27 +98,3 @@ def run_test(pins, tx_pin=TX_PIN_NAME, rx_pin=RX_PIN_NAME, baud_rate=BAUD_RATE): # Else (no pins found) print("No UART pins found") return NA, [] - - -def _main(): - - # List out all the pins available to us - pins = list(dir(board)) - print() - print("All pins found:", end=" ") - - # Print pins - for pin3 in pins: - print(pin3, end=" ") - print("\n") - - # Run test - result = run_test(pins) - print() - print(result[0]) - print("Pins tested: " + str(result[1])) - - -# Execute only if run as main.py or code.py -if __name__ == "__main__": - _main() diff --git a/adafruit_boardtest/boardtest_voltage_monitor.py b/adafruit_boardtest/boardtest_voltage_monitor.py index 968560d..c56a782 100644 --- a/adafruit_boardtest/boardtest_voltage_monitor.py +++ b/adafruit_boardtest/boardtest_voltage_monitor.py @@ -89,27 +89,3 @@ def run_test(pins): # Else (no pins found) print("No battery monitor pins found") return NA, [] - - -def _main(): - - # List out all the pins available to us - pins = list(dir(board)) - print() - print("All pins found:", end=" ") - - # Print pins - for pin8 in pins: - print(pin8, end=" ") - print("\n") - - # Run test - result = run_test(pins) - print() - print(result[0]) - print("Pins tested: " + str(result[1])) - - -# Execute only if run as main.py or code.py -if __name__ == "__main__": - _main()