diff --git a/homeassistant/components/arwn/sensor.py b/homeassistant/components/arwn/sensor.py index 7c947be61bf..3db1283279e 100644 --- a/homeassistant/components/arwn/sensor.py +++ b/homeassistant/components/arwn/sensor.py @@ -96,7 +96,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= store[sensor.name] = sensor _LOGGER.debug( "Registering new sensor %(name)s => %(event)s", - dict(name=sensor.name, event=event), + {"name": sensor.name, "event": event}, ) async_add_entities((sensor,), True) else: diff --git a/homeassistant/components/cast/media_player.py b/homeassistant/components/cast/media_player.py index 76b6bd17f40..314236d9f56 100644 --- a/homeassistant/components/cast/media_player.py +++ b/homeassistant/components/cast/media_player.py @@ -172,7 +172,7 @@ async def _async_setup_platform( # Import CEC IGNORE attributes pychromecast.IGNORE_CEC += config.get(CONF_IGNORE_CEC, []) hass.data.setdefault(ADDED_CAST_DEVICES_KEY, set()) - hass.data.setdefault(KNOWN_CHROMECAST_INFO_KEY, dict()) + hass.data.setdefault(KNOWN_CHROMECAST_INFO_KEY, {}) info = None if discovery_info is not None: diff --git a/homeassistant/components/concord232/alarm_control_panel.py b/homeassistant/components/concord232/alarm_control_panel.py index 94880dcccf7..f502e805c85 100644 --- a/homeassistant/components/concord232/alarm_control_panel.py +++ b/homeassistant/components/concord232/alarm_control_panel.py @@ -101,7 +101,7 @@ class Concord232Alarm(alarm.AlarmControlPanelEntity): except requests.exceptions.ConnectionError as ex: _LOGGER.error( "Unable to connect to %(host)s: %(reason)s", - dict(host=self._url, reason=ex), + {"host": self._url, "reason": ex}, ) return except IndexError: diff --git a/homeassistant/components/garadget/cover.py b/homeassistant/components/garadget/cover.py index e1ac9ca7fc5..9c089e85811 100644 --- a/homeassistant/components/garadget/cover.py +++ b/homeassistant/components/garadget/cover.py @@ -105,14 +105,14 @@ class GaradgetCover(CoverEntity): self._name = doorconfig["nme"] self.update() except requests.exceptions.ConnectionError as ex: - _LOGGER.error("Unable to connect to server: %(reason)s", dict(reason=ex)) + _LOGGER.error("Unable to connect to server: %(reason)s", {"reason": ex}) self._state = STATE_OFFLINE self._available = False self._name = DEFAULT_NAME except KeyError: _LOGGER.warning( "Garadget device %(device)s seems to be offline", - dict(device=self.device_id), + {"device": self.device_id}, ) self._name = DEFAULT_NAME self._state = STATE_OFFLINE @@ -230,12 +230,12 @@ class GaradgetCover(CoverEntity): self.sensor = status["sensor"] self._available = True except requests.exceptions.ConnectionError as ex: - _LOGGER.error("Unable to connect to server: %(reason)s", dict(reason=ex)) + _LOGGER.error("Unable to connect to server: %(reason)s", {"reason": ex}) self._state = STATE_OFFLINE except KeyError: _LOGGER.warning( "Garadget device %(device)s seems to be offline", - dict(device=self.device_id), + {"device": self.device_id}, ) self._state = STATE_OFFLINE diff --git a/homeassistant/components/huawei_router/device_tracker.py b/homeassistant/components/huawei_router/device_tracker.py index be34b26be0d..69278ed6574 100644 --- a/homeassistant/components/huawei_router/device_tracker.py +++ b/homeassistant/components/huawei_router/device_tracker.py @@ -50,7 +50,7 @@ class HuaweiDeviceScanner(DeviceScanner): '"(?P.*?)","(?P.*?)",' '"(?P.*?)"' ) - LOGIN_COOKIE = dict(Cookie="body:Language:portuguese:id=-1") + LOGIN_COOKIE = {"Cookie": "body:Language:portuguese:id=-1"} def __init__(self, config): """Initialize the scanner.""" diff --git a/homeassistant/components/nfandroidtv/notify.py b/homeassistant/components/nfandroidtv/notify.py index 369a5c875ac..e71d81f2b79 100644 --- a/homeassistant/components/nfandroidtv/notify.py +++ b/homeassistant/components/nfandroidtv/notify.py @@ -158,26 +158,26 @@ class NFAndroidTVNotificationService(BaseNotificationService): """Send a message to a Android TV device.""" _LOGGER.debug("Sending notification to: %s", self._target) - payload = dict( - filename=( + payload = { + "filename": ( "icon.png", self._icon_file, "application/octet-stream", {"Expires": "0"}, ), - type="0", - title=kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT), - msg=message, - duration="%i" % self._default_duration, - fontsize="%i" % FONTSIZES.get(self._default_fontsize), - position="%i" % POSITIONS.get(self._default_position), - bkgcolor="%s" % COLORS.get(self._default_color), - transparency="%i" % TRANSPARENCIES.get(self._default_transparency), - offset="0", - app=ATTR_TITLE_DEFAULT, - force="true", - interrupt="%i" % self._default_interrupt, - ) + "type": "0", + "title": kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT), + "msg": message, + "duration": "%i" % self._default_duration, + "fontsize": "%i" % FONTSIZES.get(self._default_fontsize), + "position": "%i" % POSITIONS.get(self._default_position), + "bkgcolor": "%s" % COLORS.get(self._default_color), + "transparency": "%i" % TRANSPARENCIES.get(self._default_transparency), + "offset": "0", + "app": ATTR_TITLE_DEFAULT, + "force": "true", + "interrupt": "%i" % self._default_interrupt, + } data = kwargs.get(ATTR_DATA) if data: diff --git a/homeassistant/components/numato/__init__.py b/homeassistant/components/numato/__init__.py index 0f088cd179d..1730ff82956 100644 --- a/homeassistant/components/numato/__init__.py +++ b/homeassistant/components/numato/__init__.py @@ -171,7 +171,7 @@ class NumatoAPI: def __init__(self): """Initialize API state.""" - self.ports_registered = dict() + self.ports_registered = {} def check_port_free(self, device_id, port, direction): """Check whether a port is still free set up. diff --git a/homeassistant/components/nx584/alarm_control_panel.py b/homeassistant/components/nx584/alarm_control_panel.py index 2df7cd1bb4b..6366831b598 100644 --- a/homeassistant/components/nx584/alarm_control_panel.py +++ b/homeassistant/components/nx584/alarm_control_panel.py @@ -58,7 +58,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= except requests.exceptions.ConnectionError as ex: _LOGGER.error( "Unable to connect to %(host)s: %(reason)s", - dict(host=url, reason=ex), + {"host": url, "reason": ex}, ) raise PlatformNotReady from ex @@ -118,7 +118,7 @@ class NX584Alarm(alarm.AlarmControlPanelEntity): except requests.exceptions.ConnectionError as ex: _LOGGER.error( "Unable to connect to %(host)s: %(reason)s", - dict(host=self._url, reason=ex), + {"host": self._url, "reason": ex}, ) self._state = None zones = [] @@ -132,7 +132,7 @@ class NX584Alarm(alarm.AlarmControlPanelEntity): if zone["bypassed"]: _LOGGER.debug( "Zone %(zone)s is bypassed, assuming HOME", - dict(zone=zone["number"]), + {"zone": zone["number"]}, ) bypassed = True break diff --git a/homeassistant/components/rfxtrx/__init__.py b/homeassistant/components/rfxtrx/__init__.py index ccdf79772aa..22cc3ea4c9a 100644 --- a/homeassistant/components/rfxtrx/__init__.py +++ b/homeassistant/components/rfxtrx/__init__.py @@ -237,7 +237,7 @@ def _create_rfx(config): def _get_device_lookup(devices): """Get a lookup structure for devices.""" - lookup = dict() + lookup = {} for event_code, event_config in devices.items(): event = get_rfx_object(event_code) if event is None: diff --git a/homeassistant/components/sms/gateway.py b/homeassistant/components/sms/gateway.py index 2d36444c03d..9bdfbad0f55 100644 --- a/homeassistant/components/sms/gateway.py +++ b/homeassistant/components/sms/gateway.py @@ -59,9 +59,11 @@ class Gateway: if inner_entry["Buffer"] is not None: text = text + inner_entry["Buffer"] - event_data = dict( - phone=message["Number"], date=str(message["DateTime"]), message=text - ) + event_data = { + "phone": message["Number"], + "date": str(message["DateTime"]), + "message": text, + } _LOGGER.debug("Append event data:%s", event_data) data.append(event_data) diff --git a/homeassistant/components/uvc/camera.py b/homeassistant/components/uvc/camera.py index e07fac28d1f..da748c20c1c 100644 --- a/homeassistant/components/uvc/camera.py +++ b/homeassistant/components/uvc/camera.py @@ -152,7 +152,7 @@ class UnifiVideoCamera(Camera): camera.login() _LOGGER.debug( "Logged into UVC camera %(name)s via %(addr)s", - dict(name=self._name, addr=addr), + {"name": self._name, "addr": addr}, ) self._connect_addr = addr break diff --git a/homeassistant/components/vivotek/camera.py b/homeassistant/components/vivotek/camera.py index 6bf9fdace5a..b1c7d2bb2a7 100644 --- a/homeassistant/components/vivotek/camera.py +++ b/homeassistant/components/vivotek/camera.py @@ -52,9 +52,9 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( def setup_platform(hass, config, add_entities, discovery_info=None): """Set up a Vivotek IP Camera.""" creds = f"{config[CONF_USERNAME]}:{config[CONF_PASSWORD]}" - args = dict( - config=config, - cam=VivotekCamera( + args = { + "config": config, + "cam": VivotekCamera( host=config[CONF_IP_ADDRESS], port=(443 if config[CONF_SSL] else 80), verify_ssl=config[CONF_VERIFY_SSL], @@ -63,8 +63,8 @@ def setup_platform(hass, config, add_entities, discovery_info=None): digest_auth=config[CONF_AUTHENTICATION] == HTTP_DIGEST_AUTHENTICATION, sec_lvl=config[CONF_SECURITY_LEVEL], ), - stream_source=f"rtsp://{creds}@{config[CONF_IP_ADDRESS]}:554/{config[CONF_STREAM_PATH]}", - ) + "stream_source": f"rtsp://{creds}@{config[CONF_IP_ADDRESS]}:554/{config[CONF_STREAM_PATH]}", + } add_entities([VivotekCam(**args)], True) diff --git a/homeassistant/setup.py b/homeassistant/setup.py index 818e28479fb..4060b0410d6 100644 --- a/homeassistant/setup.py +++ b/homeassistant/setup.py @@ -77,7 +77,7 @@ async def _async_process_dependencies( if dep not in hass.config.components } - after_dependencies_tasks = dict() + after_dependencies_tasks = {} to_be_loaded = hass.data.get(DATA_SETUP_DONE, {}) for dep in integration.after_dependencies: if (