|
@@ 71-87 (lines=17) @@
|
| 68 |
|
"""List of computer states for an application.""" |
| 69 |
|
|
| 70 |
|
|
| 71 |
|
@yorm.attr(application=yorm.types.String) |
| 72 |
|
@yorm.attr(computers=StateList) |
| 73 |
|
@yorm.attr(next=yorm.types.NullableString) |
| 74 |
|
class Status(yorm.types.AttributeDictionary): |
| 75 |
|
"""Dictionary of computers using an application.""" |
| 76 |
|
|
| 77 |
|
def __init__(self, application, computers=None, next=None): # pylint: disable=redefined-builtin |
| 78 |
|
super().__init__() |
| 79 |
|
self.application = application |
| 80 |
|
self.computers = computers or StateList() |
| 81 |
|
self.next = next |
| 82 |
|
|
| 83 |
|
def __str__(self): |
| 84 |
|
return str(self.application) |
| 85 |
|
|
| 86 |
|
def __lt__(self, other): |
| 87 |
|
return str(self.application).lower() < str(other.application).lower() |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
@yorm.attr(all=Status) |
|
@@ 49-63 (lines=15) @@
|
| 46 |
|
return wrapped |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
@yorm.attr(computer=yorm.types.String) |
| 50 |
|
@yorm.attr(timestamp=Timestamp) |
| 51 |
|
class State(yorm.types.AttributeDictionary): |
| 52 |
|
"""Dictionary of computer state.""" |
| 53 |
|
|
| 54 |
|
def __init__(self, computer, timestamp=None): |
| 55 |
|
super().__init__() |
| 56 |
|
self.computer = computer |
| 57 |
|
self.timestamp = timestamp or Timestamp() |
| 58 |
|
|
| 59 |
|
def __str__(self): |
| 60 |
|
return str(self.computer) |
| 61 |
|
|
| 62 |
|
def __lt__(self, other): |
| 63 |
|
return str(self.computer).lower() < str(other.computer).lower() |
| 64 |
|
|
| 65 |
|
|
| 66 |
|
@yorm.attr(all=State) |