Activate mypy in gtfs (followup on reverted #54328) (#55195)

pull/55177/head
jan iversen 2021-08-25 10:30:29 +02:00 committed by GitHub
parent 4036ba82fe
commit e2b1122eec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 11 deletions

View File

@ -11,7 +11,10 @@ import pygtfs
from sqlalchemy.sql import text
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.components.sensor import (
PLATFORM_SCHEMA as SENSOR_PLATFORM_SCHEMA,
SensorEntity,
)
from homeassistant.const import (
ATTR_ATTRIBUTION,
CONF_NAME,
@ -254,8 +257,8 @@ WHEELCHAIR_ACCESS_OPTIONS = {1: True, 2: False}
WHEELCHAIR_BOARDING_DEFAULT = STATE_UNKNOWN
WHEELCHAIR_BOARDING_OPTIONS = {1: True, 2: False}
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{ # type: ignore
PLATFORM_SCHEMA = SENSOR_PLATFORM_SCHEMA.extend(
{
vol.Required(CONF_ORIGIN): cv.string,
vol.Required(CONF_DESTINATION): cv.string,
vol.Required(CONF_DATA): cv.string,
@ -490,7 +493,7 @@ def setup_platform(
origin = config.get(CONF_ORIGIN)
destination = config.get(CONF_DESTINATION)
name = config.get(CONF_NAME)
offset = config.get(CONF_OFFSET)
offset: datetime.timedelta = config[CONF_OFFSET]
include_tomorrow = config[CONF_TOMORROW]
if not os.path.exists(gtfs_dir):
@ -541,10 +544,10 @@ class GTFSDepartureSensor(SensorEntity):
self._icon = ICON
self._name = ""
self._state: str | None = None
self._attributes = {}
self._attributes: dict[str, Any] = {}
self._agency = None
self._departure = {}
self._departure: dict[str, Any] = {}
self._destination = None
self._origin = None
self._route = None
@ -559,7 +562,7 @@ class GTFSDepartureSensor(SensorEntity):
return self._name
@property
def native_value(self) -> str | None: # type: ignore
def native_value(self) -> str | None:
"""Return the state of the sensor."""
return self._state

View File

@ -1355,9 +1355,6 @@ ignore_errors = true
[mypy-homeassistant.components.growatt_server.*]
ignore_errors = true
[mypy-homeassistant.components.gtfs.*]
ignore_errors = true
[mypy-homeassistant.components.habitica.*]
ignore_errors = true

View File

@ -44,7 +44,6 @@ IGNORED_MODULES: Final[list[str]] = [
"homeassistant.components.gpmdp.*",
"homeassistant.components.gree.*",
"homeassistant.components.growatt_server.*",
"homeassistant.components.gtfs.*",
"homeassistant.components.habitica.*",
"homeassistant.components.harmony.*",
"homeassistant.components.hassio.*",