docs: bring public docstrings up to NumPy completeness (#91)#100
Merged
Conversation
Expand thin one-line docstrings across public APIs to include the NumPy sections users and the mkdocstrings reference rely on. - api.py: HAClient lifecycle methods (connect/close/__aenter__/__aexit__) and accessor properties now document side effects, return shapes, and propagated exceptions. - Domain action shortcuts (switch.on/off/toggle, cover.open/close/stop/ toggle, lock.lock/unlock, fan.on/off/toggle, humidifier.on/off/toggle, valve.open/close/toggle, media_player.play/pause/play_pause/stop/next/ previous/power_on/power_off, timer.pause/cancel/finish, scene.delete, FavoriteItem.play) now document the underlying HA service and the CommandError / HTTPError / TimeoutError / ConnectionClosedError surface, including the lack of capability gating where relevant. - Properties with non-obvious semantics (Light.rgb_color, Switch.is_on, Scene.name/icon, Timer.duration/remaining/finishes_at/time_remaining/ persistent, MediaPlayer.now_playing) now document data shape and computation/coercion behavior. - Light.set_kelvin documents that the value is forwarded verbatim (no min/max clamping) and that out-of-range values surface as CommandError from HA.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #91.
Issue validity
Valid and actionable.
mkdocs.ymlconfigures mkdocstrings withdocstring_style: numpy, so reference docs quality depends directly on public docstrings. An audit confirmed several public APIs still had one-line docstrings missingReturns/Parameters/Raises/Notessections, particularly:_call_service(no-argon/off/toggle/play/pause/open/close/ ...)Light.set_kelvinnot clamping;Scene.namemapping tofriendly_name)Fix
Expanded docstrings across the public API surface to NumPy completeness:
src/haclient/api.py—HAClient.__aenter__,__aexit__,connect,close, and every public property (config,base_url,connection,events,services,state,domains,loop).switch,cover,lock,fan,humidifier,valve,media_player,scene,timer) — each now documents the underlying HA service invoked and theCommandError/HTTPError/TimeoutError/ConnectionClosedErrorsurface, plus capability-gating behavior where relevant (e.g.MediaPlayer.nextdoes not pre-checkNowPlaying.next).Light.rgb_color,Switch.is_on,Scene.name/icon,Timer.duration/remaining/finishes_at/time_remaining/persistent,MediaPlayer.now_playing.Light.set_kelvin— documents that the value is forwarded verbatim (no min/max clamping) and that out-of-range values surface asCommandErrorfrom HA.Scene.delete— documents that it only works for runtime-created scenes and that the local entity is not removed from the registry.Timer.cancel/finish— documents the auto-cleanup side effect for ephemeral timers.No behavior changes; documentation only.
Checks run
ruff check src tests— passedruff format --check src tests— passed (60 files already formatted)mypy src— passed (no issues in 38 source files)pytest tests/ --cov=haclient --cov-fail-under=95— 329 passed, 97.19% coverage