Remove deprecated code

pull/244/head
Paulus Schoutsen 2015-08-04 16:21:09 -04:00
parent 2075de3d81
commit d2b5f429fe
9 changed files with 17 additions and 99 deletions

View File

@ -96,7 +96,7 @@ class HomeAssistant(object):
self.pool.stop()
def track_point_in_time(self, action, point_in_time):
"""Deprecated method to track point in time."""
"""Deprecated method as of 8/4/2015 to track point in time."""
_LOGGER.warning(
'hass.track_point_in_time is deprecated. '
'Please use homeassistant.helpers.event.track_point_in_time')
@ -104,7 +104,7 @@ class HomeAssistant(object):
helper.track_point_in_time(self, action, point_in_time)
def track_point_in_utc_time(self, action, point_in_time):
"""Deprecated method to track point in UTC time."""
"""Deprecated method as of 8/4/2015 to track point in UTC time."""
_LOGGER.warning(
'hass.track_point_in_utc_time is deprecated. '
'Please use homeassistant.helpers.event.track_point_in_utc_time')
@ -114,7 +114,7 @@ class HomeAssistant(object):
def track_utc_time_change(self, action,
year=None, month=None, day=None,
hour=None, minute=None, second=None):
"""Deprecated method to track UTC time change."""
"""Deprecated method as of 8/4/2015 to track UTC time change."""
# pylint: disable=too-many-arguments
_LOGGER.warning(
'hass.track_utc_time_change is deprecated. '
@ -126,7 +126,7 @@ class HomeAssistant(object):
def track_time_change(self, action,
year=None, month=None, day=None,
hour=None, minute=None, second=None, utc=False):
"""Deprecated method to track time change."""
"""Deprecated method as of 8/4/2015 to track time change."""
# pylint: disable=too-many-arguments
_LOGGER.warning(
'hass.track_time_change is deprecated. '
@ -183,7 +183,7 @@ class Event(object):
self.event_type = event_type
self.data = data or {}
self.origin = origin
self.time_fired = util.strip_microseconds(
self.time_fired = date_util.strip_microseconds(
time_fired or date_util.utcnow())
def as_dict(self):
@ -502,7 +502,7 @@ class StateMachine(object):
def track_change(self, entity_ids, action, from_state=None, to_state=None):
"""
DEPRECATED
DEPRECATED AS OF 8/4/2015
"""
_LOGGER.warning(
'hass.states.track_change is deprecated. '

View File

@ -63,12 +63,15 @@ def setup_component(hass, domain, config=None):
def _handle_requirements(component, name):
""" Installs requirements for component. """
if hasattr(component, 'REQUIREMENTS'):
for req in component.REQUIREMENTS:
if not pkg_util.install_package(req):
_LOGGER.error('Not initializing %s because could not install '
'dependency %s', name, req)
return False
if not hasattr(component, 'REQUIREMENTS'):
return True
for req in component.REQUIREMENTS:
if not pkg_util.install_package(req):
_LOGGER.error('Not initializing %s because could not install '
'dependency %s', name, req)
return False
return True

View File

@ -103,10 +103,6 @@ def get_entity_ids(hass, entity_id, domain_filter=None):
def setup(hass, config):
""" Sets up all groups found definded in the configuration. """
for name, entity_ids in config.get(DOMAIN, {}).items():
# Support old deprecated method - 2/28/2015
if isinstance(entity_ids, str):
entity_ids = entity_ids.split(",")
setup_group(hass, name, entity_ids)
return True

View File

@ -1,52 +0,0 @@
"""
homeassistant.components.process
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides functionality to watch for specific processes running
on the host machine.
Author: Markus Stenberg <fingon@iki.fi>
"""
import logging
import os
from homeassistant.const import STATE_ON, STATE_OFF
import homeassistant.util as util
DOMAIN = 'process'
DEPENDENCIES = []
ENTITY_ID_FORMAT = DOMAIN + '.{}'
PS_STRING = 'ps awx'
def setup(hass, config):
""" Sets up a check if specified processes are running.
processes: dict mapping entity id to substring to search for
in process list.
"""
# Deprecated as of 3/7/2015
logging.getLogger(__name__).warning(
"This component has been deprecated and will be removed in the future."
" Please use sensor.systemmonitor with the process type")
entities = {ENTITY_ID_FORMAT.format(util.slugify(pname)): pstring
for pname, pstring in config[DOMAIN].items()}
def update_process_states(time):
""" Check ps for currently running processes and update states. """
with os.popen(PS_STRING, 'r') as psfile:
lines = list(psfile)
for entity_id, pstring in entities.items():
state = STATE_ON if any(pstring in l for l in lines) else STATE_OFF
hass.states.set(entity_id, state)
update_process_states(None)
hass.track_time_change(update_process_states, second=[0, 30])
return True

View File

@ -6,10 +6,6 @@ from homeassistant.const import (
ATTR_ENTITY_ID, CONF_PLATFORM, DEVICE_DEFAULT_NAME)
from homeassistant.util import ensure_unique_string, slugify
# Deprecated 3/5/2015 - Moved to homeassistant.helpers.entity
# pylint: disable=unused-import
from .entity import Entity as Device, ToggleEntity as ToggleDevice # noqa
def generate_entity_id(entity_id_format, name, current_ids=None, hass=None):
""" Generate a unique entity ID based on given entity IDs or used ids. """

View File

@ -1,10 +0,0 @@
"""
Deprecated since 3/21/2015 - please use helpers.entity
"""
import logging
# pylint: disable=unused-import
from .entity import Entity as Device, ToggleEntity as ToggleDevice # noqa
logging.getLogger(__name__).warning(
'This file is deprecated. Please use helpers.entity')

View File

@ -1,10 +0,0 @@
"""
Deprecated since 3/21/2015 - please use helpers.entity_component
"""
import logging
# pylint: disable=unused-import
from .entity_component import EntityComponent as DeviceComponent # noqa
logging.getLogger(__name__).warning(
'This file is deprecated. Please use helpers.entity_component')

View File

@ -16,11 +16,7 @@ import random
import string
from functools import wraps
# DEPRECATED AS OF 4/27/2015 - moved to homeassistant.util.dt package
# pylint: disable=unused-import
from .dt import ( # noqa
datetime_to_str, str_to_datetime, strip_microseconds,
datetime_to_local_str, utcnow)
from .dt import datetime_to_local_str, utcnow
RE_SANITIZE_FILENAME = re.compile(r'(~|\.\.|/|\\)')

View File

@ -199,8 +199,7 @@ class TestComponentsGroup(unittest.TestCase):
self.hass,
{
group.DOMAIN: {
'second_group': ','.join((self.group_entity_id,
'light.Bowl'))
'second_group': (self.group_entity_id, 'light.Bowl')
}
}))