From 6e1b787ba6a7690340e2b1652a9831a8a9a570e9 Mon Sep 17 00:00:00 2001 From: Marvin Wichmann Date: Sun, 1 May 2022 13:21:27 +0200 Subject: [PATCH] Add missing type information for panel_custom (#71122) --- .../components/panel_custom/__init__.py | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/panel_custom/__init__.py b/homeassistant/components/panel_custom/__init__.py index d0ff0ad44a0..493a738c1ea 100644 --- a/homeassistant/components/panel_custom/__init__.py +++ b/homeassistant/components/panel_custom/__init__.py @@ -1,4 +1,6 @@ """Register a custom front end panel.""" +from __future__ import annotations + import logging import voluptuous as vol @@ -70,27 +72,27 @@ CONFIG_SCHEMA = vol.Schema( @bind_hass async def async_register_panel( - hass, + hass: HomeAssistant, # The url to serve the panel - frontend_url_path, + frontend_url_path: str, # The webcomponent name that loads your panel - webcomponent_name, + webcomponent_name: str, # Title/icon for sidebar - sidebar_title=None, - sidebar_icon=None, + sidebar_title: str | None = None, + sidebar_icon: str | None = None, # JS source of your panel - js_url=None, + js_url: str | None = None, # JS module of your panel - module_url=None, + module_url: str | None = None, # If your panel should be run inside an iframe - embed_iframe=DEFAULT_EMBED_IFRAME, + embed_iframe: bool = DEFAULT_EMBED_IFRAME, # Should user be asked for confirmation when loading external source - trust_external=DEFAULT_TRUST_EXTERNAL, + trust_external: bool = DEFAULT_TRUST_EXTERNAL, # Configuration to be passed to the panel - config=None, + config: ConfigType | None = None, # If your panel should only be shown to admin users - require_admin=False, -): + require_admin: bool = False, +) -> None: """Register a new custom panel.""" if js_url is None and module_url is None: raise ValueError("Either js_url, module_url or html_url is required.")