(cls, data: dict)
| 445 | @classmethod |
| 446 | @handle_type_error |
| 447 | def from_json(cls, data: dict) -> 'PlacementSpec': |
| 448 | c = data.copy() |
| 449 | hosts = c.get('hosts', []) |
| 450 | if hosts: |
| 451 | c['hosts'] = [] |
| 452 | for host in hosts: |
| 453 | c['hosts'].append(HostPlacementSpec.from_json(host)) |
| 454 | _cls = cls(**c) |
| 455 | _cls.validate() |
| 456 | return _cls |
| 457 | |
| 458 | def to_json(self) -> dict: |
| 459 | r: Dict[str, Any] = {} |