Skip to content

Commit f0283fa

Browse files
committed
a little help from pre-commit
1 parent b89f5b8 commit f0283fa

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

adafruit_usb_host_mouse/__init__.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,16 @@ def find_and_init_boot_mouse(cursor_image=DEFAULT_CURSOR): # noqa: PLR0912
122122
# if no mouse found
123123
return None
124124

125+
125126
def find_and_init_report_mouse(cursor_image=DEFAULT_CURSOR): # noqa: PLR0912
126127
"""
127128
Scan for an attached report mouse connected via USB host.
128129
If one is found initialize an instance of :class:`ReportMouse` class
129130
and return it.
130131
131132
:param cursor_image: Provide the absolute path to the desired cursor bitmap image. If set as
132-
`None`, the :class:`ReportMouse` instance will not control a :class:`displayio.TileGrid` object.
133+
`None`, the :class:`ReportMouse` instance will not control
134+
a :class:`displayio.TileGrid` object.
133135
:return: The :class:`ReportMouse` instance or None if no mouse was found.
134136
"""
135137
mouse_interface_index, mouse_endpoint_address = None, None
@@ -200,7 +202,8 @@ def find_and_init_report_mouse(cursor_image=DEFAULT_CURSOR): # noqa: PLR0912
200202
# if no mouse found
201203
return None
202204

203-
class BootMouse():
205+
206+
class BootMouse:
204207
"""
205208
Helpler class that encapsulates the objects needed to interact with a boot
206209
mouse, show a visible cursor on the display, and determine when buttons
@@ -307,7 +310,7 @@ def update(self):
307310
# update the mouse x and y coordinates
308311
# based on the delta values read from the mouse
309312
# Standard Boot Mouse: 3 bytes [Btn, X, Y]
310-
313+
311314
dx, dy = self.buffer[1:3]
312315
dx = int(round((dx / self.sensitivity), 0))
313316
dy = int(round((dy / self.sensitivity), 0))
@@ -333,8 +336,8 @@ def update(self):
333336

334337
return tuple(self.pressed_btns)
335338

336-
class ReportMouse(BootMouse):
337339

340+
class ReportMouse(BootMouse):
338341
def __init__(self, device, endpoint_address, was_attached, tilegrid=None, scale=1): # noqa: PLR0913, too many args
339342
super().__init__(device, endpoint_address, was_attached, tilegrid, scale)
340343

@@ -363,7 +366,7 @@ def update(self):
363366
# Mouse with Report ID: 4 bytes [ID, Btn, X, Y]
364367
offset = 1
365368

366-
dx, dy = self.buffer[1 + offset:3 + offset]
369+
dx, dy = self.buffer[1 + offset : 3 + offset]
367370
dx = int(round((dx / self.sensitivity), 0))
368371
dy = int(round((dy / self.sensitivity), 0))
369372
if self.tilegrid:
@@ -387,4 +390,3 @@ def update(self):
387390
self.pressed_btns.append(button)
388391

389392
return tuple(self.pressed_btns)
390-

0 commit comments

Comments
 (0)