mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Update ruff to 0.1.15 (#109303)
This commit is contained in:
parent
9bb6d756f1
commit
d2dee9e327
@ -1,6 +1,6 @@
|
|||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.1.8
|
rev: v0.1.15
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args:
|
args:
|
||||||
|
@ -51,6 +51,7 @@ class PassiveBluetoothEntityKey:
|
|||||||
Example:
|
Example:
|
||||||
key: temperature
|
key: temperature
|
||||||
device_id: outdoor_sensor_1
|
device_id: outdoor_sensor_1
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
key: str
|
key: str
|
||||||
|
@ -21,6 +21,7 @@ def get_gas_price(data: EasyEnergyData, hours: int) -> float | None:
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The gas market price value.
|
The gas market price value.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not data.gas_today:
|
if not data.gas_today:
|
||||||
return None
|
return None
|
||||||
|
@ -208,6 +208,7 @@ def get_gas_price(data: EasyEnergyData, hours: int) -> float | None:
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The gas market price value.
|
The gas market price value.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if data.gas_today is None:
|
if data.gas_today is None:
|
||||||
return None
|
return None
|
||||||
|
@ -21,6 +21,7 @@ def get_gas_price(data: EnergyZeroData, hours: int) -> float | None:
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The gas market price value.
|
The gas market price value.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not data.gas_today:
|
if not data.gas_today:
|
||||||
return None
|
return None
|
||||||
|
@ -140,6 +140,7 @@ def get_gas_price(data: EnergyZeroData, hours: int) -> float | None:
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The gas market price value.
|
The gas market price value.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if data.gas_today is None:
|
if data.gas_today is None:
|
||||||
return None
|
return None
|
||||||
|
@ -332,6 +332,7 @@ class NukiCoordinator(DataUpdateCoordinator[None]): # pylint: disable=hass-enfo
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A dict with the events to be fired. The event type is the key and the device ids are the value
|
A dict with the events to be fired. The event type is the key and the device ids are the value
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
events: dict[str, set[str]] = defaultdict(set)
|
events: dict[str, set[str]] = defaultdict(set)
|
||||||
|
@ -502,6 +502,7 @@ class SensorEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
|||||||
Note:
|
Note:
|
||||||
suggested_unit_of_measurement is stored in the entity registry the first
|
suggested_unit_of_measurement is stored in the entity registry the first
|
||||||
time the entity is seen, and then never updated.
|
time the entity is seen, and then never updated.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if hasattr(self, "_attr_suggested_unit_of_measurement"):
|
if hasattr(self, "_attr_suggested_unit_of_measurement"):
|
||||||
return self._attr_suggested_unit_of_measurement
|
return self._attr_suggested_unit_of_measurement
|
||||||
|
@ -134,6 +134,7 @@ class HomeAssistantSnapcast:
|
|||||||
----------
|
----------
|
||||||
client : Snapclient
|
client : Snapclient
|
||||||
Snapcast client to be added to HA.
|
Snapcast client to be added to HA.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not self.hass_async_add_entities:
|
if not self.hass_async_add_entities:
|
||||||
return
|
return
|
||||||
|
@ -55,6 +55,7 @@ class OptionsValidationError(Exception):
|
|||||||
field_key must also match one of the field names inside the Options class.
|
field_key must also match one of the field names inside the Options class.
|
||||||
error_key: Name of the options.error key that corresponds to this error.
|
error_key: Name of the options.error key that corresponds to this error.
|
||||||
message: Message for the Exception class.
|
message: Message for the Exception class.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
self.field_key = field_key
|
self.field_key = field_key
|
||||||
|
@ -564,6 +564,7 @@ class ConfigurableFanValueMappingDataTemplate(
|
|||||||
|
|
||||||
`configuration_value_to_fan_value_mapping` maps the values from
|
`configuration_value_to_fan_value_mapping` maps the values from
|
||||||
`configuration_option` to the value mapping object.
|
`configuration_option` to the value mapping object.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def resolve_data(
|
def resolve_data(
|
||||||
@ -634,6 +635,7 @@ class FixedFanValueMappingDataTemplate(
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def get_fan_value_mapping(
|
def get_fan_value_mapping(
|
||||||
|
@ -364,6 +364,7 @@ def domain_key(config_key: Any) -> str:
|
|||||||
'hue 1' returns 'hue'
|
'hue 1' returns 'hue'
|
||||||
'hue ' raises
|
'hue ' raises
|
||||||
'hue ' raises
|
'hue ' raises
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not isinstance(config_key, str):
|
if not isinstance(config_key, str):
|
||||||
raise vol.Invalid("invalid domain", path=[config_key])
|
raise vol.Invalid("invalid domain", path=[config_key])
|
||||||
|
@ -2295,6 +2295,7 @@ def iif(
|
|||||||
{{ is_state("device_tracker.frenck", "home") | iif("yes", "no") }}
|
{{ is_state("device_tracker.frenck", "home") | iif("yes", "no") }}
|
||||||
{{ iif(1==2, "yes", "no") }}
|
{{ iif(1==2, "yes", "no") }}
|
||||||
{{ (1 == 1) | iif("yes", "no") }}
|
{{ (1 == 1) | iif("yes", "no") }}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if value is None and if_none is not _SENTINEL:
|
if value is None and if_none is not _SENTINEL:
|
||||||
return if_none
|
return if_none
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Automatically generated from .pre-commit-config.yaml by gen_requirements_all.py, do not edit
|
# Automatically generated from .pre-commit-config.yaml by gen_requirements_all.py, do not edit
|
||||||
|
|
||||||
codespell==2.2.2
|
codespell==2.2.2
|
||||||
ruff==0.1.8
|
ruff==0.1.15
|
||||||
yamllint==1.32.0
|
yamllint==1.32.0
|
||||||
|
@ -287,10 +287,10 @@ async def test_state(hass: HomeAssistant, media_player_entity, mock_blackbird) -
|
|||||||
async def test_supported_features(media_player_entity) -> None:
|
async def test_supported_features(media_player_entity) -> None:
|
||||||
"""Test supported features property."""
|
"""Test supported features property."""
|
||||||
assert (
|
assert (
|
||||||
MediaPlayerEntityFeature.TURN_ON
|
media_player_entity.supported_features
|
||||||
|
== MediaPlayerEntityFeature.TURN_ON
|
||||||
| MediaPlayerEntityFeature.TURN_OFF
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
| MediaPlayerEntityFeature.SELECT_SOURCE
|
| MediaPlayerEntityFeature.SELECT_SOURCE
|
||||||
== media_player_entity.supported_features
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2285,6 +2285,7 @@ async def test_cast_platform_play_media_local_media(
|
|||||||
quick_play_mock.assert_called()
|
quick_play_mock.assert_called()
|
||||||
app_data = quick_play_mock.call_args[0][2]
|
app_data = quick_play_mock.call_args[0][2]
|
||||||
# No authSig appended
|
# No authSig appended
|
||||||
assert app_data[
|
assert (
|
||||||
"media_id"
|
app_data["media_id"]
|
||||||
] == f"{network.get_url(hass)}/api/hls/bla/master_playlist.m3u8?token=bla"
|
== f"{network.get_url(hass)}/api/hls/bla/master_playlist.m3u8?token=bla"
|
||||||
|
)
|
||||||
|
@ -172,7 +172,8 @@ async def test_supported_features(
|
|||||||
# Features supported for main DVR
|
# Features supported for main DVR
|
||||||
state = hass.states.get(MAIN_ENTITY_ID)
|
state = hass.states.get(MAIN_ENTITY_ID)
|
||||||
assert (
|
assert (
|
||||||
MediaPlayerEntityFeature.PAUSE
|
state.attributes.get("supported_features")
|
||||||
|
== MediaPlayerEntityFeature.PAUSE
|
||||||
| MediaPlayerEntityFeature.TURN_ON
|
| MediaPlayerEntityFeature.TURN_ON
|
||||||
| MediaPlayerEntityFeature.TURN_OFF
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
| MediaPlayerEntityFeature.PLAY_MEDIA
|
| MediaPlayerEntityFeature.PLAY_MEDIA
|
||||||
@ -180,19 +181,18 @@ async def test_supported_features(
|
|||||||
| MediaPlayerEntityFeature.NEXT_TRACK
|
| MediaPlayerEntityFeature.NEXT_TRACK
|
||||||
| MediaPlayerEntityFeature.PREVIOUS_TRACK
|
| MediaPlayerEntityFeature.PREVIOUS_TRACK
|
||||||
| MediaPlayerEntityFeature.PLAY
|
| MediaPlayerEntityFeature.PLAY
|
||||||
== state.attributes.get("supported_features")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Feature supported for clients.
|
# Feature supported for clients.
|
||||||
state = hass.states.get(CLIENT_ENTITY_ID)
|
state = hass.states.get(CLIENT_ENTITY_ID)
|
||||||
assert (
|
assert (
|
||||||
MediaPlayerEntityFeature.PAUSE
|
state.attributes.get("supported_features")
|
||||||
|
== MediaPlayerEntityFeature.PAUSE
|
||||||
| MediaPlayerEntityFeature.PLAY_MEDIA
|
| MediaPlayerEntityFeature.PLAY_MEDIA
|
||||||
| MediaPlayerEntityFeature.STOP
|
| MediaPlayerEntityFeature.STOP
|
||||||
| MediaPlayerEntityFeature.NEXT_TRACK
|
| MediaPlayerEntityFeature.NEXT_TRACK
|
||||||
| MediaPlayerEntityFeature.PREVIOUS_TRACK
|
| MediaPlayerEntityFeature.PREVIOUS_TRACK
|
||||||
| MediaPlayerEntityFeature.PLAY
|
| MediaPlayerEntityFeature.PLAY
|
||||||
== state.attributes.get("supported_features")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -360,13 +360,13 @@ async def test_supported_features(hass: HomeAssistant) -> None:
|
|||||||
|
|
||||||
state = hass.states.get(ZONE_1_ID)
|
state = hass.states.get(ZONE_1_ID)
|
||||||
assert (
|
assert (
|
||||||
MediaPlayerEntityFeature.VOLUME_MUTE
|
state.attributes["supported_features"]
|
||||||
|
== MediaPlayerEntityFeature.VOLUME_MUTE
|
||||||
| MediaPlayerEntityFeature.VOLUME_SET
|
| MediaPlayerEntityFeature.VOLUME_SET
|
||||||
| MediaPlayerEntityFeature.VOLUME_STEP
|
| MediaPlayerEntityFeature.VOLUME_STEP
|
||||||
| MediaPlayerEntityFeature.TURN_ON
|
| MediaPlayerEntityFeature.TURN_ON
|
||||||
| MediaPlayerEntityFeature.TURN_OFF
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
| MediaPlayerEntityFeature.SELECT_SOURCE
|
| MediaPlayerEntityFeature.SELECT_SOURCE
|
||||||
== state.attributes["supported_features"]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ def fake_zones():
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
list: List of fake zones
|
list: List of fake zones
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return [
|
return [
|
||||||
{"name": "front", "number": 1},
|
{"name": "front", "number": 1},
|
||||||
@ -44,6 +45,7 @@ def client(fake_zones):
|
|||||||
|
|
||||||
Yields:
|
Yields:
|
||||||
MagicMock: Client Mock
|
MagicMock: Client Mock
|
||||||
|
|
||||||
"""
|
"""
|
||||||
with mock.patch.object(nx584_client, "Client") as _mock_client:
|
with mock.patch.object(nx584_client, "Client") as _mock_client:
|
||||||
client = nx584_client.Client.return_value
|
client = nx584_client.Client.return_value
|
||||||
|
@ -189,7 +189,8 @@ async def test_supported_features(
|
|||||||
# Features supported for Rokus
|
# Features supported for Rokus
|
||||||
state = hass.states.get(MAIN_ENTITY_ID)
|
state = hass.states.get(MAIN_ENTITY_ID)
|
||||||
assert (
|
assert (
|
||||||
MediaPlayerEntityFeature.PREVIOUS_TRACK
|
state.attributes.get("supported_features")
|
||||||
|
== MediaPlayerEntityFeature.PREVIOUS_TRACK
|
||||||
| MediaPlayerEntityFeature.NEXT_TRACK
|
| MediaPlayerEntityFeature.NEXT_TRACK
|
||||||
| MediaPlayerEntityFeature.VOLUME_STEP
|
| MediaPlayerEntityFeature.VOLUME_STEP
|
||||||
| MediaPlayerEntityFeature.VOLUME_MUTE
|
| MediaPlayerEntityFeature.VOLUME_MUTE
|
||||||
@ -200,7 +201,6 @@ async def test_supported_features(
|
|||||||
| MediaPlayerEntityFeature.TURN_ON
|
| MediaPlayerEntityFeature.TURN_ON
|
||||||
| MediaPlayerEntityFeature.TURN_OFF
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
| MediaPlayerEntityFeature.BROWSE_MEDIA
|
| MediaPlayerEntityFeature.BROWSE_MEDIA
|
||||||
== state.attributes.get("supported_features")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -214,7 +214,8 @@ async def test_tv_supported_features(
|
|||||||
state = hass.states.get(TV_ENTITY_ID)
|
state = hass.states.get(TV_ENTITY_ID)
|
||||||
assert state
|
assert state
|
||||||
assert (
|
assert (
|
||||||
MediaPlayerEntityFeature.PREVIOUS_TRACK
|
state.attributes.get("supported_features")
|
||||||
|
== MediaPlayerEntityFeature.PREVIOUS_TRACK
|
||||||
| MediaPlayerEntityFeature.NEXT_TRACK
|
| MediaPlayerEntityFeature.NEXT_TRACK
|
||||||
| MediaPlayerEntityFeature.VOLUME_STEP
|
| MediaPlayerEntityFeature.VOLUME_STEP
|
||||||
| MediaPlayerEntityFeature.VOLUME_MUTE
|
| MediaPlayerEntityFeature.VOLUME_MUTE
|
||||||
@ -225,7 +226,6 @@ async def test_tv_supported_features(
|
|||||||
| MediaPlayerEntityFeature.TURN_ON
|
| MediaPlayerEntityFeature.TURN_ON
|
||||||
| MediaPlayerEntityFeature.TURN_OFF
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
| MediaPlayerEntityFeature.BROWSE_MEDIA
|
| MediaPlayerEntityFeature.BROWSE_MEDIA
|
||||||
== state.attributes.get("supported_features")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -260,13 +260,13 @@ async def test_supported_features(hass: HomeAssistant) -> None:
|
|||||||
|
|
||||||
state = hass.states.get(ZONE_1_ID)
|
state = hass.states.get(ZONE_1_ID)
|
||||||
assert (
|
assert (
|
||||||
MediaPlayerEntityFeature.VOLUME_MUTE
|
state.attributes["supported_features"]
|
||||||
|
== MediaPlayerEntityFeature.VOLUME_MUTE
|
||||||
| MediaPlayerEntityFeature.VOLUME_SET
|
| MediaPlayerEntityFeature.VOLUME_SET
|
||||||
| MediaPlayerEntityFeature.VOLUME_STEP
|
| MediaPlayerEntityFeature.VOLUME_STEP
|
||||||
| MediaPlayerEntityFeature.TURN_ON
|
| MediaPlayerEntityFeature.TURN_ON
|
||||||
| MediaPlayerEntityFeature.TURN_OFF
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
| MediaPlayerEntityFeature.SELECT_SOURCE
|
| MediaPlayerEntityFeature.SELECT_SOURCE
|
||||||
== state.attributes["supported_features"]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user