From db72039b8f613efcc2495f5018e3ef36ffac3473 Mon Sep 17 00:00:00 2001 From: springstan <46536646+springstan@users.noreply.github.com> Date: Sat, 4 Apr 2020 23:14:47 +0200 Subject: [PATCH] Use list literals (#33659) --- homeassistant/components/discord/notify.py | 4 ++-- homeassistant/components/ecobee/binary_sensor.py | 2 +- homeassistant/components/ecobee/sensor.py | 2 +- homeassistant/components/ecobee/weather.py | 4 ++-- homeassistant/components/fail2ban/sensor.py | 4 ++-- homeassistant/components/ios/__init__.py | 2 +- homeassistant/components/ios/sensor.py | 2 +- homeassistant/components/kodi/media_player.py | 2 +- homeassistant/components/mobile_app/binary_sensor.py | 2 +- homeassistant/components/mobile_app/sensor.py | 2 +- homeassistant/components/openhome/media_player.py | 4 ++-- homeassistant/components/sleepiq/binary_sensor.py | 2 +- homeassistant/components/sleepiq/sensor.py | 2 +- homeassistant/components/yeelight/light.py | 2 +- 14 files changed, 18 insertions(+), 18 deletions(-) diff --git a/homeassistant/components/discord/notify.py b/homeassistant/components/discord/notify.py index 864b7da5e55..19c25a2fd45 100644 --- a/homeassistant/components/discord/notify.py +++ b/homeassistant/components/discord/notify.py @@ -56,7 +56,7 @@ class DiscordNotificationService(BaseNotificationService): data = kwargs.get(ATTR_DATA) or {} if ATTR_IMAGES in data: - images = list() + images = [] for image in data.get(ATTR_IMAGES): image_exists = await self.hass.async_add_executor_job( @@ -84,7 +84,7 @@ class DiscordNotificationService(BaseNotificationService): # Must create new instances of File for each channel. files = None if images: - files = list() + files = [] for image in images: files.append(discord.File(image)) diff --git a/homeassistant/components/ecobee/binary_sensor.py b/homeassistant/components/ecobee/binary_sensor.py index a4062905eaa..71aaee1c405 100644 --- a/homeassistant/components/ecobee/binary_sensor.py +++ b/homeassistant/components/ecobee/binary_sensor.py @@ -10,7 +10,7 @@ from .const import _LOGGER, DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFACTURER async def async_setup_entry(hass, config_entry, async_add_entities): """Set up ecobee binary (occupancy) sensors.""" data = hass.data[DOMAIN] - dev = list() + dev = [] for index in range(len(data.ecobee.thermostats)): for sensor in data.ecobee.get_remote_sensors(index): for item in sensor["capability"]: diff --git a/homeassistant/components/ecobee/sensor.py b/homeassistant/components/ecobee/sensor.py index e510cc976a6..4fd1a061cff 100644 --- a/homeassistant/components/ecobee/sensor.py +++ b/homeassistant/components/ecobee/sensor.py @@ -20,7 +20,7 @@ SENSOR_TYPES = { async def async_setup_entry(hass, config_entry, async_add_entities): """Set up ecobee (temperature and humidity) sensors.""" data = hass.data[DOMAIN] - dev = list() + dev = [] for index in range(len(data.ecobee.thermostats)): for sensor in data.ecobee.get_remote_sensors(index): for item in sensor["capability"]: diff --git a/homeassistant/components/ecobee/weather.py b/homeassistant/components/ecobee/weather.py index 95ed220a16c..457d924d2fb 100644 --- a/homeassistant/components/ecobee/weather.py +++ b/homeassistant/components/ecobee/weather.py @@ -26,7 +26,7 @@ from .const import ( async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the ecobee weather platform.""" data = hass.data[DOMAIN] - dev = list() + dev = [] for index in range(len(data.ecobee.thermostats)): thermostat = data.ecobee.get_thermostat(index) if "weather" in thermostat: @@ -164,7 +164,7 @@ class EcobeeWeather(WeatherEntity): if "forecasts" not in self.weather: return None - forecasts = list() + forecasts = [] for day in range(1, 5): forecast = _process_forecast(self.weather["forecasts"][day]) if forecast is None: diff --git a/homeassistant/components/fail2ban/sensor.py b/homeassistant/components/fail2ban/sensor.py index 5a7e673ca02..2f206dca737 100644 --- a/homeassistant/components/fail2ban/sensor.py +++ b/homeassistant/components/fail2ban/sensor.py @@ -107,12 +107,12 @@ class BanLogParser: def __init__(self, log_file): """Initialize the parser.""" self.log_file = log_file - self.data = list() + self.data = [] self.ip_regex = {} def read_log(self, jail): """Read the fail2ban log and find entries for jail.""" - self.data = list() + self.data = [] try: with open(self.log_file, encoding="utf-8") as file_data: self.data = self.ip_regex[jail].findall(file_data.read()) diff --git a/homeassistant/components/ios/__init__.py b/homeassistant/components/ios/__init__.py index 3f193993c2b..9eec508bbd5 100644 --- a/homeassistant/components/ios/__init__.py +++ b/homeassistant/components/ios/__init__.py @@ -195,7 +195,7 @@ def devices_with_push(hass): def enabled_push_ids(hass): """Return a list of push enabled target push IDs.""" - push_ids = list() + push_ids = [] for device in hass.data[DOMAIN][ATTR_DEVICES].values(): if device.get(ATTR_PUSH_ID) is not None: push_ids.append(device.get(ATTR_PUSH_ID)) diff --git a/homeassistant/components/ios/sensor.py b/homeassistant/components/ios/sensor.py index e12ab9b4a40..1a655e242f9 100644 --- a/homeassistant/components/ios/sensor.py +++ b/homeassistant/components/ios/sensor.py @@ -20,7 +20,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): async def async_setup_entry(hass, config_entry, async_add_entities): """Set up iOS from a config entry.""" - dev = list() + dev = [] for device_name, device in ios.devices(hass).items(): for sensor_type in ("level", "state"): dev.append(IOSSensor(sensor_type, device_name, device)) diff --git a/homeassistant/components/kodi/media_player.py b/homeassistant/components/kodi/media_player.py index 5f53de899e4..33e7c014e40 100644 --- a/homeassistant/components/kodi/media_player.py +++ b/homeassistant/components/kodi/media_player.py @@ -333,7 +333,7 @@ class KodiDevice(MediaPlayerDevice): self._turn_on_action = turn_on_action self._turn_off_action = turn_off_action self._enable_websocket = websocket - self._players = list() + self._players = [] self._properties = {} self._item = {} self._app_properties = {} diff --git a/homeassistant/components/mobile_app/binary_sensor.py b/homeassistant/components/mobile_app/binary_sensor.py index 73bf925553e..c04a1af316d 100644 --- a/homeassistant/components/mobile_app/binary_sensor.py +++ b/homeassistant/components/mobile_app/binary_sensor.py @@ -18,7 +18,7 @@ from .entity import MobileAppEntity, sensor_id async def async_setup_entry(hass, config_entry, async_add_entities): """Set up mobile app binary sensor from a config entry.""" - entities = list() + entities = [] webhook_id = config_entry.data[CONF_WEBHOOK_ID] diff --git a/homeassistant/components/mobile_app/sensor.py b/homeassistant/components/mobile_app/sensor.py index 199ba968dd2..11e07ed5e79 100644 --- a/homeassistant/components/mobile_app/sensor.py +++ b/homeassistant/components/mobile_app/sensor.py @@ -18,7 +18,7 @@ from .entity import MobileAppEntity, sensor_id async def async_setup_entry(hass, config_entry, async_add_entities): """Set up mobile app sensor from a config entry.""" - entities = list() + entities = [] webhook_id = config_entry.data[CONF_WEBHOOK_ID] diff --git a/homeassistant/components/openhome/media_player.py b/homeassistant/components/openhome/media_player.py index 967bce6007e..8456ae9338d 100644 --- a/homeassistant/components/openhome/media_player.py +++ b/homeassistant/components/openhome/media_player.py @@ -64,7 +64,7 @@ class OpenhomeDevice(MediaPlayerDevice): self._volume_level = None self._volume_muted = None self._supported_features = SUPPORT_OPENHOME - self._source_names = list() + self._source_names = [] self._source_index = {} self._source = {} self._name = None @@ -79,7 +79,7 @@ class OpenhomeDevice(MediaPlayerDevice): self._name = self._device.Room().decode("utf-8") self._supported_features = SUPPORT_OPENHOME source_index = {} - source_names = list() + source_names = [] if self._device.VolumeEnabled(): self._supported_features |= ( diff --git a/homeassistant/components/sleepiq/binary_sensor.py b/homeassistant/components/sleepiq/binary_sensor.py index b9278fab278..8396537a2a0 100644 --- a/homeassistant/components/sleepiq/binary_sensor.py +++ b/homeassistant/components/sleepiq/binary_sensor.py @@ -11,7 +11,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): data = sleepiq.DATA data.update() - dev = list() + dev = [] for bed_id, bed in data.beds.items(): for side in sleepiq.SIDES: if getattr(bed, side) is not None: diff --git a/homeassistant/components/sleepiq/sensor.py b/homeassistant/components/sleepiq/sensor.py index 3c2df69331c..404823abe96 100644 --- a/homeassistant/components/sleepiq/sensor.py +++ b/homeassistant/components/sleepiq/sensor.py @@ -12,7 +12,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): data = sleepiq.DATA data.update() - dev = list() + dev = [] for bed_id, bed in data.beds.items(): for side in sleepiq.SIDES: if getattr(bed, side) is not None: diff --git a/homeassistant/components/yeelight/light.py b/homeassistant/components/yeelight/light.py index 2f69b98bcbc..ab49e46938c 100644 --- a/homeassistant/components/yeelight/light.py +++ b/homeassistant/components/yeelight/light.py @@ -679,7 +679,7 @@ class YeelightGenericLight(Light): red, green, blue = color_util.color_hs_to_RGB(*self._hs) - transitions = list() + transitions = [] transitions.append( RGBTransition(255, 0, 0, brightness=10, duration=duration) )