Skip to content

Commit 7b51269

Browse files
committed
Remove dead None check in uinput.set_position
position() is annotated to return Tuple[int, int] and never None, so the guard always evaluated false (Sonar pythonbugs:S2583). Drop the check and unpack directly.
1 parent 656458f commit 7b51269

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

  • je_auto_control/linux_with_x11/uinput

je_auto_control/linux_with_x11/uinput/mouse.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,9 @@ def position() -> Tuple[int, int]:
5757

5858
def set_position(x: int, y: int) -> None:
5959
"""Move to absolute ``(x, y)`` by emitting the relative delta."""
60-
cur = position()
61-
if cur is None:
62-
return
63-
dx = int(x) - int(cur[0])
64-
dy = int(y) - int(cur[1])
60+
cur_x, cur_y = position()
61+
dx = int(x) - int(cur_x)
62+
dy = int(y) - int(cur_y)
6563
if dx == 0 and dy == 0:
6664
return
6765
emit_combo([

0 commit comments

Comments
 (0)