A FireTraceElement represents a single step taken by a Fire execution. Examples of a FireTraceElement are the instantiation of a class or the accessing of an object member.
| 237 | |
| 238 | |
| 239 | class FireTraceElement: |
| 240 | """A FireTraceElement represents a single step taken by a Fire execution. |
| 241 | |
| 242 | Examples of a FireTraceElement are the instantiation of a class or the |
| 243 | accessing of an object member. |
| 244 | """ |
| 245 | |
| 246 | def __init__(self, |
| 247 | component=None, |
| 248 | action=None, |
| 249 | target=None, |
| 250 | args=None, |
| 251 | filename=None, |
| 252 | lineno=None, |
| 253 | error=None, |
| 254 | capacity=None): |
| 255 | """Instantiates a FireTraceElement. |
| 256 | |
| 257 | Args: |
| 258 | component: The result of this element of the trace. |
| 259 | action: The type of action (e.g. instantiating a class) taking place. |
| 260 | target: (string) The name of the component being acted upon. |
| 261 | args: The args consumed by the represented action. |
| 262 | filename: The file in which the action is defined, or None if N/A. |
| 263 | lineno: The line number on which the action is defined, or None if N/A. |
| 264 | error: The error represented by the action, or None if N/A. |
| 265 | capacity: (bool) Whether the action could have accepted additional args. |
| 266 | """ |
| 267 | self.component = component |
| 268 | self._action = action |
| 269 | self._target = target |
| 270 | self.args = args |
| 271 | self._filename = filename |
| 272 | self._lineno = lineno |
| 273 | self._error = error |
| 274 | self._separator = False |
| 275 | self._capacity = capacity |
| 276 | |
| 277 | def HasError(self): |
| 278 | return self._error is not None |
| 279 | |
| 280 | def HasCapacity(self): |
| 281 | return self._capacity |
| 282 | |
| 283 | def HasSeparator(self): |
| 284 | return self._separator |
| 285 | |
| 286 | def AddSeparator(self): |
| 287 | self._separator = True |
| 288 | |
| 289 | def ErrorAsStr(self): |
| 290 | return ' '.join(str(arg) for arg in self._error.args) |
| 291 | |
| 292 | def __str__(self): |
| 293 | if self.HasError(): |
| 294 | return self.ErrorAsStr() |
| 295 | else: |
| 296 | # Format is: {action} "{target}" ({filename}:{lineno}) |
no outgoing calls
no test coverage detected