mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Update docstrings
This commit is contained in:
parent
b13e48bd71
commit
7aba78f96e
@ -18,7 +18,6 @@ from functools import wraps
|
|||||||
|
|
||||||
from .dt import datetime_to_local_str, utcnow
|
from .dt import datetime_to_local_str, utcnow
|
||||||
|
|
||||||
|
|
||||||
RE_SANITIZE_FILENAME = re.compile(r'(~|\.\.|/|\\)')
|
RE_SANITIZE_FILENAME = re.compile(r'(~|\.\.|/|\\)')
|
||||||
RE_SANITIZE_PATH = re.compile(r'(~|\.(\.)+)')
|
RE_SANITIZE_PATH = re.compile(r'(~|\.(\.)+)')
|
||||||
RE_SLUGIFY = re.compile(r'[^a-z0-9_]+')
|
RE_SLUGIFY = re.compile(r'[^a-z0-9_]+')
|
||||||
@ -181,8 +180,10 @@ class OrderedSet(collections.MutableSet):
|
|||||||
curr = curr[1]
|
curr = curr[1]
|
||||||
|
|
||||||
def pop(self, last=True): # pylint: disable=arguments-differ
|
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:
|
if not self:
|
||||||
raise KeyError('set is empty')
|
raise KeyError('set is empty')
|
||||||
key = self.end[1][0] if last else self.end[2][0]
|
key = self.end[1][0] if last else self.end[2][0]
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
"""Color util methods."""
|
"""
|
||||||
|
homeassistant.util.color
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Color util methods.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Taken from: http://www.cse.unr.edu/~quiroz/inc/colortransforms.py
|
# Taken from: http://www.cse.unr.edu/~quiroz/inc/colortransforms.py
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
""" Environement helpers. """
|
"""
|
||||||
|
homeassistant.util.environement
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Environement helpers.
|
||||||
|
"""
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
"""Module with location helpers."""
|
"""
|
||||||
|
homeassistant.util.location
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Module with location helpers.
|
||||||
|
"""
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
@ -6,7 +10,6 @@ from vincenty import vincenty
|
|||||||
|
|
||||||
ELEVATION_URL = 'http://maps.googleapis.com/maps/api/elevation/json'
|
ELEVATION_URL = 'http://maps.googleapis.com/maps/api/elevation/json'
|
||||||
|
|
||||||
|
|
||||||
LocationInfo = collections.namedtuple(
|
LocationInfo = collections.namedtuple(
|
||||||
"LocationInfo",
|
"LocationInfo",
|
||||||
['ip', 'country_code', 'country_name', 'region_code', 'region_name',
|
['ip', 'country_code', 'country_name', 'region_code', 'region_name',
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
"""Helpers to install PyPi packages."""
|
"""
|
||||||
|
homeassistant.util.package
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Helpers to install PyPi packages.
|
||||||
|
"""
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -13,8 +17,10 @@ INSTALL_LOCK = threading.Lock()
|
|||||||
|
|
||||||
|
|
||||||
def install_package(package, upgrade=True, target=None):
|
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
|
# Not using 'import pip; pip.main([])' because it breaks the logger
|
||||||
with INSTALL_LOCK:
|
with INSTALL_LOCK:
|
||||||
if check_package_exists(package, target):
|
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):
|
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 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:
|
try:
|
||||||
req = pkg_resources.Requirement.parse(package)
|
req = pkg_resources.Requirement.parse(package)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""
|
"""
|
||||||
homeassistant.util.temperature
|
homeassistant.util.temperature
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Temperature util functions.
|
Temperature util functions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""
|
"""
|
||||||
homeassistant.util.template
|
homeassistant.util.template
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Template utility methods for rendering strings with HA data.
|
Template utility methods for rendering strings with HA data.
|
||||||
"""
|
"""
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
|
Loading…
x
Reference in New Issue
Block a user