Upgrade pylint to 2.2.2 (#18750)
* Upgrade to 2.2.0 * simplifiable-if-expression fixes * duplicate-string-formatting-argument fixes * unused-import fixes * Upgrade to 2.2.1 * Remove no longer needed disable * Upgrade to 2.2.2
This commit is contained in:
parent
04c7d5c128
commit
1be440a72b
19 changed files with 35 additions and 40 deletions
|
@ -92,14 +92,14 @@ class AlarmDecoderBinarySensor(BinarySensorDevice):
|
|||
"""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
|
||||
|
|
|
@ -61,8 +61,7 @@ class MyStromView(HomeAssistantView):
|
|||
'{}_{}'.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)
|
||||
|
||||
|
||||
|
|
|
@ -55,8 +55,8 @@ MANIFEST_JSON = {
|
|||
|
||||
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'
|
||||
})
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ class HomeKit():
|
|||
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,
|
||||
|
|
|
@ -78,7 +78,7 @@ class Fan(HomeAccessory):
|
|||
"""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)
|
||||
|
|
|
@ -779,7 +779,7 @@ class BluesoundPlayer(MediaPlayerDevice):
|
|||
@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."""
|
||||
|
|
|
@ -136,7 +136,7 @@ class UERadioDevice(MediaPlayerDevice):
|
|||
@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):
|
||||
|
|
|
@ -9,8 +9,7 @@ CONF_SECRET = 'secret'
|
|||
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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -147,10 +147,10 @@ class MVGLiveData:
|
|||
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 = []
|
||||
|
||||
|
|
|
@ -80,8 +80,7 @@ class StatisticsSensor(Entity):
|
|||
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:
|
||||
|
|
|
@ -129,7 +129,7 @@ class APISpaceApiView(HomeAssistantView):
|
|||
|
||||
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),
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ class I2CHatSwitch(ToggleEntity):
|
|||
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:
|
||||
|
@ -132,7 +132,7 @@ class I2CHatSwitch(ToggleEntity):
|
|||
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:
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue