Coverage for functions \ flipdare \ generated \ shared \ model \ core \ stopwatch_duration.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 StopwatchDuration(StrEnum):
28 # Declared here so type-checkers know these attributes exist.
29 # They are populated per-member inside __new__.
30 _days: int
31 _label: str
33 def __new__(
34 cls,
35 code: str,
36 days: int | None = None,
37 label: str | None = None,
38 ) -> "StopwatchDuration":
39 obj = str.__new__(cls, code)
40 obj._value_ = code
41 # Only set attributes if they are provided (during member definition)
42 if days is not None:
43 obj._days = days
44 if label is not None:
45 obj._label = label
46 return obj
48 # ---- Members --------------------------------------------------------
49 # fmt: off
50 ONE_DAY = ("one_day", 1, "1 Day")
51 TWO_DAYS = ("two_days", 2, "2 Days")
52 THREE_DAYS = ("three_days", 3, "3 Days")
53 ONE_WEEK = ("one_week", 7, "1 Week")
54 ONE_MONTH = ("one_month", 30, "1 Month")
55 THREE_MONTHS = ("three_months", 90, "3 Months")
56 SIX_MONTHS = ("six_months", 180, "6 Months")
57 SEMI_PERMANENT = ("semi_permanent", 365, "Semi-Permanent")
58 PERMANENT = ("permanent", 3650, "Permanent")
59 # fmt: on
60 # ---- Properties -----------------------------------------------------
61 @property
62 def days(self) -> int:
63 return self._days
65 @property
66 def label(self) -> str:
67 return self._label
69 # ---- Convenience predicates -----------------------------------------
70 @property
71 def prefix(self) -> str:
72 match self:
73 case StopwatchDuration.SEMI_PERMANENT | StopwatchDuration.PERMANENT:
74 return "is "
75 case _:
76 return "will last for"