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'
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]

View File

@ -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)

View File

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

View File

@ -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,