Fix spelling [docstrings + comments] (#114168)
parent
9b7cc088be
commit
81c34ac952
|
@ -1584,7 +1584,7 @@ class AlexaModeController(AlexaCapability):
|
|||
)
|
||||
modes += 1
|
||||
|
||||
# Alexa requiers at least 2 modes
|
||||
# Alexa requires at least 2 modes
|
||||
if modes == 1:
|
||||
self._resource.add_mode(f"state.{PRESET_MODE_NA}", [PRESET_MODE_NA])
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class IPWebcamBinarySensor(AndroidIPCamBaseEntity, BinarySensorEntity):
|
|||
|
||||
@property
|
||||
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
|
||||
|
||||
@property
|
||||
|
|
|
@ -408,7 +408,7 @@ class BaseAutomationEntity(ToggleEntity, ABC):
|
|||
class UnavailableAutomationEntity(BaseAutomationEntity):
|
||||
"""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
|
||||
|
|
|
@ -132,7 +132,7 @@ class CCM15Climate(CoordinatorEntity[CCM15Coordinator], ClimateEntity):
|
|||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return the avalability of the entity."""
|
||||
"""Return the availability of the entity."""
|
||||
return self.data is not None
|
||||
|
||||
@property
|
||||
|
|
|
@ -177,7 +177,7 @@ class CloudGoogleConfig(AbstractConfig):
|
|||
def get_local_user_id(self, webhook_id: Any) -> str:
|
||||
"""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.
|
||||
"""
|
||||
return self._user
|
||||
|
|
|
@ -86,7 +86,7 @@ class Fan(CoordinatorEntity[FjaraskupanCoordinator], FanEntity):
|
|||
async def async_set_percentage(self, percentage: int) -> None:
|
||||
"""Set speed."""
|
||||
|
||||
# Proactively update percentage to mange successive increases
|
||||
# Proactively update percentage to manage successive increases
|
||||
self._percentage = percentage
|
||||
|
||||
async with self.coordinator.async_connect_and_update() as device:
|
||||
|
|
|
@ -165,7 +165,7 @@ class AbstractConfig(ABC):
|
|||
def get_local_user_id(self, webhook_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.
|
||||
|
||||
Return None if no user id is found for the webhook_id.
|
||||
|
|
|
@ -124,7 +124,7 @@ class GoogleConfig(AbstractConfig):
|
|||
def get_local_user_id(self, webhook_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.
|
||||
|
||||
Return None if no user id is found for the webhook_id.
|
||||
|
|
|
@ -92,7 +92,7 @@ class HomeConnectPowerSwitch(HomeConnectEntity, SwitchEntity):
|
|||
"""Power switch class for Home Connect."""
|
||||
|
||||
def __init__(self, device):
|
||||
"""Inititialize the entity."""
|
||||
"""Initialize the entity."""
|
||||
super().__init__(device, "Power")
|
||||
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"""Expose iamges as media sources."""
|
||||
"""Expose images as media sources."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ def _read_only_schema(name, value):
|
|||
|
||||
|
||||
def get_schema(prop, name, groups):
|
||||
"""Return the correct shema type."""
|
||||
"""Return the correct schema type."""
|
||||
if prop.is_read_only:
|
||||
return _read_only_schema(name, prop.value)
|
||||
if name == RAMP_RATE_IN_SEC:
|
||||
|
|
|
@ -173,7 +173,7 @@ class NestFlowHandler(
|
|||
async def async_step_create_cloud_project(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Handle initial step in app credentails flow."""
|
||||
"""Handle initial step in app credentials flow."""
|
||||
implementations = await config_entry_oauth2_flow.async_get_implementations(
|
||||
self.hass, self.DOMAIN
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ async def async_setup_entry(
|
|||
|
||||
|
||||
class NexiaBinarySensor(NexiaThermostatEntity, BinarySensorEntity):
|
||||
"""Provices Nexia BinarySensor support."""
|
||||
"""Provides Nexia BinarySensor support."""
|
||||
|
||||
def __init__(self, coordinator, thermostat, sensor_call, translation_key):
|
||||
"""Initialize the nexia sensor."""
|
||||
|
|
|
@ -74,7 +74,7 @@ class DeviceData(TypedDict):
|
|||
|
||||
|
||||
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:
|
||||
return None
|
||||
return int(value, base)
|
||||
|
|
|
@ -155,7 +155,7 @@ class RoonConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
)
|
||||
|
||||
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 = {}
|
||||
if user_input is not None:
|
||||
# Do not authenticate if the host is already configured
|
||||
|
|
|
@ -447,7 +447,7 @@ class BaseScriptEntity(ToggleEntity, ABC):
|
|||
class UnavailableScriptEntity(BaseScriptEntity):
|
||||
"""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
|
||||
|
|
|
@ -41,7 +41,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up Synology DSM sensors."""
|
||||
|
||||
# Migrate device indentifiers
|
||||
# Migrate device identifiers
|
||||
dev_reg = dr.async_get(hass)
|
||||
devices: list[dr.DeviceEntry] = dr.async_entries_for_config_entry(
|
||||
dev_reg, entry.entry_id
|
||||
|
|
|
@ -102,7 +102,7 @@ CONST_EXCLUSIVE_OVERLAY_GROUP = (
|
|||
|
||||
|
||||
# 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.
|
||||
# Heat is preferred as it generally has a lower minimum temperature
|
||||
ORDERED_KNOWN_TADO_MODES = [
|
||||
|
|
|
@ -476,7 +476,7 @@ class TeslemetryVehicleTimeSensorEntity(TeslemetryVehicleEntity, SensorEntity):
|
|||
|
||||
@property
|
||||
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
|
||||
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ async def async_restore_traces(hass: HomeAssistant) -> None:
|
|||
restored_traces = {}
|
||||
|
||||
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):
|
||||
if (
|
||||
(stored_traces := _get_data(hass).get(key))
|
||||
|
|
|
@ -54,7 +54,7 @@ async def velbus_connect_task(
|
|||
|
||||
|
||||
def _migrate_device_identifiers(hass: HomeAssistant, entry_id: str) -> None:
|
||||
"""Migrate old device indentifiers."""
|
||||
"""Migrate old device identifiers."""
|
||||
dev_reg = dr.async_get(hass)
|
||||
devices: list[dr.DeviceEntry] = dr.async_entries_for_config_entry(dev_reg, entry_id)
|
||||
for device in devices:
|
||||
|
|
|
@ -204,7 +204,7 @@ class XiaomiAqaraFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
valid_key = True
|
||||
|
||||
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)
|
||||
|
||||
# set unique_id
|
||||
|
|
|
@ -2339,7 +2339,7 @@ async def websocket_subscribe_controller_statistics(
|
|||
client: Client,
|
||||
driver: Driver,
|
||||
) -> None:
|
||||
"""Subsribe to the statistics updates for a controller."""
|
||||
"""Subscribe to the statistics updates for a controller."""
|
||||
|
||||
@callback
|
||||
def async_cleanup() -> None:
|
||||
|
@ -2434,7 +2434,7 @@ async def websocket_subscribe_node_statistics(
|
|||
msg: dict[str, Any],
|
||||
node: Node,
|
||||
) -> None:
|
||||
"""Subsribe to the statistics updates for a node."""
|
||||
"""Subscribe to the statistics updates for a node."""
|
||||
|
||||
@callback
|
||||
def async_cleanup() -> None:
|
||||
|
|
|
@ -57,7 +57,7 @@ class FakeSchedule:
|
|||
"""Test fixture class for return events in a specific date range."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, freezer: FrozenDateTimeFactory) -> None:
|
||||
"""Initiailize FakeSchedule."""
|
||||
"""Initialize FakeSchedule."""
|
||||
self.hass = hass
|
||||
self.freezer = freezer
|
||||
|
||||
|
|
|
@ -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:
|
||||
"""Test setup of Fritz!Tools sesnors."""
|
||||
"""Test setup of Fritz!Tools sensors."""
|
||||
|
||||
entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_DATA)
|
||||
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(
|
||||
hass: HomeAssistant, fc_class_mock, fh_class_mock
|
||||
) -> None:
|
||||
"""Test failed update of Fritz!Tools sesnors."""
|
||||
"""Test failed update of Fritz!Tools sensors."""
|
||||
|
||||
entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_DATA)
|
||||
entry.add_to_hass(hass)
|
||||
|
|
|
@ -310,7 +310,7 @@ async def test_ingress_missing_peername(
|
|||
aioclient_mock: AiohttpClientMocker,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test hadnling of missing peername."""
|
||||
"""Test handling of missing peername."""
|
||||
aioclient_mock.get(
|
||||
"http://127.0.0.1/ingress/lorem/ipsum",
|
||||
text="test",
|
||||
|
|
|
@ -1959,7 +1959,7 @@ async def test_thermostat_with_no_off_after_recheck(
|
|||
async def test_thermostat_with_temp_clamps(
|
||||
hass: HomeAssistant, hk_driver, events
|
||||
) -> 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"
|
||||
base_attrs = {
|
||||
ATTR_SUPPORTED_FEATURES: ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
|
|
|
@ -26,7 +26,7 @@ async def init_integration(
|
|||
config_entry: MockConfigEntry,
|
||||
device_type: int,
|
||||
) -> None:
|
||||
"""Inititialize integration for testing."""
|
||||
"""Initialize integration for testing."""
|
||||
with patch(
|
||||
"pymystrom.get_device_info",
|
||||
side_effect=AsyncMock(return_value=get_default_device_response(device_type)),
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
There are two interesting cases to exercise that have different strategies
|
||||
for token refresh and for testing:
|
||||
- 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.
|
||||
"""
|
||||
|
@ -75,7 +75,7 @@ async def test_auth(
|
|||
(method, url, data, headers) = calls[1]
|
||||
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 captured_creds
|
||||
creds = captured_creds
|
||||
|
|
|
@ -161,7 +161,7 @@ async def test_subscriber_auth_failure(
|
|||
async def test_setup_missing_subscriber_id(
|
||||
hass: HomeAssistant, warning_caplog, setup_base_platform
|
||||
) -> None:
|
||||
"""Test missing susbcriber id from configuration."""
|
||||
"""Test missing subscriber id from configuration."""
|
||||
await setup_base_platform()
|
||||
assert "Configuration option" in warning_caplog.text
|
||||
|
||||
|
|
|
@ -536,7 +536,7 @@ async def test_same_entity_included_excluded_include_domain_wins(
|
|||
async def test_specificly_included_entity_always_wins(
|
||||
recorder_mock: Recorder, hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test specificlly included entity always wins."""
|
||||
"""Test specifically included entity always wins."""
|
||||
filter_accept = {
|
||||
"media_player.test2",
|
||||
"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(
|
||||
recorder_mock: Recorder, hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test specificlly included entity always wins over a glob."""
|
||||
"""Test specifically included entity always wins over a glob."""
|
||||
filter_accept = {
|
||||
"sensor.apc900va_status",
|
||||
"sensor.apc900va_battery_charge",
|
||||
|
|
|
@ -553,7 +553,7 @@ async def test_same_entity_included_excluded_include_domain_wins(
|
|||
async def test_specificly_included_entity_always_wins(
|
||||
legacy_recorder_mock: Recorder, hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test specificlly included entity always wins."""
|
||||
"""Test specifically included entity always wins."""
|
||||
filter_accept = {
|
||||
"media_player.test2",
|
||||
"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(
|
||||
legacy_recorder_mock: Recorder, hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test specificlly included entity always wins over a glob."""
|
||||
"""Test specifically included entity always wins over a glob."""
|
||||
filter_accept = {
|
||||
"sensor.apc900va_status",
|
||||
"sensor.apc900va_battery_charge",
|
||||
|
|
|
@ -2067,7 +2067,7 @@ def test_deduplication_state_attributes_inside_commit_interval(
|
|||
hass.states.set(entity_id, "on", 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):
|
||||
hass.states.set(entity_id, "on", {"test_attr": attr_id})
|
||||
hass.states.set(entity_id, "off", {"test_attr": attr_id})
|
||||
|
|
|
@ -1164,7 +1164,7 @@ async def test_script_variables(
|
|||
async def test_script_this_var_always(
|
||||
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
|
||||
) -> 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(
|
||||
hass,
|
||||
|
|
|
@ -118,7 +118,7 @@ class MockBinaryValveEntity(ValveEntity):
|
|||
self._attr_is_closed = False
|
||||
|
||||
def close_valve(self) -> None:
|
||||
"""Mock implementantion for sync close function."""
|
||||
"""Mock implementation for sync close function."""
|
||||
self._attr_is_closed = True
|
||||
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ async def test_async_update_locked_multiple_callbacks(
|
|||
async def test_avaliable_after_update(
|
||||
hass: HomeAssistant, pywemo_registry, pywemo_device, wemo_entity, domain
|
||||
) -> 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
|
||||
ActionException when the SERVICE_TURN_ON method is called and that the
|
||||
|
|
|
@ -90,7 +90,7 @@ async def test_fan_update_entity(
|
|||
async def test_available_after_update(
|
||||
hass: HomeAssistant, pywemo_registry, pywemo_device, wemo_entity
|
||||
) -> 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.get_state.return_value = 1
|
||||
await entity_test_helpers.test_avaliable_after_update(
|
||||
|
|
|
@ -85,7 +85,7 @@ async def test_available_after_update(
|
|||
pywemo_bridge_light,
|
||||
wemo_entity,
|
||||
) -> 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.state["onoff"] = 1
|
||||
await entity_test_helpers.test_avaliable_after_update(
|
||||
|
|
|
@ -38,7 +38,7 @@ test_async_update_locked_callback_and_update = (
|
|||
async def test_available_after_update(
|
||||
hass: HomeAssistant, pywemo_registry, pywemo_device, wemo_entity
|
||||
) -> 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.get_state.return_value = 1
|
||||
await entity_test_helpers.test_avaliable_after_update(
|
||||
|
|
|
@ -103,7 +103,7 @@ async def test_switch_update_entity(
|
|||
async def test_available_after_update(
|
||||
hass: HomeAssistant, pywemo_registry, pywemo_device, wemo_entity
|
||||
) -> 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.get_state.return_value = 1
|
||||
await entity_test_helpers.test_avaliable_after_update(
|
||||
|
|
|
@ -3397,7 +3397,7 @@ async def test_disabled_condition(hass: HomeAssistant) -> None:
|
|||
hass.states.async_set("binary_sensor.test", "on")
|
||||
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")
|
||||
assert test(hass) is None
|
||||
|
||||
|
|
Loading…
Reference in New Issue