Upgrade flake8 to 3.6.0 ()

* Upgrade flake8 to 3.6.0

* flake8/pylint comment tweaks

* flake8 F841 fixes

* flake8 W605 fix

* Ignore pyflakes bug  false positives

https://github.com/PyCQA/pyflakes/issues/373

* pycodestyle bug  workaround

https://github.com/PyCQA/pycodestyle/issues/811
pull/17796/head
Ville Skyttä 2018-10-25 23:15:20 +03:00 committed by GitHub
parent 77bf10e37c
commit 43048962f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 19 additions and 17 deletions

View File

@ -144,7 +144,7 @@ def _authenticate(cloud, email, password):
cognito.authenticate(password=password)
return cognito
except ForceChangePasswordException as err:
except ForceChangePasswordException:
raise PasswordChangeRequired
except ClientError as err:

View File

@ -106,7 +106,7 @@ class GaradgetCover(CoverDevice):
self._state = STATE_OFFLINE
self._available = False
self._name = DEFAULT_NAME
except KeyError as ex:
except KeyError:
_LOGGER.warning("Garadget device %(device)s seems to be offline",
dict(device=self.device_id))
self._name = DEFAULT_NAME
@ -235,7 +235,7 @@ class GaradgetCover(CoverDevice):
_LOGGER.error(
"Unable to connect to server: %(reason)s", dict(reason=ex))
self._state = STATE_OFFLINE
except KeyError as ex:
except KeyError:
_LOGGER.warning("Garadget device %(device)s seems to be offline",
dict(device=self.device_id))
self._state = STATE_OFFLINE

View File

@ -699,8 +699,8 @@ def async_setup_scanner_platform(hass: HomeAssistantType, config: ConfigType,
seen.add(mac)
try:
extra_attributes = (await
scanner.async_get_extra_attributes(mac))
extra_attributes = \
await scanner.async_get_extra_attributes(mac)
except NotImplementedError:
extra_attributes = dict()

View File

@ -254,7 +254,7 @@ class Tplink3DeviceScanner(Tplink1DeviceScanner):
self.sysauth = regex_result.group(1)
_LOGGER.info(self.sysauth)
return True
except (ValueError, KeyError) as _:
except (ValueError, KeyError):
_LOGGER.error("Couldn't fetch auth tokens! Response was: %s",
response.text)
return False

View File

@ -213,7 +213,7 @@ async def _process(hass, config, message):
'requestId': request_id,
'payload': {'errorCode': err.code}
}
except Exception as err: # pylint: disable=broad-except
except Exception: # pylint: disable=broad-except
_LOGGER.exception('Unexpected error')
return {
'requestId': request_id,

View File

@ -56,7 +56,8 @@ def brightness_from_percentage(percent):
class TPLinkSmartBulb(Light):
"""Representation of a TPLink Smart Bulb."""
def __init__(self, smartbulb: 'SmartBulb', name) -> None:
# F821: https://github.com/PyCQA/pyflakes/issues/373
def __init__(self, smartbulb: 'SmartBulb', name) -> None: # noqa: F821
"""Initialize the bulb."""
self.smartbulb = smartbulb
self._name = name

View File

@ -278,8 +278,9 @@ class YeelightLight(Light):
def _properties(self) -> dict:
return self._bulb.last_properties
# F821: https://github.com/PyCQA/pyflakes/issues/373
@property
def _bulb(self) -> 'yeelight.Bulb':
def _bulb(self) -> 'yeelight.Bulb': # noqa: F821
import yeelight
if self._bulb_device is None:
try:

View File

@ -35,7 +35,7 @@ from homeassistant.util.async_ import (
run_callback_threadsafe, run_coroutine_threadsafe)
# Loading the config flow file will register the flow
from . import config_flow # noqa # pylint: disable=unused-import
from . import config_flow # noqa pylint: disable=unused-import
from .const import CONF_BROKER, CONF_DISCOVERY, DEFAULT_DISCOVERY
from .server import HBMQTT_CONFIG_SCHEMA

View File

@ -130,7 +130,7 @@ class TcpSensor(Entity):
self._state = self._config[CONF_VALUE_TEMPLATE].render(
value=value)
return
except TemplateError as err:
except TemplateError:
_LOGGER.error(
"Unable to render template of %r with value: %r",
self._config[CONF_VALUE_TEMPLATE], value)

View File

@ -142,7 +142,7 @@ async def async_setup(hass, config):
hass, DOMAIN, intent_type, slots, request['input'])
if 'plain' in intent_response.speech:
snips_response = intent_response.speech['plain']['speech']
except intent.UnknownIntent as err:
except intent.UnknownIntent:
_LOGGER.warning("Received unknown intent %s",
request['intent']['intentName'])
except intent.IntentError:

View File

@ -29,7 +29,7 @@ from homeassistant.helpers.dispatcher import (
async_dispatcher_connect, async_dispatcher_send)
from . import const
from . import config_flow # noqa # pylint: disable=unused-import
from . import config_flow # noqa pylint: disable=unused-import
from .const import (
CONF_AUTOHEAL, CONF_DEBUG, CONF_POLLING_INTERVAL,
CONF_USB_STICK_PATH, CONF_CONFIG_PATH, CONF_NETWORK_KEY,

View File

@ -56,7 +56,7 @@ async def async_call_from_config(hass, config, blocking=False, variables=None,
except TemplateError as ex:
_LOGGER.error('Error rendering service name template: %s', ex)
return
except vol.Invalid as ex:
except vol.Invalid:
_LOGGER.error('Template rendered invalid service: %s',
domain_service)
return

View File

@ -4,7 +4,7 @@
asynctest==0.12.2
coveralls==1.2.0
flake8-docstrings==1.3.0
flake8==3.5
flake8==3.6.0
mock-open==1.3.1
mypy==0.641
pydocstyle==2.1.1

View File

@ -5,7 +5,7 @@
asynctest==0.12.2
coveralls==1.2.0
flake8-docstrings==1.3.0
flake8==3.5
flake8==3.6.0
mock-open==1.3.1
mypy==0.641
pydocstyle==2.1.1

View File

@ -90,7 +90,7 @@ TEST_REQUIREMENTS = (
'pyspcwebgw',
'python-forecastio',
'python-nest',
'pytradfri\[async\]',
'pytradfri\\[async\\]',
'pyunifi',
'pyupnp-async',
'pywebpush',