Updated docstrings (#7383)

* Updated docstrings

* Updated docstrings

* Updated docstrings

* Update docstrings

* Update more docstrings
This commit is contained in:
Alok Saboo 2017-04-30 23:10:08 -04:00 committed by Paulus Schoutsen
parent 6aac53399d
commit 86cfc2a0ed
35 changed files with 56 additions and 56 deletions

View file

@ -55,7 +55,7 @@ class NetatmoCamera(Camera):
"""Representation of the images published from a Netatmo camera."""
def __init__(self, data, camera_name, home, camera_type, verify_ssl):
"""Setup for access to the Netatmo camera images."""
"""Set up access to the Netatmo camera images."""
super(NetatmoCamera, self).__init__()
self._data = data
self._camera_name = camera_name

View file

@ -48,7 +48,7 @@ class ProliphixThermostat(ClimateDevice):
@property
def should_poll(self):
"""Polling needed for thermostat."""
"""Set up polling needed for thermostat."""
return True
def update(self):

View file

@ -17,7 +17,7 @@ _LOGGER = logging.getLogger(__name__)
def setup_scanner(hass, config, see, discovery_info=None):
"""Set up the MySensors tracker."""
def mysensors_callback(gateway, msg):
"""Callback for mysensors platform."""
"""Set up callback for mysensors platform."""
node = gateway.sensors[msg.node_id]
if node.sketch_name is None:
_LOGGER.debug("No sketch_name: node %s", msg.node_id)

View file

@ -234,7 +234,7 @@ class Config(object):
return is_default_exposed or explicit_expose
def _load_numbers_json(self):
"""Helper method to load numbers json."""
"""Set up helper method to load numbers json."""
try:
with open(self.hass.config.path(NUMBERS_FILE),
encoding='utf-8') as fil:
@ -247,7 +247,7 @@ class Config(object):
return {}
def _save_numbers_json(self):
"""Helper method to save numbers json."""
"""Set up helper method to save numbers json."""
try:
with open(self.hass.config.path(NUMBERS_FILE), 'w',
encoding='utf-8') as fil:

View file

@ -54,7 +54,7 @@ class BlinkStickLight(Light):
@property
def should_poll(self):
"""Polling needed."""
"""Set up polling."""
return True
@property

View file

@ -34,7 +34,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the EnOcean light platform."""
"""Set up the EnOcean light platform."""
sender_id = config.get(CONF_SENDER_ID)
devname = config.get(CONF_NAME)
dev_id = config.get(CONF_ID)

View file

@ -94,7 +94,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Flux lights."""
"""Set up the Flux lights."""
import flux_led
lights = []
light_ips = []

View file

@ -18,7 +18,7 @@ SUPPORT_HOMEMATIC = SUPPORT_BRIGHTNESS
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Homematic light platform."""
"""Set up the Homematic light platform."""
if discovery_info is None:
return

View file

@ -104,7 +104,7 @@ def _find_host_from_config(hass, filename=PHUE_CONFIG_FILE):
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Hue lights."""
"""Set up the Hue lights."""
# Default needed in case of discovery
filename = config.get(CONF_FILENAME, PHUE_CONFIG_FILE)
allow_unreachable = config.get(CONF_ALLOW_UNREACHABLE,
@ -140,7 +140,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
def setup_bridge(host, hass, add_devices, filename, allow_unreachable,
allow_in_emulated_hue, allow_hue_groups):
"""Setup a phue bridge based on host parameter."""
"""Set up a phue bridge based on host parameter."""
import phue
try:
@ -273,7 +273,7 @@ def request_configuration(host, hass, add_devices, filename,
# pylint: disable=unused-argument
def hue_configuration_callback(data):
"""The actions to do when our configuration callback is called."""
"""Set up actions to do when our configuration callback is called."""
setup_bridge(host, hass, add_devices, filename, allow_unreachable,
allow_in_emulated_hue, allow_hue_groups)

View file

@ -36,7 +36,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup a Hyperion server remote."""
"""Set up a Hyperion server remote."""
host = config.get(CONF_HOST)
port = config.get(CONF_PORT)
default_color = config.get(CONF_DEFAULT_COLOR)

View file

@ -14,7 +14,7 @@ SUPPORT_INSTEON_HUB = SUPPORT_BRIGHTNESS
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Insteon Hub light platform."""
"""Set up the Insteon Hub light platform."""
devs = []
for device in INSTEON.devices:
if device.DeviceCategory == "Switched Lighting Control":

View file

@ -64,7 +64,7 @@ def request_configuration(device_id, insteonhub, model, hass,
return
def insteon_light_config_callback(data):
"""The actions to do when our configuration callback is called."""
"""Set up actions to do when our configuration callback is called."""
setup_light(device_id, data.get('name'), insteonhub, hass,
add_devices_callback)

View file

@ -25,7 +25,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the KNX light platform."""
"""Set up the KNX light platform."""
add_devices([KNXLight(hass, KNXConfig(config))])

View file

@ -48,7 +48,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the LIFX platform."""
"""Set up the LIFX platform."""
server_addr = config.get(CONF_SERVER)
broadcast_addr = config.get(CONF_BROADCAST)
@ -121,7 +121,7 @@ class LIFX(object):
# pylint: disable=unused-argument
def poll(self, now):
"""Polling for the light."""
"""Set up polling for the light."""
self.probe()
def probe(self, address=None):

View file

@ -95,7 +95,7 @@ def rewrite_legacy(config):
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the LimitlessLED lights."""
"""Set up the LimitlessLED lights."""
from limitlessled.bridge import Bridge
# Two legacy configuration formats are supported to maintain backwards
@ -123,7 +123,7 @@ def state(new_state):
Specify True (turn on) or False (turn off).
"""
def decorator(function):
"""Decorator function."""
"""Set up the decorator function."""
# pylint: disable=no-member,protected-access
def wrapper(self, **kwargs):
"""Wrap a group state change."""

View file

@ -57,7 +57,7 @@ class LiteJetLight(Light):
@property
def name(self):
"""The light's name."""
"""Set up the light's name."""
return self._name
@property

View file

@ -13,7 +13,7 @@ _LOGGER = logging.getLogger(__name__)
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup Lutron lights."""
"""Set up Lutron lights."""
devs = []
for (area_name, device) in hass.data[LUTRON_DEVICES]['light']:
dev = LutronLight(area_name, device, hass.data[LUTRON_CONTROLLER])
@ -82,6 +82,6 @@ class LutronLight(LutronDevice, Light):
return self._lutron_device.last_level() > 0
def update(self):
"""Called when forcing a refresh of the device."""
"""Call when forcing a refresh of the device."""
if self._prev_brightness is None:
self._prev_brightness = to_hass_level(self._lutron_device.level)

View file

@ -16,7 +16,7 @@ DEPENDENCIES = ['lutron_caseta']
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup Lutron Caseta lights."""
"""Set up Lutron Caseta lights."""
devs = []
bridge = hass.data[LUTRON_CASETA_SMARTBRIDGE]
light_devices = bridge.get_devices_by_types(["WallDimmer", "PlugInDimmer"])
@ -59,6 +59,6 @@ class LutronCasetaLight(LutronCasetaDevice, Light):
return self._state["current_state"] > 0
def update(self):
"""Called when forcing a refresh of the device."""
"""Call when forcing a refresh of the device."""
self._state = self._smartbridge.get_device_by_id(self._device_id)
_LOGGER.debug(self._state)

View file

@ -71,7 +71,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Setup a MQTT JSON Light."""
"""Set up a MQTT JSON Light."""
if discovery_info is not None:
config = PLATFORM_SCHEMA(discovery_info)
async_add_devices([MqttJson(

View file

@ -65,7 +65,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Setup a MQTT Template light."""
"""Set up a MQTT Template light."""
if discovery_info is not None:
config = PLATFORM_SCHEMA(discovery_info)

View file

@ -25,7 +25,7 @@ SUPPORT_MYSENSORS = (SUPPORT_BRIGHTNESS | SUPPORT_RGB_COLOR |
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the mysensors platform for sensors."""
"""Set up the mysensors platform for sensors."""
# Only act if loaded via mysensors by discovery event.
# Otherwise gateway is not setup.
if discovery_info is None:
@ -65,7 +65,7 @@ class MySensorsLight(mysensors.MySensorsDeviceEntity, Light):
"""Represent the value of a MySensors Light child node."""
def __init__(self, *args):
"""Setup instance attributes."""
"""Set up instance attributes."""
mysensors.MySensorsDeviceEntity.__init__(self, *args)
self._state = None
self._brightness = None

View file

@ -39,7 +39,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Osram Lightify lights."""
"""Set up the Osram Lightify lights."""
import lightify
host = config.get(CONF_HOST)
if host:
@ -57,7 +57,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
def setup_bridge(bridge, add_devices_callback):
"""Setup the Lightify bridge."""
"""Set up the Lightify bridge."""
lights = {}
@util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_FORCED_SCANS)

View file

@ -20,14 +20,14 @@ SUPPORT_RFXTRX = SUPPORT_BRIGHTNESS
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the RFXtrx platform."""
"""Set up the RFXtrx platform."""
import RFXtrx as rfxtrxmod
lights = rfxtrx.get_devices_from_config(config, RfxtrxLight)
add_devices(lights)
def light_update(event):
"""Callback for light updates from the RFXtrx gateway."""
"""Define callback for light updates from the RFXtrx gateway."""
if not isinstance(event.device, rfxtrxmod.LightingDevice) or \
not event.device.known_to_be_dimmable:
return

View file

@ -55,7 +55,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the pwm lights."""
"""Set up the pwm lights."""
from pwmled.led import SimpleLed
from pwmled.led.rgb import RgbLed
from pwmled.led.rgbw import RgbwLed

View file

@ -24,7 +24,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the SCSGate switches."""
"""Set up the SCSGate switches."""
devices = config.get(CONF_DEVICES)
lights = []
logger = logging.getLogger(__name__)

View file

@ -17,7 +17,7 @@ _LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup lights."""
"""Set up lights."""
if discovery_info is None:
return
add_devices(TelldusLiveLight(hass, light) for light in discovery_info)
@ -32,7 +32,7 @@ class TelldusLiveLight(TelldusLiveEntity, Light):
self._last_brightness = self.brightness
def changed(self):
"""A property of the device might have changed."""
"""Define a property of the device that might have changed."""
self._last_brightness = self.brightness
super().changed()

View file

@ -20,7 +20,7 @@ SUPPORT_TELLSTICK = SUPPORT_BRIGHTNESS
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup Tellstick lights."""
"""Set up Tellstick lights."""
if (discovery_info is None or
discovery_info[ATTR_DISCOVER_DEVICES] is None):
return

View file

@ -20,7 +20,7 @@ ALLOWED_TEMPERATURES = {
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the IKEA Tradfri Light platform."""
"""Set up the IKEA Tradfri Light platform."""
if discovery_info is None:
return

View file

@ -20,7 +20,7 @@ SUPPORT_VERA = SUPPORT_BRIGHTNESS
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup Vera lights."""
"""Set up Vera lights."""
add_devices(
VeraLight(device, VERA_CONTROLLER) for device in VERA_DEVICES['light'])
@ -67,5 +67,5 @@ class VeraLight(VeraDevice, Light):
return self._state
def update(self):
"""Called by the vera device callback to update state."""
"""Call to update state."""
self._state = self.vera_device.is_switched_on()

View file

@ -26,7 +26,7 @@ SUPPORT_WEMO = (SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP | SUPPORT_RGB_COLOR |
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup WeMo bridges and register connected lights."""
"""Set up WeMo bridges and register connected lights."""
import pywemo.discovery as discovery
if discovery_info is not None:
@ -39,7 +39,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
def setup_bridge(bridge, add_devices):
"""Setup a WeMo link."""
"""Set up a WeMo link."""
lights = {}
@util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_FORCED_SCANS)
@ -97,7 +97,7 @@ class WemoLight(Light):
@property
def is_on(self):
"""True if device is on."""
"""Set True if device is on."""
return self.device.state['onoff'] != 0
@property

View file

@ -22,7 +22,7 @@ RGB_MODES = ['hsb', 'rgb']
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Wink lights."""
"""Set up the Wink lights."""
import pywink
for light in pywink.get_light_bulbs():
@ -53,7 +53,7 @@ class WinkLight(WinkDevice, Light):
@property
def rgb_color(self):
"""Current bulb color in RGB."""
"""Define current bulb color in RGB."""
if not self.wink.supports_hue_saturation():
return None
elif self.wink.color_model() not in RGB_MODES:
@ -72,14 +72,14 @@ class WinkLight(WinkDevice, Light):
@property
def xy_color(self):
"""Current bulb color in CIE 1931 (XY) color space."""
"""Define current bulb color in CIE 1931 (XY) color space."""
if not self.wink.supports_xy_color():
return None
return self.wink.color_xy()
@property
def color_temp(self):
"""Current bulb color in degrees Kelvin."""
"""Define current bulb color in degrees Kelvin."""
if not self.wink.supports_temperature():
return None
return color_util.color_temperature_kelvin_to_mired(

View file

@ -40,7 +40,7 @@ def get_unit_status(code):
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the x10 Light platform."""
"""Set up the x10 Light platform."""
try:
x10_command('info')
except CalledProcessError as err:

View file

@ -54,7 +54,7 @@ SUPPORT_YEELIGHT_RGB = (SUPPORT_YEELIGHT |
def _cmd(func):
"""A wrapper to catch exceptions from the bulb."""
"""Define a wrapper to catch exceptions from the bulb."""
def _wrap(self, *args, **kwargs):
import yeelight
try:
@ -67,7 +67,7 @@ def _cmd(func):
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Yeelight bulbs."""
"""Set up Yeelight bulbs."""
lights = []
if discovery_info is not None:
_LOGGER.debug("Adding autodetected %s", discovery_info['hostname'])

View file

@ -17,7 +17,7 @@ DEPENDENCIES = ['zha']
@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Setup Zigbee Home Automation lights."""
"""Set up Zigbee Home Automation lights."""
discovery_info = zha.get_discovery_info(hass, discovery_info)
if discovery_info is None:
return

View file

@ -113,19 +113,19 @@ class ZwaveDimmer(zwave.ZWaveDeviceEntity, Light):
self._brightness, self._state = brightness_state(self.values.primary)
def value_added(self):
"""Called when a new value is added to this entity."""
"""Call when a new value is added to this entity."""
self._supported_features = SUPPORT_BRIGHTNESS
if self.values.dimming_duration is not None:
self._supported_features |= SUPPORT_TRANSITION
def value_changed(self):
"""Called when a value for this entity's node has changed."""
"""Call when a value for this entity's node has changed."""
if self._refresh_value:
if self._refreshing:
self._refreshing = False
else:
def _refresh_value():
"""Used timer callback for delayed value refresh."""
"""Use timer callback for delayed value refresh."""
self._refreshing = True
self.values.primary.refresh()
@ -218,7 +218,7 @@ class ZwaveColorLight(ZwaveDimmer):
super().__init__(values, refresh, delay)
def value_added(self):
"""Called when a new value is added to this entity."""
"""Call when a new value is added to this entity."""
super().value_added()
self._supported_features |= SUPPORT_RGB_COLOR