Add strict typing to Sonarr (#79802)

This commit is contained in:
Robert Hillis 2022-10-07 13:08:08 -04:00 committed by GitHub
parent 04f07cecba
commit 5981864992
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 9 deletions

View file

@ -5,7 +5,7 @@ from collections.abc import Awaitable, Callable, Coroutine
from datetime import timedelta
from functools import wraps
import logging
from typing import Any, TypeVar
from typing import Any, TypeVar, cast
from aiopyarr import ArrConnectionException, ArrException, SystemStatus
from aiopyarr.models.host_configuration import PyArrHostConfiguration
@ -267,7 +267,7 @@ class SonarrSensor(SonarrEntity, SensorEntity):
return len(self.data[key])
if key == "queue" and self.data.get(key) is not None:
return self.data[key].totalRecords
return cast(int, self.data[key].totalRecords)
if key == "series" and self.data.get(key) is not None:
return len(self.data[key])
@ -276,6 +276,6 @@ class SonarrSensor(SonarrEntity, SensorEntity):
return len(self.data[key])
if key == "wanted" and self.data.get(key) is not None:
return self.data[key].totalRecords
return cast(int, self.data[key].totalRecords)
return None