Bump mypy to 0.940 (#68007)

This commit is contained in:
Marc Mueller 2022-03-12 00:57:38 +01:00 committed by GitHub
parent 380f04277e
commit 41df798375
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 9 additions and 9 deletions

View File

@ -98,7 +98,7 @@ class CO2Sensor(update_coordinator.CoordinatorEntity[CO2SignalResponse], SensorE
@property
def native_value(self) -> StateType:
"""Return sensor state."""
if (value := self.coordinator.data["data"][self._description.key]) is None: # type: ignore[misc]
if (value := self.coordinator.data["data"][self._description.key]) is None: # type: ignore[literal-required]
return None
return round(value, 2)

View File

@ -291,7 +291,7 @@ class EnergyManager:
"device_consumption",
):
if key in update:
data[key] = update[key] # type: ignore[misc]
data[key] = update[key] # type: ignore[literal-required]
self.data = data
self._store.async_delay_save(lambda: cast(dict, self.data), 60)

View File

@ -102,9 +102,9 @@ def async_populate_data_from_discovery(
device.get(discovery_key) is not None
and conf_key
not in data_updates # Prefer the model num from TCP instead of UDP
and current_data.get(conf_key) != device[discovery_key] # type: ignore[misc]
and current_data.get(conf_key) != device[discovery_key] # type: ignore[literal-required]
):
data_updates[conf_key] = device[discovery_key] # type: ignore[misc]
data_updates[conf_key] = device[discovery_key] # type: ignore[literal-required]
@callback

View File

@ -44,7 +44,6 @@ def _async_device_entities(
for device in data.get_by_types({model_type}):
assert isinstance(device, (Camera, Light, Sensor, Viewer, Doorlock))
for description in descs:
assert isinstance(description, EntityDescription)
if description.ufp_required_field:
required_field = get_nested_attr(device, description.ufp_required_field)
if not required_field:

View File

@ -18,7 +18,7 @@ T = TypeVar("T", bound=ProtectDeviceModel)
@dataclass
class ProtectRequiredKeysMixin(Generic[T]):
class ProtectRequiredKeysMixin(EntityDescription, Generic[T]):
"""Mixin for required keys."""
ufp_required_field: str | None = None
@ -54,7 +54,6 @@ class ProtectSetableKeysMixin(ProtectRequiredKeysMixin, Generic[T]):
async def ufp_set(self, obj: T, value: Any) -> None:
"""Set value for UniFi Protect device."""
assert isinstance(self, EntityDescription)
_LOGGER.debug("Setting %s to %s for %s", self.name, value, obj.name)
if self.ufp_set_method is not None:
await getattr(obj, self.ufp_set_method)(value)

View File

@ -478,7 +478,7 @@ class EntityPlatform:
"via_device",
):
if key in device_info:
processed_dev_info[key] = device_info[key] # type: ignore[misc]
processed_dev_info[key] = device_info[key] # type: ignore[literal-required]
if "configuration_url" in device_info:
if device_info["configuration_url"] is None:

View File

@ -12,6 +12,7 @@ warn_incomplete_stub = true
warn_redundant_casts = true
warn_unused_configs = true
warn_unused_ignores = true
enable_error_code = ignore-without-code
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true

View File

@ -11,7 +11,7 @@ codecov==2.1.12
coverage==6.3.2
freezegun==1.1.0
mock-open==1.4.0
mypy==0.931
mypy==0.940
pre-commit==2.17.0
pylint==2.12.2
pipdeptree==2.2.1

View File

@ -247,6 +247,7 @@ GENERAL_SETTINGS: Final[dict[str, str]] = {
"warn_redundant_casts": "true",
"warn_unused_configs": "true",
"warn_unused_ignores": "true",
"enable_error_code": "ignore-without-code",
}
# This is basically the list of checks which is enabled for "strict=true".