diff --git a/homeassistant/auth/mfa_modules/__init__.py b/homeassistant/auth/mfa_modules/__init__.py index 0706efbbb7a..fa9b1f50224 100644 --- a/homeassistant/auth/mfa_modules/__init__.py +++ b/homeassistant/auth/mfa_modules/__init__.py @@ -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( diff --git a/homeassistant/core.py b/homeassistant/core.py index c58a5f2f390..a205aa401a6 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -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 diff --git a/homeassistant/helpers/location.py b/homeassistant/helpers/location.py index cf3f7d3f1ea..0070ba4ca6f 100644 --- a/homeassistant/helpers/location.py +++ b/homeassistant/helpers/location.py @@ -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) ) diff --git a/homeassistant/setup.py b/homeassistant/setup.py index 43343376105..dd29bf3ab09 100644 --- a/homeassistant/setup.py +++ b/homeassistant/setup.py @@ -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 diff --git a/homeassistant/util/dt.py b/homeassistant/util/dt.py index 680eeca3c31..359387974f3 100644 --- a/homeassistant/util/dt.py +++ b/homeassistant/util/dt.py @@ -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()) ) diff --git a/homeassistant/util/unit_system.py b/homeassistant/util/unit_system.py index 07d8d965a4e..d79a9da1922 100644 --- a/homeassistant/util/unit_system.py +++ b/homeassistant/util/unit_system.py @@ -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: diff --git a/homeassistant/util/yaml/dumper.py b/homeassistant/util/yaml/dumper.py index e8ff4f3ab17..a6fba4d04d8 100644 --- a/homeassistant/util/yaml/dumper.py +++ b/homeassistant/util/yaml/dumper.py @@ -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 diff --git a/homeassistant/util/yaml/loader.py b/homeassistant/util/yaml/loader.py index 2f23ced91ef..f5dfdb933f2 100644 --- a/homeassistant/util/yaml/loader.py +++ b/homeassistant/util/yaml/loader.py @@ -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):