diff --git a/homeassistant/components/ifttt.py b/homeassistant/components/ifttt.py index 246265a5268..da1b377b078 100644 --- a/homeassistant/components/ifttt.py +++ b/homeassistant/components/ifttt.py @@ -28,7 +28,7 @@ REQUIREMENTS = ['pyfttt==0.3'] def trigger(hass, event, value1=None, value2=None, value3=None): - """ Trigger a Maker IFTTT recipe """ + """ Trigger a Maker IFTTT recipe. """ data = { ATTR_EVENT: event, ATTR_VALUE1: value1, @@ -39,7 +39,7 @@ def trigger(hass, event, value1=None, value2=None, value3=None): def setup(hass, config): - """ Setup the ifttt service component """ + """ Setup the ifttt service component. """ if not validate_config(config, {DOMAIN: ['key']}, _LOGGER): return False diff --git a/homeassistant/components/mqtt/__init__.py b/homeassistant/components/mqtt/__init__.py index 7f4ff030d36..b8dc8909887 100644 --- a/homeassistant/components/mqtt/__init__.py +++ b/homeassistant/components/mqtt/__init__.py @@ -132,7 +132,7 @@ def setup(hass, config): # pylint: disable=too-few-public-methods class _JsonFmtParser(object): - """ Implements a json parser on xpath""" + """ Implements a json parser on xpath. """ def __init__(self, jsonpath): import jsonpath_rw self._expr = jsonpath_rw.parse(jsonpath) @@ -144,7 +144,7 @@ class _JsonFmtParser(object): # pylint: disable=too-few-public-methods class FmtParser(object): - """ wrapper for all supported formats """ + """ Wrapper for all supported formats. """ def __init__(self, fmt): self._parse = lambda x: x if fmt: @@ -252,7 +252,7 @@ def _mqtt_on_connect(mqttc, userdata, flags, result_code): def _mqtt_on_subscribe(mqttc, userdata, mid, granted_qos): - """ Called when subscribe successfull. """ + """ Called when subscribe successful. """ topic = userdata['progress'].pop(mid, None) if topic is None: return @@ -260,7 +260,7 @@ def _mqtt_on_subscribe(mqttc, userdata, mid, granted_qos): def _mqtt_on_unsubscribe(mqttc, userdata, mid, granted_qos): - """ Called when subscribe successfull. """ + """ Called when subscribe successful. """ topic = userdata['progress'].pop(mid, None) if topic is None: return diff --git a/homeassistant/components/notify/pushbullet.py b/homeassistant/components/notify/pushbullet.py index 16c4e4192eb..5dc97a399b5 100644 --- a/homeassistant/components/notify/pushbullet.py +++ b/homeassistant/components/notify/pushbullet.py @@ -47,16 +47,16 @@ class PushBulletNotificationService(BaseNotificationService): self.refresh() def refresh(self): - ''' + """ Refresh devices, contacts, etc pbtargets stores all targets available from this pushbullet instance into a dict. These are PB objects!. It sacrifices a bit of memory - for faster processing at send_message + for faster processing at send_message. As of sept 2015, contacts were replaced by chats. This is not - implemented in the module yet - ''' + implemented in the module yet. + """ self.pushbullet.refresh() self.pbtargets = { 'device': { @@ -72,7 +72,7 @@ class PushBulletNotificationService(BaseNotificationService): If no target specified, a 'normal' push will be sent to all devices linked to the PB account. Email is special, these are assumed to always exist. We use a special - call which doesn't require a push object + call which doesn't require a push object. """ targets = kwargs.get(ATTR_TARGET) title = kwargs.get(ATTR_TITLE) diff --git a/homeassistant/components/recorder.py b/homeassistant/components/recorder.py index b09e10f7d92..f654f035857 100644 --- a/homeassistant/components/recorder.py +++ b/homeassistant/components/recorder.py @@ -59,7 +59,7 @@ def query_events(event_query, arguments=None): def row_to_state(row): - """ Convert a databsae row to a state. """ + """ Convert a database row to a state. """ try: return State( row[1], row[2], json.loads(row[3]), @@ -83,8 +83,9 @@ def row_to_event(row): def run_information(point_in_time=None): - """ Returns information about current run or the run that - covers point_in_time. """ + """ + Returns information about current run or the run that covers point_in_time. + """ _verify_instance() if point_in_time is None or point_in_time > _INSTANCE.recording_start: @@ -142,8 +143,10 @@ class RecorderRun(object): @property def where_after_start_run(self): - """ Returns SQL WHERE clause to select rows - created after the start of the run. """ + """ + Returns SQL WHERE clause to select rows created after the start of the + run. + """ return "created >= {} ".format(_adapt_datetime(self.start)) @property @@ -158,9 +161,7 @@ class RecorderRun(object): class Recorder(threading.Thread): - """ - Threaded recorder - """ + """ Threaded recorder class """ def __init__(self, hass): threading.Thread.__init__(self) @@ -208,8 +209,10 @@ class Recorder(threading.Thread): self.queue.task_done() def event_listener(self, event): - """ Listens for new events on the EventBus and puts them - in the process queue. """ + """ + Listens for new events on the EventBus and puts them in the process + queue. + """ self.queue.put(event) def shutdown(self, event): @@ -433,6 +436,6 @@ def _adapt_datetime(datetimestamp): def _verify_instance(): - """ throws error if recorder not initialized. """ + """ Throws error if recorder not initialized. """ if _INSTANCE is None: raise RuntimeError("Recorder not initialized.") diff --git a/homeassistant/components/switch/mqtt.py b/homeassistant/components/switch/mqtt.py index ed99a87868a..43bceab69a5 100644 --- a/homeassistant/components/switch/mqtt.py +++ b/homeassistant/components/switch/mqtt.py @@ -43,7 +43,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None): # pylint: disable=too-many-arguments, too-many-instance-attributes class MqttSwitch(SwitchDevice): - """ Represents a switch that can be togggled using MQTT. """ + """ Represents a switch that can be toggled using MQTT. """ def __init__(self, hass, name, state_topic, command_topic, qos, payload_on, payload_off, optimistic, state_format): self._state = False diff --git a/homeassistant/components/thermostat/honeywell.py b/homeassistant/components/thermostat/honeywell.py index 56880c4eded..2d724502d85 100644 --- a/homeassistant/components/thermostat/honeywell.py +++ b/homeassistant/components/thermostat/honeywell.py @@ -74,6 +74,7 @@ class RoundThermostat(ThermostatDevice): self.device.set_temperature(self._name, temperature) def update(self): + """ Update the data from the thermostat. """ try: # Only take first thermostat data from API for now data = next(self.device.temperatures(force_refresh=True)) diff --git a/homeassistant/components/thermostat/radiotherm.py b/homeassistant/components/thermostat/radiotherm.py index 748d0421acd..051a2a6413e 100644 --- a/homeassistant/components/thermostat/radiotherm.py +++ b/homeassistant/components/thermostat/radiotherm.py @@ -101,6 +101,7 @@ class RadioThermostat(ThermostatDevice): return round(self._target_temperature, 1) def update(self): + """ Update the data from the thermostat. """ self._current_temperature = self.device.temp['raw'] self._name = self.device.name['raw'] if self.device.tmode['human'] == 'Cool': diff --git a/homeassistant/components/zwave.py b/homeassistant/components/zwave.py index 11515e4031d..e21c339fb23 100644 --- a/homeassistant/components/zwave.py +++ b/homeassistant/components/zwave.py @@ -83,7 +83,7 @@ def _obj_to_dict(obj): def nice_print_node(node): - """ Prints a nice formatted node to the output (debug method) """ + """ Prints a nice formatted node to the output (debug method). """ node_dict = _obj_to_dict(node) node_dict['values'] = {value_id: _obj_to_dict(value) for value_id, value in node.values.items()} @@ -95,7 +95,7 @@ def nice_print_node(node): def get_config_value(node, value_index): - """ Returns the current config value for a specific index """ + """ Returns the current config value for a specific index. """ try: for value in node.values.values():