Update pydocstyle to 2.1.1 and flake8-docstrings to 1.3.0 (#14557)

* Update pydocstyle to 2.1.1 and flake8-docstrings to 1.3.0

* Pydocstyle D401 fixes
This commit is contained in:
Ville Skyttä authored and Paulus Schoutsen committed 2018-08-24 10:28:43 +02:00
1 parent 89d856d147
commit dd9d53c83e
84 files changed
+148 -130

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ EMPTY_CONFIG = []
async def async_setup_auth(hass, aiohttp_client, provider_configs=BASE_CONFIG,
module_configs=EMPTY_CONFIG, setup_api=False):
"""Helper to set up authentication and create an HTTP client."""
"""Set up authentication and create an HTTP client."""
hass.auth = await auth.auth_manager_from_config(
hass, provider_configs, module_configs)
ensure_auth_manager_loaded(hass.auth)
+1 -1
View File
@@ -5,7 +5,7 @@ from tests.common import CLIENT_ID, CLIENT_REDIRECT_URI
async def async_get_code(hass, aiohttp_client):
"""Helper for link user tests that returns authorization code."""
"""Return authorization code for link user tests."""
config = [{
'name': 'Example',
'type': 'insecure_example',
+1 -1
View File
@@ -20,7 +20,7 @@ class TestAutomationEvent(unittest.TestCase):
@callback
def record_call(service):
"""Helper for recording the call."""
"""Record the call."""
self.calls.append(service)
self.hass.services.register('test', 'automation', record_call)
+1 -1
View File
@@ -22,7 +22,7 @@ class TestAutomationMQTT(unittest.TestCase):
@callback
def record_call(service):
"""Helper to record calls."""
"""Record calls."""
self.calls.append(service)
self.hass.services.register('test', 'automation', record_call)
@@ -25,7 +25,7 @@ class TestAutomationNumericState(unittest.TestCase):
@callback
def record_call(service):
"""Helper to record calls."""
"""Record calls."""
self.calls.append(service)
self.hass.services.register('test', 'automation', record_call)
+1 -1
View File
@@ -22,7 +22,7 @@ class TestAutomationTemplate(unittest.TestCase):
@callback
def record_call(service):
"""Helper to record calls."""
"""Record calls."""
self.calls.append(service)
self.hass.services.register('test', 'automation', record_call)
+1 -1
View File
@@ -25,7 +25,7 @@ class TestAutomationTime(unittest.TestCase):
@callback
def record_call(service):
"""Helper to record calls."""
"""Record calls."""
self.calls.append(service)
self.hass.services.register('test', 'automation', record_call)
+1 -1
View File
@@ -29,7 +29,7 @@ class TestAutomationZone(unittest.TestCase):
@callback
def record_call(service):
"""Helper to record calls."""
"""Record calls."""
self.calls.append(service)
self.hass.services.register('test', 'automation', record_call)
+1 -1
View File
@@ -323,7 +323,7 @@ class TestComponentsDeviceTracker(unittest.TestCase):
@callback
def listener(event):
"""Helper method that will verify our event got called."""
"""Record that our event got called."""
test_events.append(event)
self.hass.bus.listen("device_tracker_new_device", listener)
@@ -11,7 +11,7 @@ from homeassistant.components.device_tracker.locative import URL
def _url(data=None):
"""Helper method to generate URLs."""
"""Generate URL."""
data = data or {}
data = "&".join(["{}={}".format(name, value) for
name, value in data.items()])
+1 -1
View File
@@ -15,7 +15,7 @@ class TestDemoFan(unittest.TestCase):
"""Test the fan demo platform."""
def get_entity(self):
"""Helper method to get the fan entity."""
"""Get the fan entity."""
return self.hass.states.get(FAN_ENTITY_ID)
def setUp(self):
+1 -1
View File
@@ -8,7 +8,7 @@ from homeassistant.components.http.const import KEY_REAL_IP
async def mock_handler(request):
"""Handler that returns the real IP as text."""
"""Return the real IP as text."""
return web.Response(text=str(request[KEY_REAL_IP]))
+1 -1
View File
@@ -48,7 +48,7 @@ def get_fake_chromecast_info(host='192.168.178.42', port=8009,
async def async_setup_cast(hass, config=None, discovery_info=None):
"""Helper to set up the cast platform."""
"""Set up the cast platform."""
if config is None:
config = {}
add_devices = Mock()
@@ -52,7 +52,7 @@ class TestSamsungTv(unittest.TestCase):
@MockDependency('samsungctl')
@MockDependency('wakeonlan')
def setUp(self, samsung_mock, wol_mock):
"""Setting up test environment."""
"""Set up test environment."""
self.hass = tests.common.get_test_home_assistant()
self.hass.start()
self.hass.block_till_done()
@@ -94,7 +94,7 @@ class MockMediaPlayer(media_player.MediaPlayerDevice):
@property
def volume_level(self):
"""The volume level of player."""
"""Return the volume level of player."""
return self._volume_level
@property
+2 -2
View File
@@ -56,7 +56,7 @@ class TestMQTTComponent(unittest.TestCase):
@callback
def record_calls(self, *args):
"""Helper for recording calls."""
"""Record calls."""
self.calls.append(args)
def aiohttp_client_stops_on_home_assistant_start(self):
@@ -199,7 +199,7 @@ class TestMQTTCallbacks(unittest.TestCase):
@callback
def record_calls(self, *args):
"""Helper for recording calls."""
"""Record calls."""
self.calls.append(args)
def aiohttp_client_starts_on_home_assistant_mqtt_setup(self):
+1 -1
View File
@@ -73,7 +73,7 @@ class TestNotifyDemo(unittest.TestCase):
@callback
def record_calls(self, *args):
"""Helper for recording calls."""
"""Record calls."""
self.calls.append(args)
def test_sending_none_message(self):
+1 -1
View File
@@ -100,7 +100,7 @@ class YahooWeatherMock():
@property
def Now(self): # pylint: disable=invalid-name
"""Current weather data."""
"""Return current weather data."""
if self.woeid == '111':
raise ValueError
return self._data['query']['results']['channel']['item']['condition']
+6 -6
View File
@@ -154,7 +154,7 @@ def test_api_fire_event_with_no_data(hass, mock_api_client):
@ha.callback
def listener(event):
"""Helper method that will verify our event got called."""
"""Record that our event got called."""
test_value.append(1)
hass.bus.async_listen_once("test.event_no_data", listener)
@@ -174,7 +174,7 @@ def test_api_fire_event_with_data(hass, mock_api_client):
@ha.callback
def listener(event):
"""Helper method that will verify that our event got called.
"""Record that our event got called.
Also test if our data came through.
"""
@@ -200,7 +200,7 @@ def test_api_fire_event_with_invalid_json(hass, mock_api_client):
@ha.callback
def listener(event):
"""Helper method that will verify our event got called."""
"""Record that our event got called."""
test_value.append(1)
hass.bus.async_listen_once("test_event_bad_data", listener)
@@ -281,7 +281,7 @@ def test_api_call_service_no_data(hass, mock_api_client):
@ha.callback
def listener(service_call):
"""Helper method that will verify that our service got called."""
"""Record that our service got called."""
test_value.append(1)
hass.services.async_register("test_domain", "test_service", listener)
@@ -300,7 +300,7 @@ def test_api_call_service_with_data(hass, mock_api_client):
@ha.callback
def listener(service_call):
"""Helper method that will verify that our service got called.
"""Record that our service got called.
Also test if our data came through.
"""
@@ -440,7 +440,7 @@ async def test_api_fire_event_context(hass, mock_api_client,
@ha.callback
def listener(event):
"""Helper method that will verify our event got called."""
"""Record that our event got called."""
test_value.append(event)
hass.bus.async_listen("test.event", listener)
+1 -1
View File
@@ -47,7 +47,7 @@ def netdisco_mock():
async def mock_discovery(hass, discoveries, config=BASE_CONFIG):
"""Helper to mock discoveries."""
"""Mock discoveries."""
result = await async_setup_component(hass, 'discovery', config)
assert result
+1 -1
View File
@@ -79,7 +79,7 @@ class TestFeedreaderComponent(unittest.TestCase):
VALID_CONFIG_3))
def setup_manager(self, feed_data, max_entries=DEFAULT_MAX_ENTRIES):
"""Generic test setup method."""
"""Set up feed manager."""
events = []
@callback
+4 -4
View File
@@ -41,11 +41,11 @@ class PilightDaemonSim:
pass
def send_code(self, call): # pylint: disable=no-self-use
"""Called pilight.send service is called."""
"""Handle pilight.send service callback."""
_LOGGER.error('PilightDaemonSim payload: ' + str(call))
def start(self):
"""Called homeassistant.start is called.
"""Handle homeassistant.start callback.
Also sends one test message after start up
"""
@@ -56,11 +56,11 @@ class PilightDaemonSim:
self.called = True
def stop(self): # pylint: disable=no-self-use
"""Called homeassistant.stop is called."""
"""Handle homeassistant.stop callback."""
_LOGGER.error('PilightDaemonSim stop')
def set_callback(self, function):
"""Callback called on event pilight.pilight_received."""
"""Handle pilight.pilight_received event callback."""
self.callback = function
_LOGGER.error('PilightDaemonSim callback: ' + str(function))
+2 -2
View File
@@ -47,7 +47,7 @@ class MockResp(MagicMock):
@pytest.fixture
def mock_msearch_first(*args, **kwargs):
"""Wrapper to async mock function."""
"""Wrap async mock msearch_first."""
async def async_mock_msearch_first(*args, **kwargs):
"""Mock msearch_first."""
return MockResp(*args, **kwargs)
@@ -58,7 +58,7 @@ def mock_msearch_first(*args, **kwargs):
@pytest.fixture
def mock_async_exception(*args, **kwargs):
"""Wrapper to async mock function with exception."""
"""Wrap async mock exception."""
async def async_mock_exception(*args, **kwargs):
return Exception
+5 -5
View File
@@ -41,31 +41,31 @@ class YahooWeatherMock():
@property
def RawData(self): # pylint: disable=invalid-name
"""Raw Data."""
"""Return raw Data."""
if self.woeid == '12345':
return json.loads('[]')
return self._data
@property
def Now(self): # pylint: disable=invalid-name
"""Current weather data."""
"""Return current weather data."""
if self.woeid == '111':
raise ValueError
return self._data['query']['results']['channel']['item']['condition']
@property
def Atmosphere(self): # pylint: disable=invalid-name
"""Atmosphere weather data."""
"""Return atmosphere weather data."""
return self._data['query']['results']['channel']['atmosphere']
@property
def Wind(self): # pylint: disable=invalid-name
"""Wind weather data."""
"""Return wind weather data."""
return self._data['query']['results']['channel']['wind']
@property
def Forecast(self): # pylint: disable=invalid-name
"""Forecast data 0-5 Days."""
"""Return forecast data 0-5 Days."""
if self.woeid == '123123':
raise ValueError
return self._data['query']['results']['channel']['item']['forecast']