Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
46 changes: 23 additions & 23 deletions homeassistant/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@


def from_config_dict(config: Dict[str, Any],
hass: Optional[core.HomeAssistant]=None,
config_dir: Optional[str]=None,
enable_log: bool=True,
verbose: bool=False,
skip_pip: bool=False,
log_rotate_days: Any=None,
log_file: Any=None) \
hass: Optional[core.HomeAssistant] = None,
config_dir: Optional[str] = None,
enable_log: bool = True,
verbose: bool = False,
skip_pip: bool = False,
log_rotate_days: Any = None,
log_file: Any = None) \
-> Optional[core.HomeAssistant]:
"""Try to configure Home Assistant from a configuration dictionary.

Expand All @@ -68,12 +68,12 @@ def from_config_dict(config: Dict[str, Any],
@asyncio.coroutine
def async_from_config_dict(config: Dict[str, Any],
hass: core.HomeAssistant,
config_dir: Optional[str]=None,
enable_log: bool=True,
verbose: bool=False,
skip_pip: bool=False,
log_rotate_days: Any=None,
log_file: Any=None) \
config_dir: Optional[str] = None,
enable_log: bool = True,
verbose: bool = False,
skip_pip: bool = False,
log_rotate_days: Any = None,
log_file: Any = None) \
-> Optional[core.HomeAssistant]:
"""Try to configure Home Assistant from a configuration dictionary.

Expand Down Expand Up @@ -163,11 +163,11 @@ def async_from_config_dict(config: Dict[str, Any],


def from_config_file(config_path: str,
hass: Optional[core.HomeAssistant]=None,
verbose: bool=False,
skip_pip: bool=True,
log_rotate_days: Any=None,
log_file: Any=None):
hass: Optional[core.HomeAssistant] = None,
verbose: bool = False,
skip_pip: bool = True,
log_rotate_days: Any = None,
log_file: Any = None):
"""Read the configuration file and try to start all the functionality.

Will add functionality to 'hass' parameter if given,
Expand All @@ -188,10 +188,10 @@ def from_config_file(config_path: str,
@asyncio.coroutine
def async_from_config_file(config_path: str,
hass: core.HomeAssistant,
verbose: bool=False,
skip_pip: bool=True,
log_rotate_days: Any=None,
log_file: Any=None):
verbose: bool = False,
skip_pip: bool = True,
log_rotate_days: Any = None,
log_file: Any = None):
"""Read the configuration file and try to start all the functionality.

