(cls, host_spec: dict)
| 97 | |
| 98 | @classmethod |
| 99 | def from_json(cls, host_spec: dict) -> 'HostSpec': |
| 100 | host_spec = cls.normalize_json(host_spec) |
| 101 | _cls = cls( |
| 102 | host_spec['hostname'], |
| 103 | host_spec['addr'] if 'addr' in host_spec else None, |
| 104 | list(OrderedDict.fromkeys( |
| 105 | host_spec['labels'])) if 'labels' in host_spec else None, |
| 106 | host_spec['status'] if 'status' in host_spec else None, |
| 107 | host_spec.get('location'), |
| 108 | host_spec['oob'] if 'oob' in host_spec else None, |
| 109 | ) |
| 110 | return _cls |
| 111 | |
| 112 | @staticmethod |
| 113 | def normalize_json(host_spec: dict) -> dict: |
nothing calls this directly
no test coverage detected