From 0490167a121009f5f6c76d7d036e19deae162449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Wed, 31 Jul 2019 22:21:36 +0300 Subject: [PATCH] Azure flake8 dep, docstring fixes (#25605) * Fix Azure CI flake8 deps * Docstyle fixes --- azure-pipelines-ci.yml | 2 +- homeassistant/components/rejseplanen/sensor.py | 2 +- homeassistant/components/ring/camera.py | 2 +- homeassistant/components/ring/sensor.py | 2 +- homeassistant/components/zha/core/channels/__init__.py | 2 ++ homeassistant/components/zha/core/device.py | 1 + homeassistant/components/zha/entity.py | 1 + tests/components/emulated_hue/test_hue_api.py | 1 + 8 files changed, 9 insertions(+), 4 deletions(-) diff --git a/azure-pipelines-ci.yml b/azure-pipelines-ci.yml index 58879ef6029..c92d5a9f53b 100644 --- a/azure-pipelines-ci.yml +++ b/azure-pipelines-ci.yml @@ -38,7 +38,7 @@ stages: python -m venv venv . venv/bin/activate - pip install flake8 + pip install -r requirements_test.txt displayName: 'Setup Env' - script: | . venv/bin/activate diff --git a/homeassistant/components/rejseplanen/sensor.py b/homeassistant/components/rejseplanen/sensor.py index f5301445430..d99551a9528 100755 --- a/homeassistant/components/rejseplanen/sensor.py +++ b/homeassistant/components/rejseplanen/sensor.py @@ -174,7 +174,7 @@ class PublicTransportData(): self.info = [] def intersection(lst1, lst2): - """Return items contained in both lists""" + """Return items contained in both lists.""" return list(set(lst1) & set(lst2)) # Limit search to selected types, to get more results diff --git a/homeassistant/components/ring/camera.py b/homeassistant/components/ring/camera.py index 2c29143eac3..20a3a246e5e 100644 --- a/homeassistant/components/ring/camera.py +++ b/homeassistant/components/ring/camera.py @@ -147,7 +147,7 @@ class RingCam(Camera): @property def should_poll(self): - """Updates controlled via the hub.""" + """Return False, updates are controlled via the hub.""" return False def update(self): diff --git a/homeassistant/components/ring/sensor.py b/homeassistant/components/ring/sensor.py index 4fb9ab38d30..740425dbaab 100644 --- a/homeassistant/components/ring/sensor.py +++ b/homeassistant/components/ring/sensor.py @@ -109,7 +109,7 @@ class RingSensor(Entity): @property def should_poll(self): - """Updates controlled via the hub.""" + """Return False, updates are controlled via the hub.""" return False @property diff --git a/homeassistant/components/zha/core/channels/__init__.py b/homeassistant/components/zha/core/channels/__init__.py index f219a7823da..d0e61caca64 100644 --- a/homeassistant/components/zha/core/channels/__init__.py +++ b/homeassistant/components/zha/core/channels/__init__.py @@ -204,6 +204,7 @@ class ZigbeeChannel(LogMixin): return result.get(attribute) def log(self, level, msg, *args): + """Log a message.""" msg = '[%s]: ' + msg args = (self.unique_id, ) + args _LOGGER.log(level, msg, *args) @@ -301,6 +302,7 @@ class ZDOChannel(LogMixin): self._status = ChannelStatus.CONFIGURED def log(self, level, msg, *args): + """Log a message.""" msg = '[%s:ZDO](%s): ' + msg args = (self._zha_device.nwk, self._zha_device.model, ) + args _LOGGER.log(level, msg, *args) diff --git a/homeassistant/components/zha/core/device.py b/homeassistant/components/zha/core/device.py index bd748708395..f5ff7aebfd3 100644 --- a/homeassistant/components/zha/core/device.py +++ b/homeassistant/components/zha/core/device.py @@ -444,6 +444,7 @@ class ZHADevice(LogMixin): return response def log(self, level, msg, *args): + """Log a message.""" msg = '[%s](%s): ' + msg args = (self.nwk, self.model, ) + args _LOGGER.log(level, msg, *args) diff --git a/homeassistant/components/zha/entity.py b/homeassistant/components/zha/entity.py index c38c8aaffbb..3008146656e 100644 --- a/homeassistant/components/zha/entity.py +++ b/homeassistant/components/zha/entity.py @@ -189,6 +189,7 @@ class ZhaEntity(RestoreEntity, LogMixin, entity.Entity): self._unsubs.append(unsub) def log(self, level, msg, *args): + """Log a message.""" msg = '%s: ' + msg args = (self.entity_id, ) + args _LOGGER.log(level, msg, *args) diff --git a/tests/components/emulated_hue/test_hue_api.py b/tests/components/emulated_hue/test_hue_api.py index 7cd5a04081a..8fff62d1043 100644 --- a/tests/components/emulated_hue/test_hue_api.py +++ b/tests/components/emulated_hue/test_hue_api.py @@ -225,6 +225,7 @@ def test_discover_lights(hue_client): @asyncio.coroutine def test_light_without_brightness_supported(hass_hue, hue_client): + """Test that light without brightness is supported.""" light_without_brightness_json = yield from perform_get_light_state( hue_client, 'light.no_brightness', 200)