Fix spelling [docstrings + comments] (#114168)

This commit is contained in:
Marc Mueller 2024-03-25 11:33:00 +01:00 committed by GitHub
parent 9b7cc088be
commit 81c34ac952
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 46 additions and 46 deletions

View file

@ -1584,7 +1584,7 @@ class AlexaModeController(AlexaCapability):
) )
modes += 1 modes += 1
# Alexa requiers at least 2 modes # Alexa requires at least 2 modes
if modes == 1: if modes == 1:
self._resource.add_mode(f"state.{PRESET_MODE_NA}", [PRESET_MODE_NA]) self._resource.add_mode(f"state.{PRESET_MODE_NA}", [PRESET_MODE_NA])

View file

@ -52,7 +52,7 @@ class IPWebcamBinarySensor(AndroidIPCamBaseEntity, BinarySensorEntity):
@property @property
def available(self) -> bool: def available(self) -> bool:
"""Return avaibility if setting is enabled.""" """Return availability if setting is enabled."""
return MOTION_ACTIVE in self.cam.enabled_sensors and super().available return MOTION_ACTIVE in self.cam.enabled_sensors and super().available
@property @property

View file

@ -408,7 +408,7 @@ class BaseAutomationEntity(ToggleEntity, ABC):
class UnavailableAutomationEntity(BaseAutomationEntity): class UnavailableAutomationEntity(BaseAutomationEntity):
"""A non-functional automation entity with its state set to unavailable. """A non-functional automation entity with its state set to unavailable.
This class is instatiated when an automation fails to validate. This class is instantiated when an automation fails to validate.
""" """
_attr_should_poll = False _attr_should_poll = False

View file

@ -132,7 +132,7 @@ class CCM15Climate(CoordinatorEntity[CCM15Coordinator], ClimateEntity):
@property @property
def available(self) -> bool: def available(self) -> bool:
"""Return the avalability of the entity.""" """Return the availability of the entity."""
return self.data is not None return self.data is not None
@property @property

View file

@ -177,7 +177,7 @@ class CloudGoogleConfig(AbstractConfig):
def get_local_user_id(self, webhook_id: Any) -> str: def get_local_user_id(self, webhook_id: Any) -> str:
"""Map webhook ID to a Home Assistant user ID. """Map webhook ID to a Home Assistant user ID.
Any action inititated by Google Assistant via the local SDK will be attributed Any action initiated by Google Assistant via the local SDK will be attributed
to the returned user ID. to the returned user ID.
""" """
return self._user return self._user

View file

@ -86,7 +86,7 @@ class Fan(CoordinatorEntity[FjaraskupanCoordinator], FanEntity):
async def async_set_percentage(self, percentage: int) -> None: async def async_set_percentage(self, percentage: int) -> None:
"""Set speed.""" """Set speed."""
# Proactively update percentage to mange successive increases # Proactively update percentage to manage successive increases
self._percentage = percentage self._percentage = percentage
async with self.coordinator.async_connect_and_update() as device: async with self.coordinator.async_connect_and_update() as device:

View file

@ -165,7 +165,7 @@ class AbstractConfig(ABC):
def get_local_user_id(self, webhook_id): def get_local_user_id(self, webhook_id):
"""Map webhook ID to a Home Assistant user ID. """Map webhook ID to a Home Assistant user ID.
Any action inititated by Google Assistant via the local SDK will be attributed Any action initiated by Google Assistant via the local SDK will be attributed
to the returned user ID. to the returned user ID.
Return None if no user id is found for the webhook_id. Return None if no user id is found for the webhook_id.

View file

@ -124,7 +124,7 @@ class GoogleConfig(AbstractConfig):
def get_local_user_id(self, webhook_id): def get_local_user_id(self, webhook_id):
"""Map webhook ID to a Home Assistant user ID. """Map webhook ID to a Home Assistant user ID.
Any action inititated by Google Assistant via the local SDK will be attributed Any action initiated by Google Assistant via the local SDK will be attributed
to the returned user ID. to the returned user ID.
Return None if no user id is found for the webhook_id. Return None if no user id is found for the webhook_id.

