Import Upstream version 4.12.4
This commit is contained in:
@@ -58,7 +58,7 @@ class KnobValueError(ValueError):
|
||||
self.name = name
|
||||
|
||||
|
||||
class PropertyBase(six.with_metaclass(util.InnerClassMeta, object)):
|
||||
class PropertyBase(metaclass=util.InnerClassMeta):
|
||||
# shut up pylint
|
||||
__outer_class__ = None
|
||||
__outer_name__ = None
|
||||
@@ -227,7 +227,7 @@ def extend_knob(base, default=_missing, bases=_missing, group=_missing,
|
||||
)
|
||||
|
||||
|
||||
class Configurable(six.with_metaclass(abc.ABCMeta, object)):
|
||||
class Configurable(metaclass=abc.ABCMeta):
|
||||
"""
|
||||
Base class of all configurables.
|
||||
|
||||
@@ -415,7 +415,11 @@ class Configurable(six.with_metaclass(abc.ABCMeta, object)):
|
||||
def __runner(self, pending_state, running_state, exc_handler):
|
||||
self.__transition(pending_state, running_state)
|
||||
|
||||
step = lambda: next(self.__gen)
|
||||
def step_next():
|
||||
return next(self.__gen)
|
||||
|
||||
step = step_next
|
||||
|
||||
while True:
|
||||
try:
|
||||
step()
|
||||
@@ -440,9 +444,13 @@ class Configurable(six.with_metaclass(abc.ABCMeta, object)):
|
||||
yield
|
||||
except BaseException:
|
||||
exc_info = sys.exc_info()
|
||||
step = lambda: self.__gen.throw(*exc_info)
|
||||
|
||||
def step_throw():
|
||||
return self.__gen.throw(*exc_info)
|
||||
|
||||
step = step_throw
|
||||
else:
|
||||
step = lambda: next(self.__gen)
|
||||
step = step_next
|
||||
|
||||
def _handle_exception(self, exc_info):
|
||||
assert not hasattr(super(Configurable, self), '_handle_exception')
|
||||
@@ -479,7 +487,7 @@ class ComponentMeta(util.InnerClassMeta, abc.ABCMeta):
|
||||
pass
|
||||
|
||||
|
||||
class ComponentBase(six.with_metaclass(ComponentMeta, Configurable)):
|
||||
class ComponentBase(Configurable, metaclass=ComponentMeta):
|
||||
# shut up pylint
|
||||
__outer_class__ = None
|
||||
__outer_name__ = None
|
||||
|
||||
Reference in New Issue
Block a user