| Conditions | 2 |
| Total Lines | 18 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | from dataclasses import dataclass |
||
| 22 | @staticmethod |
||
| 23 | def from_dict(obj: Any) -> 'ChatMessage': |
||
| 24 | if not isinstance(obj, dict): |
||
| 25 | return None |
||
| 26 | id = from_str(obj.get("id")) |
||
| 27 | user = user_from_dict(obj.get("user")) |
||
| 28 | bot = from_str(obj.get("bot")) |
||
| 29 | posted_at = from_datetime(obj.get("posted_at")) |
||
| 30 | message = from_str(obj.get("message")) |
||
| 31 | message_plain = from_str(obj.get("message_plain")) |
||
| 32 | highlight = from_bool(obj.get("highlight")) |
||
| 33 | is_bot = from_bool(obj.get("is_bot")) |
||
| 34 | is_system = from_bool(obj.get("is_system")) |
||
| 35 | |||
| 36 | return ChatMessage( |
||
| 37 | id=id, user=user, bot=bot, posted_at=posted_at, message=message, |
||
| 38 | message_plain=message_plain, highlight=highlight, is_bot=is_bot, |
||
| 39 | is_system=is_system) |
||
| 40 | |||
| 44 |