Skip to content

Commit bf8129e

Browse files
committed
build: updated deps, switched to ruff for pyupgrade+format
1 parent 38acb84 commit bf8129e

File tree

6 files changed

+336
-447
lines changed

6 files changed

+336
-447
lines changed

Makefile

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,17 @@ test-examples:
1515
cd examples; yes | python3 load_dataframe.py
1616
cd examples; python3 working_hours.py 'activitywatch|aw-|github.com' fakedata
1717

18-
typecheck:
19-
poetry run mypy
20-
21-
PYFILES=aw_client/*.py examples/*.py
22-
2318
lint:
2419
ruff check .
2520

2621
lint-fix:
27-
pyupgrade --py38-plus ${PYFILES} --exit-zero-even-if-changed
2822
ruff check --fix .
2923

24+
typecheck:
25+
poetry run mypy
26+
3027
format:
31-
black .
28+
ruff format .
3229

3330
clean:
3431
rm -rf build dist

aw_client/client.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ def __init__(
8888

8989
server_host = host or server_config["hostname"]
9090
server_port = port or server_config["port"]
91-
self.server_address = "{protocol}://{host}:{port}".format(
92-
protocol=protocol, host=server_host, port=server_port
93-
)
91+
self.server_address = f"{protocol}://{server_host}:{server_port}"
9492

9593
self.instance = SingleInstance(
9694
f"{self.client_name}-at-{server_host}-on-{server_port}"
@@ -445,9 +443,7 @@ def _try_connect(self) -> bool:
445443
self._create_buckets()
446444
self.connected = True
447445
logger.info(
448-
"Connection to aw-server established by {}".format(
449-
self.client.client_name
450-
)
446+
f"Connection to aw-server established by {self.client.client_name}"
451447
)
452448
except req.RequestException:
453449
self.connected = False
@@ -511,9 +507,7 @@ def run(self) -> None:
511507
# Connect
512508
while not self._try_connect():
513509
logger.warning(
514-
"Not connected to server, {} requests in queue".format(
515-
self._persistqueue.qsize()
516-
)
510+
f"Not connected to server, {self._persistqueue.qsize()} requests in queue"
517511
)
518512
if self.wait(self._attempt_reconnect_interval):
519513
break

aw_client/queries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class EnhancedJSONEncoder(json.JSONEncoder):
2828

2929
def default(self, o):
3030
if dataclasses.is_dataclass(o):
31-
return dataclasses.asdict(o)
31+
return dataclasses.asdict(o) # type: ignore
3232
return super().default(o)
3333

3434

examples/working_hours.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def query(regex: str, timeperiods, hostname: str):
6767
)
6868
]
6969

70-
aw = aw_client.ActivityWatchClient()
70+
aw = aw_client.ActivityWatchClient(client_name="working_hours")
7171

7272
canonicalQuery = queries.canonicalEvents(
7373
queries.DesktopQueryParams(

0 commit comments

Comments
 (0)