Skip to content

Commit 50e0172

Browse files
committed
fix: resolve ruff lint errors (UP006, F401, I001, UP037)
1 parent 384b34e commit 50e0172

6 files changed

Lines changed: 11 additions & 20 deletions

File tree

lcd_content_formatter/_driver.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from __future__ import annotations
1818

1919
import time
20-
from typing import List
2120

2221
try:
2322
from smbus2 import SMBus
@@ -94,7 +93,7 @@ def __init__(
9493
self._bus = SMBus(port)
9594
except OSError as exc:
9695
raise I2CError(f"Cannot open I2C bus {port}: {exc}") from exc
97-
self._row_offsets: List[int] = [
96+
self._row_offsets: list[int] = [
9897
0x00,
9998
0x40,
10099
cols,

lcd_content_formatter/display.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
import copy
66
import time
77
from dataclasses import dataclass
8-
from typing import List
98

109
from ._driver import PCF8574Driver
11-
from .exceptions import I2CError
1210
from .frame import Frame, FrameRow
1311

1412

@@ -74,7 +72,7 @@ def close(self) -> None:
7472
"""Release the I2C bus. Call when finished with the display."""
7573
self._driver.close()
7674

77-
def __enter__(self) -> "HD44780":
75+
def __enter__(self) -> HD44780:
7876
return self
7977

8078
def __exit__(self, *_) -> None:
@@ -170,7 +168,7 @@ class _ScrollState:
170168
tmp_rows = tmp_frame.rows()
171169

172170
# Pre-compute per-row padding (only relevant for scroll_in)
173-
states: List[_ScrollState] = []
171+
states: list[_ScrollState] = []
174172
for row in all_rows:
175173
if scroll_in and (
176174
scroll_if_fit

lcd_content_formatter/frame.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from __future__ import annotations
22

33
import uuid
4-
from dataclasses import dataclass, field
5-
from typing import Dict, Iterator, List, Optional
4+
from dataclasses import dataclass
5+
from typing import Iterator
66

77
from .exceptions import DuplicateFrameRowError, FrameRowNotFoundError
88

@@ -38,7 +38,7 @@ class Frame:
3838
"""
3939

4040
def __init__(self) -> None:
41-
self._rows: Dict[str, FrameRow] = {}
41+
self._rows: dict[str, FrameRow] = {}
4242

4343
def __len__(self) -> int:
4444
return len(self._rows)
@@ -142,7 +142,7 @@ def clear(self) -> None:
142142
"""Remove all rows from this frame."""
143143
self._rows.clear()
144144

145-
def rows(self) -> List[FrameRow]:
145+
def rows(self) -> list[FrameRow]:
146146
"""Return all rows as an ordered list."""
147147
return list(self._rows.values())
148148

tests/test_display.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
"""
66

77
from dataclasses import dataclass
8-
from unittest.mock import MagicMock, call, patch
8+
from unittest.mock import MagicMock, patch
99

1010
import pytest
1111

1212
from lcd_content_formatter.display import HD44780
13-
from lcd_content_formatter.frame import Frame, FrameRow
14-
13+
from lcd_content_formatter.frame import Frame
1514

1615
# ---------------------------------------------------------------------------
1716
# Helpers

tests/test_driver.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,14 @@
44
any platform without physical hardware.
55
"""
66

7-
from unittest.mock import MagicMock, call, patch
7+
from unittest.mock import MagicMock, patch
88

99
import pytest
1010

1111
from lcd_content_formatter._driver import (
12-
PCF8574Driver,
1312
_BL,
14-
_CMD_CLEAR,
15-
_CMD_DDRAM,
16-
_CMD_HOME,
17-
_EN,
1813
_RS,
14+
PCF8574Driver,
1915
)
2016
from lcd_content_formatter.exceptions import I2CError
2117

tests/test_frame.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from lcd_content_formatter.exceptions import DuplicateFrameRowError, FrameRowNotFoundError
66
from lcd_content_formatter.frame import Frame, FrameRow
77

8-
98
# ---------------------------------------------------------------------------
109
# FrameRow
1110
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)