(cls, input)
| 103 | |
| 104 | @classmethod |
| 105 | def from_json(cls, input): |
| 106 | # type: (Dict[str, Any]) -> Device |
| 107 | if not isinstance(input, dict): |
| 108 | raise ValueError('Device: Expected dict. Got `{}...`'.format(json.dumps(input)[:10])) |
| 109 | ret = cls( |
| 110 | **{ |
| 111 | key: (input.get(key, None) if key != 'created' |
| 112 | or not input.get(key, None) |
| 113 | else str_to_datetime(input.get(key, None))) |
| 114 | for key in Device.report_fields |
| 115 | if key != 'human_readable_type' |
| 116 | } |
| 117 | ) |
| 118 | if ret.rejected_reasons: |
| 119 | ret.rejected_reasons = sorted(ret.rejected_reasons) |
| 120 | return ret |
| 121 | |
| 122 | @property |
| 123 | def human_readable_type(self): |
no test coverage detected