Coverage for functions \ flipdare \ generated \ shared \ model \ issue \ flag_type.py: 100%
0 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
1#!/usr/bin/env python
2#
3# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved.
4#
5# This file is part of Flipdare's proprietary software and contains
6# confidential and copyrighted material. Unauthorised copying,
7# modification, distribution, or use of this file is strictly
8# prohibited without prior written permission from Flipdare Pty Ltd.
9#
10# This software includes third-party components licensed under MIT,
11# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details.
12#
13# NOTE: THIS FILE IS AUTO GENERATED. DO NOT EDIT.
14#
15# Generated by codegen_models.py
16#
17# Modify 'codegen_models.py'
18# and re-run the script above to update.
19#
21# pragma: no cover
23from enum import StrEnum
26class FlagType(StrEnum):
27 """Flag Type"""
29 # Declared here so type-checkers know these attributes exist.
30 # They are populated per-member inside __new__.
31 _severity: int
32 _label: str
33 _description: str
35 def __new__(
36 cls,
37 code: str,
38 severity: int | None = None,
39 label: str | None = None,
40 description: str | None = None,
41 ) -> "FlagType":
42 obj = str.__new__(cls, code)
43 obj._value_ = code
44 # Only set attributes if they are provided (during member definition)
45 if severity is not None:
46 obj._severity = severity
47 if label is not None:
48 obj._label = label
49 if description is not None:
50 obj._description = description
51 return obj
53 # ---- Members --------------------------------------------------------
54 # fmt: off
55 DEATH = ("death", 100, "Death or self-harm", "Content that promotes or glorifies death or self-harm.")
56 CHILD = ("child", 90, "Child abuse or exploitation", "Content that exploits or endangers children.")
57 VIOLENCE = ("violence", 80, "Violence or threats", "Content that promotes or glorifies violence or harm against others.")
58 SEXUAL = ("sexual", 50, "Sexual assault or sex crimes", "Content that promotes or glorifies sexual assault or sex crimes.")
59 BULLY = ("bully", 40, "Bullying or harassment", "Content that promotes bullying, harassment, or hate speech.")
60 CRIME = ("crime", 30, "Criminal activity", "Content that promotes or glorifies criminal activity.")
61 LEGAL = ("legal", 25, "Legal issues", "Content that is legal but may be inappropriate for some audiences (e.g., alcohol, gambling).")
62 OFFENSIVE = ("offensive", 7, "Offensive content", "Content that is offensive or inappropriate for some audiences.")
63 SPAM = ("spam", 6, "Spam or irrelevant content", "Content that is considered spam or irrelevant.")
64 OTHER = ("other", 1, "Other serious issue", "Content that has a serious issue not covered by the other categories.")
65 # fmt: on
66 # ---- Properties -----------------------------------------------------
67 @property
68 def severity(self) -> int:
69 return self._severity
71 @property
72 def label(self) -> str:
73 return self._label
75 @property
76 def description(self) -> str:
77 return self._description
79 # ---- Convenience predicates -----------------------------------------
80 @staticmethod
81 def all_minor_types() -> list["FlagType"]:
82 return [FlagType.CRIME, FlagType.LEGAL, FlagType.SPAM, FlagType.OTHER]
84 @staticmethod
85 def all_major_types() -> list["FlagType"]:
86 return [
87 FlagType.DEATH,
88 FlagType.CHILD,
89 FlagType.VIOLENCE,
90 FlagType.SEXUAL,
91 FlagType.BULLY,
92 ]
94 @property
95 def is_severe(self) -> bool:
96 return self.severity >= 50
98 @property
99 def is_major(self) -> bool:
100 return 40 <= self.severity < 50
102 @property
103 def is_moderate(self) -> bool:
104 return 10 <= self.severity < 40
106 @property
107 def is_minor(self) -> bool:
108 return self.severity <= 10