This commit is contained in:
Paulus Schoutsen 2019-07-31 13:08:31 -07:00
parent 93c0db2328
commit 620cb74050
8 changed files with 24 additions and 43 deletions

View File

@ -165,8 +165,8 @@ async def _load_mfa_module(hass: HomeAssistant, module_name: str) -> types.Modul
# https://github.com/python/mypy/issues/1424 # https://github.com/python/mypy/issues/1424
req_success = await requirements.async_process_requirements( req_success = await requirements.async_process_requirements(
hass, module_path, module.REQUIREMENTS hass, module_path, module.REQUIREMENTS # type: ignore
) # type: ignore )
if not req_success: if not req_success:
raise HomeAssistantError( raise HomeAssistantError(

View File

@ -506,10 +506,9 @@ class Event:
def __eq__(self, other: Any) -> bool: def __eq__(self, other: Any) -> bool:
"""Return the comparison.""" """Return the comparison."""
return ( return ( # type: ignore
self.__class__ == other.__class__ self.__class__ == other.__class__
and self.event_type # type: ignore and self.event_type == other.event_type
== other.event_type
and self.data == other.data and self.data == other.data
and self.origin == other.origin and self.origin == other.origin
and self.time_fired == other.time_fired and self.time_fired == other.time_fired
@ -810,10 +809,9 @@ class State:
def __eq__(self, other: Any) -> bool: def __eq__(self, other: Any) -> bool:
"""Return the comparison of the state.""" """Return the comparison of the state."""
return ( return ( # type: ignore
self.__class__ == other.__class__ self.__class__ == other.__class__
and self.entity_id # type: ignore and self.entity_id == other.entity_id
== other.entity_id
and self.state == other.state and self.state == other.state
and self.attributes == other.attributes and self.attributes == other.attributes
and self.context == other.context and self.context == other.context

View File

@ -14,10 +14,8 @@ def has_location(state: State) -> bool:
""" """
# type ignore: https://github.com/python/mypy/issues/7207 # type ignore: https://github.com/python/mypy/issues/7207
return ( return (
isinstance(state, State) isinstance(state, State) # type: ignore
and isinstance( # type: ignore and isinstance(state.attributes.get(ATTR_LATITUDE), float)
state.attributes.get(ATTR_LATITUDE), float
)
and isinstance(state.attributes.get(ATTR_LONGITUDE), float) and isinstance(state.attributes.get(ATTR_LONGITUDE), float)
) )

View File

@ -169,8 +169,8 @@ async def _async_setup_component(
) )
elif hasattr(component, "setup"): elif hasattr(component, "setup"):
result = await hass.async_add_executor_job( result = await hass.async_add_executor_job(
component.setup, hass, processed_config component.setup, hass, processed_config # type: ignore
) # type: ignore )
else: else:
log_error("No setup function defined.") log_error("No setup function defined.")
return False return False

View File

@ -114,10 +114,8 @@ def start_of_local_day(
date = now().date() # type: dt.date date = now().date() # type: dt.date
elif isinstance(dt_or_d, dt.datetime): elif isinstance(dt_or_d, dt.datetime):
date = dt_or_d.date() date = dt_or_d.date()
return DEFAULT_TIME_ZONE.localize( return DEFAULT_TIME_ZONE.localize( # type: ignore
dt.datetime.combine( # type: ignore dt.datetime.combine(date, dt.time())
date, dt.time()
)
) )

View File

@ -108,10 +108,8 @@ class UnitSystem:
raise TypeError("{} is not a numeric value.".format(str(temperature))) raise TypeError("{} is not a numeric value.".format(str(temperature)))
# type ignore: https://github.com/python/mypy/issues/7207 # type ignore: https://github.com/python/mypy/issues/7207
return temperature_util.convert( return temperature_util.convert( # type: ignore
temperature, # type: ignore temperature, from_unit, self.temperature_unit
from_unit,
self.temperature_unit,
) )
def length(self, length: Optional[float], from_unit: str) -> float: def length(self, length: Optional[float], from_unit: str) -> float:
@ -120,10 +118,8 @@ class UnitSystem:
raise TypeError("{} is not a numeric value.".format(str(length))) raise TypeError("{} is not a numeric value.".format(str(length)))
# type ignore: https://github.com/python/mypy/issues/7207 # type ignore: https://github.com/python/mypy/issues/7207
return distance_util.convert( return distance_util.convert( # type: ignore
length, length, from_unit, self.length_unit
from_unit, # type: ignore
self.length_unit,
) )
def pressure(self, pressure: Optional[float], from_unit: str) -> float: def pressure(self, pressure: Optional[float], from_unit: str) -> float:
@ -132,10 +128,8 @@ class UnitSystem:
raise TypeError("{} is not a numeric value.".format(str(pressure))) raise TypeError("{} is not a numeric value.".format(str(pressure)))
# type ignore: https://github.com/python/mypy/issues/7207 # type ignore: https://github.com/python/mypy/issues/7207
return pressure_util.convert( return pressure_util.convert( # type: ignore
pressure, pressure, from_unit, self.pressure_unit
from_unit, # type: ignore
self.pressure_unit,
) )
def volume(self, volume: Optional[float], from_unit: str) -> float: def volume(self, volume: Optional[float], from_unit: str) -> float:
@ -144,10 +138,8 @@ class UnitSystem:
raise TypeError("{} is not a numeric value.".format(str(volume))) raise TypeError("{} is not a numeric value.".format(str(volume)))
# type ignore: https://github.com/python/mypy/issues/7207 # type ignore: https://github.com/python/mypy/issues/7207
return volume_util.convert( return volume_util.convert( # type: ignore
volume, volume, from_unit, self.volume_unit
from_unit, # type: ignore
self.volume_unit,
) )
def as_dict(self) -> dict: def as_dict(self) -> dict:

View File

@ -25,11 +25,8 @@ def save_yaml(path: str, data: dict) -> None:
# From: https://gist.github.com/miracle2k/3184458 # From: https://gist.github.com/miracle2k/3184458
# pylint: disable=redefined-outer-name # pylint: disable=redefined-outer-name
def represent_odict( def represent_odict( # type: ignore
dump, dump, tag, mapping, flow_style=None
tag,
mapping, # type: ignore
flow_style=None,
) -> yaml.MappingNode: ) -> yaml.MappingNode:
"""Like BaseRepresenter.represent_mapping but does not issue the sort().""" """Like BaseRepresenter.represent_mapping but does not issue the sort()."""
value = [] # type: list value = [] # type: list

View File

@ -95,10 +95,8 @@ def _add_reference(
# pylint: enable=pointless-statement # pylint: enable=pointless-statement
def _add_reference( def _add_reference( # type: ignore # noqa: F811
obj, obj, loader: SafeLineLoader, node: yaml.nodes.Node
loader: SafeLineLoader, # type: ignore # noqa: F811
node: yaml.nodes.Node,
): ):
"""Add file reference information to an object.""" """Add file reference information to an object."""
if isinstance(obj, list): if isinstance(obj, list):