[client] Unify time_ago_value default: int 1 everywhere (str "1" in get_device_ts_time_ago) #186

Closed
opened 2026-10-27 11:31:56 +00:00 by mat · 0 comments
Owner

get_device_ts_time_ago defaults time_ago_value: int | str = "1" (string, _aggregations.py:176) while all five sibling aggregation methods default to the int 1 (_aggregations.py:57, 121, 230, 294, 346). Its docstring also says time_ago_value (str) despite the int | str type.

The wire format is unchanged either way (the param is stringified into the query), so aligning on the int default is cosmetic consistency — but it is what makes the 6 signatures look alike and stops readers from wondering which one is intentional.

Fix: time_ago_value: int | str = 1 + docstring (int | str); keep accepting strings (no behavior change for callers passing "1").

Done when: all six defaults read = 1, pytest -q green.

`get_device_ts_time_ago` defaults `time_ago_value: int | str = "1"` (string, `_aggregations.py:176`) while all five sibling aggregation methods default to the int `1` (`_aggregations.py:57, 121, 230, 294, 346`). Its docstring also says `time_ago_value (str)` despite the `int | str` type. The wire format is unchanged either way (the param is stringified into the query), so aligning on the int default is cosmetic consistency — but it is what makes the 6 signatures look alike and stops readers from wondering which one is intentional. **Fix:** `time_ago_value: int | str = 1` + docstring `(int | str)`; keep accepting strings (no behavior change for callers passing `"1"`). **Done when:** all six defaults read `= 1`, `pytest -q` green.
mat closed this issue 2026-10-27 14:39:08 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mat/python-comwatt-client#186
No description provided.