♻️ refactor: relocate get_device_kinds, get_measure_keys, get_authenticated_user #191

Merged
mat merged 1 commit from refactor/relocate-misplaced-methods into main 2026-10-27 14:31:37 +00:00
Owner

Summary

Three methods move to the mixin that owns their domain — private-module moves only, resolution still happens on the composed ComwattClient, so the public API and every existing test are untouched:

_devices.py          get_device_kinds      ──► _catalogues.py   (catalogue read, next to get_products)
_connected_objects.py get_measure_keys     ──► _sites.py       (site-scoped lookup, not a CO subresource)
_sites.py            get_authenticated_user ─► _auth.py         (next to is_authenticated, same URL probed)

Kept in place (defensible): get_modbus_configurations stays in catalogues despite the /gateways/ path; get_electricity_contract_providers stays in electricity-contracts.

Evidence

  • Before: get_device_kinds sits in DevicesMixin, get_measure_keys in ConnectedObjectsMixin, get_authenticated_user in SitesMixin — flagged as misplaced by the #151 audit.
    After: each method lives in its domain mixin; pytest -q → 242 passed (no test edits), mypy → clean.

Merge Danger

Door: two-way

Blast Radius: none — same classes, same signatures, same flat client.* surface; only the private file layout changes.

Closes #177. Executes the method-relocation part of the #151 audit.

## Summary Three methods move to the mixin that owns their domain — private-module moves only, resolution still happens on the composed `ComwattClient`, so the public API and every existing test are untouched: ```text _devices.py get_device_kinds ──► _catalogues.py (catalogue read, next to get_products) _connected_objects.py get_measure_keys ──► _sites.py (site-scoped lookup, not a CO subresource) _sites.py get_authenticated_user ─► _auth.py (next to is_authenticated, same URL probed) ``` Kept in place (defensible): `get_modbus_configurations` stays in catalogues despite the `/gateways/` path; `get_electricity_contract_providers` stays in electricity-contracts. ## Evidence - **Before:** `get_device_kinds` sits in DevicesMixin, `get_measure_keys` in ConnectedObjectsMixin, `get_authenticated_user` in SitesMixin — flagged as misplaced by the #151 audit. **After:** each method lives in its domain mixin; `pytest -q` → 242 passed (no test edits), `mypy` → clean. ## Merge Danger **Door:** two-way **Blast Radius:** none — same classes, same signatures, same flat `client.*` surface; only the private file layout changes. Closes #177. Executes the method-relocation part of the #151 audit.
♻️ refactor: relocate get_device_kinds to catalogues, get_measure_keys to sites, get_authenticated_user to auth
All checks were successful
Tests / forgejo-pytest (push) Successful in 44s
Tests / forgejo-pytest (pull_request) Successful in 44s
2de1b59d89
mat changed title from WIP: ♻️ refactor: relocate get_device_kinds, get_measure_keys, get_authenticated_user to ♻️ refactor: relocate get_device_kinds, get_measure_keys, get_authenticated_user 2026-10-27 14:31:36 +00:00
mat merged commit 1da0771698 into main 2026-10-27 14:31:37 +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!191
No description provided.