mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Drop Python 3.11 support (#114220)
This commit is contained in:
parent
31f5576b6e
commit
2388e2dda9
@ -3,9 +3,9 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import sys
|
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
from webexteamssdk import ApiError, WebexTeamsAPI, exceptions
|
||||||
|
|
||||||
from homeassistant.components.notify import (
|
from homeassistant.components.notify import (
|
||||||
ATTR_TITLE,
|
ATTR_TITLE,
|
||||||
@ -14,14 +14,9 @@ from homeassistant.components.notify import (
|
|||||||
)
|
)
|
||||||
from homeassistant.const import CONF_TOKEN
|
from homeassistant.const import CONF_TOKEN
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
if sys.version_info < (3, 12):
|
|
||||||
from webexteamssdk import ApiError, WebexTeamsAPI, exceptions
|
|
||||||
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
CONF_ROOM_ID = "room_id"
|
CONF_ROOM_ID = "room_id"
|
||||||
@ -37,11 +32,6 @@ def get_service(
|
|||||||
discovery_info: DiscoveryInfoType | None = None,
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
) -> CiscoWebexTeamsNotificationService | None:
|
) -> CiscoWebexTeamsNotificationService | None:
|
||||||
"""Get the CiscoWebexTeams notification service."""
|
"""Get the CiscoWebexTeams notification service."""
|
||||||
if sys.version_info >= (3, 12):
|
|
||||||
raise HomeAssistantError(
|
|
||||||
"Cisco Webex Teams is not supported on Python 3.12. Please use Python 3.11."
|
|
||||||
)
|
|
||||||
|
|
||||||
client = WebexTeamsAPI(access_token=config[CONF_TOKEN])
|
client = WebexTeamsAPI(access_token=config[CONF_TOKEN])
|
||||||
try:
|
try:
|
||||||
# Validate the token & room_id
|
# Validate the token & room_id
|
||||||
|
@ -11,9 +11,7 @@ from decimal import Decimal, InvalidOperation as DecimalInvalidOperation
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
import logging
|
import logging
|
||||||
from math import ceil, floor, isfinite, log10
|
from math import ceil, floor, isfinite, log10
|
||||||
from typing import TYPE_CHECKING, Any, Final, Self, cast, final
|
from typing import TYPE_CHECKING, Any, Final, Self, cast, final, override
|
||||||
|
|
||||||
from typing_extensions import override
|
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ( # noqa: F401
|
from homeassistant.const import ( # noqa: F401
|
||||||
|
@ -20,10 +20,10 @@ MINOR_VERSION: Final = 4
|
|||||||
PATCH_VERSION: Final = "0.dev0"
|
PATCH_VERSION: Final = "0.dev0"
|
||||||
__short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
|
__short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
|
||||||
__version__: Final = f"{__short_version__}.{PATCH_VERSION}"
|
__version__: Final = f"{__short_version__}.{PATCH_VERSION}"
|
||||||
REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 11, 0)
|
REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 12, 0)
|
||||||
REQUIRED_NEXT_PYTHON_VER: Final[tuple[int, int, int]] = (3, 12, 0)
|
REQUIRED_NEXT_PYTHON_VER: Final[tuple[int, int, int]] = (3, 12, 0)
|
||||||
# Truthy date string triggers showing related deprecation warning messages.
|
# Truthy date string triggers showing related deprecation warning messages.
|
||||||
REQUIRED_NEXT_PYTHON_HA_RELEASE: Final = "2024.4"
|
REQUIRED_NEXT_PYTHON_HA_RELEASE: Final = ""
|
||||||
|
|
||||||
# Format for platform files
|
# Format for platform files
|
||||||
PLATFORM_FORMAT: Final = "{platform}.{domain}"
|
PLATFORM_FORMAT: Final = "{platform}.{domain}"
|
||||||
|
@ -8,7 +8,6 @@ import concurrent.futures
|
|||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
import functools
|
import functools
|
||||||
import logging
|
import logging
|
||||||
import sys
|
|
||||||
import threading
|
import threading
|
||||||
from typing import Any, ParamSpec, TypeVar, TypeVarTuple
|
from typing import Any, ParamSpec, TypeVar, TypeVarTuple
|
||||||
|
|
||||||
@ -23,35 +22,20 @@ _R = TypeVar("_R")
|
|||||||
_P = ParamSpec("_P")
|
_P = ParamSpec("_P")
|
||||||
_Ts = TypeVarTuple("_Ts")
|
_Ts = TypeVarTuple("_Ts")
|
||||||
|
|
||||||
if sys.version_info >= (3, 12, 0):
|
|
||||||
|
|
||||||
def create_eager_task(
|
def create_eager_task(
|
||||||
coro: Coroutine[Any, Any, _T],
|
coro: Coroutine[Any, Any, _T],
|
||||||
*,
|
*,
|
||||||
name: str | None = None,
|
name: str | None = None,
|
||||||
loop: AbstractEventLoop | None = None,
|
loop: AbstractEventLoop | None = None,
|
||||||
) -> Task[_T]:
|
) -> Task[_T]:
|
||||||
"""Create a task from a coroutine and schedule it to run immediately."""
|
"""Create a task from a coroutine and schedule it to run immediately."""
|
||||||
return Task(
|
return Task(
|
||||||
coro,
|
coro,
|
||||||
loop=loop or get_running_loop(),
|
loop=loop or get_running_loop(),
|
||||||
name=name,
|
name=name,
|
||||||
eager_start=True, # type: ignore[call-arg]
|
eager_start=True,
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
|
|
||||||
def create_eager_task(
|
|
||||||
coro: Coroutine[Any, Any, _T],
|
|
||||||
*,
|
|
||||||
name: str | None = None,
|
|
||||||
loop: AbstractEventLoop | None = None,
|
|
||||||
) -> Task[_T]:
|
|
||||||
"""Create a task from a coroutine and schedule it to run immediately."""
|
|
||||||
return Task(
|
|
||||||
coro,
|
|
||||||
loop=loop or get_running_loop(),
|
|
||||||
name=name,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def cancelling(task: Future[Any]) -> bool:
|
def cancelling(task: Future[Any]) -> bool:
|
||||||
|
@ -8,9 +8,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import sys
|
import sys
|
||||||
from typing import Any
|
from typing import Any, dataclass_transform
|
||||||
|
|
||||||
from typing_extensions import dataclass_transform
|
|
||||||
|
|
||||||
|
|
||||||
def _class_fields(cls: type, kw_only: bool) -> list[tuple[str, Any, Any]]:
|
def _class_fields(cls: type, kw_only: bool) -> list[tuple[str, Any, Any]]:
|
||||||
|
2
mypy.ini
2
mypy.ini
@ -3,7 +3,7 @@
|
|||||||
# To update, run python3 -m script.hassfest -p mypy_config
|
# To update, run python3 -m script.hassfest -p mypy_config
|
||||||
|
|
||||||
[mypy]
|
[mypy]
|
||||||
python_version = 3.11
|
python_version = 3.12
|
||||||
plugins = pydantic.mypy
|
plugins = pydantic.mypy
|
||||||
show_error_codes = true
|
show_error_codes = true
|
||||||
follow_imports = silent
|
follow_imports = silent
|
||||||
|
@ -18,10 +18,10 @@ classifiers = [
|
|||||||
"Intended Audience :: Developers",
|
"Intended Audience :: Developers",
|
||||||
"License :: OSI Approved :: Apache Software License",
|
"License :: OSI Approved :: Apache Software License",
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.12",
|
||||||
"Topic :: Home Automation",
|
"Topic :: Home Automation",
|
||||||
]
|
]
|
||||||
requires-python = ">=3.11.0"
|
requires-python = ">=3.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aiohttp==3.9.3",
|
"aiohttp==3.9.3",
|
||||||
"aiohttp_cors==0.7.0",
|
"aiohttp_cors==0.7.0",
|
||||||
@ -90,7 +90,7 @@ include-package-data = true
|
|||||||
include = ["homeassistant*"]
|
include = ["homeassistant*"]
|
||||||
|
|
||||||
[tool.pylint.MAIN]
|
[tool.pylint.MAIN]
|
||||||
py-version = "3.11"
|
py-version = "3.12"
|
||||||
ignore = [
|
ignore = [
|
||||||
"tests",
|
"tests",
|
||||||
]
|
]
|
||||||
@ -705,6 +705,8 @@ ignore = [
|
|||||||
"UP007", # keep type annotation style as is
|
"UP007", # keep type annotation style as is
|
||||||
# Ignored due to performance: https://github.com/charliermarsh/ruff/issues/2923
|
# Ignored due to performance: https://github.com/charliermarsh/ruff/issues/2923
|
||||||
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
|
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
|
||||||
|
# Ignored due to incompatible with mypy: https://github.com/python/mypy/issues/15238
|
||||||
|
"UP040", # Checks for use of TypeAlias annotation for declaring type aliases.
|
||||||
|
|
||||||
# May conflict with the formatter, https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
|
# May conflict with the formatter, https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
|
||||||
"W191",
|
"W191",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user