| OLD | NEW |
| 1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import collections | 5 import collections |
| 6 import copy | 6 import copy |
| 7 import json | 7 import json |
| 8 import operator | 8 import operator |
| 9 | 9 |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 def __getitem__(self, key): | 65 def __getitem__(self, key): |
| 66 return self._d[key] | 66 return self._d[key] |
| 67 | 67 |
| 68 def __hash__(self): | 68 def __hash__(self): |
| 69 return self._hash | 69 return self._hash |
| 70 | 70 |
| 71 def __repr__(self): | 71 def __repr__(self): |
| 72 return 'FrozenDict(%r)' % (self._d.items(),) | 72 return 'FrozenDict(%r)' % (self._d.items(),) |
| 73 | 73 |
| 74 def to_json(self, **kw): |
| 75 """Returns (str): a JSON string containing the encoded FrozenDict. |
| 76 |
| 77 Args: |
| 78 kw: Keyword arguments to forward to "json.dumps". |
| 79 """ |
| 80 return json.dumps(self._d, **kw) |
| 81 |
| 74 | 82 |
| 75 class StepPresentation(object): | 83 class StepPresentation(object): |
| 76 STATUSES = set(('SUCCESS', 'FAILURE', 'WARNING', 'EXCEPTION')) | 84 STATUSES = set(('SUCCESS', 'FAILURE', 'WARNING', 'EXCEPTION')) |
| 77 | 85 |
| 78 def __init__(self): | 86 def __init__(self): |
| 79 self._finalized = False | 87 self._finalized = False |
| 80 | 88 |
| 81 self._logs = collections.OrderedDict() | 89 self._logs = collections.OrderedDict() |
| 82 self._links = collections.OrderedDict() | 90 self._links = collections.OrderedDict() |
| 83 self._status = None | 91 self._status = None |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 @property | 191 @property |
| 184 def retcode(self): | 192 def retcode(self): |
| 185 return self._retcode | 193 return self._retcode |
| 186 | 194 |
| 187 @property | 195 @property |
| 188 def presentation(self): | 196 def presentation(self): |
| 189 return self._presentation | 197 return self._presentation |
| 190 | 198 |
| 191 def __getattr__(self, name): | 199 def __getattr__(self, name): |
| 192 raise StepDataAttributeError(self._step_config.name, name) | 200 raise StepDataAttributeError(self._step_config.name, name) |
| OLD | NEW |