pull/25584/head
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
req_success = await requirements.async_process_requirements(
hass, module_path, module.REQUIREMENTS
) # type: ignore
hass, module_path, module.REQUIREMENTS # type: ignore
)
if not req_success:
raise HomeAssistantError(

View File

@ -506,10 +506,9 @@ class Event:
def __eq__(self, other: Any) -> bool:
"""Return the comparison."""
return (
return ( # type: ignore
self.__class__ == other.__class__
and self.event_type # type: ignore
== other.event_type
and self.event_type == other.event_type
and self.data == other.data
and self.origin == other.origin
and self.time_fired == other.time_fired
@ -810,10 +809,9 @@ class State:
def __eq__(self, other: Any) -> bool:
"""Return the comparison of the state."""
return (
return ( # type: ignore
self.__class__ == other.__class__
and self.entity_id # type: ignore
== other.entity_id
and self.entity_id == other.entity_id
and self.state == other.state
and self.attributes == other.attributes
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
return (
isinstance(state, State)
and isinstance( # type: ignore
state.attributes.get(ATTR_LATITUDE), float
)
isinstance(state, State) # type: ignore
and isinstance(state.attributes.get(ATTR_LATITUDE), float)
and isinstance(state.attributes.get(ATTR_LONGITUDE), float)
)

View File

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

View File

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

View File

@ -108,10 +108,8 @@ class UnitSystem:
raise TypeError("{} is not a numeric value.".format(str(temperature)))
# type ignore: https://github.com/python/mypy/issues/7207
return temperature_util.convert(
temperature, # type: ignore
from_unit,
self.temperature_unit,
return temperature_util.convert( # type: ignore
temperature, from_unit, self.temperature_unit
)
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)))
# type ignore: https://github.com/python/mypy/issues/7207
return distance_util.convert(
length,
from_unit, # type: ignore
self.length_unit,
return distance_util.convert( # type: ignore
length, from_unit, self.length_unit
)
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)))
# type ignore: https://github.com/python/mypy/issues/7207
return pressure_util.convert(
pressure,
from_unit, # type: ignore
self.pressure_unit,
return pressure_util.convert( # type: ignore
pressure, from_unit, self.pressure_unit
)
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)))
# type ignore: https://github.com/python/mypy/issues/7207
return volume_util.convert(
volume,
from_unit, # type: ignore
self.volume_unit,
return volume_util.convert( # type: ignore
volume, from_unit, self.volume_unit
)
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
# pylint: disable=redefined-outer-name
def represent_odict(
dump,
tag,
mapping, # type: ignore
flow_style=None,
def represent_odict( # type: ignore
dump, tag, mapping, flow_style=None
) -> yaml.MappingNode:
"""Like BaseRepresenter.represent_mapping but does not issue the sort()."""
value = [] # type: list

View File

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