Create BuildStatus from dictionary. Args: data: Dictionary with status fields Returns: BuildStatus instance Raises: TypeError: If required fields are missing or have wrong types
(cls, data: dict[str, Any])
| 370 | |
| 371 | @classmethod |
| 372 | def from_dict(cls, data: dict[str, Any]) -> "BuildStatus": |
| 373 | """Create BuildStatus from dictionary. |
| 374 | |
| 375 | Args: |
| 376 | data: Dictionary with status fields |
| 377 | |
| 378 | Returns: |
| 379 | BuildStatus instance |
| 380 | |
| 381 | Raises: |
| 382 | TypeError: If required fields are missing or have wrong types |
| 383 | """ |
| 384 | state = BuildState.from_string(data["state"]) |
| 385 | |
| 386 | return cls( |
| 387 | request_id=data["request_id"], |
| 388 | state=state, |
| 389 | message=data.get("message", ""), |
| 390 | updated_at=data.get("updated_at", time.time()), |
| 391 | output_lines=data.get("output_lines", []), |
| 392 | exit_code=data.get("exit_code"), |
| 393 | root_pid=data.get("root_pid"), |
| 394 | child_pids=data.get("child_pids", []), |
| 395 | started_at=data.get("started_at"), |
| 396 | completed_at=data.get("completed_at"), |
| 397 | ) |
| 398 | |
| 399 | def get_age_seconds(self) -> float: |
| 400 | """Get age of this status update in seconds. |