72 lines
1.8 KiB
Python
72 lines
1.8 KiB
Python
from enum import Enum
|
|
|
|
# (str, Enum) like inbox/enums.py: the mixin keeps every member comparable to and
|
|
# usable as a plain string, which is what HTMLParser hands us and what the triage
|
|
# columns store.
|
|
|
|
|
|
class Block_Tags(str, Enum):
|
|
"""Tags that imply a line break in the rendered mail."""
|
|
|
|
BR="br"
|
|
P="p"
|
|
DIV="div"
|
|
LI="li"
|
|
TR="tr"
|
|
TABLE="table"
|
|
BLOCKQUOTE="blockquote"
|
|
SECTION="section"
|
|
ARTICLE="article"
|
|
HR="hr"
|
|
H1="h1"
|
|
H2="h2"
|
|
H3="h3"
|
|
H4="h4"
|
|
H5="h5"
|
|
H6="h6"
|
|
|
|
@classmethod
|
|
def has(cls, tag) -> bool:
|
|
# _value2member_map_ keeps this O(1) with no exception overhead. `tag in cls`
|
|
# would do the same on 3.12+ but raises TypeError on 3.11, and pyproject
|
|
# still allows 3.11.
|
|
return tag in cls._value2member_map_
|
|
|
|
|
|
class Drop_Tags(str, Enum):
|
|
"""Tags whose content is markup machinery, not readable text."""
|
|
|
|
SCRIPT="script"
|
|
STYLE="style"
|
|
HEAD="head"
|
|
TITLE="title"
|
|
META="meta"
|
|
LINK="link"
|
|
|
|
@classmethod
|
|
def has(cls, tag) -> bool:
|
|
return tag in cls._value2member_map_
|
|
|
|
|
|
class Triage_Reason_Code(str, Enum):
|
|
"""Why the gate decided what it decided.
|
|
|
|
Sent to the model as the schema's enum for `reason_code`, so these labels are
|
|
part of the prompt contract — renaming one changes model behaviour.
|
|
"""
|
|
|
|
JOB_APPLICATION="job_application"
|
|
RECRUITER_OR_VENDOR="recruiter_or_vendor"
|
|
NEWSLETTER_OR_MARKETING="newsletter_or_marketing"
|
|
INTERNAL_OR_SCHEDULING="internal_or_scheduling"
|
|
AUTOMATED_NOTIFICATION="automated_notification"
|
|
OTHER="other"
|
|
|
|
|
|
class Triage_Status(str, Enum):
|
|
"""How the verdict was reached, as stored on inbox_message_triage.status."""
|
|
|
|
CLASSIFIED="classified"
|
|
LOW_CONFIDENCE="low_confidence"
|
|
ERROR="error"
|