Skip to content

Commit

Permalink
Upgrade linter (home-assistant#4461)
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob authored Nov 19, 2016
1 parent 37e2842 commit d2bbc6e
Show file tree
Hide file tree
Showing 21 changed files with 28 additions and 7 deletions.
1 change: 1 addition & 0 deletions homeassistant/components/automation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def _platform_validator(config):

return getattr(platform, 'TRIGGER_SCHEMA')(config)


_TRIGGER_SCHEMA = vol.All(
cv.ensure_list,
[
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/device_tracker/actiontec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])


Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/device_tracker/asuswrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def get_scanner(hass, config):

return scanner if scanner.success_init else None


AsusWrtResult = namedtuple('AsusWrtResult', 'neighbors leases arp nvram')


Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/device_tracker/nmap_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])


Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def send(self, request, filepath):

return resp


_GZIP_FILE_SENDER = GzipFileSender()


Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/input_slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/media_player/yamaha.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
_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'
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/mqtt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/rfxtrx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions homeassistant/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def _valid_customize(value):

return value


CORE_CONFIG_SCHEMA = vol.Schema({
CONF_NAME: vol.Coerce(str),
CONF_LATITUDE: cv.latitude,
Expand Down
1 change: 1 addition & 0 deletions homeassistant/helpers/config_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)])


Expand Down
1 change: 1 addition & 0 deletions homeassistant/helpers/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ def is_safe_callable(self, obj):
"""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
Expand Down
1 change: 1 addition & 0 deletions homeassistant/util/yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions script/fingerprint_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ def fingerprint():
with open(fingerprint_file, 'w') as fp:
fp.write(result)


if __name__ == '__main__':
fingerprint()
1 change: 1 addition & 0 deletions script/gen_requirements_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,6 @@ def main():

write_file(data)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions script/update_mdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@ def main():

print('Updated to latest version')


if __name__ == '__main__':
main()
12 changes: 8 additions & 4 deletions tests/components/notify/test_apns.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,10 @@ def test_update_existing_device_with_tracking_id(self):

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',
Expand Down Expand Up @@ -293,8 +295,10 @@ def test_send_with_state(self, mock_client):

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,
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def guard_func(*args, **kwargs):

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)
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/test_config_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ def get_device_name(self, device):
"""
return None if device == 'DEV1' else device.lower()


SCANNER = MockScanner()

0 comments on commit d2bbc6e

Please sign in to comment.