Skip to content

Commit b2759a2

Browse files
committed
Formatting Correction - button.py
Correct formatting errors for the button.py file to pass ruff checks.
1 parent a11ed73 commit b2759a2

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

adafruit_button/button.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,21 @@ class Button(ButtonBase):
5454
Defaults to RECT.
5555
:param Optional[Union[int, Tuple[int, int, int]]] fill_color: The color to fill the button.
5656
Accepts an int or a tuple of 3 integers representing RGB values. Defaults to 0xFFFFFF.
57-
:param Optional[Union[int, Tuple[int, int, int]]] outline_color: The color of the outline of the button.
58-
Accepts an int or a tuple of 3 integers representing RGB values. Defaults to 0x0.
57+
:param Optional[Union[int, Tuple[int, int, int]]] outline_color: The color of the outline of the
58+
button. Accepts an int or a tuple of 3 integers representing RGB values. Defaults to 0x0.
5959
:param Optional[str] label: The text that appears inside the button.
6060
:param Optional[FontProtocol] label_font: The button label font. Defaults to ''terminalio.FONT''
61-
:param Optional[Union[int, Tuple[int, int, int]]] label_color: The color of the button label text.
62-
Accepts an int or a tuple of 3 integers representing RGB values. Defaults to 0x0.
63-
:param Optional[Union[int, Tuple[int, int, int]]] selected_fill: The fill color when the button is selected.
64-
Accepts an int or a tuple of 3 integers representing RGB values. Defaults to the inverse of the fill_color.
65-
:param Optional[Union[int, Tuple[int, int, int]]] selected_outline: The outline color when the button is selected.
66-
Accepts an int or a tuple of 3 integers representing RGB values. Defaults to the inverse of outline_color.
67-
:param Optional[Union[int, Tuple[int, int, int]]] selected_label: The label color when the button is selected.
68-
Accepts an int or a tuple of 3 integers representing RGB values. Defaults to inverting the label_color.
61+
:param Optional[Union[int, Tuple[int, int, int]]] label_color: The color of the button label
62+
text. Accepts an int or a tuple of 3 integers representing RGB values. Defaults to 0x0.
63+
:param Optional[Union[int, Tuple[int, int, int]]] selected_fill: The fill color when the
64+
button is selected. Accepts an int or a tuple of 3 integers representing RGB values.
65+
Defaults to the inverse of the fill_color.
66+
:param Optional[Union[int, Tuple[int, int, int]]] selected_outline: The outline color when the
67+
button is selected. Accepts an int or a tuple of 3 integers representing RGB values.
68+
Defaults to the inverse of outline_color.
69+
:param Optional[Union[int, Tuple[int, int, int]]] selected_label: The label color when the
70+
button is selected. Accepts an int or a tuple of 3 integers representing RGB values.
71+
Defaults to inverting the label_color.
6972
:param Optional[int] label_scale: The scale factor used for the label. Defaults to 1.
7073
"""
7174

@@ -141,14 +144,14 @@ def __init__(
141144
height: int,
142145
name: Optional[str] = None,
143146
style = RECT,
144-
fill_color: Optional[Union[int, tuple[int, int, int]]] = 0xFFFFFF,
145-
outline_color: Optional[Union[int, tuple[int, int, int]]] = 0x0,
147+
fill_color: Optional[Union[int, Tuple[int, int, int]]] = 0xFFFFFF,
148+
outline_color: Optional[Union[int, Tuple[int, int, int]]] = 0x0,
146149
label: Optional[str] = None,
147150
label_font: Optional[FontProtocol] = None,
148-
label_color: Optional[Union[int, tuple[int, int , int]]] = 0x0,
149-
selected_fill: Optional[Union[int, tuple[int, int , int]]] = None,
150-
selected_outline: Optional[Union[int, tuple[int, int, int]]] = None,
151-
selected_label: Optional[Union[int, tuple[int, int, int]]] = None,
151+
label_color: Optional[Union[int, Tuple[int, int , int]]] = 0x0,
152+
selected_fill: Optional[Union[int, Tuple[int, int , int]]] = None,
153+
selected_outline: Optional[Union[int, Tuple[int, int, int]]] = None,
154+
selected_label: Optional[Union[int, Tuple[int, int, int]]] = None,
152155
label_scale: Optional[int] = 1
153156
):
154157
super().__init__(
@@ -222,7 +225,7 @@ def fill_color(self) -> Optional[int]:
222225
return self._fill_color
223226

224227
@fill_color.setter
225-
def fill_color(self, new_color: Union[int, tuple[int, int, int]]) -> None:
228+
def fill_color(self, new_color: Union[int, Tuple[int, int, int]]) -> None:
226229
self._fill_color = _check_color(new_color)
227230
if not self.selected:
228231
self.body.fill = self._fill_color
@@ -233,7 +236,7 @@ def outline_color(self) -> Optional[int]:
233236
return self._outline_color
234237

235238
@outline_color.setter
236-
def outline_color(self, new_color: Union[int, tuple[int, int, int]]) -> None:
239+
def outline_color(self, new_color: Union[int, Tuple[int, int, int]]) -> None:
237240
self._outline_color = _check_color(new_color)
238241
if not self.selected:
239242
self.body.outline = self._outline_color
@@ -244,7 +247,7 @@ def selected_fill(self) -> Optional[int]:
244247
return self._selected_fill
245248

246249
@selected_fill.setter
247-
def selected_fill(self, new_color: Union[int, tuple[int, int, int]]) -> None:
250+
def selected_fill(self, new_color: Union[int, Tuple[int, int, int]]) -> None:
248251
self._selected_fill = _check_color(new_color)
249252
if self.selected:
250253
self.body.fill = self._selected_fill
@@ -255,7 +258,7 @@ def selected_outline(self) -> Optional[int]:
255258
return self._selected_outline
256259

257260
@selected_outline.setter
258-
def selected_outline(self, new_color: Union[int, tuple[int, int, int]]) -> None:
261+
def selected_outline(self, new_color: Union[int, Tuple[int, int, int]]) -> None:
259262
self._selected_outline = _check_color(new_color)
260263
if self.selected:
261264
self.body.outline = self._selected_outline

0 commit comments

Comments
 (0)