mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Fix method subtyping [recorder] (#134212)
This commit is contained in:
parent
d3fab42c85
commit
3df91cfba5
@ -6,7 +6,7 @@ from collections.abc import Callable
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
import time
|
||||
from typing import Any, Final, Self, cast
|
||||
from typing import Any, Final, Protocol, Self, cast
|
||||
|
||||
import ciso8601
|
||||
from fnv_hash_fast import fnv1a_32
|
||||
@ -233,10 +233,14 @@ CONTEXT_BINARY_TYPE = LargeBinary(CONTEXT_ID_BIN_MAX_LENGTH).with_variant(
|
||||
TIMESTAMP_TYPE = DOUBLE_TYPE
|
||||
|
||||
|
||||
class _LiteralProcessorType(Protocol):
|
||||
def __call__(self, value: Any) -> str: ...
|
||||
|
||||
|
||||
class JSONLiteral(JSON):
|
||||
"""Teach SA how to literalize json."""
|
||||
|
||||
def literal_processor(self, dialect: Dialect) -> Callable[[Any], str]:
|
||||
def literal_processor(self, dialect: Dialect) -> _LiteralProcessorType:
|
||||
"""Processor to convert a value to JSON."""
|
||||
|
||||
def process(value: Any) -> str:
|
||||
|
@ -2453,7 +2453,7 @@ class BaseMigration(ABC):
|
||||
self.migration_changes = migration_changes
|
||||
|
||||
@abstractmethod
|
||||
def migrate_data(self, instance: Recorder) -> bool:
|
||||
def migrate_data(self, instance: Recorder, /) -> bool:
|
||||
"""Migrate some data, return True if migration is completed."""
|
||||
|
||||
def _migrate_data(self, instance: Recorder) -> bool:
|
||||
|
Loading…
x
Reference in New Issue
Block a user