(cls, data: Union[dict, str])
| 130 | @classmethod |
| 131 | @handle_type_error |
| 132 | def from_json(cls, data: Union[dict, str]) -> 'HostPlacementSpec': |
| 133 | if isinstance(data, str): |
| 134 | return cls.parse(data) |
| 135 | if isinstance(data, dict): |
| 136 | return cls( |
| 137 | normalize_hostname(data.get('hostname', '')), |
| 138 | data.get('network', ''), |
| 139 | data.get('name', '') |
| 140 | ) |
| 141 | return cls(**data) |
| 142 | |
| 143 | def to_json(self) -> str: |
| 144 | return str(self) |
nothing calls this directly
no test coverage detected