diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2013-10-15 03:37:38 -0700 |
---|---|---|
committer | Dylan Baker <baker.dylan.c@gmail.com> | 2013-10-31 12:13:40 -0700 |
commit | a559fbf6cfa5a30e064694b0c46c1d57dd68c7c3 (patch) | |
tree | 6502ef918dc90676e6328b637e30fb5cfd0bac1b | |
parent | f238a7a000a6519447bc3815c8c2dbdec59dd113 (diff) |
status.py: convert status object attributes from instance to class
This converts Status objects attributes to class attributes. This should
reduce lookup time and memory consumption of these classes.
Tested-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
-rw-r--r-- | framework/status.py | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/framework/status.py b/framework/status.py index 5267380d8..a2653173b 100644 --- a/framework/status.py +++ b/framework/status.py @@ -106,6 +106,9 @@ class Status(object): # the memory consumed for creating tens of thousands of these objects. __slots__ = ['name', 'value'] + name = None + value = None + def __init__(self): raise NotImplementedError @@ -144,48 +147,64 @@ class Status(object): class NotRun(Status): + name = 'Not Run' + value = 0 + def __init__(self): - self.name = 'Not Run' - self.value = 0 + pass class Pass(Status): + name = 'pass' + value = 10 + def __init__(self): - self.name = 'pass' - self.value = 10 + pass class DmesgWarn(Status): + name = 'dmesg-warn' + value = 20 + def __init__(self): - self.name = 'dmesg-warn' - self.value = 20 + pass class Warn(Status): + name = 'warn' + value = 25 + def __init__(self): - self.name = 'warn' - self.value = 25 + pass class DmesgFail(Status): + name = 'dmesg-fail' + value = 30 + def __init__(self): - self.name = 'dmesg-fail' - self.value = 30 + pass class Fail(Status): + name = 'fail' + value = 35 + def __init__(self): - self.name = 'fail' - self.value = 35 + pass class Crash(Status): + name = 'crash' + value = 40 + def __init__(self): - self.name = 'crash' - self.value = 40 + pass class Skip(Status): + name = 'skip' + value = 50 + def __init__(self): - self.name = 'skip' - self.value = 50 + pass |