Set docstyle convention to google in ruff (#148142)

This commit is contained in:
epenet 2025-07-04 16:00:37 +02:00 committed by GitHub
parent b3d9908cd9
commit e47bdc06a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 54 additions and 65 deletions

View File

@ -95,21 +95,16 @@ def get_recurrence_rule(recurrence: rrule) -> str:
'DTSTART:YYYYMMDDTHHMMSS\nRRULE:FREQ=YEARLY;INTERVAL=2' 'DTSTART:YYYYMMDDTHHMMSS\nRRULE:FREQ=YEARLY;INTERVAL=2'
Parameters Args:
---------- recurrence: An RRULE object.
recurrence : rrule
An RRULE object.
Returns Returns:
-------
str
The recurrence rule portion of the RRULE string, starting with 'FREQ='. The recurrence rule portion of the RRULE string, starting with 'FREQ='.
Example Example:
------- >>> rule = get_recurrence_rule(task)
>>> rule = get_recurrence_rule(task) >>> print(rule)
>>> print(rule) 'FREQ=YEARLY;INTERVAL=2'
'FREQ=YEARLY;INTERVAL=2'
""" """
return str(recurrence).split("RRULE:")[1] return str(recurrence).split("RRULE:")[1]

View File

@ -866,19 +866,17 @@ def async_track_state_change_filtered(
) -> _TrackStateChangeFiltered: ) -> _TrackStateChangeFiltered:
"""Track state changes with a TrackStates filter that can be updated. """Track state changes with a TrackStates filter that can be updated.
Parameters Args:
---------- hass:
hass Home assistant object.
Home assistant object. track_states:
track_states A TrackStates data class.
A TrackStates data class. action:
action Callable to call with results.
Callable to call with results.
Returns Returns:
------- Object used to update the listeners (async_update_listeners) with a new
Object used to update the listeners (async_update_listeners) with a new TrackStates or cancel the tracking (async_remove).
TrackStates or cancel the tracking (async_remove).
""" """
tracker = _TrackStateChangeFiltered(hass, track_states, action) tracker = _TrackStateChangeFiltered(hass, track_states, action)
@ -907,29 +905,26 @@ def async_track_template(
exception, the listener will still be registered but will only exception, the listener will still be registered but will only
fire if the template result becomes true without an exception. fire if the template result becomes true without an exception.
Action arguments Action args:
---------------- entity_id:
entity_id ID of the entity that triggered the state change.
ID of the entity that triggered the state change. old_state:
old_state The old state of the entity that changed.
The old state of the entity that changed. new_state:
new_state New state of the entity that changed.
New state of the entity that changed.
Parameters Args:
---------- hass:
hass Home assistant object.
Home assistant object. template:
template The template to calculate.
The template to calculate. action:
action Callable to call with results. See above for arguments.
Callable to call with results. See above for arguments. variables:
variables Variables to pass to the template.
Variables to pass to the template.
Returns Returns:
------- Callable to unregister the listener.
Callable to unregister the listener.
""" """
job = HassJob(action, f"track template {template}") 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 Once the template returns to a non-error condition the result is sent
to the action as usual. to the action as usual.
Parameters Args:
---------- hass:
hass Home assistant object.
Home assistant object. track_templates:
track_templates An iterable of TrackTemplate.
An iterable of TrackTemplate. action:
action Callable to call with results.
Callable to call with results. strict:
strict When set to True, raise on undefined variables.
When set to True, raise on undefined variables. log_fn:
log_fn If not None, template error messages will logging by calling log_fn
If not None, template error messages will logging by calling log_fn instead of the normal logging facility.
instead of the normal logging facility. has_super_template:
has_super_template When set to True, the first template will block rendering of other
When set to True, the first template will block rendering of other templates if it doesn't render as True.
templates if it doesn't render as True.
Returns Returns:
------- Info object used to unregister the listener, and refresh the template.
Info object used to unregister the listener, and refresh the template.
""" """
tracker = TrackTemplateResultInfo(hass, track_templates, action, has_super_template) tracker = TrackTemplateResultInfo(hass, track_templates, action, has_super_template)

View File

@ -913,4 +913,5 @@ split-on-trailing-comma = false
max-complexity = 25 max-complexity = 25
[tool.ruff.lint.pydocstyle] [tool.ruff.lint.pydocstyle]
convention = "google"
property-decorators = ["propcache.api.cached_property"] property-decorators = ["propcache.api.cached_property"]

View File

@ -1724,7 +1724,7 @@ async def async_test_recorder(
wait_recorder: bool = True, wait_recorder: bool = True,
wait_recorder_setup: bool = True, wait_recorder_setup: bool = True,
) -> AsyncGenerator[recorder.Recorder]: ) -> AsyncGenerator[recorder.Recorder]:
"""Setup and return recorder instance.""" # noqa: D401 """Setup and return recorder instance."""
await _async_init_recorder_component( await _async_init_recorder_component(
hass, hass,
config, config,