From 8e29910e771a2dcad29573ec151e98869f8c45ad Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 15 Feb 2015 17:13:01 -0800 Subject: [PATCH] Style fixes to satisfy updated Flake8 --- homeassistant/components/device_sun_light_trigger.py | 4 ++-- homeassistant/components/device_tracker/__init__.py | 8 ++++---- tests/test_component_device_scanner.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/device_sun_light_trigger.py b/homeassistant/components/device_sun_light_trigger.py index 90d06e6a3c1a..8def4079d05d 100644 --- a/homeassistant/components/device_sun_light_trigger.py +++ b/homeassistant/components/device_sun_light_trigger.py @@ -147,8 +147,8 @@ def setup(hass, config): # Did all devices leave the house? elif (entity == device_group and - new_state.state == STATE_NOT_HOME and lights_are_on - and not disable_turn_off): + new_state.state == STATE_NOT_HOME and lights_are_on and + not disable_turn_off): logger.info( "Everyone has left but there are lights on. Turning them off") diff --git a/homeassistant/components/device_tracker/__init__.py b/homeassistant/components/device_tracker/__init__.py index 10efdf8c8408..97b9f4577039 100644 --- a/homeassistant/components/device_tracker/__init__.py +++ b/homeassistant/components/device_tracker/__init__.py @@ -51,8 +51,8 @@ def setup(hass, config): """ Sets up the device tracker. """ # CONF_TYPE is deprecated for CONF_PLATOFRM. We keep supporting it for now. - if not (validate_config(config, {DOMAIN: [CONF_PLATFORM]}, _LOGGER) - or validate_config(config, {DOMAIN: [CONF_TYPE]}, _LOGGER)): + if not (validate_config(config, {DOMAIN: [CONF_PLATFORM]}, _LOGGER) or + validate_config(config, {DOMAIN: [CONF_TYPE]}, _LOGGER)): return False @@ -200,8 +200,8 @@ class DeviceTracker(object): for device in new_devices: # See if the device scanner knows the name # else defaults to unknown device - name = (self.device_scanner.get_device_name(device) - or "unknown_device") + dname = self.device_scanner.get_device_name(device) + name = dname or "unknown device" writer.writerow((device, name, 0, "")) diff --git a/tests/test_component_device_scanner.py b/tests/test_component_device_scanner.py index 59b1c2a17463..e83cfe57c61b 100644 --- a/tests/test_component_device_scanner.py +++ b/tests/test_component_device_scanner.py @@ -93,7 +93,7 @@ class TestComponentsDeviceTracker(unittest.TestCase): # To ensure all the three expected lines are there, we sort the file with open(self.known_dev_path) as fil: self.assertEqual( - ['dev1,unknown_device,0,\n', 'dev2,DEV2,0,\n', + ['dev1,unknown device,0,\n', 'dev2,DEV2,0,\n', 'device,name,track,picture\n'], sorted(fil))