1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-04 02:52:22 +01:00

update minimal python version to 3.10 (#8850)

This commit is contained in:
Thomas Rupprecht
2025-05-22 03:21:43 +02:00
committed by GitHub
parent 026f47bfb3
commit aeb4e63950
36 changed files with 148 additions and 166 deletions

View File

@@ -1,5 +1,5 @@
from collections.abc import Awaitable
from typing import Any, Callable, Optional
from collections.abc import Awaitable, Callable
from typing import Any
import esphome.codegen as cg
from esphome.const import CONF_ID
@@ -103,7 +103,7 @@ def define_setting_readers(component_type: str, keys: list[str]) -> None:
def add_messages(hub: cg.MockObj, keys: list[str], schemas: dict[str, TSchema]):
messages: dict[str, tuple[bool, Optional[int]]] = {}
messages: dict[str, tuple[bool, int | None]] = {}
for key in keys:
messages[schemas[key].message] = (
schemas[key].keep_updated,

View File

@@ -2,7 +2,7 @@
# inputs of the OpenTherm component.
from dataclasses import dataclass
from typing import Any, Optional, TypeVar
from typing import Any, TypeVar
import esphome.config_validation as cv
from esphome.const import (
@@ -61,11 +61,11 @@ TSchema = TypeVar("TSchema", bound=EntitySchema)
class SensorSchema(EntitySchema):
accuracy_decimals: int
state_class: str
unit_of_measurement: Optional[str] = None
icon: Optional[str] = None
device_class: Optional[str] = None
unit_of_measurement: str | None = None
icon: str | None = None
device_class: str | None = None
disabled_by_default: bool = False
order: Optional[int] = None
order: int | None = None
SENSORS: dict[str, SensorSchema] = {
@@ -461,9 +461,9 @@ SENSORS: dict[str, SensorSchema] = {
@dataclass
class BinarySensorSchema(EntitySchema):
icon: Optional[str] = None
device_class: Optional[str] = None
order: Optional[int] = None
icon: str | None = None
device_class: str | None = None
order: int | None = None
BINARY_SENSORS: dict[str, BinarySensorSchema] = {
@@ -654,7 +654,7 @@ BINARY_SENSORS: dict[str, BinarySensorSchema] = {
@dataclass
class SwitchSchema(EntitySchema):
default_mode: Optional[str] = None
default_mode: str | None = None
SWITCHES: dict[str, SwitchSchema] = {
@@ -721,9 +721,9 @@ class InputSchema(EntitySchema):
unit_of_measurement: str
step: float
range: tuple[int, int]
icon: Optional[str] = None
auto_max_value: Optional[AutoConfigure] = None
auto_min_value: Optional[AutoConfigure] = None
icon: str | None = None
auto_max_value: AutoConfigure | None = None
auto_min_value: AutoConfigure | None = None
INPUTS: dict[str, InputSchema] = {
@@ -834,7 +834,7 @@ class SettingSchema(EntitySchema):
backing_type: str
validation_schema: cv.Schema
default_value: Any
order: Optional[int] = None
order: int | None = None
SETTINGS: dict[str, SettingSchema] = {

View File

@@ -1,4 +1,4 @@
from typing import Callable
from collections.abc import Callable
from voluptuous import Schema