Will add functionality to 'hass' parameter.
Expand Down Expand Up @@ -219,7 +219,7 @@ def async_from_config_file(config_path: str,


@core.callback
def async_enable_logging(hass: core.HomeAssistant, verbose: bool=False,
def async_enable_logging(hass: core.HomeAssistant, verbose: bool = False,
log_rotate_days=None, log_file=None) -> None:
"""Set up the logging.

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/abode.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import asyncio
import logging
from functools import partial
from requests.exceptions import HTTPError, ConnectTimeout

import voluptuous as vol

Expand All @@ -17,7 +18,6 @@
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers import discovery
from homeassistant.helpers.entity import Entity
from requests.exceptions import HTTPError, ConnectTimeout

REQUIREMENTS = ['abodepy==0.12.2']

Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/alarm_control_panel/canary.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ def state(self):
return STATE_ALARM_ARMED_HOME
elif mode.name == LOCATION_MODE_NIGHT:
return STATE_ALARM_ARMED_NIGHT
else:
return None
return None

@property
def device_state_attributes(self):
Expand Down
8 changes: 3 additions & 5 deletions homeassistant/components/alarm_control_panel/manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,8 @@ def state(self):
trigger_time) < dt_util.utcnow():
if self._disarm_after_trigger:
return STATE_ALARM_DISARMED
else:
self._state = self._previous_state
return self._state
self._state = self._previous_state
return self._state

if self._state in SUPPORTED_PENDING_STATES and \
self._within_pending_time(self._state):
Expand All @@ -187,8 +186,7 @@ def _active_state(self):
"""Get the current state."""
if self.state == STATE_ALARM_PENDING:
return self._previous_state
else:
return self._state
return self._state

def _pending_time(self, state):
"""Get the pending time."""
Expand Down
8 changes: 3 additions & 5 deletions homeassistant/components/alarm_control_panel/manual_mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,8 @@ def state(self):
trigger_time) < dt_util.utcnow():
if self._disarm_after_trigger:
return STATE_ALARM_DISARMED
else:
self._state = self._previous_state
return self._state
self._state = self._previous_state
return self._state

if self._state in SUPPORTED_PENDING_STATES and \
self._within_pending_time(self._state):
Expand All @@ -223,8 +222,7 @@ def _active_state(self):
"""Get the current state."""
if self.state == STATE_ALARM_PENDING:
return self._previous_state
else:
return self._state
return self._state

def _pending_time(self, state):
"""Get the pending time."""
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/binary_sensor/envisalink.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self, hass, zone_number, zone_name, zone_type, info,
self._zone_type = zone_type
self._zone_number = zone_number

_LOGGER.debug('Setting up zone: ' + zone_name)
_LOGGER.debug('Setting up zone: %s', zone_name)
super().__init__(zone_name, info, controller)

@asyncio.coroutine
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/binary_sensor/ihc.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class IHCBinarySensor(IHCDevice, BinarySensorDevice):

def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
sensor_type: str, inverting: bool,
product: Element=None) -> None:
product: Element = None) -> None:
"""Initialize the IHC binary sensor."""
super().__init__(ihc_controller, name, ihc_id, info, product)
self._state = None
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/calendar/todoist.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def update(self):

# Organize the best tasks (so users can see all the tasks
# they have, organized)
while len(project_tasks) > 0:
while project_tasks:
best_task = self.select_best_task(project_tasks)
_LOGGER.debug("Found Todoist Task: %s", best_task[SUMMARY])
project_tasks.remove(best_task)
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/camera/mjpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ def camera_image(self):
else:
req = requests.get(self._mjpeg_url, stream=True, timeout=10)

# https://github.com/PyCQA/pylint/issues/1437
# pylint: disable=no-member
with closing(req) as response:
return extract_image_from_mjpeg(response.iter_content(102400))

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/camera/uvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def set_motion_detection(self, mode):
self._nvr.set_recordmode(self._uuid, set_mode)
self._motion_status = mode
except NvrError as err:
_LOGGER.error("Unable to set recordmode to " + set_mode)
_LOGGER.error("Unable to set recordmode to %s", set_mode)
_LOGGER.debug(err)

def enable_motion_detection(self):
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/camera/xeoma.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@


@asyncio.coroutine
# pylint: disable=unused-argument
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Discover and setup Xeoma Cameras."""
from pyxeoma.xeoma import Xeoma, XeomaError
Expand All @@ -69,6 +68,8 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
]

for cam in config[CONF_CAMERAS]:
# https://github.com/PyCQA/pylint/issues/1830
# pylint: disable=stop-iteration-return
camera = next(
(dc for dc in discovered_cameras
if dc[CONF_IMAGE_NAME] == cam[CONF_IMAGE_NAME]), None)
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/climate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,16 +669,16 @@ def async_set_humidity(self, humidity):
"""
return self.hass.async_add_job(self.set_humidity, humidity)

def set_fan_mode(self, fan):
def set_fan_mode(self, fan_mode):
"""Set new target fan mode."""
raise NotImplementedError()

def async_set_fan_mode(self, fan):
def async_set_fan_mode(self, fan_mode):
"""Set new target fan mode.

This method must be run in the event loop and returns a coroutine.
"""
return self.hass.async_add_job(self.set_fan_mode, fan)
return self.hass.async_add_job(self.set_fan_mode, fan_mode)

def set_operation_mode(self, operation_mode):
"""Set new target operation mode."""
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/climate/daikin.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ def current_fan_mode(self):
"""Return the fan setting."""
return self.get(ATTR_FAN_MODE)

def set_fan_mode(self, fan):
def set_fan_mode(self, fan_mode):
"""Set fan mode."""
self.set({ATTR_FAN_MODE: fan})
self.set({ATTR_FAN_MODE: fan_mode})

@property
def fan_list(self):
Expand Down
10 changes: 5 additions & 5 deletions homeassistant/components/climate/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ def set_swing_mode(self, swing_mode):
self._current_swing_mode = swing_mode
self.schedule_update_ha_state()

def set_fan_mode(self, fan):
def set_fan_mode(self, fan_mode):
"""Set new target temperature."""
self._current_fan_mode = fan
self._current_fan_mode = fan_mode
self.schedule_update_ha_state()

def set_operation_mode(self, operation_mode):
Expand Down Expand Up @@ -225,9 +225,9 @@ def turn_away_mode_off(self):
self._away = False
self.schedule_update_ha_state()

def set_hold_mode(self, hold):
"""Update hold mode on."""
self._hold = hold
def set_hold_mode(self, hold_mode):
"""Update hold_mode on."""
self._hold = hold_mode
self.schedule_update_ha_state()

def turn_aux_heat_on(self):
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/climate/ephember.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ def current_operation(self):
"""Return current operation ie. heat, cool, idle."""
if self._zone['isCurrentlyActive']:
return STATE_HEAT
else:
return STATE_IDLE
return STATE_IDLE

@property
def is_aux_heat_on(self):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/climate/eq3btsmart.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
add_devices(devices)


# pylint: disable=import-error
# pylint: disable=import-error, no-name-in-module
class EQ3BTSmartThermostat(ClimateDevice):
"""Representation of an eQ-3 Bluetooth Smart thermostat."""

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/climate/flexit.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,6 @@ def set_temperature(self, **kwargs):
self._target_temperature = kwargs.get(ATTR_TEMPERATURE)
self.unit.set_temp(self._target_temperature)

def set_fan_mode(self, fan):
def set_fan_mode(self, fan_mode):
"""Set new fan mode."""
self.unit.set_fan_speed(self._fan_list.index(fan))
self.unit.set_fan_speed(self._fan_list.index(fan_mode))
8 changes: 3 additions & 5 deletions homeassistant/components/climate/generic_thermostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,9 @@ def state(self):
"""Return the current state."""
if self._is_device_active:
return self.current_operation
else:
if self._enabled:
return STATE_IDLE
else:
return STATE_OFF
if self._enabled:
return STATE_IDLE
return STATE_OFF

@property
def should_poll(self):
Expand Down
24 changes: 10 additions & 14 deletions homeassistant/components/climate/melissa.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ def set_temperature(self, **kwargs):
temp = kwargs.get(ATTR_TEMPERATURE)
self.send({self._api.TEMP: temp})

def set_fan_mode(self, fan):
def set_fan_mode(self, fan_mode):
"""Set fan mode."""
fan_mode = self.hass_fan_to_melissa(fan)
self.send({self._api.FAN: fan_mode})
melissa_fan_mode = self.hass_fan_to_melissa(fan_mode)
self.send({self._api.FAN: melissa_fan_mode})

def set_operation_mode(self, operation_mode):
"""Set operation mode."""
Expand All @@ -174,8 +174,7 @@ def send(self, value):
if not self._api.send(self._serial_number, self._cur_settings):
self._cur_settings = old_value
return False
else:
return True
return True

def update(self):
"""Get latest data from Melissa."""
Expand All @@ -196,8 +195,7 @@ def melissa_state_to_hass(self, state):
return STATE_OFF
elif state == self._api.STATE_IDLE:
return STATE_IDLE
else:
return None
return None

def melissa_op_to_hass(self, mode):
"""Translate Melissa modes to hass states."""
Expand All @@ -211,10 +209,9 @@ def melissa_op_to_hass(self, mode):
return STATE_DRY
elif mode == self._api.MODE_FAN:
return STATE_FAN_ONLY
else:
_LOGGER.warning(
"Operation mode %s could not be mapped to hass", mode)
return None
_LOGGER.warning(
"Operation mode %s could not be mapped to hass", mode)
return None

def melissa_fan_to_hass(self, fan):
"""Translate Melissa fan modes to hass modes."""
Expand All @@ -226,9 +223,8 @@ def melissa_fan_to_hass(self, fan):
return SPEED_MEDIUM
elif fan == self._api.FAN_HIGH:
return SPEED_HIGH
else:
_LOGGER.warning("Fan mode %s could not be mapped to hass", fan)
return None
_LOGGER.warning("Fan mode %s could not be mapped to hass", fan)
return None

def hass_mode_to_melissa(self, mode):
"""Translate hass states to melissa modes."""
Expand Down
Loading