mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Upgrade flake8 to 3.6.0 (#17770)
* Upgrade flake8 to 3.6.0 * flake8/pylint comment tweaks * flake8 F841 fixes * flake8 W605 fix * Ignore pyflakes bug #373 false positives https://github.com/PyCQA/pyflakes/issues/373 * pycodestyle bug #811 workaround https://github.com/PyCQA/pycodestyle/issues/811
This commit is contained in:
parent
77bf10e37c
commit
43048962f2
@ -144,7 +144,7 @@ def _authenticate(cloud, email, password):
|
|||||||
cognito.authenticate(password=password)
|
cognito.authenticate(password=password)
|
||||||
return cognito
|
return cognito
|
||||||
|
|
||||||
except ForceChangePasswordException as err:
|
except ForceChangePasswordException:
|
||||||
raise PasswordChangeRequired
|
raise PasswordChangeRequired
|
||||||
|
|
||||||
except ClientError as err:
|
except ClientError as err:
|
||||||
|
@ -106,7 +106,7 @@ class GaradgetCover(CoverDevice):
|
|||||||
self._state = STATE_OFFLINE
|
self._state = STATE_OFFLINE
|
||||||
self._available = False
|
self._available = False
|
||||||
self._name = DEFAULT_NAME
|
self._name = DEFAULT_NAME
|
||||||
except KeyError as ex:
|
except KeyError:
|
||||||
_LOGGER.warning("Garadget device %(device)s seems to be offline",
|
_LOGGER.warning("Garadget device %(device)s seems to be offline",
|
||||||
dict(device=self.device_id))
|
dict(device=self.device_id))
|
||||||
self._name = DEFAULT_NAME
|
self._name = DEFAULT_NAME
|
||||||
@ -235,7 +235,7 @@ class GaradgetCover(CoverDevice):
|
|||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Unable to connect to server: %(reason)s", dict(reason=ex))
|
"Unable to connect to server: %(reason)s", dict(reason=ex))
|
||||||
self._state = STATE_OFFLINE
|
self._state = STATE_OFFLINE
|
||||||
except KeyError as ex:
|
except KeyError:
|
||||||
_LOGGER.warning("Garadget device %(device)s seems to be offline",
|
_LOGGER.warning("Garadget device %(device)s seems to be offline",
|
||||||
dict(device=self.device_id))
|
dict(device=self.device_id))
|
||||||
self._state = STATE_OFFLINE
|
self._state = STATE_OFFLINE
|
||||||
|
@ -699,8 +699,8 @@ def async_setup_scanner_platform(hass: HomeAssistantType, config: ConfigType,
|
|||||||
seen.add(mac)
|
seen.add(mac)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
extra_attributes = (await
|
extra_attributes = \
|
||||||
scanner.async_get_extra_attributes(mac))
|
await scanner.async_get_extra_attributes(mac)
|
||||||
except NotImplementedError:
|
except NotImplementedError:
|
||||||
extra_attributes = dict()
|
extra_attributes = dict()
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ class Tplink3DeviceScanner(Tplink1DeviceScanner):
|
|||||||
self.sysauth = regex_result.group(1)
|
self.sysauth = regex_result.group(1)
|
||||||
_LOGGER.info(self.sysauth)
|
_LOGGER.info(self.sysauth)
|
||||||
return True
|
return True
|
||||||
except (ValueError, KeyError) as _:
|
except (ValueError, KeyError):
|
||||||
_LOGGER.error("Couldn't fetch auth tokens! Response was: %s",
|
_LOGGER.error("Couldn't fetch auth tokens! Response was: %s",
|
||||||
response.text)
|
response.text)
|
||||||
return False
|
return False
|
||||||
|
@ -213,7 +213,7 @@ async def _process(hass, config, message):
|
|||||||
'requestId': request_id,
|
'requestId': request_id,
|
||||||
'payload': {'errorCode': err.code}
|
'payload': {'errorCode': err.code}
|
||||||
}
|
}
|
||||||
except Exception as err: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
_LOGGER.exception('Unexpected error')
|
_LOGGER.exception('Unexpected error')
|
||||||
return {
|
return {
|
||||||
'requestId': request_id,
|
'requestId': request_id,
|
||||||
|
@ -56,7 +56,8 @@ def brightness_from_percentage(percent):
|
|||||||
class TPLinkSmartBulb(Light):
|
class TPLinkSmartBulb(Light):
|
||||||
"""Representation of a TPLink Smart Bulb."""
|
"""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."""
|
"""Initialize the bulb."""
|
||||||
self.smartbulb = smartbulb
|
self.smartbulb = smartbulb
|
||||||
self._name = name
|
self._name = name
|
||||||
|
@ -278,8 +278,9 @@ class YeelightLight(Light):
|
|||||||
def _properties(self) -> dict:
|
def _properties(self) -> dict:
|
||||||
return self._bulb.last_properties
|
return self._bulb.last_properties
|
||||||
|
|
||||||
|
# F821: https://github.com/PyCQA/pyflakes/issues/373
|
||||||
@property
|
@property
|
||||||
def _bulb(self) -> 'yeelight.Bulb':
|
def _bulb(self) -> 'yeelight.Bulb': # noqa: F821
|
||||||
import yeelight
|
import yeelight
|
||||||
if self._bulb_device is None:
|
if self._bulb_device is None:
|
||||||
try:
|
try:
|
||||||
|
@ -35,7 +35,7 @@ from homeassistant.util.async_ import (
|
|||||||
run_callback_threadsafe, run_coroutine_threadsafe)
|
run_callback_threadsafe, run_coroutine_threadsafe)
|
||||||
|
|
||||||
# Loading the config flow file will register the flow
|
# 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 .const import CONF_BROKER, CONF_DISCOVERY, DEFAULT_DISCOVERY
|
||||||
from .server import HBMQTT_CONFIG_SCHEMA
|
from .server import HBMQTT_CONFIG_SCHEMA
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ class TcpSensor(Entity):
|
|||||||
self._state = self._config[CONF_VALUE_TEMPLATE].render(
|
self._state = self._config[CONF_VALUE_TEMPLATE].render(
|
||||||
value=value)
|
value=value)
|
||||||
return
|
return
|
||||||
except TemplateError as err:
|
except TemplateError:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Unable to render template of %r with value: %r",
|
"Unable to render template of %r with value: %r",
|
||||||
self._config[CONF_VALUE_TEMPLATE], value)
|
self._config[CONF_VALUE_TEMPLATE], value)
|
||||||
|
@ -142,7 +142,7 @@ async def async_setup(hass, config):
|
|||||||
hass, DOMAIN, intent_type, slots, request['input'])
|
hass, DOMAIN, intent_type, slots, request['input'])
|
||||||
if 'plain' in intent_response.speech:
|
if 'plain' in intent_response.speech:
|
||||||
snips_response = intent_response.speech['plain']['speech']
|
snips_response = intent_response.speech['plain']['speech']
|
||||||
except intent.UnknownIntent as err:
|
except intent.UnknownIntent:
|
||||||
_LOGGER.warning("Received unknown intent %s",
|
_LOGGER.warning("Received unknown intent %s",
|
||||||
request['intent']['intentName'])
|
request['intent']['intentName'])
|
||||||
except intent.IntentError:
|
except intent.IntentError:
|
||||||
|
@ -29,7 +29,7 @@ from homeassistant.helpers.dispatcher import (
|
|||||||
async_dispatcher_connect, async_dispatcher_send)
|
async_dispatcher_connect, async_dispatcher_send)
|
||||||
|
|
||||||
from . import const
|
from . import const
|
||||||
from . import config_flow # noqa # pylint: disable=unused-import
|
from . import config_flow # noqa pylint: disable=unused-import
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_AUTOHEAL, CONF_DEBUG, CONF_POLLING_INTERVAL,
|
CONF_AUTOHEAL, CONF_DEBUG, CONF_POLLING_INTERVAL,
|
||||||
CONF_USB_STICK_PATH, CONF_CONFIG_PATH, CONF_NETWORK_KEY,
|
CONF_USB_STICK_PATH, CONF_CONFIG_PATH, CONF_NETWORK_KEY,
|
||||||
|
@ -56,7 +56,7 @@ async def async_call_from_config(hass, config, blocking=False, variables=None,
|
|||||||
except TemplateError as ex:
|
except TemplateError as ex:
|
||||||
_LOGGER.error('Error rendering service name template: %s', ex)
|
_LOGGER.error('Error rendering service name template: %s', ex)
|
||||||
return
|
return
|
||||||
except vol.Invalid as ex:
|
except vol.Invalid:
|
||||||
_LOGGER.error('Template rendered invalid service: %s',
|
_LOGGER.error('Template rendered invalid service: %s',
|
||||||
domain_service)
|
domain_service)
|
||||||
return
|
return
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
asynctest==0.12.2
|
asynctest==0.12.2
|
||||||
coveralls==1.2.0
|
coveralls==1.2.0
|
||||||
flake8-docstrings==1.3.0
|
flake8-docstrings==1.3.0
|
||||||
flake8==3.5
|
flake8==3.6.0
|
||||||
mock-open==1.3.1
|
mock-open==1.3.1
|
||||||
mypy==0.641
|
mypy==0.641
|
||||||
pydocstyle==2.1.1
|
pydocstyle==2.1.1
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
asynctest==0.12.2
|
asynctest==0.12.2
|
||||||
coveralls==1.2.0
|
coveralls==1.2.0
|
||||||
flake8-docstrings==1.3.0
|
flake8-docstrings==1.3.0
|
||||||
flake8==3.5
|
flake8==3.6.0
|
||||||
mock-open==1.3.1
|
mock-open==1.3.1
|
||||||
mypy==0.641
|
mypy==0.641
|
||||||
pydocstyle==2.1.1
|
pydocstyle==2.1.1
|
||||||
|
@ -90,7 +90,7 @@ TEST_REQUIREMENTS = (
|
|||||||
'pyspcwebgw',
|
'pyspcwebgw',
|
||||||
'python-forecastio',
|
'python-forecastio',
|
||||||
'python-nest',
|
'python-nest',
|
||||||
'pytradfri\[async\]',
|
'pytradfri\\[async\\]',
|
||||||
'pyunifi',
|
'pyunifi',
|
||||||
'pyupnp-async',
|
'pyupnp-async',
|
||||||
'pywebpush',
|
'pywebpush',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user