Added method to convert state code into the human readable name.
It will be used in logging and error reporting.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
class state:
initial, parsing, running, shutdown, forceshutdown, stopped, error = range(7)
+ @classmethod
+ def get_name(cls, code):
+ for name in dir(cls):
+ value = getattr(cls, name)
+ if type(value) == type(cls.initial) and value == code:
+ return name
+ raise ValueError("Invalid status code: %s" % code)
+
class SkippedPackage:
def __init__(self, info = None, reason = None):