From 3348a0a2b5397fd5cd732a2374074013a072a002 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Wed, 12 Jun 2024 15:54:09 +0100 Subject: [PATCH] QA: Reformat with black. --- ST7789.py | 6 ++- examples/320x240.py | 10 ++--- examples/framerate.py | 20 +++++---- examples/gif.py | 26 +++++++----- examples/image.py | 26 +++++++----- examples/round.py | 25 +++++++---- examples/scrolling-text.py | 20 +++++---- examples/shapes.py | 36 ++++++++++------ st7789/__init__.py | 87 +++++++++++++++++++++++--------------- tests/conftest.py | 1 + tests/test_display.py | 2 + tests/test_setup.py | 6 ++- 12 files changed, 164 insertions(+), 101 deletions(-) diff --git a/ST7789.py b/ST7789.py index 2c5ade1..3d3a7cb 100644 --- a/ST7789.py +++ b/ST7789.py @@ -2,4 +2,8 @@ from st7789 import * # noqa F403 -warn("Using \"import ST7789\" is deprecated. Please \"import st7789\" (all lowercase)!", DeprecationWarning, stacklevel=2) \ No newline at end of file +warn( + 'Using "import ST7789" is deprecated. Please "import st7789" (all lowercase)!', + DeprecationWarning, + stacklevel=2, +) diff --git a/examples/320x240.py b/examples/320x240.py index b78e2c4..98844af 100755 --- a/examples/320x240.py +++ b/examples/320x240.py @@ -30,9 +30,9 @@ draw = ImageDraw.Draw(buffer) draw.rectangle((0, 0, 50, 50), (255, 0, 0)) -draw.rectangle((320-50, 0, 320, 50), (0, 255, 0)) -draw.rectangle((0, 240-50, 50, 240), (0, 0, 255)) -draw.rectangle((320-50, 240-50, 320, 240), (255, 255, 0)) +draw.rectangle((320 - 50, 0, 320, 50), (0, 255, 0)) +draw.rectangle((0, 240 - 50, 50, 240), (0, 0, 255)) +draw.rectangle((320 - 50, 240 - 50, 320, 240), (255, 255, 0)) display = ST7789( port=SPI_PORT, @@ -42,9 +42,9 @@ width=WIDTH, height=HEIGHT, rotation=180, - spi_speed_hz=60 * 1000 * 1000 + spi_speed_hz=60 * 1000 * 1000, ) while True: display.display(buffer) - time.sleep(1.0 / 60) \ No newline at end of file + time.sleep(1.0 / 60) diff --git a/examples/framerate.py b/examples/framerate.py index e70f16b..0589d77 100755 --- a/examples/framerate.py +++ b/examples/framerate.py @@ -20,7 +20,8 @@ except IndexError: display_type = "square" -print(f""" +print( + f""" framerate.py - Test LCD framerate. If you're using Breakout Garden, plug the 1.3" LCD (SPI) @@ -35,14 +36,15 @@ * dhmini - 320x240 2.0" Rectangular LCD Running at: {SPI_SPEED_MHZ}MHz on a {display_type} display. -""") +""" +) try: width, height, rotation, backlight, offset_left, offset_top = { "square": (240, 240, 90, 19, 0, 0), "round": (240, 240, 90, 19, 40, 0), "rect": (240, 135, 0, 19, 40, 53), - "dhmini": (320, 240, 180, 13, 0, 0) + "dhmini": (320, 240, 180, 13, 0, 0), }[display_type] except IndexError: raise RuntimeError(f"Unsupported display type: {display_type}") @@ -55,10 +57,10 @@ port=0, cs=st7789.BG_SPI_CS_FRONT, # BG_SPI_CS_BACK or BG_SPI_CS_FRONT dc=9, - backlight=backlight, # 18 for back BG slot, 19 for front BG slot. + backlight=backlight, # 18 for back BG slot, 19 for front BG slot. spi_speed_hz=SPI_SPEED_MHZ * 1000000, offset_left=offset_left, - offset_top=offset_top + offset_top=offset_top, ) WIDTH = disp.width @@ -71,9 +73,9 @@ draw = ImageDraw.Draw(image) if step % 2 == 0: - draw.rectangle((WIDTH/2, int(HEIGHT/2), WIDTH, HEIGHT), (0, 128, 0)) + draw.rectangle((WIDTH / 2, int(HEIGHT / 2), WIDTH, HEIGHT), (0, 128, 0)) else: - draw.rectangle((0, 0, WIDTH/2-1, int(HEIGHT/2)-1), (0, 128, 0)) + draw.rectangle((0, 0, WIDTH / 2 - 1, int(HEIGHT / 2) - 1), (0, 128, 0)) f = math.sin((float(step) / STEPS) * math.pi) offset_left = int(f * WIDTH) @@ -89,4 +91,6 @@ count += 1 time_current = time.time() - time_start if count % 120 == 0: - print(f"Time: {time_current:8.3f}, Frames: {count:6d}, FPS: {count / time_current:8.3f}") + print( + f"Time: {time_current:8.3f}, Frames: {count:6d}, FPS: {count / time_current:8.3f}" + ) diff --git a/examples/gif.py b/examples/gif.py index 7e63fd8..c4bda8a 100755 --- a/examples/gif.py +++ b/examples/gif.py @@ -6,16 +6,19 @@ import st7789 -print(""" +print( + """ gif.py - Display a gif on the LCD. If you're using Breakout Garden, plug the 1.3" LCD (SPI) breakout into the front slot. -""") +""" +) if len(sys.argv) < 2: - print(f"""Usage: {sys.argv[0]} + print( + f"""Usage: {sys.argv[0]} Where is a .gif file. Hint: {sys.argv[0]} deployrainbows.gif @@ -25,7 +28,8 @@ * round - 240x240 1.3" Round LCD (applies an offset) * rect - 240x135 1.14" Rectangular LCD (applies an offset) * dhmini - 320x240 2.0" Display HAT Mini -""") +""" + ) sys.exit(1) image_file = sys.argv[1] @@ -44,10 +48,10 @@ port=0, cs=st7789.BG_SPI_CS_FRONT, # BG_SPI_CS_BACK or BG_SPI_CS_FRONT dc=9, - backlight=19, # 18 for back BG slot, 19 for front BG slot. + backlight=19, # 18 for back BG slot, 19 for front BG slot. spi_speed_hz=80 * 1000 * 1000, offset_left=0 if display_type == "square" else 40, - offset_top=53 if display_type == "rect" else 0 + offset_top=53 if display_type == "rect" else 0, ) elif display_type == "dhmini": @@ -61,11 +65,11 @@ backlight=13, spi_speed_hz=60 * 1000 * 1000, offset_left=0, - offset_top=0 - ) + offset_top=0, + ) else: - print ("Invalid display type!") + print("Invalid display type!") # Initialize display. disp.begin() @@ -74,10 +78,10 @@ height = disp.height # Load an image. -print(f'Loading gif: {image_file}...') +print(f"Loading gif: {image_file}...") image = Image.open(image_file) -print('Drawing gif, press Ctrl+C to exit!') +print("Drawing gif, press Ctrl+C to exit!") frame = 0 diff --git a/examples/image.py b/examples/image.py index c28962a..87af7be 100755 --- a/examples/image.py +++ b/examples/image.py @@ -5,23 +5,27 @@ import st7789 -print(""" +print( + """ image.py - Display an image on the LCD. If you're using Breakout Garden, plug the 1.3" LCD (SPI) breakout into the front slot. -""") +""" +) if len(sys.argv) < 2: - print(f"""Usage: {sys.argv[0]} + print( + f"""Usage: {sys.argv[0]} Where is one of: * square - 240x240 1.3" Square LCD * round - 240x240 1.3" Round LCD (applies an offset) * rect - 240x135 1.14" Rectangular LCD (applies an offset) * dhmini - 320x240 2.0" Display HAT Mini -""") +""" + ) sys.exit(1) image_file = sys.argv[1] @@ -40,10 +44,10 @@ port=0, cs=st7789.BG_SPI_CS_FRONT, # BG_SPI_CS_BACK or BG_SPI_CS_FRONT dc=9, - backlight=19, # 18 for back BG slot, 19 for front BG slot. + backlight=19, # 18 for back BG slot, 19 for front BG slot. spi_speed_hz=80 * 1000 * 1000, offset_left=0 if display_type == "square" else 40, - offset_top=53 if display_type == "rect" else 0 + offset_top=53 if display_type == "rect" else 0, ) elif display_type == "dhmini": @@ -57,11 +61,11 @@ backlight=13, spi_speed_hz=60 * 1000 * 1000, offset_left=0, - offset_top=0 - ) + offset_top=0, + ) else: - print ("Invalid display type!") + print("Invalid display type!") WIDTH = disp.width HEIGHT = disp.height @@ -70,13 +74,13 @@ disp.begin() # Load an image. -print(f'Loading image: {image_file}...') +print(f"Loading image: {image_file}...") image = Image.open(image_file) # Resize the image image = image.resize((WIDTH, HEIGHT)) # Draw the image on the display hardware. -print('Drawing image') +print("Drawing image") disp.display(image) diff --git a/examples/round.py b/examples/round.py index 9389bcf..b37b0d7 100755 --- a/examples/round.py +++ b/examples/round.py @@ -8,7 +8,8 @@ import st7789 -print(f""" +print( + f""" round.py - Shiny shiny round LCD! If you're using Breakout Garden, plug a 1.3" ROUND LCD @@ -21,7 +22,8 @@ * dots - swirly swooshy dots * lines - 3D depth effect lines -""") +""" +) try: style = sys.argv[1] @@ -33,10 +35,10 @@ port=0, cs=st7789.BG_SPI_CS_FRONT, # BG_SPI_CS_BACK or BG_SPI_CS_FRONT dc=9, - backlight=19, # 18 for back BG slot, 19 for front BG slot. + backlight=19, # 18 for back BG slot, 19 for front BG slot. rotation=90, spi_speed_hz=80 * 1000 * 1000, - offset_left=40 + offset_left=40, ) # Initialize display. @@ -44,7 +46,7 @@ RADIUS = disp.width // 2 -img = Image.new('RGB', (disp.width, disp.height), color=(0, 0, 0)) +img = Image.new("RGB", (disp.width, disp.height), color=(0, 0, 0)) draw = ImageDraw.Draw(img) @@ -69,17 +71,24 @@ distance = RADIUS / steps * step distance += step * 0.2 - r, g, b = [int(c * 255) for c in colorsys.hsv_to_rgb((t / 10.0) + distance / 120.0, 1.0, 1.0)] + r, g, b = [ + int(c * 255) + for c in colorsys.hsv_to_rgb((t / 10.0) + distance / 120.0, 1.0, 1.0) + ] x = RADIUS + int(distance * math.cos(angle)) y = RADIUS + int(distance * math.sin(angle)) line = ((math.sin(t + angle) + 1) / 2.0) * 10 if style == "lines": - draw.line((prev_x + line, prev_y + line, x - line, y - line), fill=(r, g, b)) + draw.line( + (prev_x + line, prev_y + line, x - line, y - line), fill=(r, g, b) + ) else: line += 1 - draw.ellipse((x - line, y - line, x + (line * 2), y + (line * 2)), fill=(r, g, b)) + draw.ellipse( + (x - line, y - line, x + (line * 2), y + (line * 2)), fill=(r, g, b) + ) prev_x = x prev_y = y diff --git a/examples/scrolling-text.py b/examples/scrolling-text.py index 4630a37..34f94ba 100755 --- a/examples/scrolling-text.py +++ b/examples/scrolling-text.py @@ -8,7 +8,8 @@ MESSAGE = "Hello World! How are you today?" -print(f""" +print( + f""" scrolling-test.py - Display scrolling text. If you're using Breakout Garden, plug the 1.3" LCD (SPI) @@ -22,7 +23,8 @@ * round - 240x240 1.3" Round LCD (applies an offset) * rect - 240x135 1.14" Rectangular LCD (applies an offset) * dhmini - 320x240 2.0" Display HAT Mini -""") +""" +) try: MESSAGE = sys.argv[1] @@ -44,10 +46,10 @@ port=0, cs=st7789.BG_SPI_CS_FRONT, # BG_SPI_CS_BACK or BG_SPI_CS_FRONT dc=9, - backlight=19, # 18 for back BG slot, 19 for front BG slot. + backlight=19, # 18 for back BG slot, 19 for front BG slot. spi_speed_hz=80 * 1000 * 1000, offset_left=0 if display_type == "square" else 40, - offset_top=53 if display_type == "rect" else 0 + offset_top=53 if display_type == "rect" else 0, ) elif display_type == "dhmini": @@ -61,11 +63,11 @@ backlight=13, spi_speed_hz=60 * 1000 * 1000, offset_left=0, - offset_top=0 - ) + offset_top=0, + ) else: - print ("Invalid display type!") + print("Invalid display type!") # Initialize display. disp.begin() @@ -74,7 +76,7 @@ HEIGHT = disp.height -img = Image.new('RGB', (WIDTH, HEIGHT), color=(0, 0, 0)) +img = Image.new("RGB", (WIDTH, HEIGHT), color=(0, 0, 0)) draw = ImageDraw.Draw(img) @@ -89,7 +91,7 @@ while True: x = (time.time() - t_start) * 100 - x %= (size_x + disp.width) + x %= size_x + disp.width draw.rectangle((0, 0, disp.width, disp.height), (0, 0, 0)) draw.text((int(text_x - x), text_y), MESSAGE, font=font, fill=(255, 255, 255)) disp.display(img) diff --git a/examples/shapes.py b/examples/shapes.py index 587cebc..965297a 100755 --- a/examples/shapes.py +++ b/examples/shapes.py @@ -5,7 +5,8 @@ import st7789 -print(f""" +print( + f""" shapes.py - Display test shapes on the LCD using PIL. If you're using Breakout Garden, plug the 1.3" LCD (SPI) @@ -19,7 +20,8 @@ * round - 240x240 1.3" Round LCD (applies an offset) * rect - 240x135 1.14" Rectangular LCD (applies an offset) * dhmini - 320x240 2.0" Display HAT Mini -""") +""" +) try: display_type = sys.argv[1] @@ -35,10 +37,10 @@ port=0, cs=st7789.BG_SPI_CS_FRONT, # BG_SPI_CS_BACK or BG_SPI_CS_FRONT dc=9, - backlight=19, # 18 for back BG slot, 19 for front BG slot. + backlight=19, # 18 for back BG slot, 19 for front BG slot. spi_speed_hz=80 * 1000 * 1000, offset_left=0 if display_type == "square" else 40, - offset_top=53 if display_type == "rect" else 0 + offset_top=53 if display_type == "rect" else 0, ) elif display_type == "dhmini": @@ -52,11 +54,11 @@ backlight=13, spi_speed_hz=60 * 1000 * 1000, offset_left=0, - offset_top=0 - ) + offset_top=0, + ) else: - print ("Invalid display type!") + print("Invalid display type!") # Initialize display. disp.begin() @@ -68,12 +70,14 @@ # Clear the display to a red background. # Can pass any tuple of red, green, blue values (from 0 to 255 each). # Get a PIL Draw object to start drawing on the display buffer. -img = Image.new('RGB', (WIDTH, HEIGHT), color=(255, 0, 0)) +img = Image.new("RGB", (WIDTH, HEIGHT), color=(255, 0, 0)) draw = ImageDraw.Draw(img) # Draw a purple rectangle with yellow outline. -draw.rectangle((10, 10, WIDTH - 10, HEIGHT - 10), outline=(255, 255, 0), fill=(255, 0, 255)) +draw.rectangle( + (10, 10, WIDTH - 10, HEIGHT - 10), outline=(255, 255, 0), fill=(255, 0, 255) +) # Draw some shapes. # Draw a blue ellipse with a green outline. @@ -84,7 +88,11 @@ draw.line((10, HEIGHT - 10, WIDTH - 10, 10), fill=(255, 255, 255)) # Draw a cyan triangle with a black outline. -draw.polygon([(WIDTH / 2, 10), (WIDTH - 10, HEIGHT - 10), (10, HEIGHT - 10)], outline=(0, 0, 0), fill=(0, 255, 255)) +draw.polygon( + [(WIDTH / 2, 10), (WIDTH - 10, HEIGHT - 10), (10, HEIGHT - 10)], + outline=(0, 0, 0), + fill=(0, 255, 255), +) # Load default font. font = ImageFont.load_default() @@ -102,7 +110,7 @@ def draw_rotated_text(image, text, position, angle, font, fill=(255, 255, 255)): draw = ImageDraw.Draw(image) width, height = draw.textsize(text, font=font) # Create a new image with transparent background to store the text. - textimage = Image.new('RGBA', (width, height), (0, 0, 0, 0)) + textimage = Image.new("RGBA", (width, height), (0, 0, 0, 0)) # Render the text. textdraw = ImageDraw.Draw(textimage) textdraw.text((0, 0), text, font=font, fill=fill) @@ -113,8 +121,10 @@ def draw_rotated_text(image, text, position, angle, font, fill=(255, 255, 255)): # Write two lines of white text on the buffer, rotated 90 degrees counter clockwise. -draw_rotated_text(img, 'Hello World!', (0, 0), 90, font, fill=(255, 255, 255)) -draw_rotated_text(img, 'This is a line of text.', (10, HEIGHT - 10), 0, font, fill=(255, 255, 255)) +draw_rotated_text(img, "Hello World!", (0, 0), 90, font, fill=(255, 255, 255)) +draw_rotated_text( + img, "This is a line of text.", (10, HEIGHT - 10), 0, font, fill=(255, 255, 255) +) # Write buffer to display hardware, must be called to make things visible on the # display! diff --git a/st7789/__init__.py b/st7789/__init__.py index d58276d..65863f3 100644 --- a/st7789/__init__.py +++ b/st7789/__init__.py @@ -27,7 +27,7 @@ import spidev from gpiod.line import Direction, Value -__version__ = '0.0.4' +__version__ = "0.0.4" OUTL = gpiod.LineSettings(direction=Direction.OUTPUT, output_value=Value.INACTIVE) @@ -93,10 +93,21 @@ class ST7789(object): """Representation of an ST7789 TFT LCD.""" - def __init__(self, port, cs, dc, backlight=None, rst=None, width=240, - height=240, rotation=90, invert=True, spi_speed_hz=4000000, - offset_left=0, - offset_top=0): + def __init__( + self, + port, + cs, + dc, + backlight=None, + rst=None, + width=240, + height=240, + rotation=90, + invert=True, + spi_speed_hz=4000000, + offset_left=0, + offset_top=0, + ): """Create an instance of the display using SPI communication. Must provide the GPIO pin number for the D/C pin and the SPI driver. @@ -118,7 +129,9 @@ def __init__(self, port, cs, dc, backlight=None, rst=None, width=240, raise ValueError(f"Invalid rotation {rotation}") if width != height and rotation in [90, 270]: - raise ValueError(f"Invalid rotation {rotation} for {width}x{height} resolution") + raise ValueError( + f"Invalid rotation {rotation} for {width}x{height} resolution" + ) gpiodevice.friendly_errors = True @@ -180,11 +193,19 @@ def set_backlight(self, value): @property def width(self): - return self._width if self._rotation == 0 or self._rotation == 180 else self._height + return ( + self._width + if self._rotation == 0 or self._rotation == 180 + else self._height + ) @property def height(self): - return self._height if self._rotation == 0 or self._rotation == 180 else self._width + return ( + self._height + if self._rotation == 0 or self._rotation == 180 + else self._width + ) def command(self, data): """Write a byte or array of bytes to the display as command data.""" @@ -207,13 +228,13 @@ def reset(self): def _init(self): # Initialize the display. - self.command(ST7789_SWRESET) # Software reset - time.sleep(0.150) # delay 150 ms + self.command(ST7789_SWRESET) # Software reset + time.sleep(0.150) # delay 150 ms self.command(ST7789_MADCTL) self.data(0x70) - self.command(ST7789_FRMCTR2) # Frame rate ctrl - idle mode + self.command(ST7789_FRMCTR2) # Frame rate ctrl - idle mode self.data(0x0C) self.data(0x0C) self.data(0x00) @@ -229,16 +250,16 @@ def _init(self): self.command(ST7789_VCOMS) self.data(0x37) - self.command(ST7789_LCMCTRL) # Power control + self.command(ST7789_LCMCTRL) # Power control self.data(0x2C) - self.command(ST7789_VDVVRHEN) # Power control + self.command(ST7789_VDVVRHEN) # Power control self.data(0x01) - self.command(ST7789_VRHS) # Power control + self.command(ST7789_VRHS) # Power control self.data(0x12) - self.command(ST7789_VDVS) # Power control + self.command(ST7789_VDVS) # Power control self.data(0x20) self.command(0xD0) @@ -248,7 +269,7 @@ def _init(self): self.command(ST7789_FRCTRL2) self.data(0x0F) - self.command(ST7789_GMCTRP1) # Set Gamma + self.command(ST7789_GMCTRP1) # Set Gamma self.data(0xD0) self.data(0x04) self.data(0x0D) @@ -264,7 +285,7 @@ def _init(self): self.data(0x1F) self.data(0x23) - self.command(ST7789_GMCTRN1) # Set Gamma + self.command(ST7789_GMCTRN1) # Set Gamma self.data(0xD0) self.data(0x04) self.data(0x0C) @@ -281,14 +302,14 @@ def _init(self): self.data(0x23) if self._invert: - self.command(ST7789_INVON) # Invert display + self.command(ST7789_INVON) # Invert display else: self.command(ST7789_INVOFF) # Don't invert display self.command(ST7789_SLPOUT) - self.command(ST7789_DISPON) # Display on - time.sleep(0.100) # 100 ms + self.command(ST7789_DISPON) # Display on + time.sleep(0.100) # 100 ms def begin(self): """Set up the display @@ -317,17 +338,17 @@ def set_window(self, x0=0, y0=0, x1=None, y1=None): x0 += self._offset_left x1 += self._offset_left - self.command(ST7789_CASET) # Column addr set + self.command(ST7789_CASET) # Column addr set self.data(x0 >> 8) - self.data(x0 & 0xFF) # XSTART + self.data(x0 & 0xFF) # XSTART self.data(x1 >> 8) - self.data(x1 & 0xFF) # XEND - self.command(ST7789_RASET) # Row addr set + self.data(x1 & 0xFF) # XEND + self.command(ST7789_RASET) # Row addr set self.data(y0 >> 8) - self.data(y0 & 0xFF) # YSTART + self.data(y0 & 0xFF) # YSTART self.data(y1 >> 8) - self.data(y1 & 0xFF) # YEND - self.command(ST7789_RAMWR) # write to RAM + self.data(y1 & 0xFF) # YEND + self.command(ST7789_RAMWR) # write to RAM def display(self, image): """Write the provided image to the hardware. @@ -344,19 +365,19 @@ def display(self, image): # Write data to hardware. for i in range(0, len(pixelbytes), 4096): - self.data(pixelbytes[i:i + 4096]) + self.data(pixelbytes[i : i + 4096]) def image_to_data(self, image, rotation=0): if not isinstance(image, numpy.ndarray): - image = numpy.array(image.convert('RGB')) + image = numpy.array(image.convert("RGB")) # Rotate the image - pb = numpy.rot90(image, rotation // 90).astype('uint16') + pb = numpy.rot90(image, rotation // 90).astype("uint16") # Mask and shift the 888 RGB into 565 RGB - red = (pb[..., [0]] & 0xf8) << 8 - green = (pb[..., [1]] & 0xfc) << 3 - blue = (pb[..., [2]] & 0xf8) >> 3 + red = (pb[..., [0]] & 0xF8) << 8 + green = (pb[..., [1]] & 0xFC) << 3 + blue = (pb[..., [2]] & 0xF8) >> 3 # Stick 'em together result = red | green | blue diff --git a/tests/conftest.py b/tests/conftest.py index eb8579f..9a36fc4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,6 +7,7 @@ @pytest.fixture(scope="function", autouse=False) def st7789(): import st7789 + yield st7789 del sys.modules["st7789"] diff --git a/tests/test_display.py b/tests/test_display.py index 3b059ce..c6b9eb6 100644 --- a/tests/test_display.py +++ b/tests/test_display.py @@ -1,5 +1,6 @@ def test_display_pil_image(gpiodevice, gpiod, spidev, st7789): from PIL import Image + display = st7789.ST7789(port=0, cs=0, dc=24) image = Image.new("RGB", (display.width, display.width)) @@ -8,6 +9,7 @@ def test_display_pil_image(gpiodevice, gpiod, spidev, st7789): def test_display_numpy_array(gpiodevice, gpiod, spidev, st7789): import numpy + display = st7789.ST7789(port=0, cs=0, dc=24) image = numpy.empty((display.width, display.height, 3)) diff --git a/tests/test_setup.py b/tests/test_setup.py index 0964477..46b8589 100644 --- a/tests/test_setup.py +++ b/tests/test_setup.py @@ -24,5 +24,7 @@ def test_unsupported_rotation_320_x_240_90(gpiodevice, gpiod, spidev, numpy, st7 def test_unsupported_rotation_320_x_240_270(gpiodevice, gpiod, spidev, numpy, st7789): with pytest.raises(ValueError): - display = st7789.ST7789(port=0, cs=0, dc=24, width=320, height=240, rotation=270) - del display \ No newline at end of file + display = st7789.ST7789( + port=0, cs=0, dc=24, width=320, height=240, rotation=270 + ) + del display