Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions homeassistant/components/binary_sensor/alarmdecoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ def device_state_attributes(self):
"""Return the state attributes."""
attr = {}
if self._rfid and self._rfstate is not None:
attr[ATTR_RF_BIT0] = True if self._rfstate & 0x01 else False
attr[ATTR_RF_LOW_BAT] = True if self._rfstate & 0x02 else False
attr[ATTR_RF_SUPERVISED] = True if self._rfstate & 0x04 else False
attr[ATTR_RF_BIT3] = True if self._rfstate & 0x08 else False
attr[ATTR_RF_LOOP3] = True if self._rfstate & 0x10 else False
attr[ATTR_RF_LOOP2] = True if self._rfstate & 0x20 else False
attr[ATTR_RF_LOOP4] = True if self._rfstate & 0x40 else False
attr[ATTR_RF_LOOP1] = True if self._rfstate & 0x80 else False
attr[ATTR_RF_BIT0] = bool(self._rfstate & 0x01)
attr[ATTR_RF_LOW_BAT] = bool(self._rfstate & 0x02)
attr[ATTR_RF_SUPERVISED] = bool(self._rfstate & 0x04)
attr[ATTR_RF_BIT3] = bool(self._rfstate & 0x08)
attr[ATTR_RF_LOOP3] = bool(self._rfstate & 0x10)
attr[ATTR_RF_LOOP2] = bool(self._rfstate & 0x20)
attr[ATTR_RF_LOOP4] = bool(self._rfstate & 0x40)
attr[ATTR_RF_LOOP1] = bool(self._rfstate & 0x80)
return attr

@property
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/binary_sensor/mystrom.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ async def _handle(self, hass, data):
'{}_{}'.format(button_id, button_action))
self.add_entities([self.buttons[entity_id]])
else:
new_state = True if self.buttons[entity_id].state == 'off' \
else False
new_state = self.buttons[entity_id].state == 'off'
self.buttons[entity_id].async_on_update(new_state)


Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/frontend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@

for size in (192, 384, 512, 1024):
MANIFEST_JSON['icons'].append({
'src': '/static/icons/favicon-{}x{}.png'.format(size, size),
'sizes': '{}x{}'.format(size, size),
'src': '/static/icons/favicon-{size}x{size}.png'.format(size=size),
'sizes': '{size}x{size}'.format(size=size),
'type': 'image/png'
})

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/homekit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def start(self, *args):
return
self.status = STATUS_WAIT

