mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Remove vizio from mypy ignore list (#73585)
* Remove vizio config_flow from mypy ignore list * Fix mypy errors * Adjust media_player * Add space
This commit is contained in:
parent
e7e9c65e44
commit
a92105171c
@ -187,11 +187,11 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
"""Initialize config flow."""
|
"""Initialize config flow."""
|
||||||
self._user_schema = None
|
self._user_schema = None
|
||||||
self._must_show_form = None
|
self._must_show_form: bool | None = None
|
||||||
self._ch_type = None
|
self._ch_type = None
|
||||||
self._pairing_token = None
|
self._pairing_token = None
|
||||||
self._data = None
|
self._data: dict[str, Any] | None = None
|
||||||
self._apps = {}
|
self._apps: dict[str, list] = {}
|
||||||
|
|
||||||
async def _create_entry(self, input_dict: dict[str, Any]) -> FlowResult:
|
async def _create_entry(self, input_dict: dict[str, Any]) -> FlowResult:
|
||||||
"""Create vizio config entry."""
|
"""Create vizio config entry."""
|
||||||
@ -387,10 +387,11 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
Ask user for PIN to complete pairing process.
|
Ask user for PIN to complete pairing process.
|
||||||
"""
|
"""
|
||||||
errors = {}
|
errors: dict[str, str] = {}
|
||||||
|
|
||||||
# Start pairing process if it hasn't already started
|
# Start pairing process if it hasn't already started
|
||||||
if not self._ch_type and not self._pairing_token:
|
if not self._ch_type and not self._pairing_token:
|
||||||
|
assert self._data
|
||||||
dev = VizioAsync(
|
dev = VizioAsync(
|
||||||
DEVICE_ID,
|
DEVICE_ID,
|
||||||
self._data[CONF_HOST],
|
self._data[CONF_HOST],
|
||||||
@ -448,6 +449,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
async def _pairing_complete(self, step_id: str) -> FlowResult:
|
async def _pairing_complete(self, step_id: str) -> FlowResult:
|
||||||
"""Handle config flow completion."""
|
"""Handle config flow completion."""
|
||||||
|
assert self._data
|
||||||
if not self._must_show_form:
|
if not self._must_show_form:
|
||||||
return await self._create_entry(self._data)
|
return await self._create_entry(self._data)
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from pyvizio import VizioAsync
|
from pyvizio import VizioAsync
|
||||||
from pyvizio.api.apps import find_app_name
|
from pyvizio.api.apps import find_app_name
|
||||||
@ -103,7 +102,10 @@ async def async_setup_entry(
|
|||||||
params["data"] = new_data
|
params["data"] = new_data
|
||||||
|
|
||||||
if params:
|
if params:
|
||||||
hass.config_entries.async_update_entry(config_entry, **params)
|
hass.config_entries.async_update_entry(
|
||||||
|
config_entry,
|
||||||
|
**params, # type: ignore[arg-type]
|
||||||
|
)
|
||||||
|
|
||||||
device = VizioAsync(
|
device = VizioAsync(
|
||||||
DEVICE_ID,
|
DEVICE_ID,
|
||||||
@ -134,7 +136,7 @@ class VizioDevice(MediaPlayerEntity):
|
|||||||
config_entry: ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
device: VizioAsync,
|
device: VizioAsync,
|
||||||
name: str,
|
name: str,
|
||||||
device_class: str,
|
device_class: MediaPlayerDeviceClass,
|
||||||
apps_coordinator: DataUpdateCoordinator,
|
apps_coordinator: DataUpdateCoordinator,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize Vizio device."""
|
"""Initialize Vizio device."""
|
||||||
@ -145,8 +147,8 @@ class VizioDevice(MediaPlayerEntity):
|
|||||||
self._current_input = None
|
self._current_input = None
|
||||||
self._current_app_config = None
|
self._current_app_config = None
|
||||||
self._attr_app_name = None
|
self._attr_app_name = None
|
||||||
self._available_inputs = []
|
self._available_inputs: list[str] = []
|
||||||
self._available_apps = []
|
self._available_apps: list[str] = []
|
||||||
self._all_apps = apps_coordinator.data if apps_coordinator else None
|
self._all_apps = apps_coordinator.data if apps_coordinator else None
|
||||||
self._conf_apps = config_entry.options.get(CONF_APPS, {})
|
self._conf_apps = config_entry.options.get(CONF_APPS, {})
|
||||||
self._additional_app_configs = config_entry.data.get(CONF_APPS, {}).get(
|
self._additional_app_configs = config_entry.data.get(CONF_APPS, {}).get(
|
||||||
@ -195,6 +197,7 @@ class VizioDevice(MediaPlayerEntity):
|
|||||||
self._attr_available = True
|
self._attr_available = True
|
||||||
|
|
||||||
if not self._attr_device_info:
|
if not self._attr_device_info:
|
||||||
|
assert self._attr_unique_id
|
||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
identifiers={(DOMAIN, self._attr_unique_id)},
|
identifiers={(DOMAIN, self._attr_unique_id)},
|
||||||
manufacturer="VIZIO",
|
manufacturer="VIZIO",
|
||||||
@ -276,7 +279,7 @@ class VizioDevice(MediaPlayerEntity):
|
|||||||
if self._attr_app_name == NO_APP_RUNNING:
|
if self._attr_app_name == NO_APP_RUNNING:
|
||||||
self._attr_app_name = None
|
self._attr_app_name = None
|
||||||
|
|
||||||
def _get_additional_app_names(self) -> list[dict[str, Any]]:
|
def _get_additional_app_names(self) -> list[str]:
|
||||||
"""Return list of additional apps that were included in configuration.yaml."""
|
"""Return list of additional apps that were included in configuration.yaml."""
|
||||||
return [
|
return [
|
||||||
additional_app["name"] for additional_app in self._additional_app_configs
|
additional_app["name"] for additional_app in self._additional_app_configs
|
||||||
|
@ -758,7 +758,7 @@ def ensure_list_csv(value: Any) -> list:
|
|||||||
class multi_select:
|
class multi_select:
|
||||||
"""Multi select validator returning list of selected values."""
|
"""Multi select validator returning list of selected values."""
|
||||||
|
|
||||||
def __init__(self, options: dict) -> None:
|
def __init__(self, options: dict | list) -> None:
|
||||||
"""Initialize multi select."""
|
"""Initialize multi select."""
|
||||||
self.options = options
|
self.options = options
|
||||||
|
|
||||||
|
6
mypy.ini
6
mypy.ini
@ -2940,12 +2940,6 @@ ignore_errors = true
|
|||||||
[mypy-homeassistant.components.unifi.unifi_entity_base]
|
[mypy-homeassistant.components.unifi.unifi_entity_base]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
[mypy-homeassistant.components.vizio.config_flow]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.vizio.media_player]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.withings]
|
[mypy-homeassistant.components.withings]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
|
@ -129,8 +129,6 @@ IGNORED_MODULES: Final[list[str]] = [
|
|||||||
"homeassistant.components.unifi.device_tracker",
|
"homeassistant.components.unifi.device_tracker",
|
||||||
"homeassistant.components.unifi.diagnostics",
|
"homeassistant.components.unifi.diagnostics",
|
||||||
"homeassistant.components.unifi.unifi_entity_base",
|
"homeassistant.components.unifi.unifi_entity_base",
|
||||||
"homeassistant.components.vizio.config_flow",
|
|
||||||
"homeassistant.components.vizio.media_player",
|
|
||||||
"homeassistant.components.withings",
|
"homeassistant.components.withings",
|
||||||
"homeassistant.components.withings.binary_sensor",
|
"homeassistant.components.withings.binary_sensor",
|
||||||
"homeassistant.components.withings.common",
|
"homeassistant.components.withings.common",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user