From 810367b7576e365d44d35b64e7fca7c2562e71fe Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 3 Feb 2023 11:37:16 +0100 Subject: [PATCH] Fix `can not` typo (#87254) --- homeassistant/components/axis/device.py | 2 +- homeassistant/components/buienradar/camera.py | 2 +- homeassistant/components/cert_expiry/strings.json | 2 +- homeassistant/components/cloud/repairs.py | 2 +- homeassistant/components/deconz/gateway.py | 2 +- homeassistant/components/fjaraskupan/__init__.py | 2 +- homeassistant/components/geniushub/__init__.py | 2 +- homeassistant/components/hue/v2/group.py | 2 +- homeassistant/components/hue/v2/light.py | 4 ++-- homeassistant/components/influxdb/__init__.py | 2 +- homeassistant/components/modbus/validators.py | 2 +- homeassistant/components/mqtt/util.py | 2 +- homeassistant/components/onvif/base.py | 2 +- homeassistant/components/raspyrfm/switch.py | 2 +- homeassistant/components/recorder/core.py | 2 +- homeassistant/components/sensor/recorder.py | 4 ++-- homeassistant/components/soundtouch/media_player.py | 4 ++-- homeassistant/components/watson_iot/__init__.py | 2 +- homeassistant/components/wiz/strings.json | 2 +- homeassistant/components/zabbix/__init__.py | 2 +- homeassistant/exceptions.py | 2 +- homeassistant/helpers/config_validation.py | 2 +- tests/components/buienradar/test_camera.py | 2 +- tests/components/kraken/test_config_flow.py | 2 +- tests/components/modbus/test_sensor.py | 2 +- tests/components/sensor/test_recorder.py | 12 ++++++------ tests/util/test_json.py | 2 +- 27 files changed, 35 insertions(+), 35 deletions(-) diff --git a/homeassistant/components/axis/device.py b/homeassistant/components/axis/device.py index 2dce4b7692a..1a65b31ef72 100644 --- a/homeassistant/components/axis/device.py +++ b/homeassistant/components/axis/device.py @@ -155,7 +155,7 @@ class AxisNetworkDevice: Called when config entry is updated. This is a static method because a class method (bound method), - can not be used with weak references. + cannot be used with weak references. """ device: AxisNetworkDevice = hass.data[AXIS_DOMAIN][entry.entry_id] device.api.config.host = device.host diff --git a/homeassistant/components/buienradar/camera.py b/homeassistant/components/buienradar/camera.py index bbd24ea9966..265d40ab724 100644 --- a/homeassistant/components/buienradar/camera.py +++ b/homeassistant/components/buienradar/camera.py @@ -168,7 +168,7 @@ class BuienradarCam(Camera): # get lock, check iff loading, await notification if loading async with self._condition: - # can not be tested - mocked http response returns immediately + # cannot be tested - mocked http response returns immediately if self._loading: _LOGGER.debug("already loading - waiting for notification") await self._condition.wait() diff --git a/homeassistant/components/cert_expiry/strings.json b/homeassistant/components/cert_expiry/strings.json index bb50f1ee88b..5c8af4df931 100644 --- a/homeassistant/components/cert_expiry/strings.json +++ b/homeassistant/components/cert_expiry/strings.json @@ -12,7 +12,7 @@ } }, "error": { - "resolve_failed": "This host can not be resolved", + "resolve_failed": "This host cannot be resolved", "connection_timeout": "Timeout when connecting to this host", "connection_refused": "Connection refused when connecting to host" }, diff --git a/homeassistant/components/cloud/repairs.py b/homeassistant/components/cloud/repairs.py index 440254399db..dbc9b71a990 100644 --- a/homeassistant/components/cloud/repairs.py +++ b/homeassistant/components/cloud/repairs.py @@ -72,7 +72,7 @@ class LegacySubscriptionRepairFlow(RepairsFlow): async def _async_wait_for_plan_change() -> None: flow_manager = repairs_flow_manager(self.hass) - # We can not get here without a flow manager + # We cannot get here without a flow manager assert flow_manager is not None retries = 0 diff --git a/homeassistant/components/deconz/gateway.py b/homeassistant/components/deconz/gateway.py index c1b8139e6f7..d977e8813da 100644 --- a/homeassistant/components/deconz/gateway.py +++ b/homeassistant/components/deconz/gateway.py @@ -235,7 +235,7 @@ class DeconzGateway: ) -> None: """Handle signals of config entry being updated. - This is a static method because a class method (bound method), can not be used with weak references. + This is a static method because a class method (bound method), cannot be used with weak references. Causes for this is either discovery updating host address or config entry options changing. """ gateway = get_gateway_from_config_entry(hass, entry) diff --git a/homeassistant/components/fjaraskupan/__init__.py b/homeassistant/components/fjaraskupan/__init__.py index e009aeabe77..044d17662cf 100644 --- a/homeassistant/components/fjaraskupan/__init__.py +++ b/homeassistant/components/fjaraskupan/__init__.py @@ -36,7 +36,7 @@ from .const import DISPATCH_DETECTION, DOMAIN class UnableToConnect(HomeAssistantError): - """Exception to indicate that we can not connect to device.""" + """Exception to indicate that we cannot connect to device.""" PLATFORMS = [ diff --git a/homeassistant/components/geniushub/__init__.py b/homeassistant/components/geniushub/__init__.py index 32a15285d6c..4b460efeea6 100644 --- a/homeassistant/components/geniushub/__init__.py +++ b/homeassistant/components/geniushub/__init__.py @@ -310,7 +310,7 @@ class GeniusZone(GeniusEntity): # pylint: disable=protected-access if mode == "footprint" and not self._zone._has_pir: raise TypeError( - f"'{self.entity_id}' can not support footprint mode (it has no PIR)" + f"'{self.entity_id}' cannot support footprint mode (it has no PIR)" ) await self._zone.set_mode(mode) diff --git a/homeassistant/components/hue/v2/group.py b/homeassistant/components/hue/v2/group.py index dd22c98f63e..1cb862e3d77 100644 --- a/homeassistant/components/hue/v2/group.py +++ b/homeassistant/components/hue/v2/group.py @@ -177,7 +177,7 @@ class GroupedHueLight(HueBaseEntity, LightEntity): if flash is not None: await self.async_set_flash(flash) - # flash can not be sent with other commands at the same time + # flash cannot be sent with other commands at the same time return await self.bridge.async_request_call( diff --git a/homeassistant/components/hue/v2/light.py b/homeassistant/components/hue/v2/light.py index b925177f26b..f2c1571fda2 100644 --- a/homeassistant/components/hue/v2/light.py +++ b/homeassistant/components/hue/v2/light.py @@ -208,7 +208,7 @@ class HueLight(HueBaseEntity, LightEntity): if flash is not None: await self.async_set_flash(flash) - # flash can not be sent with other commands at the same time or result will be flaky + # flash cannot be sent with other commands at the same time or result will be flaky # Hue's default behavior is that a light returns to its previous state for short # flash (identify) and the light is kept turned on for long flash (breathe effect) # Why is this flash alert/effect hidden in the turn_on/off commands ? @@ -232,7 +232,7 @@ class HueLight(HueBaseEntity, LightEntity): if flash is not None: await self.async_set_flash(flash) - # flash can not be sent with other commands at the same time or result will be flaky + # flash cannot be sent with other commands at the same time or result will be flaky # Hue's default behavior is that a light returns to its previous state for short # flash (identify) and the light is kept turned on for long flash (breathe effect) return diff --git a/homeassistant/components/influxdb/__init__.py b/homeassistant/components/influxdb/__init__.py index d342a9d3aca..8fde1c2d8be 100644 --- a/homeassistant/components/influxdb/__init__.py +++ b/homeassistant/components/influxdb/__init__.py @@ -295,7 +295,7 @@ def _generate_event_to_json(conf: dict) -> Callable[[Event], dict[str, Any] | No key = f"{key}_" # Prevent column data errors in influxDB. # For each value we try to cast it as float - # But if we can not do it we store the value + # But if we cannot do it we store the value # as string add "_str" postfix to the field key try: json[INFLUX_CONF_FIELDS][key] = float(value) diff --git a/homeassistant/components/modbus/validators.py b/homeassistant/components/modbus/validators.py index 84e2e6d06b5..a583b93ea80 100644 --- a/homeassistant/components/modbus/validators.py +++ b/homeassistant/components/modbus/validators.py @@ -87,7 +87,7 @@ def struct_validator(config: dict[str, Any]) -> dict[str, Any]: raise vol.Invalid(error) if not structure: error = ( - f"Error in sensor {name}. The `{CONF_STRUCTURE}` field can not be empty" + f"Error in sensor {name}. The `{CONF_STRUCTURE}` field cannot be empty" ) raise vol.Invalid(error) try: diff --git a/homeassistant/components/mqtt/util.py b/homeassistant/components/mqtt/util.py index bf26729470d..44deb0781cb 100644 --- a/homeassistant/components/mqtt/util.py +++ b/homeassistant/components/mqtt/util.py @@ -108,7 +108,7 @@ def valid_publish_topic(topic: Any) -> str: """Validate that we can publish using this MQTT topic.""" validated_topic = valid_topic(topic) if "+" in validated_topic or "#" in validated_topic: - raise vol.Invalid("Wildcards can not be used in topic names") + raise vol.Invalid("Wildcards cannot be used in topic names") return validated_topic diff --git a/homeassistant/components/onvif/base.py b/homeassistant/components/onvif/base.py index f40b6173a3b..3b0f1efab38 100644 --- a/homeassistant/components/onvif/base.py +++ b/homeassistant/components/onvif/base.py @@ -26,7 +26,7 @@ class ONVIFBaseEntity(Entity): MAC address is not always available, and given the number of non-conformant ONVIF devices we have historically supported, - we can not guarantee serial number either. Due to this, we have + we cannot guarantee serial number either. Due to this, we have adopted an either/or approach in the config entry setup, and can guarantee that one or the other will be populated. See: https://github.com/home-assistant/core/issues/35883 diff --git a/homeassistant/components/raspyrfm/switch.py b/homeassistant/components/raspyrfm/switch.py index 6d4e09a96c8..6bf097b9f54 100644 --- a/homeassistant/components/raspyrfm/switch.py +++ b/homeassistant/components/raspyrfm/switch.py @@ -115,7 +115,7 @@ class RaspyRFMSwitch(SwitchEntity): @property def assumed_state(self): - """Return True when the current state can not be queried.""" + """Return True when the current state cannot be queried.""" return True @property diff --git a/homeassistant/components/recorder/core.py b/homeassistant/components/recorder/core.py index ddca32e6970..82e48cad97e 100644 --- a/homeassistant/components/recorder/core.py +++ b/homeassistant/components/recorder/core.py @@ -770,7 +770,7 @@ class Recorder(threading.Thread): _LOGGER.warning( "Database queue backlog reached more than 90% of maximum queue " "length while waiting for backup to finish; recorder will now " - "resume writing to database. The backup can not be trusted and " + "resume writing to database. The backup cannot be trusted and " "must be restarted" ) task.queue_overflow = True diff --git a/homeassistant/components/sensor/recorder.py b/homeassistant/components/sensor/recorder.py index 49a352bf17c..88343e32c31 100644 --- a/homeassistant/components/sensor/recorder.py +++ b/homeassistant/components/sensor/recorder.py @@ -224,7 +224,7 @@ def _normalize_states( hass.data[WARN_UNSUPPORTED_UNIT].add(entity_id) _LOGGER.warning( ( - "The unit of %s (%s) can not be converted to the unit of" + "The unit of %s (%s) cannot be converted to the unit of" " previously compiled statistics (%s). Generation of long term" " statistics will be suppressed unless the unit changes back to" " %s or a compatible unit. Go to %s to fix this" @@ -475,7 +475,7 @@ def _compile_statistics( # noqa: C901 hass.data[WARN_UNSTABLE_UNIT].add(entity_id) _LOGGER.warning( ( - "The unit of %s (%s) can not be converted to the unit of" + "The unit of %s (%s) cannot be converted to the unit of" " previously compiled statistics (%s). Generation of long" " term statistics will be suppressed unless the unit" " changes back to %s or a compatible unit. Go to %s to fix" diff --git a/homeassistant/components/soundtouch/media_player.py b/homeassistant/components/soundtouch/media_player.py index cab2076c750..bb7ad0577ac 100644 --- a/homeassistant/components/soundtouch/media_player.py +++ b/homeassistant/components/soundtouch/media_player.py @@ -345,7 +345,7 @@ class SoundTouchMediaPlayer(MediaPlayerEntity): """ Remove slave(s) from and existing zone (multi-room). - Zone must already exist and slaves array can not be empty. + Zone must already exist and slaves array cannot be empty. Note: If removing last slave, the zone will be deleted and you'll have to create a new one. You will not be able to add a new slave anymore @@ -370,7 +370,7 @@ class SoundTouchMediaPlayer(MediaPlayerEntity): """ Add slave(s) to and existing zone (multi-room). - Zone must already exist and slaves array can not be empty. + Zone must already exist and slaves array cannot be empty. :param slaves:slaves to add diff --git a/homeassistant/components/watson_iot/__init__.py b/homeassistant/components/watson_iot/__init__.py index 6271e3b9b82..5e3a150bed1 100644 --- a/homeassistant/components/watson_iot/__init__.py +++ b/homeassistant/components/watson_iot/__init__.py @@ -131,7 +131,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool: if key in out_event["fields"]: key = f"{key}_" # For each value we try to cast it as float - # But if we can not do it we store the value + # But if we cannot do it we store the value # as string try: out_event["fields"][key] = float(value) diff --git a/homeassistant/components/wiz/strings.json b/homeassistant/components/wiz/strings.json index 64537aacaf2..2efa3c9a1c3 100644 --- a/homeassistant/components/wiz/strings.json +++ b/homeassistant/components/wiz/strings.json @@ -21,7 +21,7 @@ "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "unknown": "[%key:common::config_flow::error::unknown%]", "bulb_time_out": "Can not connect to the bulb. Maybe the bulb is offline or a wrong IP was entered. Please turn on the light and try again!", - "no_wiz_light": "The bulb can not be connected via WiZ Platform integration.", + "no_wiz_light": "The bulb cannot be connected via WiZ Platform integration.", "no_ip": "Not a valid IP address." }, "abort": { diff --git a/homeassistant/components/zabbix/__init__.py b/homeassistant/components/zabbix/__init__.py index 3fc38af4cf1..a59465bf400 100644 --- a/homeassistant/components/zabbix/__init__.py +++ b/homeassistant/components/zabbix/__init__.py @@ -123,7 +123,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool: for key, value in state.attributes.items(): # For each value we try to cast it as float - # But if we can not do it we store the value + # But if we cannot do it we store the value # as string attribute_id = f"{entity_id}/{key}" try: diff --git a/homeassistant/exceptions.py b/homeassistant/exceptions.py index 953df61e840..6cc93ef4f66 100644 --- a/homeassistant/exceptions.py +++ b/homeassistant/exceptions.py @@ -207,7 +207,7 @@ class RequiredParameterMissing(HomeAssistantError): class DependencyError(HomeAssistantError): - """Raised when dependencies can not be setup.""" + """Raised when dependencies cannot be setup.""" def __init__(self, failed_dependencies: list[str]) -> None: """Initialize error.""" diff --git a/homeassistant/helpers/config_validation.py b/homeassistant/helpers/config_validation.py index 22022fbfa73..5d8f7d8a8fd 100644 --- a/homeassistant/helpers/config_validation.py +++ b/homeassistant/helpers/config_validation.py @@ -303,7 +303,7 @@ def entity_id_or_uuid(value: Any) -> str: def _entity_ids(value: str | list, allow_uuid: bool) -> list[str]: """Help validate entity IDs or UUIDs.""" if value is None: - raise vol.Invalid("Entity IDs can not be None") + raise vol.Invalid("Entity IDs cannot be None") if isinstance(value, str): value = [ent_id.strip() for ent_id in value.split(",")] diff --git a/tests/components/buienradar/test_camera.py b/tests/components/buienradar/test_camera.py index 9267caff959..300d9de3886 100644 --- a/tests/components/buienradar/test_camera.py +++ b/tests/components/buienradar/test_camera.py @@ -233,6 +233,6 @@ async def test_retries_after_error(aioclient_mock, hass, hass_client): resp_2 = await client.get("/api/camera_proxy/camera.buienradar_51_5288505_400216") assert aioclient_mock.call_count == 1 - # Binary text can not be added as body to `aioclient_mock.get(text=...)`, + # Binary text cannot be added as body to `aioclient_mock.get(text=...)`, # while `resp.read()` returns bytes, encode the value. assert (await resp_2.read()) == b"DEADBEEF" diff --git a/tests/components/kraken/test_config_flow.py b/tests/components/kraken/test_config_flow.py index 6015098e573..15e730baf37 100644 --- a/tests/components/kraken/test_config_flow.py +++ b/tests/components/kraken/test_config_flow.py @@ -29,7 +29,7 @@ async def test_config_flow(hass): async def test_already_configured(hass): - """Test we can not add a second config flow.""" + """Test we cannot add a second config flow.""" MockConfigEntry(domain=DOMAIN).add_to_hass(hass) result = await hass.config_entries.flow.async_init( diff --git a/tests/components/modbus/test_sensor.py b/tests/components/modbus/test_sensor.py index 02f55b075fa..40ba2bc7643 100644 --- a/tests/components/modbus/test_sensor.py +++ b/tests/components/modbus/test_sensor.py @@ -213,7 +213,7 @@ async def test_config_sensor(hass, mock_modbus): }, ] }, - f"Error in sensor {TEST_ENTITY_NAME}. The `structure` field can not be empty", + f"Error in sensor {TEST_ENTITY_NAME}. The `structure` field cannot be empty", ), ( { diff --git a/tests/components/sensor/test_recorder.py b/tests/components/sensor/test_recorder.py index e3df80d54df..8c38e1de64b 100644 --- a/tests/components/sensor/test_recorder.py +++ b/tests/components/sensor/test_recorder.py @@ -1944,7 +1944,7 @@ def test_compile_hourly_statistics_changing_units_1( ): """Test compiling hourly statistics where units change from one hour to the next. - This tests the case where the recorder can not convert between the units. + This tests the case where the recorder cannot convert between the units. """ zero = dt_util.utcnow() hass = hass_recorder() @@ -1970,7 +1970,7 @@ def test_compile_hourly_statistics_changing_units_1( do_adhoc_statistics(hass, start=zero) wait_recording_done(hass) - assert "can not be converted to the unit of previously" not in caplog.text + assert "cannot be converted to the unit of previously" not in caplog.text statistic_ids = list_statistic_ids(hass) assert statistic_ids == [ { @@ -2003,7 +2003,7 @@ def test_compile_hourly_statistics_changing_units_1( do_adhoc_statistics(hass, start=zero + timedelta(minutes=10)) wait_recording_done(hass) assert ( - f"The unit of sensor.test1 ({state_unit2}) can not be converted to the unit of " + f"The unit of sensor.test1 ({state_unit2}) cannot be converted to the unit of " f"previously compiled statistics ({state_unit})" in caplog.text ) statistic_ids = list_statistic_ids(hass) @@ -2388,7 +2388,7 @@ def test_compile_hourly_statistics_equivalent_units_1( do_adhoc_statistics(hass, start=zero) wait_recording_done(hass) - assert "can not be converted to the unit of previously" not in caplog.text + assert "cannot be converted to the unit of previously" not in caplog.text statistic_ids = list_statistic_ids(hass) assert statistic_ids == [ { @@ -3472,7 +3472,7 @@ async def test_validate_unit_change_convertible( """Test validate_statistics. This tests what happens if a sensor is first recorded in a unit which supports unit - conversion, and the unit is then changed to a unit which can and can not be + conversion, and the unit is then changed to a unit which can and cannot be converted to the original unit. The test also asserts that the sensor's device class is ignored. @@ -3671,7 +3671,7 @@ async def test_validate_statistics_unit_change_no_device_class( """Test validate_statistics. This tests what happens if a sensor is first recorded in a unit which supports unit - conversion, and the unit is then changed to a unit which can and can not be + conversion, and the unit is then changed to a unit which can and cannot be converted to the original unit. """ id = 1 diff --git a/tests/util/test_json.py b/tests/util/test_json.py index 509c0376fae..824ec16c91e 100644 --- a/tests/util/test_json.py +++ b/tests/util/test_json.py @@ -22,7 +22,7 @@ from homeassistant.util.json import ( # Test data that can be saved as JSON TEST_JSON_A = {"a": 1, "B": "two"} TEST_JSON_B = {"a": "one", "B": 2} -# Test data that can not be loaded as JSON +# Test data that cannot be loaded as JSON TEST_BAD_SERIALIED = "THIS IS NOT JSON\n" TMP_DIR = None