# pylint: disable=unused-variable
# pylint: disable=unused-import
from . import ( # noqa F401
type_covers, type_fans, type_lights, type_locks,
type_media_players, type_security_systems, type_sensors,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/homekit/type_fans.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def set_oscillating(self, value):
"""Set state if call came from HomeKit."""
_LOGGER.debug('%s: Set oscillating to %d', self.entity_id, value)
self._flag[CHAR_SWING_MODE] = True
oscillating = True if value == 1 else False
oscillating = value == 1
params = {ATTR_ENTITY_ID: self.entity_id,
ATTR_OSCILLATING: oscillating}
self.call_service(DOMAIN, SERVICE_OSCILLATE, params, oscillating)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/media_player/bluesound.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ def is_grouped(self):
@property
def shuffle(self):
"""Return true if shuffle is active."""
return True if self._status.get('shuffle', '0') == '1' else False
return self._status.get('shuffle', '0') == '1'

async def async_join(self, master):
"""Join the player to a group."""
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/media_player/ue_smart_radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def icon(self):
@property
def is_volume_muted(self):
"""Boolean if volume is currently muted."""
return True if self._volume <= 0 else False
return self._volume <= 0

@property
def volume_level(self):
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/owntracks/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
def supports_encryption():
"""Test if we support encryption."""
try:
# pylint: disable=unused-variable
import libnacl # noqa
import libnacl # noqa pylint: disable=unused-import
return True
except OSError:
return False
Expand Down
6 changes: 2 additions & 4 deletions homeassistant/components/sensor/bme680.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,8 @@ def _setup_bme680(config):

sensor_handler = BME680Handler(
sensor,
True if (
SENSOR_GAS in config[CONF_MONITORED_CONDITIONS] or
SENSOR_AQ in config[CONF_MONITORED_CONDITIONS]
) else False,
(SENSOR_GAS in config[CONF_MONITORED_CONDITIONS] or
SENSOR_AQ in config[CONF_MONITORED_CONDITIONS]),
config[CONF_AQ_BURN_IN_TIME],
config[CONF_AQ_HUM_BASELINE],
config[CONF_AQ_HUM_WEIGHTING]
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/sensor/miflora.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async def async_setup_platform(hass, config, async_add_entities,
"""Set up the MiFlora sensor."""
from miflora import miflora_poller
try:
import bluepy.btle # noqa: F401 pylint: disable=unused-variable
import bluepy.btle # noqa: F401 pylint: disable=unused-import
from btlewrap import BluepyBackend
backend = BluepyBackend
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/sensor/mitemp_bt.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the MiTempBt sensor."""
from mitemp_bt import mitemp_bt_poller
try:
import bluepy.btle # noqa: F401 pylint: disable=unused-variable
import bluepy.btle # noqa: F401 pylint: disable=unused-import
from btlewrap import BluepyBackend
backend = BluepyBackend
except ImportError:
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/sensor/mvglive.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ def __init__(self, station, destinations, directions,
self._products = products
self._timeoffset = timeoffset
self._number = number
self._include_ubahn = True if 'U-Bahn' in self._products else False
self._include_tram = True if 'Tram' in self._products else False
self._include_bus = True if 'Bus' in self._products else False
self._include_sbahn = True if 'S-Bahn' in self._products else False
self._include_ubahn = 'U-Bahn' in self._products
self._include_tram = 'Tram' in self._products
self._include_bus = 'Bus' in self._products
self._include_sbahn = 'S-Bahn' in self._products
self.mvg = MVGLive.MVGLive()
self.departures = []

Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/sensor/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ def __init__(self, entity_id, name, sampling_size, max_age,
precision):
"""Initialize the Statistics sensor."""
self._entity_id = entity_id
self.is_binary = True if self._entity_id.split('.')[0] == \
'binary_sensor' else False
self.is_binary = self._entity_id.split('.')[0] == 'binary_sensor'
if not self.is_binary:
self._name = '{} {}'.format(name, ATTR_MEAN)
else:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/spaceapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def get(self, request):

if space_state is not None:
state = {
ATTR_OPEN: False if space_state.state == 'off' else True,
ATTR_OPEN: space_state.state != 'off',
ATTR_LASTCHANGE:
dt_util.as_timestamp(space_state.last_updated),
}
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/switch/raspihats.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def is_on(self):
def turn_on(self, **kwargs):
"""Turn the device on."""
try:
state = True if self._invert_logic is False else False
state = self._invert_logic is False
self.I2C_HATS_MANAGER.write_dq(self._address, self._channel, state)
self.schedule_update_ha_state()
except I2CHatsException as ex:
Expand All @@ -132,7 +132,7 @@ def turn_on(self, **kwargs):
def turn_off(self, **kwargs):
"""Turn the device off."""
try:
state = False if self._invert_logic is False else True
state = self._invert_logic is not False
self.I2C_HATS_MANAGER.write_dq(self._address, self._channel, state)
self.schedule_update_ha_state()
except I2CHatsException as ex:
Expand Down
7 changes: 4 additions & 3 deletions homeassistant/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,10 @@ def _format_config_error(ex: vol.Invalid, domain: str, config: Dict) -> str:
"""
message = "Invalid config for [{}]: ".format(domain)
if 'extra keys not allowed' in ex.error_message:
message += '[{}] is an invalid option for [{}]. Check: {}->{}.'\
.format(ex.path[-1], domain, domain,
'->'.join(str(m) for m in ex.path))
message += '[{option}] is an invalid option for [{domain}]. ' \
'Check: {domain}->{path}.'.format(
option=ex.path[-1], domain=domain,
path='->'.join(str(m) for m in ex.path))
else:
message += '{}.'.format(humanize_error(config, ex))

Expand Down
3 changes: 1 addition & 2 deletions homeassistant/helpers/intent.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ async def async_handle(hass: HomeAssistantType, platform: str,
intent_type, err)
raise InvalidSlotInfo(
'Received invalid slot info for {}'.format(intent_type)) from err
# https://github.com/PyCQA/pylint/issues/2284
except IntentHandleError: # pylint: disable=try-except-raise
except IntentHandleError:
raise
except Exception as err:
raise IntentUnexpectedError(
Expand Down
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ flake8==3.6.0
mock-open==1.3.1
mypy==0.641
pydocstyle==2.1.1
pylint==2.1.1
pylint==2.2.2
pytest-aiohttp==0.3.0
pytest-cov==2.6.0
pytest-sugar==0.9.2
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ flake8==3.6.0
mock-open==1.3.1
mypy==0.641
pydocstyle==2.1.1
pylint==2.1.1
pylint==2.2.2
pytest-aiohttp==0.3.0
pytest-cov==2.6.0
pytest-sugar==0.9.2
Expand Down