Use debtcollector removals function instead of warnings.warn

Change-Id: I7a9554a66c38999645d12c42a939e787c95fff3c
This commit is contained in:
Joshua Harlow 2015-06-05 17:28:47 -07:00
parent d71b6cf8b4
commit 33c7e82b94
2 changed files with 10 additions and 7 deletions

View File

@ -20,9 +20,9 @@ except ImportError:
from ordereddict import OrderedDict # noqa
import collections
import warnings
import weakref
from debtcollector import removals
import prettytable
import six
@ -79,15 +79,15 @@ class FiniteMachine(object):
return cls._Effect(new_state['reactions'].get(event),
new_state["terminal"])
@removals.removed_kwarg('default_start_state',
message="The usage of 'default_start_state' via"
" the machine constructor is deprecated and will"
" be removed in a future version; usage of"
" the 'default_start_state' property setter is"
" recommended.")
def __init__(self, default_start_state=None):
self._transitions = {}
self._states = OrderedDict()
if default_start_state is not None:
warnings.warn("The usage of 'default_start_state' via the machine"
" constructor is deprecated and will be removed in a"
" future version; usage of the 'default_start_state'"
" property setter is recommended.",
DeprecationWarning, stacklevel=2)
self._default_start_state = default_start_state
self._current = None
self._runner = _FiniteRunner(self)

View File

@ -8,6 +8,9 @@ pbr>=0.11,<2.0
# Python 2->3 compatibility library.
six>=1.9.0
# For deprecation of things
debtcollector>=0.3.0 # Apache-2.0
# Only needed on python 2.6
ordereddict