Use assignment expressions 18 (#57967)

This commit is contained in:
Marc Mueller 2021-10-18 18:36:35 +02:00 committed by GitHub
parent ff853b2d53
commit f149bef9f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 29 additions and 64 deletions

View file

@ -51,8 +51,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the SQL sensor platform."""
db_url = config.get(CONF_DB_URL)
if not db_url:
if not (db_url := config.get(CONF_DB_URL)):
db_url = DEFAULT_URL.format(hass_config_path=hass.config.path(DEFAULT_DB_FILE))
sess = None