Skip to content

Commit 575a6f5

Browse files
committed
fix: fixed lints
1 parent 2b638db commit 575a6f5

File tree

5 files changed

+14
-20
lines changed

5 files changed

+14
-20
lines changed

aw_watcher_afk/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
from . import __main__
21
from .__main__ import main
2+
3+
__all__ = ["main"]

aw_watcher_afk/afk.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import os
44
from datetime import datetime, timedelta, timezone
55
from time import sleep
6-
from typing import Optional
76

87
from aw_core.models import Event
98
from aw_client import ActivityWatchClient

aw_watcher_afk/macos.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import logging
21
from Quartz.CoreGraphics import (CGEventSourceSecondsSinceLastEventType,
32
kCGEventSourceStateHIDSystemState,
43
kCGAnyInputEventType)

aw_watcher_afk/unix.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22
from datetime import datetime
3+
from time import sleep
34

45
from .listeners import KeyboardListener, MouseListener
56

@@ -25,8 +26,8 @@ def seconds_since_last_input(self) -> float:
2526
self.logger.debug("New event")
2627
self.last_activity = now
2728
# Get/clear events
28-
mouse_event = self.mouseListener.next_event()
29-
keyboard_event = self.keyboardListener.next_event()
29+
self.mouseListener.next_event()
30+
self.keyboardListener.next_event()
3031
return (now - self.last_activity).total_seconds()
3132

3233

@@ -43,8 +44,6 @@ def seconds_since_last_input():
4344

4445

4546
if __name__ == "__main__":
46-
from time import sleep
47-
4847
while True:
4948
sleep(1)
5049
print(seconds_since_last_input())

aw_watcher_afk/windows.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
1-
import time
2-
31
import ctypes
4-
from ctypes import Structure, POINTER, WINFUNCTYPE, windll # type: ignore
5-
from ctypes.wintypes import BOOL, UINT, DWORD # type: ignore
2+
import time
3+
from ctypes import POINTER, WINFUNCTYPE, Structure
4+
from ctypes.wintypes import BOOL, DWORD, UINT
65

76

87
class LastInputInfo(Structure):
9-
_fields_ = [
10-
("cbSize", UINT),
11-
("dwTime", DWORD)
12-
]
8+
_fields_ = [("cbSize", UINT), ("dwTime", DWORD)]
139

1410

1511
def _getLastInputTick() -> int:
1612
prototype = WINFUNCTYPE(BOOL, POINTER(LastInputInfo))
17-
paramflags = ((1, "lastinputinfo"), )
13+
paramflags = ((1, "lastinputinfo"),)
1814
c_GetLastInputInfo = prototype(("GetLastInputInfo", ctypes.windll.user32), paramflags) # type: ignore
1915

20-
l = LastInputInfo()
21-
l.cbSize = ctypes.sizeof(LastInputInfo)
22-
assert 0 != c_GetLastInputInfo(l)
23-
return l.dwTime
16+
lastinput = LastInputInfo()
17+
lastinput.cbSize = ctypes.sizeof(LastInputInfo)
18+
assert 0 != c_GetLastInputInfo(lastinput)
19+
return lastinput.dwTime
2420

2521

2622
def _getTickCount() -> int:

0 commit comments

Comments
 (0)