Skip to content

Commit

Permalink
Remove unnecessary string literal concatenations (home-assistant#30360)
Browse files Browse the repository at this point in the history
  • Loading branch information
scop authored Jan 2, 2020
1 parent cac7500 commit e6388e1
Show file tree
Hide file tree
Showing 183 changed files with 362 additions and 393 deletions.
8 changes: 2 additions & 6 deletions homeassistant/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@ def ensure_config_path(config_dir: str) -> None:
try:
os.mkdir(lib_dir)
except OSError:
print(
("Fatal Error: Unable to create library " "directory {} ").format(
lib_dir
)
)
print("Fatal Error: Unable to create library directory {}".format(lib_dir))
sys.exit(1)


Expand Down Expand Up @@ -147,7 +143,7 @@ def get_arguments() -> argparse.Namespace:
"--log-file",
type=str,
default=None,
help="Log file to write to. If not set, CONFIG/home-assistant.log " "is used",
help="Log file to write to. If not set, CONFIG/home-assistant.log is used",
)
parser.add_argument(
"--log-no-color", action="store_true", help="Disable color logs"
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/auth/providers/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async def async_validate_login(self, username: str, password: str) -> None:

if process.returncode != 0:
_LOGGER.error(
"User %r failed to authenticate, command exited " "with code %d.",
"User %r failed to authenticate, command exited with code %d.",
username,
process.returncode,
)
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async def async_from_config_dict(
hass.config.skip_pip = skip_pip
if skip_pip:
_LOGGER.warning(
"Skipping pip installation of required modules. " "This may cause issues"
"Skipping pip installation of required modules. This may cause issues"
)

core_config = config.get(core.DOMAIN, {})
Expand Down Expand Up @@ -168,7 +168,7 @@ def async_enable_logging(
This method must be run in the event loop.
"""
fmt = "%(asctime)s %(levelname)s (%(threadName)s) " "[%(name)s] %(message)s"
fmt = "%(asctime)s %(levelname)s (%(threadName)s) [%(name)s] %(message)s"
datefmt = "%Y-%m-%d %H:%M:%S"

if not log_no_color:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alexa/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def async_do_auth(self, accept_grant_code):
"client_secret": self.client_secret,
}
_LOGGER.debug(
"Calling LWA to get the access token (first time), " "with: %s",
"Calling LWA to get the access token (first time), with: %s",
json.dumps(lwa_params),
)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/arest/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
response = requests.get(resource, timeout=10).json()
except requests.exceptions.MissingSchema:
_LOGGER.error(
"Missing resource or schema in configuration. " "Add http:// to your URL"
"Missing resource or schema in configuration. Add http:// to your URL"
)
return False
except requests.exceptions.ConnectionError:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/arest/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
response = requests.get(resource, timeout=10).json()
except requests.exceptions.MissingSchema:
_LOGGER.error(
"Missing resource or schema in configuration. " "Add http:// to your URL"
"Missing resource or schema in configuration. Add http:// to your URL"
)
return False
except requests.exceptions.ConnectionError:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/arest/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
response = requests.get(resource, timeout=10)
except requests.exceptions.MissingSchema:
_LOGGER.error(
"Missing resource or schema in configuration. " "Add http:// to your URL"
"Missing resource or schema in configuration. Add http:// to your URL"
)
return False
except requests.exceptions.ConnectionError:
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/august/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def _update_doorbells(self):
)
except RequestException as ex:
_LOGGER.error(
"Request error trying to retrieve doorbell" " status for %s. %s",
"Request error trying to retrieve doorbell status for %s. %s",
doorbell.device_name,
ex,
)
Expand Down Expand Up @@ -301,7 +301,7 @@ def _update_doors(self):
)
except RequestException as ex:
_LOGGER.error(
"Request error trying to retrieve door" " status for %s. %s",
"Request error trying to retrieve door status for %s. %s",
lock.device_name,
ex,
)
Expand All @@ -327,7 +327,7 @@ def _update_locks(self):
)
except RequestException as ex:
_LOGGER.error(
"Request error trying to retrieve door" " status for %s. %s",
"Request error trying to retrieve door status for %s. %s",
lock.device_name,
ex,
)
Expand All @@ -342,7 +342,7 @@ def _update_locks(self):
)
except RequestException as ex:
_LOGGER.error(
"Request error trying to retrieve door" " details for %s. %s",
"Request error trying to retrieve door details for %s. %s",
lock.device_name,
ex,
)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/aurora/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

_LOGGER = logging.getLogger(__name__)

ATTRIBUTION = "Data provided by the National Oceanic and Atmospheric " "Administration"
ATTRIBUTION = "Data provided by the National Oceanic and Atmospheric Administration"
CONF_THRESHOLD = "forecast_threshold"

DEFAULT_DEVICE_CLASS = "visible"
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/auth/indieauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def fetch_redirect_uris(hass, url):
pass
except aiohttp.client_exceptions.ClientConnectionError:
_LOGGER.error(
("Low level connection error while looking up " "redirect_uri %s"), url
"Low level connection error while looking up redirect_uri %s", url
)
pass
except aiohttp.client_exceptions.ClientError:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/automatic/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def handle_event(self, name, event):
if event.created_at < self.vehicle_seen[event.vehicle.id]:
# Skip events received out of order
_LOGGER.debug(
"Skipping out of order event. Event Created %s. " "Last seen event: %s",
"Skipping out of order event. Event Created %s. Last seen event: %s",
event.created_at,
self.vehicle_seen[event.vehicle.id],
)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/automation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ async def async_added_to_hass(self) -> None:
else:
enable_automation = DEFAULT_INITIAL_STATE
_LOGGER.debug(
"Automation %s not in state storage, state %s from " "default is used.",
"Automation %s not in state storage, state %s from default is used.",
self.entity_id,
enable_automation,
)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/buienradar/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
CONF_DIMENSION = "dimension"
CONF_DELTA = "delta"

RADAR_MAP_URL_TEMPLATE = "https://api.buienradar.nl/image/1.0/" "RadarMapNL?w={w}&h={h}"
RADAR_MAP_URL_TEMPLATE = "https://api.buienradar.nl/image/1.0/RadarMapNL?w={w}&h={h}"

_LOG = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/buienradar/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ async def async_update(self, *_):
if raincontent.get(SUCCESS) is not True:
# unable to get the data
_LOGGER.warning(
"Unable to retrieve raindata from Buienradar." "(Msg: %s, status: %s,)",
"Unable to retrieve raindata from Buienradar. (Msg: %s, status: %s)",
raincontent.get(MESSAGE),
raincontent.get(STATUS_CODE),
)
Expand All @@ -136,7 +136,7 @@ async def async_update(self, *_):
if result.get(SUCCESS) is not True:
if int(datetime.now().strftime("%H")) > 0:
_LOGGER.warning(
"Unable to parse data from Buienradar." "(Msg: %s)",
"Unable to parse data from Buienradar. (Msg: %s)",
result.get(MESSAGE),
)
await self.schedule_update(SCHEDULE_NOK)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/camera/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ async def async_get_still_stream(request, image_cb, content_type, interval):
This method must be run in the event loop.
"""
response = web.StreamResponse()
response.content_type = "multipart/x-mixed-replace; " "boundary=--frameboundary"
response.content_type = "multipart/x-mixed-replace; boundary=--frameboundary"
await response.prepare(request)

async def write_to_mjpeg_stream(img_bytes):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ def _update_info(self):
"""Check the Cisco ME controller for devices."""
self.last_results = self.controller.get_associated_devices()
_LOGGER.debug(
"Cisco Mobility Express controller returned:" " %s", self.last_results
"Cisco Mobility Express controller returned: %s", self.last_results
)
2 changes: 1 addition & 1 deletion homeassistant/components/cisco_webex_teams/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ def send_message(self, message="", **kwargs):
self.client.messages.create(roomId=self.room, html=f"{title}{message}")
except ApiError as api_error:
_LOGGER.error(
"Could not send CiscoWebexTeams notification. " "Error: %s", api_error
"Could not send CiscoWebexTeams notification. Error: %s", api_error
)
6 changes: 2 additions & 4 deletions homeassistant/components/citybikes/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
STATIONS_URI = "v2/networks/{uid}?fields=network.stations"

CITYBIKES_ATTRIBUTION = (
"Information provided by the CityBikes Project " "(https://citybik.es/#about)"
"Information provided by the CityBikes Project (https://citybik.es/#about)"
)

CITYBIKES_NETWORKS = "citybikes_networks"
Expand Down Expand Up @@ -143,9 +143,7 @@ async def async_citybikes_request(hass, uri, schema):
except ValueError:
_LOGGER.error("Received non-JSON data from CityBikes API endpoint")
except vol.Invalid as err:
_LOGGER.error(
"Received unexpected JSON from CityBikes" " API endpoint: %s", err
)
_LOGGER.error("Received unexpected JSON from CityBikes API endpoint: %s", err)
raise CityBikesRequestError


Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/cloud/http_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ async def alexa_sync(hass, connection, msg):
connection.send_error(
msg["id"],
"alexa_relink",
"Please go to the Alexa app and re-link the Home Assistant " "skill.",
"Please go to the Alexa app and re-link the Home Assistant skill.",
)
return

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/coinbase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,5 @@ def update(self):
self.exchange_rates = self.client.get_exchange_rates()
except AuthenticationError as coinbase_error:
_LOGGER.error(
"Authentication error connecting" " to coinbase: %s", coinbase_error
"Authentication error connecting to coinbase: %s", coinbase_error
)
3 changes: 1 addition & 2 deletions homeassistant/components/decora/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ def wrapper_retry(device, *args, **kwargs):
return method(device, *args, **kwargs)
except (decora.decoraException, AttributeError, BTLEException):
_LOGGER.warning(
"Decora connect error for device %s. " "Reconnecting...",
device.name,
"Decora connect error for device %s. Reconnecting...", device.name,
)
# pylint: disable=protected-access
device._switch.connect()
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/demo/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def media_duration(self):
@property
def media_image_url(self):
"""Return the image url of current playing media."""
return "https://graph.facebook.com/v2.5/107771475912710/" "picture?type=large"
return "https://graph.facebook.com/v2.5/107771475912710/picture?type=large"

@property
def media_title(self):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/directv/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
)
else:
_LOGGER.debug(
"Adding discovered device %s with" " client address %s",
"Adding discovered device %s with client address %s",
str.title(loc["locationName"]),
loc["clientAddr"],
)
Expand Down Expand Up @@ -214,7 +214,7 @@ def update(self):

except requests.RequestException as ex:
_LOGGER.error(
"%s: Request error trying to update current status: " "%s",
"%s: Request error trying to update current status: %s",
self.entity_id,
ex,
)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/dyson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def setup(hass, config):
# Not yet reliable
for device in dyson_devices:
_LOGGER.info(
"Trying to connect to device %s with timeout=%i " "and retry=%i",
"Trying to connect to device %s with timeout=%i and retry=%i",
device,
timeout,
retry,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/ecoal_boiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def setup(hass, hass_config):
if ecoal_contr.version is None:
# Wrong credentials nor network config
_LOGGER.error(
"Unable to read controller status from %s@%s" " (wrong host/credentials)",
"Unable to read controller status from %s@%s (wrong host/credentials)",
username,
host,
)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/ecobee/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def set_auto_temp_hold(self, heat_temp, cool_temp):
self.hold_preference(),
)
_LOGGER.debug(
"Setting ecobee hold_temp to: heat=%s, is=%s, " "cool=%s, is=%s",
"Setting ecobee hold_temp to: heat=%s, is=%s, cool=%s, is=%s",
heat_temp,
isinstance(heat_temp, (int, float)),
cool_temp,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/egardia/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def alarm_disarm(self, code=None):
self._egardiasystem.alarm_disarm()
except requests.exceptions.RequestException as err:
_LOGGER.error(
"Egardia device exception occurred when " "sending disarm command: %s",
"Egardia device exception occurred when sending disarm command: %s",
err,
)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/esphome/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def async_on_service_call(service: HomeassistantServiceCall) -> None:
# ESPHome uses servicecall packet for both events and service calls
# Ensure the user can only send events of form 'esphome.xyz'
if domain != "esphome":
_LOGGER.error("Can only generate events under esphome " "domain!")
_LOGGER.error("Can only generate events under esphome domain!")
return
hass.bus.async_fire(service.service, service_data)
else:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/feedreader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def _filter_entries(self):
"""Filter the entries provided and return the ones to keep."""
if len(self._feed.entries) > self._max_entries:
_LOGGER.debug(
"Processing only the first %s entries " "in feed %s",
"Processing only the first %s entries in feed %s",
self._max_entries,
self._url,
)
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/fibaro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ def connect(self):
info = self._client.info.get()
self.hub_serial = slugify(info.serialNumber)
except AssertionError:
_LOGGER.error("Can't connect to Fibaro HC. " "Please check URL.")
_LOGGER.error("Can't connect to Fibaro HC. Please check URL.")
return False
if login is None or login.status is False:
_LOGGER.error(
"Invalid login for Fibaro HC. " "Please check username and password"
"Invalid login for Fibaro HC. Please check username and password"
)
return False

Expand Down Expand Up @@ -380,7 +380,7 @@ def level2(self):
def dont_know_message(self, action):
"""Make a warning in case we don't know how to perform an action."""
_LOGGER.warning(
"Not sure how to setValue: %s " "(available actions: %s)",
"Not sure how to setValue: %s (available actions: %s)",
str(self.ha_id),
str(self.fibaro_device.actions),
)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/flux/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ async def async_flux_update(self, utcnow=None):
elif self._mode == MODE_RGB:
await async_set_lights_rgb(self.hass, self._lights, rgb, self._transition)
_LOGGER.debug(
"Lights updated to rgb:%s, %s%% " "of %s cycle complete at %s",
"Lights updated to rgb:%s, %s%% of %s cycle complete at %s",
rgb,
round(percentage_complete * 100),
time_state,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/foursquare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async def post(self, request):

if self.push_secret != secret:
_LOGGER.error(
"Received Foursquare push with invalid" "push secret: %s", secret
"Received Foursquare push with invalid push secret: %s", secret
)
return self.json_message("Incorrect secret", HTTP_BAD_REQUEST)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/fritz/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, config):
self._update_info()
else:
_LOGGER.error(
"Failed to establish connection to FRITZ!Box " "with IP: %s", self.host
"Failed to establish connection to FRITZ!Box with IP: %s", self.host
)

def scan_devices(self):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/generic_thermostat/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def _async_startup(event):
else:
self._target_temp = self.min_temp
_LOGGER.warning(
"Undefined target temperature," "falling back to %s",
"Undefined target temperature, falling back to %s",
self._target_temp,
)
else:
Expand Down
Loading

0 comments on commit e6388e1

Please sign in to comment.