Update docstrings

This commit is contained in:
Fabian Affolter 2016-01-27 00:08:06 +01:00
parent b13e48bd71
commit 7aba78f96e
7 changed files with 32 additions and 14 deletions

View File

@ -18,7 +18,6 @@ from functools import wraps
from .dt import datetime_to_local_str, utcnow
RE_SANITIZE_FILENAME = re.compile(r'(~|\.\.|/|\\)')
RE_SANITIZE_PATH = re.compile(r'(~|\.(\.)+)')
RE_SLUGIFY = re.compile(r'[^a-z0-9_]+')
@ -181,8 +180,10 @@ class OrderedSet(collections.MutableSet):
curr = curr[1]
def pop(self, last=True): # pylint: disable=arguments-differ
""" Pops element of the end of the set.
Set last=False to pop from the beginning. """
"""
Pops element of the end of the set.
Set last=False to pop from the beginning.
"""
if not self:
raise KeyError('set is empty')
key = self.end[1][0] if last else self.end[2][0]

View File

@ -1,4 +1,8 @@
"""Color util methods."""
"""
homeassistant.util.color
~~~~~~~~~~~~~~~~~~~~~~~~
Color util methods.
"""
# Taken from: http://www.cse.unr.edu/~quiroz/inc/colortransforms.py

View File

@ -1,4 +1,8 @@
""" Environement helpers. """
"""
homeassistant.util.environement
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Environement helpers.
"""
import sys

View File

@ -1,4 +1,8 @@
"""Module with location helpers."""
"""
homeassistant.util.location
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module with location helpers.
"""
import collections
import requests
@ -6,7 +10,6 @@ from vincenty import vincenty
ELEVATION_URL = 'http://maps.googleapis.com/maps/api/elevation/json'
LocationInfo = collections.namedtuple(
"LocationInfo",
['ip', 'country_code', 'country_name', 'region_code', 'region_name',

View File

@ -1,4 +1,8 @@
"""Helpers to install PyPi packages."""
"""
homeassistant.util.package
~~~~~~~~~~~~~~~~~~~~~~~~~~
Helpers to install PyPi packages.
"""
import logging
import os
import subprocess
@ -13,8 +17,10 @@ INSTALL_LOCK = threading.Lock()
def install_package(package, upgrade=True, target=None):
"""Install a package on PyPi. Accepts pip compatible package strings.
Return boolean if install successfull."""
"""
Install a package on PyPi. Accepts pip compatible package strings.
Return boolean if install successful.
"""
# Not using 'import pip; pip.main([])' because it breaks the logger
with INSTALL_LOCK:
if check_package_exists(package, target):
@ -35,9 +41,11 @@ def install_package(package, upgrade=True, target=None):
def check_package_exists(package, lib_dir):
"""Check if a package is installed globally or in lib_dir.
"""
Check if a package is installed globally or in lib_dir.
Returns True when the requirement is met.
Returns False when the package is not installed or doesn't meet req."""
Returns False when the package is not installed or doesn't meet req.
"""
try:
req = pkg_resources.Requirement.parse(package)
except ValueError:

View File

@ -1,7 +1,6 @@
"""
homeassistant.util.temperature
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Temperature util functions.
"""

View File

@ -1,7 +1,6 @@
"""
homeassistant.util.template
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Template utility methods for rendering strings with HA data.
"""
# pylint: disable=too-few-public-methods