Use list literals (#33659)
parent
dde93304d3
commit
db72039b8f
|
@ -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))
|
||||
|
||||
|
|
|
@ -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"]:
|
||||
|
|
|
@ -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"]:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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 = {}
|
||||
|
|
|
@ -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]
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
||||
|
|
|
@ -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 |= (
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue