Add Self typing (4) [mypy 1.0] (#87601)
This commit is contained in:
parent
f7b39aa4a8
commit
ea4e2ab4aa
11 changed files with 32 additions and 19 deletions
|
@ -5,6 +5,7 @@ from collections.abc import Callable
|
|||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
|
@ -207,14 +208,14 @@ class Timer(collection.CollectionEntity, RestoreEntity):
|
|||
self._attr_force_update = True
|
||||
|
||||
@classmethod
|
||||
def from_storage(cls, config: ConfigType) -> Timer:
|
||||
def from_storage(cls, config: ConfigType) -> Self:
|
||||
"""Return entity instance initialized from storage."""
|
||||
timer = cls(config)
|
||||
timer.editable = True
|
||||
return timer
|
||||
|
||||
@classmethod
|
||||
def from_yaml(cls, config: ConfigType) -> Timer:
|
||||
def from_yaml(cls, config: ConfigType) -> Self:
|
||||
"""Return entity instance initialized from yaml."""
|
||||
timer = cls(config)
|
||||
timer.entity_id = ENTITY_ID_FORMAT.format(config[CONF_ID])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue