Cleanup strings (#26243)

pull/26247/head
Andrew Sayre 2019-08-27 18:08:09 -05:00 committed by Aaron Bach
parent 6525f8704a
commit 3c07a9b4c7
5 changed files with 11 additions and 21 deletions

View File

@ -78,8 +78,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
"""Initialize config entry which represents an installed SmartApp."""
if not validate_webhook_requirements(hass):
_LOGGER.warning(
"The 'base_url' of the 'http' integration must be "
"configured and start with 'https://'"
"The 'base_url' of the 'http' integration must be configured and start with 'https://'"
)
return False
@ -121,8 +120,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
await device.status.refresh()
except ClientResponseError:
_LOGGER.debug(
"Unable to update status for device: %s (%s), "
"the device will be excluded",
"Unable to update status for device: %s (%s), the device will be excluded",
device.label,
device.device_id,
exc_info=True,
@ -148,8 +146,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
except ClientResponseError as ex:
if ex.status in (401, 403):
_LOGGER.exception(
"Unable to setup config entry '%s' - please "
"reconfigure the integration",
"Unable to setup config entry '%s' - please reconfigure the integration",
entry.title,
)
remove_entry = True
@ -186,9 +183,7 @@ async def async_get_entry_scenes(entry: ConfigEntry, api):
except ClientResponseError as ex:
if ex.status == 403:
_LOGGER.exception(
"Unable to load scenes for config entry '%s' "
"because the access token does not have the "
"required access",
"Unable to load scenes for config entry '%s' because the access token does not have the required access",
entry.title,
)
else:
@ -235,7 +230,7 @@ async def async_remove_entry(hass: HomeAssistantType, entry: ConfigEntry) -> Non
app_count = sum(1 for entry in all_entries if entry.data[CONF_APP_ID] == app_id)
if app_count > 1:
_LOGGER.debug(
"App %s was not removed because it is in use by other" "config entries",
"App %s was not removed because it is in use by other config entries",
app_id,
)
return

View File

@ -406,7 +406,7 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateDevice):
modes.add(state)
else:
_LOGGER.debug(
"Device %s (%s) returned an invalid supported " "AC mode: %s",
"Device %s (%s) returned an invalid supported AC mode: %s",
self._device.label,
self._device.device_id,
mode,

View File

@ -37,8 +37,5 @@ SUPPORTED_PLATFORMS = [
"scene",
]
TOKEN_REFRESH_INTERVAL = timedelta(days=14)
VAL_UID = (
"^(?:([0-9a-fA-F]{32})|([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]"
"{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}))$"
)
VAL_UID = "^(?:([0-9a-fA-F]{32})|([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}))$"
VAL_UID_MATCHER = re.compile(VAL_UID)

View File

@ -77,8 +77,7 @@ async def validate_installed_app(api, installed_app_id: str):
installed_app = await api.installed_app(installed_app_id)
if installed_app.installed_app_status != InstalledAppStatus.AUTHORIZED:
raise RuntimeWarning(
"Installed SmartApp instance '{}' ({}) is not "
"AUTHORIZED but instead {}".format(
"Installed SmartApp instance '{}' ({}) is not AUTHORIZED but instead {}".format(
installed_app.display_name,
installed_app.installed_app_id,
installed_app.installed_app_status,
@ -321,7 +320,7 @@ async def smartapp_sync_subscriptions(
)
except Exception as error: # pylint:disable=broad-except
_LOGGER.error(
"Failed to create subscription for '%s' under app " "'%s': %s",
"Failed to create subscription for '%s' under app '%s': %s",
target,
installed_app_id,
error,
@ -331,8 +330,7 @@ async def smartapp_sync_subscriptions(
try:
await api.delete_subscription(installed_app_id, sub.subscription_id)
_LOGGER.debug(
"Removed subscription for '%s' under app '%s' "
"because it was no longer needed",
"Removed subscription for '%s' under app '%s' because it was no longer needed",
sub.capability,
installed_app_id,
)

View File

@ -371,7 +371,7 @@ async def test_broker_regenerates_token(hass, config_entry):
stored_action = action
with patch(
"homeassistant.components.smartthings" ".async_track_time_interval",
"homeassistant.components.smartthings.async_track_time_interval",
new=async_track_time_interval,
):
broker = smartthings.DeviceBroker(hass, config_entry, token, Mock(), [], [])