Update mypy-dev to 1.11.0a5 (#118519)

This commit is contained in:
Marc Mueller 2024-06-02 15:28:24 +02:00 committed by GitHub
parent 8f94205014
commit dbb27755a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 9 deletions

View File

@ -4,7 +4,7 @@ from __future__ import annotations
from functools import partial from functools import partial
from types import MappingProxyType from types import MappingProxyType
from typing import TYPE_CHECKING, Any, cast from typing import TYPE_CHECKING, Any, Literal, cast
from homeassistant.components.weather import ( from homeassistant.components.weather import (
ATTR_CONDITION_CLEAR_NIGHT, ATTR_CONDITION_CLEAR_NIGHT,
@ -156,6 +156,8 @@ class NWSWeather(CoordinatorWeatherEntity[TimestampDataUpdateCoordinator[None]])
for forecast_type in ("twice_daily", "hourly"): for forecast_type in ("twice_daily", "hourly"):
if (coordinator := self.forecast_coordinators[forecast_type]) is None: if (coordinator := self.forecast_coordinators[forecast_type]) is None:
continue continue
if TYPE_CHECKING:
forecast_type = cast(Literal["twice_daily", "hourly"], forecast_type)
self.unsub_forecast[forecast_type] = coordinator.async_add_listener( self.unsub_forecast[forecast_type] = coordinator.async_add_listener(
partial(self._handle_forecast_update, forecast_type) partial(self._handle_forecast_update, forecast_type)
) )

View File

@ -74,7 +74,7 @@ class LazyState(State):
def last_changed(self) -> datetime: # type: ignore[override] def last_changed(self) -> datetime: # type: ignore[override]
"""Last changed datetime.""" """Last changed datetime."""
return dt_util.utc_from_timestamp( return dt_util.utc_from_timestamp(
self._last_changed_ts or self._last_updated_ts self._last_changed_ts or self._last_updated_ts # type: ignore[arg-type]
) )
@cached_property @cached_property
@ -86,7 +86,7 @@ class LazyState(State):
def last_reported(self) -> datetime: # type: ignore[override] def last_reported(self) -> datetime: # type: ignore[override]
"""Last reported datetime.""" """Last reported datetime."""
return dt_util.utc_from_timestamp( return dt_util.utc_from_timestamp(
self._last_reported_ts or self._last_updated_ts self._last_reported_ts or self._last_updated_ts # type: ignore[arg-type]
) )
@cached_property @cached_property

View File

@ -5,7 +5,7 @@ from __future__ import annotations
from functools import partial from functools import partial
import logging import logging
import re import re
from typing import Any from typing import Any, Literal
import transmission_rpc import transmission_rpc
from transmission_rpc.error import ( from transmission_rpc.error import (
@ -248,6 +248,7 @@ async def get_api(
hass: HomeAssistant, entry: dict[str, Any] hass: HomeAssistant, entry: dict[str, Any]
) -> transmission_rpc.Client: ) -> transmission_rpc.Client:
"""Get Transmission client.""" """Get Transmission client."""
protocol: Literal["http", "https"]
protocol = "https" if entry[CONF_SSL] else "http" protocol = "https" if entry[CONF_SSL] else "http"
host = entry[CONF_HOST] host = entry[CONF_HOST]
port = entry[CONF_PORT] port = entry[CONF_PORT]

View File

@ -17,13 +17,13 @@ from .file import WriteError # noqa: F401
_SENTINEL = object() _SENTINEL = object()
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
JsonValueType = ( type JsonValueType = (
dict[str, "JsonValueType"] | list["JsonValueType"] | str | int | float | bool | None dict[str, JsonValueType] | list[JsonValueType] | str | int | float | bool | None
) )
"""Any data that can be returned by the standard JSON deserializing process.""" """Any data that can be returned by the standard JSON deserializing process."""
JsonArrayType = list[JsonValueType] type JsonArrayType = list[JsonValueType]
"""List that can be returned by the standard JSON deserializing process.""" """List that can be returned by the standard JSON deserializing process."""
JsonObjectType = dict[str, JsonValueType] type JsonObjectType = dict[str, JsonValueType]
"""Dictionary that can be returned by the standard JSON deserializing process.""" """Dictionary that can be returned by the standard JSON deserializing process."""
JSON_ENCODE_EXCEPTIONS = (TypeError, ValueError) JSON_ENCODE_EXCEPTIONS = (TypeError, ValueError)

View File

@ -11,7 +11,7 @@ astroid==3.2.2
coverage==7.5.0 coverage==7.5.0
freezegun==1.5.0 freezegun==1.5.0
mock-open==1.4.0 mock-open==1.4.0
mypy-dev==1.11.0a3 mypy-dev==1.11.0a5
pre-commit==3.7.1 pre-commit==3.7.1
pydantic==1.10.15 pydantic==1.10.15
pylint==3.2.2 pylint==3.2.2