mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 18:27:51 +00:00
Add type ignore error codes [other] (#66781)
This commit is contained in:
parent
8d2fb72cc3
commit
ac50248938
@ -12,7 +12,7 @@ T = TypeVar("T")
|
|||||||
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def async_redact_data(data: Mapping, to_redact: Iterable[Any]) -> dict: # type: ignore
|
def async_redact_data(data: Mapping, to_redact: Iterable[Any]) -> dict: # type: ignore[misc]
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ class EnergyManager:
|
|||||||
"device_consumption",
|
"device_consumption",
|
||||||
):
|
):
|
||||||
if key in update:
|
if key in update:
|
||||||
data[key] = update[key] # type: ignore
|
data[key] = update[key] # type: ignore[misc]
|
||||||
|
|
||||||
self.data = data
|
self.data = data
|
||||||
self._store.async_delay_save(lambda: cast(dict, self.data), 60)
|
self._store.async_delay_save(lambda: cast(dict, self.data), 60)
|
||||||
|
@ -148,17 +148,17 @@ class SensorManager:
|
|||||||
self._process_sensor_data(
|
self._process_sensor_data(
|
||||||
adapter,
|
adapter,
|
||||||
# Opting out of the type complexity because can't get it to work
|
# Opting out of the type complexity because can't get it to work
|
||||||
energy_source, # type: ignore
|
energy_source, # type: ignore[arg-type]
|
||||||
to_add,
|
to_add,
|
||||||
to_remove,
|
to_remove,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for flow in energy_source[adapter.flow_type]: # type: ignore
|
for flow in energy_source[adapter.flow_type]: # type: ignore[typeddict-item]
|
||||||
self._process_sensor_data(
|
self._process_sensor_data(
|
||||||
adapter,
|
adapter,
|
||||||
# Opting out of the type complexity because can't get it to work
|
# Opting out of the type complexity because can't get it to work
|
||||||
flow, # type: ignore
|
flow, # type: ignore[arg-type]
|
||||||
to_add,
|
to_add,
|
||||||
to_remove,
|
to_remove,
|
||||||
)
|
)
|
||||||
|
@ -123,7 +123,7 @@ class MediaGroup(MediaPlayerEntity):
|
|||||||
"""Update supported features and state when a new state is received."""
|
"""Update supported features and state when a new state is received."""
|
||||||
self.async_set_context(event.context)
|
self.async_set_context(event.context)
|
||||||
self.async_update_supported_features(
|
self.async_update_supported_features(
|
||||||
event.data.get("entity_id"), event.data.get("new_state") # type: ignore
|
event.data.get("entity_id"), event.data.get("new_state") # type: ignore[arg-type]
|
||||||
)
|
)
|
||||||
self.async_update_state()
|
self.async_update_state()
|
||||||
|
|
||||||
@ -361,14 +361,14 @@ class MediaGroup(MediaPlayerEntity):
|
|||||||
async def async_volume_up(self) -> None:
|
async def async_volume_up(self) -> None:
|
||||||
"""Turn volume up for media player(s)."""
|
"""Turn volume up for media player(s)."""
|
||||||
for entity in self._features[KEY_VOLUME]:
|
for entity in self._features[KEY_VOLUME]:
|
||||||
volume_level = self.hass.states.get(entity).attributes["volume_level"] # type: ignore
|
volume_level = self.hass.states.get(entity).attributes["volume_level"] # type: ignore[union-attr]
|
||||||
if volume_level < 1:
|
if volume_level < 1:
|
||||||
await self.async_set_volume_level(min(1, volume_level + 0.1))
|
await self.async_set_volume_level(min(1, volume_level + 0.1))
|
||||||
|
|
||||||
async def async_volume_down(self) -> None:
|
async def async_volume_down(self) -> None:
|
||||||
"""Turn volume down for media player(s)."""
|
"""Turn volume down for media player(s)."""
|
||||||
for entity in self._features[KEY_VOLUME]:
|
for entity in self._features[KEY_VOLUME]:
|
||||||
volume_level = self.hass.states.get(entity).attributes["volume_level"] # type: ignore
|
volume_level = self.hass.states.get(entity).attributes["volume_level"] # type: ignore[union-attr]
|
||||||
if volume_level > 0:
|
if volume_level > 0:
|
||||||
await self.async_set_volume_level(max(0, volume_level - 0.1))
|
await self.async_set_volume_level(max(0, volume_level - 0.1))
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ class SensorEntity(Entity):
|
|||||||
hasattr(self, "_attr_unit_of_measurement")
|
hasattr(self, "_attr_unit_of_measurement")
|
||||||
and self._attr_unit_of_measurement is not None
|
and self._attr_unit_of_measurement is not None
|
||||||
):
|
):
|
||||||
return self._attr_unit_of_measurement # type: ignore
|
return self._attr_unit_of_measurement # type: ignore[unreachable]
|
||||||
|
|
||||||
native_unit_of_measurement = self.native_unit_of_measurement
|
native_unit_of_measurement = self.native_unit_of_measurement
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ def _compile_statistics( # noqa: C901
|
|||||||
]
|
]
|
||||||
history_list = {}
|
history_list = {}
|
||||||
if entities_full_history:
|
if entities_full_history:
|
||||||
history_list = history.get_significant_states_with_session( # type: ignore
|
history_list = history.get_significant_states_with_session( # type: ignore[no-untyped-call]
|
||||||
hass,
|
hass,
|
||||||
session,
|
session,
|
||||||
start - datetime.timedelta.resolution,
|
start - datetime.timedelta.resolution,
|
||||||
@ -432,7 +432,7 @@ def _compile_statistics( # noqa: C901
|
|||||||
if "sum" not in wanted_statistics[i.entity_id]
|
if "sum" not in wanted_statistics[i.entity_id]
|
||||||
]
|
]
|
||||||
if entities_significant_history:
|
if entities_significant_history:
|
||||||
_history_list = history.get_significant_states_with_session( # type: ignore
|
_history_list = history.get_significant_states_with_session( # type: ignore[no-untyped-call]
|
||||||
hass,
|
hass,
|
||||||
session,
|
session,
|
||||||
start - datetime.timedelta.resolution,
|
start - datetime.timedelta.resolution,
|
||||||
|
@ -56,7 +56,7 @@ class TTSMediaSource(MediaSource):
|
|||||||
manager: SpeechManager = self.hass.data[DOMAIN]
|
manager: SpeechManager = self.hass.data[DOMAIN]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
url = await manager.async_get_url_path(**kwargs) # type: ignore
|
url = await manager.async_get_url_path(**kwargs) # type: ignore[arg-type]
|
||||||
except HomeAssistantError as err:
|
except HomeAssistantError as err:
|
||||||
raise Unresolvable(str(err)) from err
|
raise Unresolvable(str(err)) from err
|
||||||
|
|
||||||
|
@ -23,5 +23,5 @@ def install_multiple_zeroconf_catcher(hass_zc: HaZeroconf) -> None:
|
|||||||
def new_zeroconf_init(self: zeroconf.Zeroconf, *k: Any, **kw: Any) -> None:
|
def new_zeroconf_init(self: zeroconf.Zeroconf, *k: Any, **kw: Any) -> None:
|
||||||
return
|
return
|
||||||
|
|
||||||
zeroconf.Zeroconf.__new__ = new_zeroconf_new # type: ignore
|
zeroconf.Zeroconf.__new__ = new_zeroconf_new # type: ignore[assignment]
|
||||||
zeroconf.Zeroconf.__init__ = new_zeroconf_init # type: ignore
|
zeroconf.Zeroconf.__init__ = new_zeroconf_init # type: ignore[assignment]
|
||||||
|
@ -122,7 +122,7 @@ def async_active_zone(
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
within_zone = zone_dist - radius < zone.attributes[ATTR_RADIUS]
|
within_zone = zone_dist - radius < zone.attributes[ATTR_RADIUS]
|
||||||
closer_zone = closest is None or zone_dist < min_dist # type: ignore
|
closer_zone = closest is None or zone_dist < min_dist # type: ignore[unreachable]
|
||||||
smaller_zone = (
|
smaller_zone = (
|
||||||
zone_dist == min_dist
|
zone_dist == min_dist
|
||||||
and zone.attributes[ATTR_RADIUS]
|
and zone.attributes[ATTR_RADIUS]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user