Check the content type of the input. Four types are allowed: str, dict, liststr, listdict. Args: msgs: Raw input messages. Returns: str: The message type.
(self, msgs)
| 81 | return False |
| 82 | |
| 83 | def check_content(self, msgs): |
| 84 | """Check the content type of the input. Four types are allowed: str, dict, liststr, listdict. |
| 85 | |
| 86 | Args: |
| 87 | msgs: Raw input messages. |
| 88 | |
| 89 | Returns: |
| 90 | str: The message type. |
| 91 | """ |
| 92 | if isinstance(msgs, str): |
| 93 | return 'str' |
| 94 | if isinstance(msgs, dict): |
| 95 | return 'dict' |
| 96 | if isinstance(msgs, list): |
| 97 | types = [self.check_content(m) for m in msgs] |
| 98 | if all(t == 'str' for t in types): |
| 99 | return 'liststr' |
| 100 | if all(t == 'dict' for t in types): |
| 101 | return 'listdict' |
| 102 | return 'unknown' |
| 103 | |
| 104 | def preproc_content(self, inputs): |
| 105 | """Convert the raw input messages to a list of dicts. |
no outgoing calls
no test coverage detected