View file

@ -92,7 +92,7 @@ class HomeConnectPowerSwitch(HomeConnectEntity, SwitchEntity):
"""Power switch class for Home Connect.""" """Power switch class for Home Connect."""
def __init__(self, device): def __init__(self, device):
"""Inititialize the entity.""" """Initialize the entity."""
super().__init__(device, "Power") super().__init__(device, "Power")
async def async_turn_on(self, **kwargs: Any) -> None: async def async_turn_on(self, **kwargs: Any) -> None:

View file

@ -1,4 +1,4 @@
"""Expose iamges as media sources.""" """Expose images as media sources."""
from __future__ import annotations from __future__ import annotations

View file

@ -74,7 +74,7 @@ def _read_only_schema(name, value):
def get_schema(prop, name, groups): def get_schema(prop, name, groups):
"""Return the correct shema type.""" """Return the correct schema type."""
if prop.is_read_only: if prop.is_read_only:
return _read_only_schema(name, prop.value) return _read_only_schema(name, prop.value)
if name == RAMP_RATE_IN_SEC: if name == RAMP_RATE_IN_SEC:

View file

@ -173,7 +173,7 @@ class NestFlowHandler(
async def async_step_create_cloud_project( async def async_step_create_cloud_project(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle initial step in app credentails flow.""" """Handle initial step in app credentials flow."""
implementations = await config_entry_oauth2_flow.async_get_implementations( implementations = await config_entry_oauth2_flow.async_get_implementations(
self.hass, self.DOMAIN self.hass, self.DOMAIN
) )

View file

@ -41,7 +41,7 @@ async def async_setup_entry(
class NexiaBinarySensor(NexiaThermostatEntity, BinarySensorEntity): class NexiaBinarySensor(NexiaThermostatEntity, BinarySensorEntity):
"""Provices Nexia BinarySensor support.""" """Provides Nexia BinarySensor support."""
def __init__(self, coordinator, thermostat, sensor_call, translation_key): def __init__(self, coordinator, thermostat, sensor_call, translation_key):
"""Initialize the nexia sensor.""" """Initialize the nexia sensor."""

View file

@ -74,7 +74,7 @@ class DeviceData(TypedDict):
def none_or_int(value: str | None, base: int) -> int | None: def none_or_int(value: str | None, base: int) -> int | None:
"""Check if strin is one otherwise convert to int.""" """Check if string is one otherwise convert to int."""
if value is None: if value is None:
return None return None
return int(value, base) return int(value, base)

View file

@ -155,7 +155,7 @@ class RoonConfigFlow(ConfigFlow, domain=DOMAIN):
) )
async def async_step_link(self, user_input=None): async def async_step_link(self, user_input=None):
"""Handle linking and authenticting with the roon server.""" """Handle linking and authenticating with the roon server."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:
# Do not authenticate if the host is already configured # Do not authenticate if the host is already configured

View file

@ -447,7 +447,7 @@ class BaseScriptEntity(ToggleEntity, ABC):
class UnavailableScriptEntity(BaseScriptEntity): class UnavailableScriptEntity(BaseScriptEntity):
"""A non-functional script entity with its state set to unavailable. """A non-functional script entity with its state set to unavailable.
This class is instatiated when an script fails to validate. This class is instantiated when an script fails to validate.
""" """
_attr_should_poll = False _attr_should_poll = False

View file

@ -41,7 +41,7 @@ _LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Synology DSM sensors.""" """Set up Synology DSM sensors."""
# Migrate device indentifiers # Migrate device identifiers
dev_reg = dr.async_get(hass) dev_reg = dr.async_get(hass)
devices: list[dr.DeviceEntry] = dr.async_entries_for_config_entry( devices: list[dr.DeviceEntry] = dr.async_entries_for_config_entry(
dev_reg, entry.entry_id dev_reg, entry.entry_id

View file

@ -102,7 +102,7 @@ CONST_EXCLUSIVE_OVERLAY_GROUP = (
# Heat always comes first since we get the # Heat always comes first since we get the
# min and max tempatures for the zone from # min and max temperatures for the zone from
# it. # it.
# Heat is preferred as it generally has a lower minimum temperature # Heat is preferred as it generally has a lower minimum temperature
ORDERED_KNOWN_TADO_MODES = [ ORDERED_KNOWN_TADO_MODES = [

View file

@ -476,7 +476,7 @@ class TeslemetryVehicleTimeSensorEntity(TeslemetryVehicleEntity, SensorEntity):
@property @property
def available(self) -> bool: def available(self) -> bool:
"""Return the avaliability of the sensor.""" """Return the availability of the sensor."""
return isinstance(self._value, int | float) and self._value > 0 return isinstance(self._value, int | float) and self._value > 0

View file

@ -175,7 +175,7 @@ async def async_restore_traces(hass: HomeAssistant) -> None:
restored_traces = {} restored_traces = {}
for key, traces in restored_traces.items(): for key, traces in restored_traces.items():
# Add stored traces in reversed order to priorize the newest traces # Add stored traces in reversed order to prioritize the newest traces
for json_trace in reversed(traces): for json_trace in reversed(traces):
if ( if (
(stored_traces := _get_data(hass).get(key)) (stored_traces := _get_data(hass).get(key))

View file

@ -54,7 +54,7 @@ async def velbus_connect_task(
def _migrate_device_identifiers(hass: HomeAssistant, entry_id: str) -> None: def _migrate_device_identifiers(hass: HomeAssistant, entry_id: str) -> None:
"""Migrate old device indentifiers.""" """Migrate old device identifiers."""
dev_reg = dr.async_get(hass) dev_reg = dr.async_get(hass)
devices: list[dr.DeviceEntry] = dr.async_entries_for_config_entry(dev_reg, entry_id) devices: list[dr.DeviceEntry] = dr.async_entries_for_config_entry(dev_reg, entry_id)
for device in devices: for device in devices:

View file

@ -204,7 +204,7 @@ class XiaomiAqaraFlowHandler(ConfigFlow, domain=DOMAIN):
valid_key = True valid_key = True
if valid_key: if valid_key:
# format_mac, for a gateway the sid equels the mac address # format_mac, for a gateway the sid equals the mac address
mac_address = format_mac(self.sid) mac_address = format_mac(self.sid)
# set unique_id # set unique_id

View file

@ -2339,7 +2339,7 @@ async def websocket_subscribe_controller_statistics(
client: Client, client: Client,
driver: Driver, driver: Driver,
) -> None: ) -> None:
"""Subsribe to the statistics updates for a controller.""" """Subscribe to the statistics updates for a controller."""
@callback @callback
def async_cleanup() -> None: def async_cleanup() -> None:
@ -2434,7 +2434,7 @@ async def websocket_subscribe_node_statistics(
msg: dict[str, Any], msg: dict[str, Any],
node: Node, node: Node,
) -> None: ) -> None:
"""Subsribe to the statistics updates for a node.""" """Subscribe to the statistics updates for a node."""
@callback @callback
def async_cleanup() -> None: def async_cleanup() -> None:

View file

@ -57,7 +57,7 @@ class FakeSchedule:
"""Test fixture class for return events in a specific date range.""" """Test fixture class for return events in a specific date range."""
def __init__(self, hass: HomeAssistant, freezer: FrozenDateTimeFactory) -> None: def __init__(self, hass: HomeAssistant, freezer: FrozenDateTimeFactory) -> None:
"""Initiailize FakeSchedule.""" """Initialize FakeSchedule."""
self.hass = hass self.hass = hass
self.freezer = freezer self.freezer = freezer

View file

@ -100,7 +100,7 @@ SENSOR_STATES: dict[str, dict[str, Any]] = {
async def test_sensor_setup(hass: HomeAssistant, fc_class_mock, fh_class_mock) -> None: async def test_sensor_setup(hass: HomeAssistant, fc_class_mock, fh_class_mock) -> None:
"""Test setup of Fritz!Tools sesnors.""" """Test setup of Fritz!Tools sensors."""
entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_DATA) entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_DATA)
entry.add_to_hass(hass) entry.add_to_hass(hass)
@ -124,7 +124,7 @@ async def test_sensor_setup(hass: HomeAssistant, fc_class_mock, fh_class_mock) -
async def test_sensor_update_fail( async def test_sensor_update_fail(
hass: HomeAssistant, fc_class_mock, fh_class_mock hass: HomeAssistant, fc_class_mock, fh_class_mock
) -> None: ) -> None:
"""Test failed update of Fritz!Tools sesnors.""" """Test failed update of Fritz!Tools sensors."""
entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_DATA) entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_DATA)
entry.add_to_hass(hass) entry.add_to_hass(hass)

View file

@ -310,7 +310,7 @@ async def test_ingress_missing_peername(
aioclient_mock: AiohttpClientMocker, aioclient_mock: AiohttpClientMocker,
caplog: pytest.LogCaptureFixture, caplog: pytest.LogCaptureFixture,
) -> None: ) -> None:
"""Test hadnling of missing peername.""" """Test handling of missing peername."""
aioclient_mock.get( aioclient_mock.get(
"http://127.0.0.1/ingress/lorem/ipsum", "http://127.0.0.1/ingress/lorem/ipsum",
text="test", text="test",

View file

@ -1959,7 +1959,7 @@ async def test_thermostat_with_no_off_after_recheck(
async def test_thermostat_with_temp_clamps( async def test_thermostat_with_temp_clamps(
hass: HomeAssistant, hk_driver, events hass: HomeAssistant, hk_driver, events
) -> None: ) -> None:
"""Test that tempatures are clamped to valid values to prevent homekit crash.""" """Test that temperatures are clamped to valid values to prevent homekit crash."""
entity_id = "climate.test" entity_id = "climate.test"
base_attrs = { base_attrs = {
ATTR_SUPPORTED_FEATURES: ClimateEntityFeature.TARGET_TEMPERATURE ATTR_SUPPORTED_FEATURES: ClimateEntityFeature.TARGET_TEMPERATURE

View file

@ -26,7 +26,7 @@ async def init_integration(
config_entry: MockConfigEntry, config_entry: MockConfigEntry,
device_type: int, device_type: int,
) -> None: ) -> None:
"""Inititialize integration for testing.""" """Initialize integration for testing."""
with patch( with patch(
"pymystrom.get_device_info", "pymystrom.get_device_info",
side_effect=AsyncMock(return_value=get_default_device_response(device_type)), side_effect=AsyncMock(return_value=get_default_device_response(device_type)),

View file

@ -3,7 +3,7 @@
There are two interesting cases to exercise that have different strategies There are two interesting cases to exercise that have different strategies
for token refresh and for testing: for token refresh and for testing:
- API based requests, tested using aioclient_mock - API based requests, tested using aioclient_mock
- Pub/sub subcriber initialization, intercepted with patch() - Pub/sub subscriber initialization, intercepted with patch()
The tests below exercise both cases during integration setup. The tests below exercise both cases during integration setup.
""" """
@ -75,7 +75,7 @@ async def test_auth(
(method, url, data, headers) = calls[1] (method, url, data, headers) = calls[1]
assert headers == {"Authorization": f"Bearer {FAKE_TOKEN}"} assert headers == {"Authorization": f"Bearer {FAKE_TOKEN}"}
# Verify the susbcriber was created with the correct credentials # Verify the subscriber was created with the correct credentials
assert len(new_subscriber_mock.mock_calls) == 1 assert len(new_subscriber_mock.mock_calls) == 1
assert captured_creds assert captured_creds
creds = captured_creds creds = captured_creds

View file

@ -161,7 +161,7 @@ async def test_subscriber_auth_failure(
async def test_setup_missing_subscriber_id( async def test_setup_missing_subscriber_id(
hass: HomeAssistant, warning_caplog, setup_base_platform hass: HomeAssistant, warning_caplog, setup_base_platform
) -> None: ) -> None:
"""Test missing susbcriber id from configuration.""" """Test missing subscriber id from configuration."""
await setup_base_platform() await setup_base_platform()
assert "Configuration option" in warning_caplog.text assert "Configuration option" in warning_caplog.text

View file

@ -536,7 +536,7 @@ async def test_same_entity_included_excluded_include_domain_wins(
async def test_specificly_included_entity_always_wins( async def test_specificly_included_entity_always_wins(
recorder_mock: Recorder, hass: HomeAssistant recorder_mock: Recorder, hass: HomeAssistant
) -> None: ) -> None:
"""Test specificlly included entity always wins.""" """Test specifically included entity always wins."""
filter_accept = { filter_accept = {
"media_player.test2", "media_player.test2",
"media_player.test3", "media_player.test3",
@ -586,7 +586,7 @@ async def test_specificly_included_entity_always_wins(
async def test_specificly_included_entity_always_wins_over_glob( async def test_specificly_included_entity_always_wins_over_glob(
recorder_mock: Recorder, hass: HomeAssistant recorder_mock: Recorder, hass: HomeAssistant
) -> None: ) -> None:
"""Test specificlly included entity always wins over a glob.""" """Test specifically included entity always wins over a glob."""
filter_accept = { filter_accept = {
"sensor.apc900va_status", "sensor.apc900va_status",
"sensor.apc900va_battery_charge", "sensor.apc900va_battery_charge",

View file

@ -553,7 +553,7 @@ async def test_same_entity_included_excluded_include_domain_wins(
async def test_specificly_included_entity_always_wins( async def test_specificly_included_entity_always_wins(
legacy_recorder_mock: Recorder, hass: HomeAssistant legacy_recorder_mock: Recorder, hass: HomeAssistant
) -> None: ) -> None:
"""Test specificlly included entity always wins.""" """Test specifically included entity always wins."""
filter_accept = { filter_accept = {
"media_player.test2", "media_player.test2",
"media_player.test3", "media_player.test3",
@ -603,7 +603,7 @@ async def test_specificly_included_entity_always_wins(
async def test_specificly_included_entity_always_wins_over_glob( async def test_specificly_included_entity_always_wins_over_glob(
legacy_recorder_mock: Recorder, hass: HomeAssistant legacy_recorder_mock: Recorder, hass: HomeAssistant
) -> None: ) -> None:
"""Test specificlly included entity always wins over a glob.""" """Test specifically included entity always wins over a glob."""
filter_accept = { filter_accept = {
"sensor.apc900va_status", "sensor.apc900va_status",
"sensor.apc900va_battery_charge", "sensor.apc900va_battery_charge",

View file

@ -2067,7 +2067,7 @@ def test_deduplication_state_attributes_inside_commit_interval(
hass.states.set(entity_id, "on", attributes) hass.states.set(entity_id, "on", attributes)
hass.states.set(entity_id, "off", attributes) hass.states.set(entity_id, "off", attributes)
# Now exaust the cache to ensure we go back to the db # Now exhaust the cache to ensure we go back to the db
for attr_id in range(5): for attr_id in range(5):
hass.states.set(entity_id, "on", {"test_attr": attr_id}) hass.states.set(entity_id, "on", {"test_attr": attr_id})
hass.states.set(entity_id, "off", {"test_attr": attr_id}) hass.states.set(entity_id, "off", {"test_attr": attr_id})

View file

@ -1164,7 +1164,7 @@ async def test_script_variables(
async def test_script_this_var_always( async def test_script_this_var_always(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None: ) -> None:
"""Test script always has reference to this, even with no variabls are configured.""" """Test script always has reference to this, even with no variables are configured."""
assert await async_setup_component( assert await async_setup_component(
hass, hass,

View file

@ -118,7 +118,7 @@ class MockBinaryValveEntity(ValveEntity):
self._attr_is_closed = False self._attr_is_closed = False
def close_valve(self) -> None: def close_valve(self) -> None:
"""Mock implementantion for sync close function.""" """Mock implementation for sync close function."""
self._attr_is_closed = True self._attr_is_closed = True

View file

@ -124,7 +124,7 @@ async def test_async_update_locked_multiple_callbacks(
async def test_avaliable_after_update( async def test_avaliable_after_update(
hass: HomeAssistant, pywemo_registry, pywemo_device, wemo_entity, domain hass: HomeAssistant, pywemo_registry, pywemo_device, wemo_entity, domain
) -> None: ) -> None:
"""Test the avaliability when an On call fails and after an update. """Test the availability when an On call fails and after an update.
This test expects that the pywemo_device Mock has been setup to raise an This test expects that the pywemo_device Mock has been setup to raise an
ActionException when the SERVICE_TURN_ON method is called and that the ActionException when the SERVICE_TURN_ON method is called and that the

View file

@ -90,7 +90,7 @@ async def test_fan_update_entity(
async def test_available_after_update( async def test_available_after_update(
hass: HomeAssistant, pywemo_registry, pywemo_device, wemo_entity hass: HomeAssistant, pywemo_registry, pywemo_device, wemo_entity
) -> None: ) -> None:
"""Test the avaliability when an On call fails and after an update.""" """Test the availability when an On call fails and after an update."""
pywemo_device.set_state.side_effect = ActionException pywemo_device.set_state.side_effect = ActionException
pywemo_device.get_state.return_value = 1 pywemo_device.get_state.return_value = 1
await entity_test_helpers.test_avaliable_after_update( await entity_test_helpers.test_avaliable_after_update(

View file

@ -85,7 +85,7 @@ async def test_available_after_update(
pywemo_bridge_light, pywemo_bridge_light,
wemo_entity, wemo_entity,
) -> None: ) -> None:
"""Test the avaliability when an On call fails and after an update.""" """Test the availability when an On call fails and after an update."""
pywemo_bridge_light.turn_on.side_effect = pywemo.exceptions.ActionException pywemo_bridge_light.turn_on.side_effect = pywemo.exceptions.ActionException
pywemo_bridge_light.state["onoff"] = 1 pywemo_bridge_light.state["onoff"] = 1
await entity_test_helpers.test_avaliable_after_update( await entity_test_helpers.test_avaliable_after_update(

View file

@ -38,7 +38,7 @@ test_async_update_locked_callback_and_update = (
async def test_available_after_update( async def test_available_after_update(
hass: HomeAssistant, pywemo_registry, pywemo_device, wemo_entity hass: HomeAssistant, pywemo_registry, pywemo_device, wemo_entity
) -> None: ) -> None:
"""Test the avaliability when an On call fails and after an update.""" """Test the availability when an On call fails and after an update."""
pywemo_device.on.side_effect = ActionException pywemo_device.on.side_effect = ActionException
pywemo_device.get_state.return_value = 1 pywemo_device.get_state.return_value = 1
await entity_test_helpers.test_avaliable_after_update( await entity_test_helpers.test_avaliable_after_update(

View file

@ -103,7 +103,7 @@ async def test_switch_update_entity(
async def test_available_after_update( async def test_available_after_update(
hass: HomeAssistant, pywemo_registry, pywemo_device, wemo_entity hass: HomeAssistant, pywemo_registry, pywemo_device, wemo_entity
) -> None: ) -> None:
"""Test the avaliability when an On call fails and after an update.""" """Test the availability when an On call fails and after an update."""
pywemo_device.on.side_effect = pywemo.exceptions.ActionException pywemo_device.on.side_effect = pywemo.exceptions.ActionException
pywemo_device.get_state.return_value = 1 pywemo_device.get_state.return_value = 1
await entity_test_helpers.test_avaliable_after_update( await entity_test_helpers.test_avaliable_after_update(

View file

@ -3397,7 +3397,7 @@ async def test_disabled_condition(hass: HomeAssistant) -> None:
hass.states.async_set("binary_sensor.test", "on") hass.states.async_set("binary_sensor.test", "on")
assert test(hass) is None assert test(hass) is None
# Still passses, condition is not enabled # Still passes, condition is not enabled
hass.states.async_set("binary_sensor.test", "off") hass.states.async_set("binary_sensor.test", "off")
assert test(hass) is None assert test(hass) is None