Add Self typing (1) [mypy 1.0] (#87598)

This commit is contained in:
Marc Mueller
2023-02-07 05:29:47 +01:00
committed by GitHub
parent a5d376069a
commit 342b406dc0
7 changed files with 23 additions and 35 deletions

View File

@@ -14,6 +14,8 @@ from types import MappingProxyType, MethodType
from typing import TYPE_CHECKING, Any, TypeVar, cast
import weakref
from typing_extensions import Self
from . import data_entry_flow, loader
from .backports.enum import StrEnum
from .components import persistent_notification
@@ -86,7 +88,6 @@ PATH_CONFIG = ".config_entries.json"
SAVE_DELAY = 1
_ConfigEntryStateSelfT = TypeVar("_ConfigEntryStateSelfT", bound="ConfigEntryState")
_R = TypeVar("_R")
@@ -110,9 +111,7 @@ class ConfigEntryState(Enum):
_recoverable: bool
def __new__(
cls: type[_ConfigEntryStateSelfT], value: str, recoverable: bool
) -> _ConfigEntryStateSelfT:
def __new__(cls, value: str, recoverable: bool) -> Self:
"""Create new ConfigEntryState."""
obj = object.__new__(cls)
obj._value_ = value