Coverage for functions \ flipdare \ generated \ shared \ model \ restriction \ restriction_action.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 RestrictionAction(StrEnum):
27 """Action taken when a restriction is applied to a user."""
29 # Declared here so type-checkers know these attributes exist.
30 # They are populated per-member inside __new__.
31 _severity: int
32 _label: str
34 def __new__(
35 cls,
36 code: str,
37 severity: int | None = None,
38 label: str | None = None,
39 ) -> "RestrictionAction":
40 obj = str.__new__(cls, code)
41 obj._value_ = code
42 # Only set attributes if they are provided (during member definition)
43 if severity is not None:
44 obj._severity = severity
45 if label is not None:
46 obj._label = label
47 return obj
49 # ---- Members --------------------------------------------------------
50 # fmt: off
51 PROFILE = ("profile", 10, "Change your profile")
52 CHAT = ("chat", 20, "Chat")
53 DARE = ("dare", 30, "Create a dare")
54 PLEDGE = ("pledge", 80, "Make a pledge")
55 FULL = ("full", 100, "Chat, create dares and make pledges")
56 # fmt: on
57 # ---- Properties -----------------------------------------------------
58 @property
59 def severity(self) -> int:
60 return self._severity
62 @property
63 def label(self) -> str:
64 return self._label
66 # ---- Convenience predicates -----------------------------------------
67 @property
68 def can_chat(self) -> bool:
69 return self.severity < RestrictionAction.CHAT.severity
71 @property
72 def can_profile(self) -> bool:
73 return self.severity < RestrictionAction.PROFILE.severity
75 @property
76 def can_dare(self) -> bool:
77 return self.severity < RestrictionAction.DARE.severity
79 @property
80 def can_pledge(self) -> bool:
81 return self.severity < RestrictionAction.PLEDGE.severity