diff --git a/homeassistant/components/accuweather/__init__.py b/homeassistant/components/accuweather/__init__.py index 1f7e72681e6..25cff4ed4fc 100644 --- a/homeassistant/components/accuweather/__init__.py +++ b/homeassistant/components/accuweather/__init__.py @@ -135,4 +135,4 @@ class AccuWeatherDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]): ) as error: raise UpdateFailed(error) from error _LOGGER.debug("Requests remaining: %d", self.accuweather.requests_remaining) - return {**current, **{ATTR_FORECAST: forecast}} + return {**current, ATTR_FORECAST: forecast} diff --git a/homeassistant/components/anova/__init__.py b/homeassistant/components/anova/__init__.py index 653b556089c..9b0f649dad9 100644 --- a/homeassistant/components/anova/__init__.py +++ b/homeassistant/components/anova/__init__.py @@ -56,7 +56,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: entry, data={ **entry.data, - **{CONF_DEVICES: serialize_device_list(devices)}, + CONF_DEVICES: serialize_device_list(devices), }, ) coordinators = [AnovaCoordinator(hass, device) for device in devices] diff --git a/homeassistant/components/gogogate2/__init__.py b/homeassistant/components/gogogate2/__init__.py index ece2f6bbbc8..ceb07c99849 100644 --- a/homeassistant/components/gogogate2/__init__.py +++ b/homeassistant/components/gogogate2/__init__.py @@ -18,7 +18,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: if CONF_DEVICE not in entry.data: config_updates = { **entry.data, - **{CONF_DEVICE: DEVICE_TYPE_GOGOGATE2}, + CONF_DEVICE: DEVICE_TYPE_GOGOGATE2, } if config_updates: diff --git a/homeassistant/components/isy994/const.py b/homeassistant/components/isy994/const.py index daa474b736b..85ecafd6490 100644 --- a/homeassistant/components/isy994/const.py +++ b/homeassistant/components/isy994/const.py @@ -596,14 +596,12 @@ UOM_TO_STATES = { 4: "highly polluted", }, UOM_BARRIER: { # Barrier Status - **{ - 0: STATE_CLOSED, - 100: STATE_OPEN, - 101: STATE_UNKNOWN, - 102: "stopped", - 103: STATE_CLOSING, - 104: STATE_OPENING, - }, + 0: STATE_CLOSED, + 100: STATE_OPEN, + 101: STATE_UNKNOWN, + 102: "stopped", + 103: STATE_CLOSING, + 104: STATE_OPENING, **{ b: f"{b} %" for a, b in enumerate(list(range(1, 100))) }, # 1-99 are percentage open diff --git a/homeassistant/components/risco/config_flow.py b/homeassistant/components/risco/config_flow.py index bd703ca5a6d..0f13721856c 100644 --- a/homeassistant/components/risco/config_flow.py +++ b/homeassistant/components/risco/config_flow.py @@ -206,8 +206,8 @@ class RiscoConfigFlow(ConfigFlow, domain=DOMAIN): title=info["title"], data={ **user_input, - **{CONF_TYPE: TYPE_LOCAL}, - **{CONF_COMMUNICATION_DELAY: info["comm_delay"]}, + CONF_TYPE: TYPE_LOCAL, + CONF_COMMUNICATION_DELAY: info["comm_delay"], }, ) diff --git a/homeassistant/components/stream/worker.py b/homeassistant/components/stream/worker.py index 1bea660c95d..e86179a91eb 100644 --- a/homeassistant/components/stream/worker.py +++ b/homeassistant/components/stream/worker.py @@ -161,21 +161,19 @@ class StreamMuxer: mode="w", format=SEGMENT_CONTAINER_FORMAT, container_options={ - **{ - # Removed skip_sidx - see: - # https://github.com/home-assistant/core/pull/39970 - # "cmaf" flag replaces several of the movflags used, - # but too recent to use for now - "movflags": "frag_custom+empty_moov+default_base_moof+frag_discont+negative_cts_offsets+skip_trailer+delay_moov", - # Sometimes the first segment begins with negative timestamps, - # and this setting just - # adjusts the timestamps in the output from that segment to start - # from 0. Helps from having to make some adjustments - # in test_durations - "avoid_negative_ts": "make_non_negative", - "fragment_index": str(sequence + 1), - "video_track_timescale": str(int(1 / input_vstream.time_base)), - }, + # Removed skip_sidx - see: + # https://github.com/home-assistant/core/pull/39970 + # "cmaf" flag replaces several of the movflags used, + # but too recent to use for now + "movflags": "frag_custom+empty_moov+default_base_moof+frag_discont+negative_cts_offsets+skip_trailer+delay_moov", + # Sometimes the first segment begins with negative timestamps, + # and this setting just + # adjusts the timestamps in the output from that segment to start + # from 0. Helps from having to make some adjustments + # in test_durations + "avoid_negative_ts": "make_non_negative", + "fragment_index": str(sequence + 1), + "video_track_timescale": str(int(1 / input_vstream.time_base)), # Only do extra fragmenting if we are using ll_hls # Let ffmpeg do the work using frag_duration # Fragment durations may exceed the 15% allowed variance but it seems ok diff --git a/homeassistant/components/vera/config_flow.py b/homeassistant/components/vera/config_flow.py index 7c6a4376cd8..fcb1e5f013e 100644 --- a/homeassistant/components/vera/config_flow.py +++ b/homeassistant/components/vera/config_flow.py @@ -116,15 +116,15 @@ class VeraFlowHandler(ConfigFlow, domain=DOMAIN): { **user_input, **options_data(user_input), - **{CONF_SOURCE: SOURCE_USER}, - **{CONF_LEGACY_UNIQUE_ID: False}, + CONF_SOURCE: SOURCE_USER, + CONF_LEGACY_UNIQUE_ID: False, } ) return self.async_show_form( step_id="user", data_schema=vol.Schema( - {**{vol.Required(CONF_CONTROLLER): str}, **options_schema()} + {vol.Required(CONF_CONTROLLER): str, **options_schema()} ), ) @@ -148,8 +148,8 @@ class VeraFlowHandler(ConfigFlow, domain=DOMAIN): return await self.async_step_finish( { **config, - **{CONF_SOURCE: SOURCE_IMPORT}, - **{CONF_LEGACY_UNIQUE_ID: use_legacy_unique_id}, + CONF_SOURCE: SOURCE_IMPORT, + CONF_LEGACY_UNIQUE_ID: use_legacy_unique_id, } ) diff --git a/homeassistant/components/zha/websocket_api.py b/homeassistant/components/zha/websocket_api.py index fe9c5680e27..f9a92acdd4c 100644 --- a/homeassistant/components/zha/websocket_api.py +++ b/homeassistant/components/zha/websocket_api.py @@ -1098,7 +1098,7 @@ async def websocket_update_zha_configuration( """Update the ZHA configuration.""" zha_gateway = get_zha_gateway(hass) options = zha_gateway.config_entry.options - data_to_save = {**options, **{CUSTOM_CONFIGURATION: msg["data"]}} + data_to_save = {**options, CUSTOM_CONFIGURATION: msg["data"]} for section, schema in ZHA_CONFIG_SCHEMAS.items(): for entry in schema.schema: diff --git a/pyproject.toml b/pyproject.toml index aeff05426ae..c743e3507ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -605,6 +605,7 @@ select = [ "N815", # Variable {name} in class scope should not be mixedCase "PERF", # Perflint "PGH004", # Use specific rule codes when using noqa + "PIE800", # Unnecessary dictionary unpacking operators "PL", # pylint "PIE804", # Unnecessary dict kwargs "PIE790", # Unnecessary pass statement diff --git a/tests/components/cast/test_media_player.py b/tests/components/cast/test_media_player.py index 6b658ece853..ce69c6778f4 100644 --- a/tests/components/cast/test_media_player.py +++ b/tests/components/cast/test_media_player.py @@ -116,7 +116,7 @@ async def async_setup_cast(hass, config=None): """Set up the cast platform.""" if config is None: config = {} - data = {**{"ignore_cec": [], "known_hosts": [], "uuid": []}, **config} + data = {"ignore_cec": [], "known_hosts": [], "uuid": [], **config} with patch( "homeassistant.helpers.entity_platform.EntityPlatform._async_schedule_add_entities_for_entry" ) as add_entities: diff --git a/tests/components/energy/test_sensor.py b/tests/components/energy/test_sensor.py index c51a228f7f0..5b06d01c1b8 100644 --- a/tests/components/energy/test_sensor.py +++ b/tests/components/energy/test_sensor.py @@ -425,7 +425,7 @@ async def test_cost_sensor_price_entity_total( hass.states.async_set( usage_sensor_entity_id, initial_energy, - {**energy_attributes, **{"last_reset": last_reset}}, + {**energy_attributes, "last_reset": last_reset}, ) hass.states.async_set("sensor.energy_price", "1") @@ -444,7 +444,7 @@ async def test_cost_sensor_price_entity_total( hass.states.async_set( usage_sensor_entity_id, "0", - {**energy_attributes, **{"last_reset": last_reset}}, + {**energy_attributes, "last_reset": last_reset}, ) await hass.async_block_till_done() @@ -466,7 +466,7 @@ async def test_cost_sensor_price_entity_total( hass.states.async_set( usage_sensor_entity_id, "10", - {**energy_attributes, **{"last_reset": last_reset}}, + {**energy_attributes, "last_reset": last_reset}, ) await hass.async_block_till_done() state = hass.states.get(cost_sensor_entity_id) @@ -493,7 +493,7 @@ async def test_cost_sensor_price_entity_total( hass.states.async_set( usage_sensor_entity_id, "14.5", - {**energy_attributes, **{"last_reset": last_reset}}, + {**energy_attributes, "last_reset": last_reset}, ) await hass.async_block_till_done() state = hass.states.get(cost_sensor_entity_id) @@ -511,7 +511,7 @@ async def test_cost_sensor_price_entity_total( hass.states.async_set( usage_sensor_entity_id, "14", - {**energy_attributes, **{"last_reset": last_reset}}, + {**energy_attributes, "last_reset": last_reset}, ) await hass.async_block_till_done() state = hass.states.get(cost_sensor_entity_id) @@ -524,7 +524,7 @@ async def test_cost_sensor_price_entity_total( hass.states.async_set( usage_sensor_entity_id, "4", - {**energy_attributes, **{"last_reset": last_reset}}, + {**energy_attributes, "last_reset": last_reset}, ) await hass.async_block_till_done() state = hass.states.get(cost_sensor_entity_id) @@ -537,7 +537,7 @@ async def test_cost_sensor_price_entity_total( hass.states.async_set( usage_sensor_entity_id, "10", - {**energy_attributes, **{"last_reset": last_reset}}, + {**energy_attributes, "last_reset": last_reset}, ) await hass.async_block_till_done() state = hass.states.get(cost_sensor_entity_id) diff --git a/tests/components/risco/test_config_flow.py b/tests/components/risco/test_config_flow.py index 4775cfca903..d4dd4e3fac5 100644 --- a/tests/components/risco/test_config_flow.py +++ b/tests/components/risco/test_config_flow.py @@ -249,7 +249,8 @@ async def test_local_form(hass: HomeAssistant) -> None: expected_data = { **TEST_LOCAL_DATA, - **{"type": "local", CONF_COMMUNICATION_DELAY: 0}, + "type": "local", + CONF_COMMUNICATION_DELAY: 0, } assert result3["type"] == FlowResultType.CREATE_ENTRY assert result3["title"] == TEST_SITE_NAME diff --git a/tests/components/roborock/test_vacuum.py b/tests/components/roborock/test_vacuum.py index 97a76803b8f..4b683da88fc 100644 --- a/tests/components/roborock/test_vacuum.py +++ b/tests/components/roborock/test_vacuum.py @@ -140,7 +140,7 @@ async def test_failed_user_command( setup_entry: MockConfigEntry, ) -> None: """Test that when a user sends an invalid command, we raise HomeAssistantError.""" - data = {ATTR_ENTITY_ID: ENTITY_ID, **{"command": "fake_command"}} + data = {ATTR_ENTITY_ID: ENTITY_ID, "command": "fake_command"} with patch( "homeassistant.components.roborock.coordinator.RoborockLocalClient.send_command", side_effect=RoborockException(), diff --git a/tests/components/sensor/test_recorder.py b/tests/components/sensor/test_recorder.py index 83cfd8c2e83..40b38b2e57a 100644 --- a/tests/components/sensor/test_recorder.py +++ b/tests/components/sensor/test_recorder.py @@ -4140,14 +4140,14 @@ async def test_validate_unit_change_convertible( # No statistics, unit in state matching device class - empty response hass.states.async_set( - "sensor.test", 10, attributes={**attributes, **{"unit_of_measurement": unit}} + "sensor.test", 10, attributes={**attributes, "unit_of_measurement": unit} ) await async_recorder_block_till_done(hass) await assert_validation_result(client, {}) # No statistics, unit in state not matching device class - empty response hass.states.async_set( - "sensor.test", 11, attributes={**attributes, **{"unit_of_measurement": "dogs"}} + "sensor.test", 11, attributes={**attributes, "unit_of_measurement": "dogs"} ) await async_recorder_block_till_done(hass) await assert_validation_result(client, {}) @@ -4156,7 +4156,7 @@ async def test_validate_unit_change_convertible( await async_recorder_block_till_done(hass) do_adhoc_statistics(hass, start=now) hass.states.async_set( - "sensor.test", 12, attributes={**attributes, **{"unit_of_measurement": "dogs"}} + "sensor.test", 12, attributes={**attributes, "unit_of_measurement": "dogs"} ) await async_recorder_block_till_done(hass) expected = { @@ -4176,7 +4176,7 @@ async def test_validate_unit_change_convertible( # Valid state - empty response hass.states.async_set( - "sensor.test", 13, attributes={**attributes, **{"unit_of_measurement": unit}} + "sensor.test", 13, attributes={**attributes, "unit_of_measurement": unit} ) await async_recorder_block_till_done(hass) await assert_validation_result(client, {}) @@ -4188,7 +4188,7 @@ async def test_validate_unit_change_convertible( # Valid state in compatible unit - empty response hass.states.async_set( - "sensor.test", 13, attributes={**attributes, **{"unit_of_measurement": unit2}} + "sensor.test", 13, attributes={**attributes, "unit_of_measurement": unit2} ) await async_recorder_block_till_done(hass) await assert_validation_result(client, {}) @@ -4263,7 +4263,7 @@ async def test_validate_statistics_unit_ignore_device_class( do_adhoc_statistics(hass, start=now) await async_recorder_block_till_done(hass) hass.states.async_set( - "sensor.test", 12, attributes={**attributes, **{"unit_of_measurement": "dogs"}} + "sensor.test", 12, attributes={**attributes, "unit_of_measurement": "dogs"} ) await hass.async_block_till_done() await assert_validation_result(client, {}) @@ -4350,14 +4350,14 @@ async def test_validate_statistics_unit_change_no_device_class( # No statistics, sensor state set - empty response hass.states.async_set( - "sensor.test", 10, attributes={**attributes, **{"unit_of_measurement": unit}} + "sensor.test", 10, attributes={**attributes, "unit_of_measurement": unit} ) await async_recorder_block_till_done(hass) await assert_validation_result(client, {}) # No statistics, sensor state set to an incompatible unit - empty response hass.states.async_set( - "sensor.test", 11, attributes={**attributes, **{"unit_of_measurement": "dogs"}} + "sensor.test", 11, attributes={**attributes, "unit_of_measurement": "dogs"} ) await async_recorder_block_till_done(hass) await assert_validation_result(client, {}) @@ -4366,7 +4366,7 @@ async def test_validate_statistics_unit_change_no_device_class( await async_recorder_block_till_done(hass) do_adhoc_statistics(hass, start=now) hass.states.async_set( - "sensor.test", 12, attributes={**attributes, **{"unit_of_measurement": "dogs"}} + "sensor.test", 12, attributes={**attributes, "unit_of_measurement": "dogs"} ) await async_recorder_block_till_done(hass) expected = { @@ -4386,7 +4386,7 @@ async def test_validate_statistics_unit_change_no_device_class( # Valid state - empty response hass.states.async_set( - "sensor.test", 13, attributes={**attributes, **{"unit_of_measurement": unit}} + "sensor.test", 13, attributes={**attributes, "unit_of_measurement": unit} ) await async_recorder_block_till_done(hass) await assert_validation_result(client, {}) @@ -4398,7 +4398,7 @@ async def test_validate_statistics_unit_change_no_device_class( # Valid state in compatible unit - empty response hass.states.async_set( - "sensor.test", 13, attributes={**attributes, **{"unit_of_measurement": unit2}} + "sensor.test", 13, attributes={**attributes, "unit_of_measurement": unit2} ) await async_recorder_block_till_done(hass) await assert_validation_result(client, {}) @@ -4739,13 +4739,13 @@ async def test_validate_statistics_unit_change_no_conversion( # No statistics, original unit - empty response hass.states.async_set( - "sensor.test", 10, attributes={**attributes, **{"unit_of_measurement": unit1}} + "sensor.test", 10, attributes={**attributes, "unit_of_measurement": unit1} ) await assert_validation_result(client, {}) # No statistics, changed unit - empty response hass.states.async_set( - "sensor.test", 11, attributes={**attributes, **{"unit_of_measurement": unit2}} + "sensor.test", 11, attributes={**attributes, "unit_of_measurement": unit2} ) await assert_validation_result(client, {}) @@ -4757,7 +4757,7 @@ async def test_validate_statistics_unit_change_no_conversion( # No statistics, original unit - empty response hass.states.async_set( - "sensor.test", 12, attributes={**attributes, **{"unit_of_measurement": unit1}} + "sensor.test", 12, attributes={**attributes, "unit_of_measurement": unit1} ) await assert_validation_result(client, {}) @@ -4772,7 +4772,7 @@ async def test_validate_statistics_unit_change_no_conversion( # Change unit - expect error hass.states.async_set( - "sensor.test", 13, attributes={**attributes, **{"unit_of_measurement": unit2}} + "sensor.test", 13, attributes={**attributes, "unit_of_measurement": unit2} ) await async_recorder_block_till_done(hass) expected = { @@ -4792,7 +4792,7 @@ async def test_validate_statistics_unit_change_no_conversion( # Original unit - empty response hass.states.async_set( - "sensor.test", 14, attributes={**attributes, **{"unit_of_measurement": unit1}} + "sensor.test", 14, attributes={**attributes, "unit_of_measurement": unit1} ) await async_recorder_block_till_done(hass) await assert_validation_result(client, {}) @@ -4874,7 +4874,7 @@ async def test_validate_statistics_unit_change_equivalent_units( # No statistics, original unit - empty response hass.states.async_set( - "sensor.test", 10, attributes={**attributes, **{"unit_of_measurement": unit1}} + "sensor.test", 10, attributes={**attributes, "unit_of_measurement": unit1} ) await assert_validation_result(client, {}) @@ -4888,7 +4888,7 @@ async def test_validate_statistics_unit_change_equivalent_units( # Units changed to an equivalent unit - empty response hass.states.async_set( - "sensor.test", 12, attributes={**attributes, **{"unit_of_measurement": unit2}} + "sensor.test", 12, attributes={**attributes, "unit_of_measurement": unit2} ) await assert_validation_result(client, {}) @@ -4960,7 +4960,7 @@ async def test_validate_statistics_unit_change_equivalent_units_2( # No statistics, original unit - empty response hass.states.async_set( - "sensor.test", 10, attributes={**attributes, **{"unit_of_measurement": unit1}} + "sensor.test", 10, attributes={**attributes, "unit_of_measurement": unit1} ) await assert_validation_result(client, {}) @@ -4974,7 +4974,7 @@ async def test_validate_statistics_unit_change_equivalent_units_2( # Units changed to an equivalent unit which is not known by the unit converters hass.states.async_set( - "sensor.test", 12, attributes={**attributes, **{"unit_of_measurement": unit2}} + "sensor.test", 12, attributes={**attributes, "unit_of_measurement": unit2} ) expected = { "sensor.test": [ diff --git a/tests/components/vera/test_init.py b/tests/components/vera/test_init.py index 585d6d6f60a..666af780283 100644 --- a/tests/components/vera/test_init.py +++ b/tests/components/vera/test_init.py @@ -229,7 +229,7 @@ async def test_exclude_and_light_ids( controller_config=new_simple_controller_config( config_source=ConfigSource.CONFIG_ENTRY, devices=(vera_device1, vera_device2, vera_device3, vera_device4), - config={**{CONF_CONTROLLER: "http://127.0.0.1:123"}, **options}, + config={CONF_CONTROLLER: "http://127.0.0.1:123", **options}, ), )