1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Bump mypy to 0.930 (#62642)

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
This commit is contained in:
Tobias Sauerwein
2021-12-27 17:55:17 +01:00
committed by GitHub
parent b0704c190f
commit 2c904c0974
22 changed files with 73 additions and 58 deletions

View File

@@ -16,7 +16,7 @@ from numbers import Number
import os
import re
from socket import _GLOBAL_DEFAULT_TIMEOUT # type: ignore # private, not in typeshed
from typing import Any, Dict, TypeVar, cast
from typing import Any, Dict, TypeVar, cast, overload
from urllib.parse import urlparse
from uuid import UUID
@@ -245,7 +245,17 @@ def isdir(value: Any) -> str:
return dir_in
def ensure_list(value: T | list[T] | None) -> list[T]:
@overload
def ensure_list(value: None) -> list[Any]:
...
@overload
def ensure_list(value: T | list[T]) -> list[T]:
...
def ensure_list(value: T | list[T] | None) -> list[T] | list[Any]:
"""Wrap value in list if it is not one."""
if value is None:
return []