Upgrade linter (#4461)

This commit is contained in:
Paulus Schoutsen 2016-11-18 21:47:59 -08:00 committed by GitHub
parent 37e28428c1
commit d2bbc6ef70
21 changed files with 28 additions and 7 deletions

View File

@ -66,6 +66,7 @@ def _platform_validator(config):
return getattr(platform, 'TRIGGER_SCHEMA')(config)
_TRIGGER_SCHEMA = vol.All(
cv.ensure_list,
[

View File

@ -42,6 +42,7 @@ def get_scanner(hass, config):
scanner = ActiontecDeviceScanner(config[DOMAIN])
return scanner if scanner.success_init else None
Device = namedtuple("Device", ["mac", "ip", "last_update"])

View File

@ -93,6 +93,7 @@ def get_scanner(hass, config):
return scanner if scanner.success_init else None
AsusWrtResult = namedtuple('AsusWrtResult', 'neighbors leases arp nvram')

View File

@ -43,6 +43,7 @@ def get_scanner(hass, config):
return scanner if scanner.success_init else None
Device = namedtuple('Device', ['mac', 'name', 'ip', 'last_update'])

View File

@ -222,6 +222,7 @@ class GzipFileSender(FileSender):
return resp
_GZIP_FILE_SENDER = GzipFileSender()

View File

@ -51,6 +51,7 @@ def _cv_input_slider(cfg):
cfg[CONF_INITIAL] = state
return cfg
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({
cv.slug: vol.All({

View File

@ -23,7 +23,7 @@ REQUIREMENTS = ['rxv==0.4.0']
_LOGGER = logging.getLogger(__name__)
SUPPORT_YAMAHA = SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE | \
SUPPORT_TURN_ON | SUPPORT_TURN_OFF | SUPPORT_SELECT_SOURCE
SUPPORT_TURN_ON | SUPPORT_TURN_OFF | SUPPORT_SELECT_SOURCE
CONF_SOURCE_NAMES = 'source_names'
CONF_SOURCE_IGNORE = 'source_ignore'

View File

@ -78,6 +78,7 @@ def valid_publish_topic(value):
"""Validate that we can publish using this MQTT topic."""
return valid_subscribe_topic(value, invalid_chars='#+\0')
_VALID_QOS_SCHEMA = vol.All(vol.Coerce(int), vol.In([0, 1, 2]))
_HBMQTT_CONFIG_SCHEMA = vol.Schema(dict)

View File

@ -94,6 +94,7 @@ def valid_sensor(value):
def _valid_light_switch(value):
return _valid_device(value, "light_switch")
DEVICE_SCHEMA = vol.Schema({
vol.Required(ATTR_NAME): cv.string,
vol.Optional(ATTR_FIREEVENT, default=False): cv.boolean,

View File

@ -93,6 +93,7 @@ def _valid_customize(value):
return value
CORE_CONFIG_SCHEMA = vol.Schema({
CONF_NAME: vol.Coerce(str),
CONF_LATITUDE: cv.latitude,

View File

@ -305,6 +305,7 @@ def time_zone(value):
'Invalid time zone passed in. Valid options can be found here: '
'http://en.wikipedia.org/wiki/List_of_tz_database_time_zones')
weekdays = vol.All(ensure_list, [vol.In(WEEKDAYS)])

View File

@ -417,6 +417,7 @@ class TemplateEnvironment(ImmutableSandboxedEnvironment):
"""Test if callback is safe."""
return isinstance(obj, AllStates) or super().is_safe_callable(obj)
ENV = TemplateEnvironment()
ENV.filters['round'] = forgiving_round
ENV.filters['multiply'] = multiply

View File

@ -249,6 +249,7 @@ def _secret_yaml(loader: SafeLineLoader,
_LOGGER.error('Secret %s not defined.', node.value)
raise HomeAssistantError(node.value)
yaml.SafeLoader.add_constructor('!include', _include_yaml)
yaml.SafeLoader.add_constructor(yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
_ordered_dict)

View File

@ -1,7 +1,7 @@
# linters such as flake8 and pylint should be pinned, as new releases
# make new things fail. Manually update these pins when pulling in a
# new version
flake8==3.0.4
flake8==3.2.0
pylint==1.6.4
mypy-lang==0.4.5
pydocstyle==1.1.1

View File

@ -34,5 +34,6 @@ FINGERPRINTS = {}
with open(fingerprint_file, 'w') as fp:
fp.write(result)
if __name__ == '__main__':
fingerprint()

View File

@ -138,5 +138,6 @@ def main():
write_file(data)
if __name__ == '__main__':
main()

View File

@ -63,5 +63,6 @@ def main():
print('Updated to latest version')
if __name__ == '__main__':
main()

View File

@ -184,8 +184,10 @@ class TestApns(unittest.TestCase):
devices_path = hass.config.path('test_app_apns.yaml')
with open(devices_path, 'w+') as out:
out.write('1234: {name: test device 1, tracking_device_id: tracking123}\n') # nopep8
out.write('5678: {name: test device 2, tracking_device_id: tracking456}\n') # nopep8
out.write('1234: {name: test device 1, '
'tracking_device_id: tracking123}\n')
out.write('5678: {name: test device 2, '
'tracking_device_id: tracking456}\n')
notify.setup(hass, config)
self.assertTrue(hass.services.call('apns',
@ -293,8 +295,10 @@ class TestApns(unittest.TestCase):
devices_path = hass.config.path('test_app_apns.yaml')
with open(devices_path, 'w+') as out:
out.write('1234: {name: test device 1, tracking_device_id: tracking123}\n') # nopep8
out.write('5678: {name: test device 2, tracking_device_id: tracking456}\n') # nopep8
out.write('1234: {name: test device 1, '
'tracking_device_id: tracking123}\n')
out.write('5678: {name: test device 2, '
'tracking_device_id: tracking456}\n')
notify_service = ApnsNotificationService(
hass,

View File

@ -29,6 +29,7 @@ def test_real(func):
return guard_func
# Guard a few functions that would make network connections
location.detect_location_info = test_real(location.detect_location_info)
location.elevation = test_real(location.elevation)

View File

@ -341,7 +341,7 @@ def test_template_complex():
1, 'Hello',
'{{ beer }}',
'{% if 1 == 1 %}Hello{% else %}World{% endif %}',
{'test': 1, 'test': '{{ beer }}'},
{'test': 1, 'test2': '{{ beer }}'},
['{{ beer }}', 1]
):
schema(value)

View File

@ -36,4 +36,5 @@ class MockScanner(object):
"""
return None if device == 'DEV1' else device.lower()
SCANNER = MockScanner()