♻️ refactor: fold BatchMixin into AggregationsMixin (drop the cast) #192

Merged
mat merged 1 commit from refactor/fold-batch-into-aggregations into main 2026-10-27 14:32:03 +00:00
Owner

Summary

BatchMixin (a single method) folds into AggregationsMixin; the cast("AggregationsMixin", self) coupling disappears with it:

_batch.py (deleted)
└── get_devices_ts_time_ago ──► _aggregations.py, AggregationsMixin
    └── calls self.get_device_ts_time_ago directly — no cast, no TYPE_CHECKING

client.py: BatchMixin import + base removed (16 → 15 mixins)
tests/test_batch.py: monkeypatch target moves with the module (_batch → _aggregations)

Evidence

  • Before: get_devices_ts_time_ago reached into AggregationsMixin via cast("AggregationsMixin", self) (_batch.py:41) — implicit MRO coupling flagged by the #151 audit.
    After: method lives next to get_device_ts_time_ago, calls it as plain self. method. pytest -q → 242 passed, mypy → clean.

Merge Danger

Door: two-way

Blast Radius: none — public API unchanged (client.get_devices_ts_time_ago identical); private module + test monkeypatch target only.

Closes the batch part of #176. Part of the #151 audit consolidation.

## Summary `BatchMixin` (a single method) folds into `AggregationsMixin`; the `cast("AggregationsMixin", self)` coupling disappears with it: ```text _batch.py (deleted) └── get_devices_ts_time_ago ──► _aggregations.py, AggregationsMixin └── calls self.get_device_ts_time_ago directly — no cast, no TYPE_CHECKING client.py: BatchMixin import + base removed (16 → 15 mixins) tests/test_batch.py: monkeypatch target moves with the module (_batch → _aggregations) ``` ## Evidence - **Before:** `get_devices_ts_time_ago` reached into `AggregationsMixin` via `cast("AggregationsMixin", self)` (`_batch.py:41`) — implicit MRO coupling flagged by the #151 audit. **After:** method lives next to `get_device_ts_time_ago`, calls it as plain `self.` method. `pytest -q` → 242 passed, `mypy` → clean. ## Merge Danger **Door:** two-way **Blast Radius:** none — public API unchanged (`client.get_devices_ts_time_ago` identical); private module + test monkeypatch target only. Closes the batch part of #176. Part of the #151 audit consolidation.
♻️ refactor: fold BatchMixin into AggregationsMixin (drop the cast)
All checks were successful
Tests / forgejo-pytest (push) Successful in 44s
Tests / forgejo-pytest (pull_request) Successful in 46s
133ca2d0c1
mat changed title from WIP: ♻️ refactor: fold BatchMixin into AggregationsMixin (drop the cast) to ♻️ refactor: fold BatchMixin into AggregationsMixin (drop the cast) 2026-10-27 14:31:38 +00:00
mat merged commit 45004637ab into main 2026-10-27 14:32:03 +00:00
Sign in to join this conversation.
No reviewers
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!192
No description provided.