mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Update flake8 to 3.7.5 (#20761)
* Upgrade flake8 * Upgrade flake8 * Add noqa for hound
This commit is contained in:
parent
2733919cd8
commit
ef6b0b8e0b
@ -323,6 +323,7 @@ class CastDevice(MediaPlayerDevice):
|
||||
|
||||
def __init__(self, cast_info):
|
||||
"""Initialize the cast device."""
|
||||
import pychromecast # noqa: pylint: disable=unused-import
|
||||
self._cast_info = cast_info # type: ChromecastInfo
|
||||
self._chromecast = None # type: Optional[pychromecast.Chromecast]
|
||||
self.cast_status = None
|
||||
|
@ -45,6 +45,8 @@ class BboxDeviceScanner(DeviceScanner):
|
||||
|
||||
def __init__(self, config):
|
||||
"""Get host from config."""
|
||||
from typing import List # noqa: pylint: disable=unused-import
|
||||
|
||||
self.host = config[CONF_HOST]
|
||||
|
||||
"""Initialize the scanner."""
|
||||
|
@ -265,7 +265,7 @@ def _is_sensor_a_binary_sensor(hass: HomeAssistant, node) -> bool:
|
||||
|
||||
|
||||
def _categorize_nodes(hass: HomeAssistant, nodes, ignore_identifier: str,
|
||||
sensor_identifier: str)-> None:
|
||||
sensor_identifier: str) -> None:
|
||||
"""Sort the nodes to their proper domains."""
|
||||
for (path, node) in nodes:
|
||||
ignored = ignore_identifier in path or ignore_identifier in node.name
|
||||
|
@ -778,7 +778,7 @@ class StateMachine:
|
||||
self._bus = bus
|
||||
self._loop = loop
|
||||
|
||||
def entity_ids(self, domain_filter: Optional[str] = None)-> List[str]:
|
||||
def entity_ids(self, domain_filter: Optional[str] = None) -> List[str]:
|
||||
"""List of entity ids that are being tracked."""
|
||||
future = run_callback_threadsafe(
|
||||
self._loop, self.async_entity_ids, domain_filter
|
||||
@ -800,13 +800,13 @@ class StateMachine:
|
||||
return [state.entity_id for state in self._states.values()
|
||||
if state.domain == domain_filter]
|
||||
|
||||
def all(self)-> List[State]:
|
||||
def all(self) -> List[State]:
|
||||
"""Create a list of all states."""
|
||||
return run_callback_threadsafe( # type: ignore
|
||||
self._loop, self.async_all).result()
|
||||
|
||||
@callback
|
||||
def async_all(self)-> List[State]:
|
||||
def async_all(self) -> List[State]:
|
||||
"""Create a list of all states.
|
||||
|
||||
This method must be run in the event loop.
|
||||
|
@ -4,7 +4,7 @@
|
||||
asynctest==0.12.2
|
||||
coveralls==1.2.0
|
||||
flake8-docstrings==1.3.0
|
||||
flake8==3.6.0
|
||||
flake8==3.7.5
|
||||
mock-open==1.3.1
|
||||
mypy==0.650
|
||||
pydocstyle==3.0.0
|
||||
|
@ -5,7 +5,7 @@
|
||||
asynctest==0.12.2
|
||||
coveralls==1.2.0
|
||||
flake8-docstrings==1.3.0
|
||||
flake8==3.6.0
|
||||
flake8==3.7.5
|
||||
mock-open==1.3.1
|
||||
mypy==0.650
|
||||
pydocstyle==3.0.0
|
||||
|
@ -82,7 +82,7 @@ def test_default_setup(hass, mock_connection_factory):
|
||||
# ensure entities have new state value after incoming telegram
|
||||
power_consumption = hass.states.get('sensor.power_consumption')
|
||||
assert power_consumption.state == '0.0'
|
||||
assert power_consumption.attributes.get('unit_of_measurement') is 'kWh'
|
||||
assert power_consumption.attributes.get('unit_of_measurement') == 'kWh'
|
||||
|
||||
# tariff should be translated in human readable and have no unit
|
||||
power_tariff = hass.states.get('sensor.power_tariff')
|
||||
|
@ -214,7 +214,7 @@ async def test_node_discovery(hass, mock_openzwave):
|
||||
hass.async_add_job(mock_receivers[0], node)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get('zwave.mock_node').state is 'unknown'
|
||||
assert hass.states.get('zwave.mock_node').state == 'unknown'
|
||||
|
||||
|
||||
async def test_unparsed_node_discovery(hass, mock_openzwave):
|
||||
@ -257,7 +257,7 @@ async def test_unparsed_node_discovery(hass, mock_openzwave):
|
||||
assert len(mock_logger.warning.mock_calls) == 1
|
||||
assert mock_logger.warning.mock_calls[0][1][1:] == \
|
||||
(14, const.NODE_READY_WAIT_SECS)
|
||||
assert hass.states.get('zwave.unknown_node_14').state is 'unknown'
|
||||
assert hass.states.get('zwave.unknown_node_14').state == 'unknown'
|
||||
|
||||
|
||||
async def test_node_ignored(hass, mock_openzwave):
|
||||
@ -307,7 +307,7 @@ async def test_value_discovery(hass, mock_openzwave):
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get(
|
||||
'binary_sensor.mock_node_mock_value').state is 'off'
|
||||
'binary_sensor.mock_node_mock_value').state == 'off'
|
||||
|
||||
|
||||
async def test_value_discovery_existing_entity(hass, mock_openzwave):
|
||||
|
Loading…
x
Reference in New Issue
Block a user