From 38c50c830fda507fedb1abfa48d8fe622cb02334 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 16 Jul 2016 23:45:38 -0700 Subject: [PATCH] Fix linting errors --- homeassistant/components/browser.py | 3 ++- homeassistant/components/downloader.py | 3 ++- homeassistant/components/frontend/__init__.py | 5 ++--- homeassistant/components/panel_iframe.py | 2 ++ homeassistant/components/recorder/__init__.py | 3 ++- script/fingerprint_frontend.py | 1 + tests/components/test_panel_iframe.py | 3 +-- 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/browser.py b/homeassistant/components/browser.py index fc78b83bd60..041a0f9cdc6 100644 --- a/homeassistant/components/browser.py +++ b/homeassistant/components/browser.py @@ -13,7 +13,8 @@ ATTR_URL = 'url' ATTR_URL_DEFAULT = 'https://www.google.com' SERVICE_BROWSE_URL_SCHEMA = vol.Schema({ - vol.Required(ATTR_URL, default=ATTR_URL_DEFAULT): vol.Url, + # pylint: disable=no-value-for-parameter + vol.Required(ATTR_URL, default=ATTR_URL_DEFAULT): vol.Url(), }) diff --git a/homeassistant/components/downloader.py b/homeassistant/components/downloader.py index e05c617bcf0..c639619d7a7 100644 --- a/homeassistant/components/downloader.py +++ b/homeassistant/components/downloader.py @@ -24,7 +24,8 @@ ATTR_URL = "url" ATTR_SUBDIR = "subdir" SERVICE_DOWNLOAD_FILE_SCHEMA = vol.Schema({ - vol.Required(ATTR_URL): vol.Url, + # pylint: disable=no-value-for-parameter + vol.Required(ATTR_URL): vol.Url(), vol.Optional(ATTR_SUBDIR): cv.string, }) diff --git a/homeassistant/components/frontend/__init__.py b/homeassistant/components/frontend/__init__.py index 1f6cdc81a81..a5db2229eda 100644 --- a/homeassistant/components/frontend/__init__.py +++ b/homeassistant/components/frontend/__init__.py @@ -19,7 +19,7 @@ _LOGGER = logging.getLogger(__name__) def register_built_in_panel(hass, component_name, title=None, icon=None, url_name=None, config=None): """Register a built-in panel.""" - + # pylint: disable=too-many-arguments path = 'panels/ha-panel-{}.html'.format(component_name) register_panel(hass, component_name, os.path.join(STATIC_PATH, path), @@ -40,6 +40,7 @@ def register_panel(hass, component_name, path, md5, title=None, icon=None, Warning: this API will probably change. Use at own risk. """ + # pylint: disable=too-many-arguments if url_name is None: url_name = component_name @@ -72,8 +73,6 @@ def register_panel(hass, component_name, path, md5, title=None, icon=None, PANELS[url_name] = data - # TODO register / to index view. - def setup(hass, config): """Setup serving the frontend.""" diff --git a/homeassistant/components/panel_iframe.py b/homeassistant/components/panel_iframe.py index 8df0644ea37..30773296aeb 100644 --- a/homeassistant/components/panel_iframe.py +++ b/homeassistant/components/panel_iframe.py @@ -1,3 +1,4 @@ +"""Add an iframe panel to Home Assistant.""" import voluptuous as vol import homeassistant.helpers.config_validation as cv @@ -15,6 +16,7 @@ CONFIG_SCHEMA = vol.Schema({ cv.slug: { vol.Optional(CONF_TITLE): cv.string, vol.Optional(CONF_ICON): cv.icon, + # pylint: disable=no-value-for-parameter vol.Required(CONF_URL): vol.Url(), }})}, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/recorder/__init__.py b/homeassistant/components/recorder/__init__.py index b52bce47c17..413106c66b5 100644 --- a/homeassistant/components/recorder/__init__.py +++ b/homeassistant/components/recorder/__init__.py @@ -39,7 +39,8 @@ CONFIG_SCHEMA = vol.Schema({ DOMAIN: vol.Schema({ vol.Optional(CONF_PURGE_DAYS): vol.All(vol.Coerce(int), vol.Range(min=1)), - vol.Optional(CONF_DB_URL): vol.Url(''), + # pylint: disable=no-value-for-parameter + vol.Optional(CONF_DB_URL): vol.Url(), }) }, extra=vol.ALLOW_EXTRA) diff --git a/script/fingerprint_frontend.py b/script/fingerprint_frontend.py index 4dfcdd7d19d..09560cee0f0 100755 --- a/script/fingerprint_frontend.py +++ b/script/fingerprint_frontend.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +"""Generate a file with all md5 hashes of the assets.""" from collections import OrderedDict import glob import hashlib diff --git a/tests/components/test_panel_iframe.py b/tests/components/test_panel_iframe.py index dc7fa7f0199..7b024c9ed56 100644 --- a/tests/components/test_panel_iframe.py +++ b/tests/components/test_panel_iframe.py @@ -1,5 +1,4 @@ """The tests for the panel_iframe component.""" -from collections import defaultdict import unittest from unittest.mock import patch @@ -15,6 +14,7 @@ class TestPanelIframe(unittest.TestCase): def setup_method(self, method): """Setup things to be run when tests are started.""" self.hass = get_test_home_assistant() + frontend.PANELS = {} def teardown_method(self, method): """Stop everything that was started.""" @@ -23,7 +23,6 @@ class TestPanelIframe(unittest.TestCase): def test_wrong_config(self): """Test setup with wrong configuration.""" - to_try = [ {'invalid space': { 'url': 'https://home-assistant.io'}},