From e47bdc06a0dc84e95e9bbc4af1928bd1a29036ef Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 4 Jul 2025 16:00:37 +0200 Subject: [PATCH] Set docstyle convention to google in ruff (#148142) --- homeassistant/components/habitica/util.py | 19 ++--- homeassistant/helpers/event.py | 97 +++++++++++------------ pyproject.toml | 1 + tests/conftest.py | 2 +- 4 files changed, 54 insertions(+), 65 deletions(-) diff --git a/homeassistant/components/habitica/util.py b/homeassistant/components/habitica/util.py index 9ef0b8cbadd..35e1577ae21 100644 --- a/homeassistant/components/habitica/util.py +++ b/homeassistant/components/habitica/util.py @@ -95,21 +95,16 @@ def get_recurrence_rule(recurrence: rrule) -> str: 'DTSTART:YYYYMMDDTHHMMSS\nRRULE:FREQ=YEARLY;INTERVAL=2' - Parameters - ---------- - recurrence : rrule - An RRULE object. + Args: + recurrence: An RRULE object. - Returns - ------- - str + Returns: The recurrence rule portion of the RRULE string, starting with 'FREQ='. - Example - ------- - >>> rule = get_recurrence_rule(task) - >>> print(rule) - 'FREQ=YEARLY;INTERVAL=2' + Example: + >>> rule = get_recurrence_rule(task) + >>> print(rule) + 'FREQ=YEARLY;INTERVAL=2' """ return str(recurrence).split("RRULE:")[1] diff --git a/homeassistant/helpers/event.py b/homeassistant/helpers/event.py index baf1f144a3f..3b959337b6d 100644 --- a/homeassistant/helpers/event.py +++ b/homeassistant/helpers/event.py @@ -866,19 +866,17 @@ def async_track_state_change_filtered( ) -> _TrackStateChangeFiltered: """Track state changes with a TrackStates filter that can be updated. - Parameters - ---------- - hass - Home assistant object. - track_states - A TrackStates data class. - action - Callable to call with results. + Args: + hass: + Home assistant object. + track_states: + A TrackStates data class. + action: + Callable to call with results. - Returns - ------- - Object used to update the listeners (async_update_listeners) with a new - TrackStates or cancel the tracking (async_remove). + Returns: + Object used to update the listeners (async_update_listeners) with a new + TrackStates or cancel the tracking (async_remove). """ tracker = _TrackStateChangeFiltered(hass, track_states, action) @@ -907,29 +905,26 @@ def async_track_template( exception, the listener will still be registered but will only fire if the template result becomes true without an exception. - Action arguments - ---------------- - entity_id - ID of the entity that triggered the state change. - old_state - The old state of the entity that changed. - new_state - New state of the entity that changed. + Action args: + entity_id: + ID of the entity that triggered the state change. + old_state: + The old state of the entity that changed. + new_state: + New state of the entity that changed. - Parameters - ---------- - hass - Home assistant object. - template - The template to calculate. - action - Callable to call with results. See above for arguments. - variables - Variables to pass to the template. + Args: + hass: + Home assistant object. + template: + The template to calculate. + action: + Callable to call with results. See above for arguments. + variables: + Variables to pass to the template. - Returns - ------- - Callable to unregister the listener. + Returns: + Callable to unregister the listener. """ job = HassJob(action, f"track template {template}") @@ -1361,26 +1356,24 @@ def async_track_template_result( Once the template returns to a non-error condition the result is sent to the action as usual. - Parameters - ---------- - hass - Home assistant object. - track_templates - An iterable of TrackTemplate. - action - Callable to call with results. - strict - When set to True, raise on undefined variables. - log_fn - If not None, template error messages will logging by calling log_fn - instead of the normal logging facility. - has_super_template - When set to True, the first template will block rendering of other - templates if it doesn't render as True. + Args: + hass: + Home assistant object. + track_templates: + An iterable of TrackTemplate. + action: + Callable to call with results. + strict: + When set to True, raise on undefined variables. + log_fn: + If not None, template error messages will logging by calling log_fn + instead of the normal logging facility. + has_super_template: + When set to True, the first template will block rendering of other + templates if it doesn't render as True. - Returns - ------- - Info object used to unregister the listener, and refresh the template. + Returns: + Info object used to unregister the listener, and refresh the template. """ tracker = TrackTemplateResultInfo(hass, track_templates, action, has_super_template) diff --git a/pyproject.toml b/pyproject.toml index 399d35ffb41..25f4d6d4a1a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -913,4 +913,5 @@ split-on-trailing-comma = false max-complexity = 25 [tool.ruff.lint.pydocstyle] +convention = "google" property-decorators = ["propcache.api.cached_property"] diff --git a/tests/conftest.py b/tests/conftest.py index ef31eee4004..9fdf010eb64 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1724,7 +1724,7 @@ async def async_test_recorder( wait_recorder: bool = True, wait_recorder_setup: bool = True, ) -> AsyncGenerator[recorder.Recorder]: - """Setup and return recorder instance.""" # noqa: D401 + """Setup and return recorder instance.""" await _async_init_recorder_component( hass, config,