From b9ffc67a44e3cdac64ffab053c3367ec0cff1bbc Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 26 Jan 2023 11:10:50 +0100 Subject: [PATCH] Add hints to get_service in syslog (#86701) --- homeassistant/components/syslog/notify.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/syslog/notify.py b/homeassistant/components/syslog/notify.py index 5a5bac002e4..d4772e95259 100644 --- a/homeassistant/components/syslog/notify.py +++ b/homeassistant/components/syslog/notify.py @@ -1,4 +1,6 @@ """Syslog notification service.""" +from __future__ import annotations + import syslog import voluptuous as vol @@ -9,6 +11,8 @@ from homeassistant.components.notify import ( PLATFORM_SCHEMA, BaseNotificationService, ) +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType CONF_FACILITY = "facility" CONF_OPTION = "option" @@ -63,12 +67,16 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( ) -def get_service(hass, config, discovery_info=None): +def get_service( + hass: HomeAssistant, + config: ConfigType, + discovery_info: DiscoveryInfoType | None = None, +) -> SyslogNotificationService: """Get the syslog notification service.""" - facility = getattr(syslog, SYSLOG_FACILITY[config.get(CONF_FACILITY)]) - option = getattr(syslog, SYSLOG_OPTION[config.get(CONF_OPTION)]) - priority = getattr(syslog, SYSLOG_PRIORITY[config.get(CONF_PRIORITY)]) + facility = getattr(syslog, SYSLOG_FACILITY[config[CONF_FACILITY]]) + option = getattr(syslog, SYSLOG_OPTION[config[CONF_OPTION]]) + priority = getattr(syslog, SYSLOG_PRIORITY[config[CONF_PRIORITY]]) return SyslogNotificationService(facility, option, priority)