diff --git a/homeassistant/components/aftership/sensor.py b/homeassistant/components/aftership/sensor.py index 9b8a5637de2..3f00c8c310d 100644 --- a/homeassistant/components/aftership/sensor.py +++ b/homeassistant/components/aftership/sensor.py @@ -191,7 +191,9 @@ class AfterShipSensor(Entity): "name": name, "tracking_number": track["tracking_number"], "slug": track["slug"], - "link": "%s%s/%s" % (BASE, track["slug"], track["tracking_number"]), + "link": "{}{}/{}".format( + BASE, track["slug"], track["tracking_number"] + ), "last_update": track["updated_at"], "expected_delivery": track["expected_delivery"], "status": track["tag"], diff --git a/homeassistant/components/buienradar/sensor.py b/homeassistant/components/buienradar/sensor.py index afa5013b339..235390d0013 100644 --- a/homeassistant/components/buienradar/sensor.py +++ b/homeassistant/components/buienradar/sensor.py @@ -255,10 +255,8 @@ class BrSensor(Entity): def uid(self, coordinates): """Generate a unique id using coordinates and sensor type.""" # The combination of the location, name and sensor type is unique - return "%2.6f%2.6f%s" % ( - coordinates[CONF_LATITUDE], - coordinates[CONF_LONGITUDE], - self.type, + return "{:2.6f}{:2.6f}{}".format( + coordinates[CONF_LATITUDE], coordinates[CONF_LONGITUDE], self.type, ) @callback diff --git a/homeassistant/components/config/zwave.py b/homeassistant/components/config/zwave.py index eaed84fe24d..b792fcccec3 100644 --- a/homeassistant/components/config/zwave.py +++ b/homeassistant/components/config/zwave.py @@ -226,7 +226,7 @@ class ZWaveProtectionView(HomeAssistantView): return self.json(protection_options) protections = node.get_protections() protection_options = { - "value_id": "{0:d}".format(list(protections)[0]), + "value_id": "{:d}".format(list(protections)[0]), "selected": node.get_protection_item(list(protections)[0]), "options": node.get_protection_items(list(protections)[0]), } diff --git a/homeassistant/components/google_travel_time/sensor.py b/homeassistant/components/google_travel_time/sensor.py index dd7d9bf8585..5e99b42b115 100644 --- a/homeassistant/components/google_travel_time/sensor.py +++ b/homeassistant/components/google_travel_time/sensor.py @@ -321,7 +321,7 @@ class GoogleTravelTimeSensor(Entity): def _get_location_from_attributes(entity): """Get the lat/long string from an entities attributes.""" attr = entity.attributes - return "%s,%s" % (attr.get(ATTR_LATITUDE), attr.get(ATTR_LONGITUDE)) + return "{},{}".format(attr.get(ATTR_LATITUDE), attr.get(ATTR_LONGITUDE)) def _resolve_zone(self, friendly_name): entities = self._hass.states.all() diff --git a/homeassistant/components/hdmi_cec/media_player.py b/homeassistant/components/hdmi_cec/media_player.py index 42c5f0b456c..9b130f91b72 100644 --- a/homeassistant/components/hdmi_cec/media_player.py +++ b/homeassistant/components/hdmi_cec/media_player.py @@ -67,7 +67,9 @@ class CecPlayerDevice(CecDevice, MediaPlayerDevice): def __init__(self, device, logical) -> None: """Initialize the HDMI device.""" CecDevice.__init__(self, device, logical) - self.entity_id = "%s.%s_%s" % (DOMAIN, "hdmi", hex(self._logical_address)[2:]) + self.entity_id = "{}.{}_{}".format( + DOMAIN, "hdmi", hex(self._logical_address)[2:] + ) def send_keypress(self, key): """Send keypress to CEC adapter.""" diff --git a/homeassistant/components/hdmi_cec/switch.py b/homeassistant/components/hdmi_cec/switch.py index 53384397cf4..a4ef91dee8f 100644 --- a/homeassistant/components/hdmi_cec/switch.py +++ b/homeassistant/components/hdmi_cec/switch.py @@ -28,7 +28,9 @@ class CecSwitchDevice(CecDevice, SwitchDevice): def __init__(self, device, logical) -> None: """Initialize the HDMI device.""" CecDevice.__init__(self, device, logical) - self.entity_id = "%s.%s_%s" % (DOMAIN, "hdmi", hex(self._logical_address)[2:]) + self.entity_id = "{}.{}_{}".format( + DOMAIN, "hdmi", hex(self._logical_address)[2:] + ) def turn_on(self, **kwargs) -> None: """Turn device on.""" diff --git a/homeassistant/components/nest/sensor.py b/homeassistant/components/nest/sensor.py index 225caee0a90..064c78917e1 100644 --- a/homeassistant/components/nest/sensor.py +++ b/homeassistant/components/nest/sensor.py @@ -203,6 +203,6 @@ class NestTempSensor(NestSensorDevice): if isinstance(temp, tuple): low, high = temp - self._state = "%s-%s" % (int(low), int(high)) + self._state = "{}-{}".format(int(low), int(high)) else: self._state = round(temp, 1) diff --git a/homeassistant/components/notion/__init__.py b/homeassistant/components/notion/__init__.py index e9c45c62816..d608199f6fc 100644 --- a/homeassistant/components/notion/__init__.py +++ b/homeassistant/components/notion/__init__.py @@ -255,7 +255,7 @@ class NotionEntity(Entity): @property def name(self): """Return the name of the sensor.""" - return "{0}: {1}".format( + return "{}: {}".format( self._notion.sensors[self._sensor_id]["name"], self._name ) @@ -268,7 +268,7 @@ class NotionEntity(Entity): def unique_id(self): """Return a unique, unchanging string that represents this sensor.""" task = self._notion.tasks[self._task_id] - return "{0}_{1}".format(self._sensor_id, task["task_type"]) + return "{}_{}".format(self._sensor_id, task["task_type"]) async def _update_bridge_id(self): """Update the entity's bridge ID if it has changed. diff --git a/homeassistant/components/openalpr_cloud/image_processing.py b/homeassistant/components/openalpr_cloud/image_processing.py index 64ba0d83844..13d8cf75e7c 100644 --- a/homeassistant/components/openalpr_cloud/image_processing.py +++ b/homeassistant/components/openalpr_cloud/image_processing.py @@ -86,7 +86,7 @@ class OpenAlprCloudEntity(ImageProcessingAlprEntity): if name: self._name = name else: - self._name = "OpenAlpr {0}".format(split_entity_id(camera_entity)[1]) + self._name = "OpenAlpr {}".format(split_entity_id(camera_entity)[1]) @property def confidence(self): diff --git a/homeassistant/components/openalpr_local/image_processing.py b/homeassistant/components/openalpr_local/image_processing.py index df7b235a224..b2e90ad5597 100644 --- a/homeassistant/components/openalpr_local/image_processing.py +++ b/homeassistant/components/openalpr_local/image_processing.py @@ -161,7 +161,7 @@ class OpenAlprLocalEntity(ImageProcessingAlprEntity): if name: self._name = name else: - self._name = "OpenAlpr {0}".format(split_entity_id(camera_entity)[1]) + self._name = "OpenAlpr {}".format(split_entity_id(camera_entity)[1]) @property def confidence(self): diff --git a/homeassistant/components/opencv/image_processing.py b/homeassistant/components/opencv/image_processing.py index 4a1b830a324..8e300c77465 100644 --- a/homeassistant/components/opencv/image_processing.py +++ b/homeassistant/components/opencv/image_processing.py @@ -132,7 +132,7 @@ class OpenCVImageProcessor(ImageProcessingEntity): if name: self._name = name else: - self._name = "OpenCV {0}".format(split_entity_id(camera_entity)[1]) + self._name = "OpenCV {}".format(split_entity_id(camera_entity)[1]) self._classifiers = classifiers self._matches = {} self._total_matches = 0 diff --git a/homeassistant/components/openuv/__init__.py b/homeassistant/components/openuv/__init__.py index 008b46d96f2..df4ff9735c3 100644 --- a/homeassistant/components/openuv/__init__.py +++ b/homeassistant/components/openuv/__init__.py @@ -82,7 +82,7 @@ async def async_setup(hass, config): conf = config[DOMAIN] - identifier = "{0}, {1}".format( + identifier = "{}, {}".format( conf.get(CONF_LATITUDE, hass.config.latitude), conf.get(CONF_LONGITUDE, hass.config.longitude), ) diff --git a/homeassistant/components/openuv/config_flow.py b/homeassistant/components/openuv/config_flow.py index 82873861fb1..402f6514178 100644 --- a/homeassistant/components/openuv/config_flow.py +++ b/homeassistant/components/openuv/config_flow.py @@ -20,7 +20,7 @@ from .const import DOMAIN def configured_instances(hass): """Return a set of configured OpenUV instances.""" return set( - "{0}, {1}".format( + "{}, {}".format( entry.data.get(CONF_LATITUDE, hass.config.latitude), entry.data.get(CONF_LONGITUDE, hass.config.longitude), ) @@ -64,7 +64,7 @@ class OpenUvFlowHandler(config_entries.ConfigFlow): if not user_input: return await self._show_form() - identifier = "{0}, {1}".format( + identifier = "{}, {}".format( user_input.get(CONF_LATITUDE, self.hass.config.latitude), user_input.get(CONF_LONGITUDE, self.hass.config.longitude), ) diff --git a/homeassistant/components/qrcode/image_processing.py b/homeassistant/components/qrcode/image_processing.py index 018f074a6d2..71bb67f0753 100644 --- a/homeassistant/components/qrcode/image_processing.py +++ b/homeassistant/components/qrcode/image_processing.py @@ -34,7 +34,7 @@ class QrEntity(ImageProcessingEntity): if name: self._name = name else: - self._name = "QR {0}".format(split_entity_id(camera_entity)[1]) + self._name = "QR {}".format(split_entity_id(camera_entity)[1]) self._state = None @property diff --git a/homeassistant/components/raincloud/__init__.py b/homeassistant/components/raincloud/__init__.py index 971b8174993..cc42bdc54b8 100644 --- a/homeassistant/components/raincloud/__init__.py +++ b/homeassistant/components/raincloud/__init__.py @@ -142,7 +142,7 @@ class RainCloudEntity(Entity): """Initialize the RainCloud entity.""" self.data = data self._sensor_type = sensor_type - self._name = "{0} {1}".format(self.data.name, KEY_MAP.get(self._sensor_type)) + self._name = "{} {}".format(self.data.name, KEY_MAP.get(self._sensor_type)) self._state = None @property diff --git a/homeassistant/components/rainmachine/__init__.py b/homeassistant/components/rainmachine/__init__.py index 92c14d0e0cb..03dc49d7475 100644 --- a/homeassistant/components/rainmachine/__init__.py +++ b/homeassistant/components/rainmachine/__init__.py @@ -426,7 +426,7 @@ class RainMachineEntity(Entity): "identifiers": {(DOMAIN, self.rainmachine.controller.mac)}, "name": self.rainmachine.controller.name, "manufacturer": "RainMachine", - "model": "Version {0} (API: {1})".format( + "model": "Version {} (API: {})".format( self.rainmachine.controller.hardware_version, self.rainmachine.controller.api_version, ), diff --git a/homeassistant/components/rainmachine/binary_sensor.py b/homeassistant/components/rainmachine/binary_sensor.py index 409ad0c9980..40802af2bfa 100644 --- a/homeassistant/components/rainmachine/binary_sensor.py +++ b/homeassistant/components/rainmachine/binary_sensor.py @@ -120,7 +120,7 @@ class RainMachineBinarySensor(RainMachineEntity, BinarySensorDevice): @property def unique_id(self) -> str: """Return a unique, Home Assistant friendly identifier for this entity.""" - return "{0}_{1}".format( + return "{}_{}".format( self.rainmachine.device_mac.replace(":", ""), self._sensor_type ) diff --git a/homeassistant/components/rainmachine/sensor.py b/homeassistant/components/rainmachine/sensor.py index 371ba00dfd0..287ce29a3cc 100644 --- a/homeassistant/components/rainmachine/sensor.py +++ b/homeassistant/components/rainmachine/sensor.py @@ -132,7 +132,7 @@ class RainMachineSensor(RainMachineEntity): @property def unique_id(self) -> str: """Return a unique, Home Assistant friendly identifier for this entity.""" - return "{0}_{1}".format( + return "{}_{}".format( self.rainmachine.device_mac.replace(":", ""), self._sensor_type ) diff --git a/homeassistant/components/rainmachine/switch.py b/homeassistant/components/rainmachine/switch.py index 264de1d6782..fd36e23cb0e 100644 --- a/homeassistant/components/rainmachine/switch.py +++ b/homeassistant/components/rainmachine/switch.py @@ -142,7 +142,7 @@ class RainMachineSwitch(RainMachineEntity, SwitchDevice): @property def unique_id(self) -> str: """Return a unique, Home Assistant friendly identifier for this entity.""" - return "{0}_{1}_{2}".format( + return "{}_{}_{}".format( self.rainmachine.device_mac.replace(":", ""), self._switch_type, self._rainmachine_entity_id, @@ -219,7 +219,7 @@ class RainMachineProgram(RainMachineSwitch): try: next_run = datetime.strptime( - "{0} {1}".format( + "{} {}".format( self._switch_data["nextRun"], self._switch_data["startTime"] ), "%Y-%m-%d %H:%M", diff --git a/homeassistant/components/ring/binary_sensor.py b/homeassistant/components/ring/binary_sensor.py index 321b668f8aa..385d8a4f955 100644 --- a/homeassistant/components/ring/binary_sensor.py +++ b/homeassistant/components/ring/binary_sensor.py @@ -47,9 +47,7 @@ class RingBinarySensor(RingEntityMixin, BinarySensorDevice): super().__init__(config_entry_id, device) self._ring = ring self._sensor_type = sensor_type - self._name = "{0} {1}".format( - self._device.name, SENSOR_TYPES.get(sensor_type)[0] - ) + self._name = "{} {}".format(self._device.name, SENSOR_TYPES.get(sensor_type)[0]) self._device_class = SENSOR_TYPES.get(sensor_type)[2] self._state = None self._unique_id = f"{device.id}-{sensor_type}" diff --git a/homeassistant/components/ring/sensor.py b/homeassistant/components/ring/sensor.py index 84edaf67c22..260b4170745 100644 --- a/homeassistant/components/ring/sensor.py +++ b/homeassistant/components/ring/sensor.py @@ -46,9 +46,7 @@ class RingSensor(RingEntityMixin, Entity): self._extra = None self._icon = "mdi:{}".format(SENSOR_TYPES.get(sensor_type)[3]) self._kind = SENSOR_TYPES.get(sensor_type)[4] - self._name = "{0} {1}".format( - self._device.name, SENSOR_TYPES.get(sensor_type)[0] - ) + self._name = "{} {}".format(self._device.name, SENSOR_TYPES.get(sensor_type)[0]) self._unique_id = f"{device.id}-{sensor_type}" @property diff --git a/homeassistant/components/roku/media_player.py b/homeassistant/components/roku/media_player.py index ba923f0fdd2..e26cce46ee2 100644 --- a/homeassistant/components/roku/media_player.py +++ b/homeassistant/components/roku/media_player.py @@ -153,8 +153,8 @@ class RokuDevice(MediaPlayerDevice): if self.current_app.id is None: return None - return "http://{0}:{1}/query/icon/{2}".format( - self.ip_address, DEFAULT_PORT, self.current_app.id + return ( + f"http://{self.ip_address}:{DEFAULT_PORT}/query/icon/{self.current_app.id}" ) @property diff --git a/homeassistant/components/seven_segments/image_processing.py b/homeassistant/components/seven_segments/image_processing.py index 315b5c39fec..4515ec7441b 100644 --- a/homeassistant/components/seven_segments/image_processing.py +++ b/homeassistant/components/seven_segments/image_processing.py @@ -69,14 +69,12 @@ class ImageProcessingSsocr(ImageProcessingEntity): if name: self._name = name else: - self._name = "SevenSegment OCR {0}".format( - split_entity_id(camera_entity)[1] - ) + self._name = "SevenSegment OCR {}".format(split_entity_id(camera_entity)[1]) self._state = None self.filepath = os.path.join( self.hass.config.config_dir, - "ssocr-{0}.png".format(self._name.replace(" ", "_")), + "ssocr-{}.png".format(self._name.replace(" ", "_")), ) crop = [ "crop", diff --git a/homeassistant/components/seventeentrack/sensor.py b/homeassistant/components/seventeentrack/sensor.py index 000019abb51..53b16944cb2 100644 --- a/homeassistant/components/seventeentrack/sensor.py +++ b/homeassistant/components/seventeentrack/sensor.py @@ -130,7 +130,7 @@ class SeventeenTrackSummarySensor(Entity): @property def unique_id(self): """Return a unique, Home Assistant friendly identifier for this entity.""" - return "summary_{0}_{1}".format(self._data.account_id, slugify(self._status)) + return "summary_{}_{}".format(self._data.account_id, slugify(self._status)) @property def unit_of_measurement(self): diff --git a/homeassistant/components/skybell/binary_sensor.py b/homeassistant/components/skybell/binary_sensor.py index 776281e1510..f0df663eba3 100644 --- a/homeassistant/components/skybell/binary_sensor.py +++ b/homeassistant/components/skybell/binary_sensor.py @@ -51,7 +51,7 @@ class SkybellBinarySensor(SkybellDevice, BinarySensorDevice): """Initialize a binary sensor for a Skybell device.""" super().__init__(device) self._sensor_type = sensor_type - self._name = "{0} {1}".format( + self._name = "{} {}".format( self._device.name, SENSOR_TYPES[self._sensor_type][0] ) self._device_class = SENSOR_TYPES[self._sensor_type][1] diff --git a/homeassistant/components/skybell/sensor.py b/homeassistant/components/skybell/sensor.py index 7d266b7d3f6..24b63b6271c 100644 --- a/homeassistant/components/skybell/sensor.py +++ b/homeassistant/components/skybell/sensor.py @@ -49,7 +49,7 @@ class SkybellSensor(SkybellDevice): super().__init__(device) self._sensor_type = sensor_type self._icon = "mdi:{}".format(SENSOR_TYPES[self._sensor_type][1]) - self._name = "{0} {1}".format( + self._name = "{} {}".format( self._device.name, SENSOR_TYPES[self._sensor_type][0] ) self._state = None diff --git a/homeassistant/components/skybell/switch.py b/homeassistant/components/skybell/switch.py index e5a6975ddbb..03ea74a2340 100644 --- a/homeassistant/components/skybell/switch.py +++ b/homeassistant/components/skybell/switch.py @@ -48,7 +48,7 @@ class SkybellSwitch(SkybellDevice, SwitchDevice): """Initialize a light for a Skybell device.""" super().__init__(device) self._switch_type = switch_type - self._name = "{0} {1}".format( + self._name = "{} {}".format( self._device.name, SWITCH_TYPES[self._switch_type][0] ) diff --git a/homeassistant/components/starlingbank/sensor.py b/homeassistant/components/starlingbank/sensor.py index 1e046192347..20fa646ce41 100644 --- a/homeassistant/components/starlingbank/sensor.py +++ b/homeassistant/components/starlingbank/sensor.py @@ -75,7 +75,7 @@ class StarlingBalanceSensor(Entity): @property def name(self): """Return the name of the sensor.""" - return "{0} {1}".format( + return "{} {}".format( self._account_name, self._balance_data_type.replace("_", " ").capitalize() ) diff --git a/homeassistant/components/statsd/__init__.py b/homeassistant/components/statsd/__init__.py index 79065f7ba53..7ca3068f003 100644 --- a/homeassistant/components/statsd/__init__.py +++ b/homeassistant/components/statsd/__init__.py @@ -79,7 +79,7 @@ def setup(hass, config): # Send attribute values for key, value in states.items(): if isinstance(value, (float, int)): - stat = "%s.%s" % (state.entity_id, key.replace(" ", "_")) + stat = "{}.{}".format(state.entity_id, key.replace(" ", "_")) statsd_client.gauge(stat, value, sample_rate) else: diff --git a/homeassistant/components/swiss_hydrological_data/sensor.py b/homeassistant/components/swiss_hydrological_data/sensor.py index d4624e82bb7..61423312b2a 100644 --- a/homeassistant/components/swiss_hydrological_data/sensor.py +++ b/homeassistant/components/swiss_hydrological_data/sensor.py @@ -97,7 +97,7 @@ class SwissHydrologicalDataSensor(Entity): @property def name(self): """Return the name of the sensor.""" - return "{0} {1}".format(self._data["water-body-name"], self._condition) + return "{} {}".format(self._data["water-body-name"], self._condition) @property def unique_id(self) -> str: diff --git a/homeassistant/components/tensorflow/image_processing.py b/homeassistant/components/tensorflow/image_processing.py index 3638cbafb9f..b003fef56c0 100644 --- a/homeassistant/components/tensorflow/image_processing.py +++ b/homeassistant/components/tensorflow/image_processing.py @@ -168,7 +168,7 @@ class TensorFlowImageProcessor(ImageProcessingEntity): if name: self._name = name else: - self._name = "TensorFlow {0}".format(split_entity_id(camera_entity)[1]) + self._name = "TensorFlow {}".format(split_entity_id(camera_entity)[1]) self._session = session self._graph = detection_graph self._category_index = category_index @@ -270,7 +270,7 @@ class TensorFlowImageProcessor(ImageProcessingEntity): # Draw detected objects for instance in values: - label = "{0} {1:.1f}%".format(category, instance["score"]) + label = "{} {:.1f}%".format(category, instance["score"]) draw_box( draw, instance["box"], img_width, img_height, label, (255, 255, 0) ) diff --git a/homeassistant/components/tile/device_tracker.py b/homeassistant/components/tile/device_tracker.py index 8bc4fb11cdf..6cfe6121ccb 100644 --- a/homeassistant/components/tile/device_tracker.py +++ b/homeassistant/components/tile/device_tracker.py @@ -121,7 +121,7 @@ class TileScanner: for tile in tiles: await self._async_see( - dev_id="tile_{0}".format(slugify(tile["tile_uuid"])), + dev_id="tile_{}".format(slugify(tile["tile_uuid"])), gps=( tile["last_tile_state"]["latitude"], tile["last_tile_state"]["longitude"], diff --git a/homeassistant/components/travisci/sensor.py b/homeassistant/components/travisci/sensor.py index ffbe5239cc9..c2ce599f5c3 100644 --- a/homeassistant/components/travisci/sensor.py +++ b/homeassistant/components/travisci/sensor.py @@ -106,9 +106,7 @@ class TravisCISensor(Entity): self._user = user self._branch = branch self._state = None - self._name = "{0} {1}".format( - self._repo_name, SENSOR_TYPES[self._sensor_type][0] - ) + self._name = "{} {}".format(self._repo_name, SENSOR_TYPES[self._sensor_type][0]) @property def name(self): diff --git a/homeassistant/components/withings/common.py b/homeassistant/components/withings/common.py index 9cba055bac4..3a9d1d52751 100644 --- a/homeassistant/components/withings/common.py +++ b/homeassistant/components/withings/common.py @@ -108,7 +108,7 @@ class ConfigEntryWithingsApi(AbstractWithingsApi): partial( requests.request, method, - "%s/%s" % (self.URL, path), + f"{self.URL}/{path}", params=params, headers={ "Authorization": "Bearer %s" diff --git a/homeassistant/components/xiaomi/camera.py b/homeassistant/components/xiaomi/camera.py index cc85f17146b..2b249c7b7c8 100644 --- a/homeassistant/components/xiaomi/camera.py +++ b/homeassistant/components/xiaomi/camera.py @@ -136,7 +136,7 @@ class XiaomiCamera(Camera): else: video = videos[-1] - return "ftp://{0}:{1}@{2}:{3}{4}/{5}".format( + return "ftp://{}:{}@{}:{}{}/{}".format( self.user, self.passwd, host, self.port, ftp.pwd(), video ) diff --git a/homeassistant/components/yeelight/__init__.py b/homeassistant/components/yeelight/__init__.py index eae1cd32c06..1e0fe841cac 100644 --- a/homeassistant/components/yeelight/__init__.py +++ b/homeassistant/components/yeelight/__init__.py @@ -147,7 +147,7 @@ def setup(hass, config): def device_discovered(_, info): _LOGGER.debug("Adding autodetected %s", info["hostname"]) - name = "yeelight_%s_%s" % (info["device_type"], info["properties"]["mac"]) + name = "yeelight_{}_{}".format(info["device_type"], info["properties"]["mac"]) device_config = DEVICE_SCHEMA({CONF_NAME: name}) diff --git a/homeassistant/components/yi/camera.py b/homeassistant/components/yi/camera.py index 6e49d287186..658cc3a23ee 100644 --- a/homeassistant/components/yi/camera.py +++ b/homeassistant/components/yi/camera.py @@ -110,7 +110,7 @@ class YiCamera(Camera): await ftp.quit() self._is_on = True - return "ftp://{0}:{1}@{2}:{3}{4}/{5}/{6}".format( + return "ftp://{}:{}@{}:{}{}/{}/{}".format( self.user, self.passwd, self.host, diff --git a/homeassistant/components/yr/sensor.py b/homeassistant/components/yr/sensor.py index 9955a650cd3..2061c061dd0 100644 --- a/homeassistant/components/yr/sensor.py +++ b/homeassistant/components/yr/sensor.py @@ -139,7 +139,7 @@ class YrSensor(Entity): return None return ( "https://api.met.no/weatherapi/weathericon/1.1/" - "?symbol={0};content_type=image/png".format(self._state) + f"?symbol={self._state};content_type=image/png" ) @property diff --git a/homeassistant/util/color.py b/homeassistant/util/color.py index b56ecbbaa89..965b5950c93 100644 --- a/homeassistant/util/color.py +++ b/homeassistant/util/color.py @@ -424,7 +424,7 @@ def color_rgbw_to_rgb(r: int, g: int, b: int, w: int) -> Tuple[int, int, int]: def color_rgb_to_hex(r: int, g: int, b: int) -> str: """Return a RGB color from a hex color string.""" - return "{0:02x}{1:02x}{2:02x}".format(round(r), round(g), round(b)) + return "{:02x}{:02x}{:02x}".format(round(r), round(g), round(b)) def rgb_hex_to_rgb_list(hex_string: str) -> List[int]: