Detect must-read list operations without colliding with profile edits.
(text: Any)
| 1027 | |
| 1028 | |
| 1029 | def looks_like_must_read_command(text: Any) -> bool: |
| 1030 | """Detect must-read list operations without colliding with profile edits.""" |
| 1031 | cleaned = first_meaningful_line(text) |
| 1032 | lowered = cleaned.lower().strip() |
| 1033 | if not lowered: |
| 1034 | return False |
| 1035 | |
| 1036 | if looks_like_bot_authored_message(cleaned): |
| 1037 | return False |
| 1038 | |
| 1039 | if any(hint in lowered for hint in MUST_READ_LIST_HINTS): |
| 1040 | return True |
| 1041 | |
| 1042 | if any(hint in lowered for hint in MUST_READ_TARGET_HINTS): |
| 1043 | return True |
| 1044 | |
| 1045 | has_action = any(hint in lowered for hint in MUST_READ_ACTION_HINTS) |
| 1046 | has_target = any(token in cleaned for token in MUST_READ_TARGET_TOKENS) or any( |
| 1047 | token in lowered for token in MUST_READ_TARGET_TOKENS |
| 1048 | ) |
| 1049 | if has_action and has_target: |
| 1050 | return True |
| 1051 | |
| 1052 | return False |
| 1053 | |
| 1054 | |
| 1055 | def extract_google_scholar_url(text: Any) -> Optional[str]: |
no test coverage detected