maleo-enums 0.0.28__py3-none-any.whl → 0.0.32__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maleo/enums/cardinality.py +55 -34
- maleo/enums/connection.py +96 -40
- maleo/enums/environment.py +27 -18
- maleo/enums/expiration.py +25 -16
- maleo/enums/identity.py +47 -28
- maleo/enums/medical.py +79 -32
- maleo/enums/order.py +25 -14
- maleo/enums/organization.py +144 -47
- maleo/enums/service.py +234 -93
- maleo/enums/status.py +39 -24
- maleo/enums/system.py +38 -17
- maleo/enums/user.py +33 -16
- {maleo_enums-0.0.28.dist-info → maleo_enums-0.0.32.dist-info}/METADATA +7 -2
- maleo_enums-0.0.32.dist-info/RECORD +18 -0
- maleo_enums-0.0.28.dist-info/RECORD +0 -18
- {maleo_enums-0.0.28.dist-info → maleo_enums-0.0.32.dist-info}/WHEEL +0 -0
- {maleo_enums-0.0.28.dist-info → maleo_enums-0.0.32.dist-info}/licenses/LICENSE +0 -0
- {maleo_enums-0.0.28.dist-info → maleo_enums-0.0.32.dist-info}/top_level.txt +0 -0
maleo/enums/cardinality.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from enum import StrEnum
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from typing import Annotated, Generic, Sequence, TypeVar
|
|
4
|
+
from maleo.types.string import ListOfStrs
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class Cardinality(StrEnum):
|
|
@@ -8,36 +9,46 @@ class Cardinality(StrEnum):
|
|
|
8
9
|
SINGLE = "single"
|
|
9
10
|
|
|
10
11
|
@classmethod
|
|
11
|
-
def choices(cls) ->
|
|
12
|
+
def choices(cls) -> ListOfStrs:
|
|
12
13
|
return [e.value for e in cls]
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
CardinalityT = TypeVar("CardinalityT", bound=Cardinality)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
OptCardinality = Cardinality | None
|
|
18
|
+
OptCardinalityT = TypeVar("OptCardinalityT", bound=OptCardinality)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class CardinalityMixin(BaseModel, Generic[OptCardinalityT]):
|
|
22
|
+
cardinality: Annotated[OptCardinalityT, Field(..., description="Cardinality")]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
ListOfCardinalities = list[Cardinality]
|
|
19
26
|
ListOfCardinalitiesT = TypeVar("ListOfCardinalitiesT", bound=ListOfCardinalities)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
)
|
|
24
|
-
SequenceOfCardinalities = Sequence[Cardinality]
|
|
25
|
-
SequenceOfCardinalitiesT = TypeVar(
|
|
26
|
-
"SequenceOfCardinalitiesT", bound=SequenceOfCardinalities
|
|
27
|
-
)
|
|
28
|
-
OptionalSequenceOfCardinalities = Optional[SequenceOfCardinalities]
|
|
29
|
-
OptionalSequenceOfCardinalitiesT = TypeVar(
|
|
30
|
-
"OptionalSequenceOfCardinalitiesT", bound=OptionalSequenceOfCardinalities
|
|
27
|
+
OptListOfCardinalities = ListOfCardinalities | None
|
|
28
|
+
OptListOfCardinalitiesT = TypeVar(
|
|
29
|
+
"OptListOfCardinalitiesT", bound=OptListOfCardinalities
|
|
31
30
|
)
|
|
32
31
|
|
|
33
32
|
|
|
33
|
+
class CardinalitiesMixin(BaseModel, Generic[OptListOfCardinalitiesT]):
|
|
34
|
+
cardinalities: Annotated[
|
|
35
|
+
OptListOfCardinalitiesT, Field(..., description="Cardinalities")
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
SeqOfCardinalities = Sequence[Cardinality]
|
|
40
|
+
SeqOfCardinalitiesT = TypeVar("SeqOfCardinalitiesT", bound=SeqOfCardinalities)
|
|
41
|
+
OptSeqOfCardinalities = SeqOfCardinalities | None
|
|
42
|
+
OptSeqOfCardinalitiesT = TypeVar("OptSeqOfCardinalitiesT", bound=OptSeqOfCardinalities)
|
|
43
|
+
|
|
44
|
+
|
|
34
45
|
class Relationship(StrEnum):
|
|
35
46
|
# One origin
|
|
36
47
|
ONE_TO_ONE = "one_to_one"
|
|
37
48
|
ONE_TO_OPTIONAL_ONE = "one_to_optional_one"
|
|
38
49
|
ONE_TO_MANY = "one_to_many"
|
|
39
50
|
ONE_TO_OPTIONAL_MANY = "one_to_optional_many"
|
|
40
|
-
#
|
|
51
|
+
# Opt one origin
|
|
41
52
|
OPTIONAL_ONE_TO_ONE = "optional_one_to_one"
|
|
42
53
|
OPTIONAL_ONE_TO_OPTIONAL_ONE = "optional_one_to_optional_one"
|
|
43
54
|
OPTIONAL_ONE_TO_MANY = "optional_one_to_many"
|
|
@@ -47,31 +58,41 @@ class Relationship(StrEnum):
|
|
|
47
58
|
MANY_TO_OPTIONAL_ONE = "many_to_optional_one"
|
|
48
59
|
MANY_TO_MANY = "many_to_many"
|
|
49
60
|
MANY_TO_OPTIONAL_MANY = "many_to_optional_many"
|
|
50
|
-
#
|
|
61
|
+
# Opt many origin
|
|
51
62
|
OPTIONAL_MANY_TO_ONE = "optional_many_to_one"
|
|
52
63
|
OPTIONAL_MANY_TO_OPTIONAL_ONE = "optional_many_to_optional_one"
|
|
53
64
|
OPTIONAL_MANY_TO_MANY = "optional_many_to_many"
|
|
54
65
|
OPTIONAL_MANY_TO_OPTIONAL_MANY = "optional_many_to_optional_many"
|
|
55
66
|
|
|
56
67
|
@classmethod
|
|
57
|
-
def choices(cls) ->
|
|
68
|
+
def choices(cls) -> ListOfStrs:
|
|
58
69
|
return [e.value for e in cls]
|
|
59
70
|
|
|
60
71
|
|
|
61
72
|
RelationshipT = TypeVar("RelationshipT", bound=Relationship)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
73
|
+
OptRelationship = Relationship | None
|
|
74
|
+
OptRelationshipT = TypeVar("OptRelationshipT", bound=OptRelationship)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class RelationshipMixin(BaseModel, Generic[OptRelationshipT]):
|
|
78
|
+
relationship: Annotated[OptRelationshipT, Field(..., description="Relationship")]
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
ListOfRelationships = list[Relationship]
|
|
65
82
|
ListOfRelationshipsT = TypeVar("ListOfRelationshipsT", bound=ListOfRelationships)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
)
|
|
70
|
-
SequenceOfRelationships = Sequence[Relationship]
|
|
71
|
-
SequenceOfRelationshipsT = TypeVar(
|
|
72
|
-
"SequenceOfRelationshipsT", bound=SequenceOfRelationships
|
|
73
|
-
)
|
|
74
|
-
OptionalSequenceOfRelationships = Optional[SequenceOfRelationships]
|
|
75
|
-
OptionalSequenceOfRelationshipsT = TypeVar(
|
|
76
|
-
"OptionalSequenceOfRelationshipsT", bound=OptionalSequenceOfRelationships
|
|
83
|
+
OptListOfRelationships = ListOfRelationships | None
|
|
84
|
+
OptListOfRelationshipsT = TypeVar(
|
|
85
|
+
"OptListOfRelationshipsT", bound=OptListOfRelationships
|
|
77
86
|
)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class RelationshipsMixin(BaseModel, Generic[OptListOfRelationshipsT]):
|
|
90
|
+
relationships: Annotated[
|
|
91
|
+
OptListOfRelationshipsT, Field(..., description="Relationships")
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
SeqOfRelationships = Sequence[Relationship]
|
|
96
|
+
SeqOfRelationshipsT = TypeVar("SeqOfRelationshipsT", bound=SeqOfRelationships)
|
|
97
|
+
OptSeqOfRelationships = SeqOfRelationships | None
|
|
98
|
+
OptSeqOfRelationshipsT = TypeVar("OptSeqOfRelationshipsT", bound=OptSeqOfRelationships)
|
maleo/enums/connection.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from enum import StrEnum
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from typing import Annotated, Generic, Sequence, TypeVar
|
|
4
|
+
from maleo.types.string import ListOfStrs
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class Scheme(StrEnum):
|
|
@@ -10,23 +11,33 @@ class Scheme(StrEnum):
|
|
|
10
11
|
WSS = "wss"
|
|
11
12
|
|
|
12
13
|
@classmethod
|
|
13
|
-
def choices(cls) ->
|
|
14
|
+
def choices(cls) -> ListOfStrs:
|
|
14
15
|
return [e.value for e in cls]
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
SchemeT = TypeVar("SchemeT", bound=Scheme)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
OptScheme = Scheme | None
|
|
20
|
+
OptSchemeT = TypeVar("OptSchemeT", bound=OptScheme)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class SchemeMixin(BaseModel, Generic[OptSchemeT]):
|
|
24
|
+
scheme: Annotated[OptSchemeT, Field(..., description="Scheme")]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
ListOfSchemes = list[Scheme]
|
|
21
28
|
ListOfSchemesT = TypeVar("ListOfSchemesT", bound=ListOfSchemes)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
OptListOfSchemes = ListOfSchemes | None
|
|
30
|
+
OptListOfSchemesT = TypeVar("OptListOfSchemesT", bound=OptListOfSchemes)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class SchemesMixin(BaseModel, Generic[OptListOfSchemesT]):
|
|
34
|
+
schemes: Annotated[OptListOfSchemesT, Field(..., description="Schemes")]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
SeqOfSchemes = Sequence[Scheme]
|
|
38
|
+
SeqOfSchemesT = TypeVar("SeqOfSchemesT", bound=SeqOfSchemes)
|
|
39
|
+
OptSeqOfSchemes = SeqOfSchemes | None
|
|
40
|
+
OptSeqOfSchemesT = TypeVar("OptSeqOfSchemesT", bound=OptSeqOfSchemes)
|
|
30
41
|
|
|
31
42
|
|
|
32
43
|
class Protocol(StrEnum):
|
|
@@ -34,11 +45,11 @@ class Protocol(StrEnum):
|
|
|
34
45
|
WEBSOCKET = "websocket"
|
|
35
46
|
|
|
36
47
|
@classmethod
|
|
37
|
-
def choices(cls) ->
|
|
48
|
+
def choices(cls) -> ListOfStrs:
|
|
38
49
|
return [e.value for e in cls]
|
|
39
50
|
|
|
40
51
|
@classmethod
|
|
41
|
-
def from_scheme(cls, scheme:
|
|
52
|
+
def from_scheme(cls, scheme: Scheme | str) -> "Protocol":
|
|
42
53
|
# Normalize to Scheme if it's a string
|
|
43
54
|
if isinstance(scheme, str):
|
|
44
55
|
try:
|
|
@@ -53,6 +64,31 @@ class Protocol(StrEnum):
|
|
|
53
64
|
raise ValueError(f"Unknown scheme: {scheme}")
|
|
54
65
|
|
|
55
66
|
|
|
67
|
+
ProtocolT = TypeVar("ProtocolT", bound=Protocol)
|
|
68
|
+
OptProtocol = Protocol | None
|
|
69
|
+
OptProtocolT = TypeVar("OptProtocolT", bound=OptProtocol)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class ProtocolMixin(BaseModel, Generic[OptProtocolT]):
|
|
73
|
+
method: Annotated[OptProtocolT, Field(..., description="Protocol")]
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
ListOfProtocols = list[Protocol]
|
|
77
|
+
ListOfProtocolsT = TypeVar("ListOfProtocolsT", bound=ListOfProtocols)
|
|
78
|
+
OptListOfProtocols = ListOfProtocols | None
|
|
79
|
+
OptListOfProtocolsT = TypeVar("OptListOfProtocolsT", bound=OptListOfProtocols)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class ProtocolsMixin(BaseModel, Generic[OptListOfProtocolsT]):
|
|
83
|
+
methods: Annotated[OptListOfProtocolsT, Field(..., description="Protocols")]
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
SeqOfProtocols = Sequence[Protocol]
|
|
87
|
+
SeqOfProtocolsT = TypeVar("SeqOfProtocolsT", bound=SeqOfProtocols)
|
|
88
|
+
OptSeqOfProtocols = SeqOfProtocols | None
|
|
89
|
+
OptSeqOfProtocolsT = TypeVar("OptSeqOfProtocolsT", bound=OptSeqOfProtocols)
|
|
90
|
+
|
|
91
|
+
|
|
56
92
|
class Method(StrEnum):
|
|
57
93
|
GET = "GET"
|
|
58
94
|
POST = "POST"
|
|
@@ -62,23 +98,33 @@ class Method(StrEnum):
|
|
|
62
98
|
OPTIONS = "OPTIONS"
|
|
63
99
|
|
|
64
100
|
@classmethod
|
|
65
|
-
def choices(cls) ->
|
|
101
|
+
def choices(cls) -> ListOfStrs:
|
|
66
102
|
return [e.value for e in cls]
|
|
67
103
|
|
|
68
104
|
|
|
69
105
|
MethodT = TypeVar("MethodT", bound=Method)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
106
|
+
OptMethod = Method | None
|
|
107
|
+
OptMethodT = TypeVar("OptMethodT", bound=OptMethod)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class MethodMixin(BaseModel, Generic[OptMethodT]):
|
|
111
|
+
method: Annotated[OptMethodT, Field(..., description="Method")]
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
ListOfMethods = list[Method]
|
|
73
115
|
ListOfMethodsT = TypeVar("ListOfMethodsT", bound=ListOfMethods)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
116
|
+
OptListOfMethods = ListOfMethods | None
|
|
117
|
+
OptListOfMethodsT = TypeVar("OptListOfMethodsT", bound=OptListOfMethods)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class MethodsMixin(BaseModel, Generic[OptListOfMethodsT]):
|
|
121
|
+
methods: Annotated[OptListOfMethodsT, Field(..., description="Methods")]
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
SeqOfMethods = Sequence[Method]
|
|
125
|
+
SeqOfMethodsT = TypeVar("SeqOfMethodsT", bound=SeqOfMethods)
|
|
126
|
+
OptSeqOfMethods = SeqOfMethods | None
|
|
127
|
+
OptSeqOfMethodsT = TypeVar("OptSeqOfMethodsT", bound=OptSeqOfMethods)
|
|
82
128
|
|
|
83
129
|
|
|
84
130
|
class Header(StrEnum):
|
|
@@ -165,20 +211,30 @@ class Header(StrEnum):
|
|
|
165
211
|
X_NEW_AUTHORIZATION = "x-new-authorization"
|
|
166
212
|
|
|
167
213
|
@classmethod
|
|
168
|
-
def choices(cls) ->
|
|
214
|
+
def choices(cls) -> ListOfStrs:
|
|
169
215
|
return [e.value for e in cls]
|
|
170
216
|
|
|
171
217
|
|
|
172
218
|
HeaderT = TypeVar("HeaderT", bound=Header)
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
219
|
+
OptHeader = Header | None
|
|
220
|
+
OptHeaderT = TypeVar("OptHeaderT", bound=OptHeader)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
class HeaderMixin(BaseModel, Generic[OptHeaderT]):
|
|
224
|
+
header: Annotated[OptHeaderT, Field(..., description="Header")]
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
ListOfHeaders = list[Header]
|
|
176
228
|
ListOfHeadersT = TypeVar("ListOfHeadersT", bound=ListOfHeaders)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
229
|
+
OptListOfHeaders = ListOfHeaders | None
|
|
230
|
+
OptListOfHeadersT = TypeVar("OptListOfHeadersT", bound=OptListOfHeaders)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
class HeadersMixin(BaseModel, Generic[OptListOfHeadersT]):
|
|
234
|
+
headers: Annotated[OptListOfHeadersT, Field(..., description="Headers")]
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
SeqOfHeaders = Sequence[Header]
|
|
238
|
+
SeqOfHeadersT = TypeVar("SeqOfHeadersT", bound=SeqOfHeaders)
|
|
239
|
+
OptSeqOfHeaders = SeqOfHeaders | None
|
|
240
|
+
OptSeqOfHeadersT = TypeVar("OptSeqOfHeadersT", bound=OptSeqOfHeaders)
|
maleo/enums/environment.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from enum import StrEnum
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from typing import Annotated, Generic, Sequence, TypeVar
|
|
4
|
+
from maleo.types.string import ListOfStrs
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class Environment(StrEnum):
|
|
@@ -9,24 +10,32 @@ class Environment(StrEnum):
|
|
|
9
10
|
PRODUCTION = "production"
|
|
10
11
|
|
|
11
12
|
@classmethod
|
|
12
|
-
def choices(cls) ->
|
|
13
|
+
def choices(cls) -> ListOfStrs:
|
|
13
14
|
return [e.value for e in cls]
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
EnvironmentT = TypeVar("EnvironmentT", bound=Environment)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
OptEnvironment = Environment | None
|
|
19
|
+
OptEnvironmentT = TypeVar("OptEnvironmentT", bound=OptEnvironment)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class EnvironmentMixin(BaseModel, Generic[OptEnvironmentT]):
|
|
23
|
+
environment: Annotated[OptEnvironmentT, Field(..., description="Environment")]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
ListOfEnvironments = list[Environment]
|
|
20
27
|
ListOfEnvironmentsT = TypeVar("ListOfEnvironmentsT", bound=ListOfEnvironments)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
)
|
|
28
|
+
OptListOfEnvironments = ListOfEnvironments | None
|
|
29
|
+
OptListOfEnvironmentsT = TypeVar("OptListOfEnvironmentsT", bound=OptListOfEnvironments)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class EnvironmentsMixin(BaseModel, Generic[OptListOfEnvironmentsT]):
|
|
33
|
+
environments: Annotated[
|
|
34
|
+
OptListOfEnvironmentsT, Field(..., description="Environments")
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
SeqOfEnvironments = Sequence[Environment]
|
|
39
|
+
SeqOfEnvironmentsT = TypeVar("SeqOfEnvironmentsT", bound=SeqOfEnvironments)
|
|
40
|
+
OptSeqOfEnvironments = SeqOfEnvironments | None
|
|
41
|
+
OptSeqOfEnvironmentsT = TypeVar("OptSeqOfEnvironmentsT", bound=OptSeqOfEnvironments)
|
maleo/enums/expiration.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from enum import IntEnum
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from typing import Annotated, Generic, Sequence, TypeVar
|
|
4
|
+
from maleo.types.integer import ListOfInts
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class Expiration(IntEnum):
|
|
@@ -21,22 +22,30 @@ class Expiration(IntEnum):
|
|
|
21
22
|
EXP_1MO = int(1 * 30 * 24 * 60 * 60)
|
|
22
23
|
|
|
23
24
|
@classmethod
|
|
24
|
-
def choices(cls) ->
|
|
25
|
+
def choices(cls) -> ListOfInts:
|
|
25
26
|
return [e.value for e in cls]
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
ExpirationT = TypeVar("ExpirationT", bound=Expiration)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
OptExpiration = Expiration | None
|
|
31
|
+
OptExpirationT = TypeVar("OptExpirationT", bound=OptExpiration)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class ExpirationMixin(BaseModel, Generic[OptExpirationT]):
|
|
35
|
+
expiration: Annotated[OptExpirationT, Field(..., description="Expiration")]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
ListOfExpirations = list[Expiration]
|
|
32
39
|
ListOfExpirationsT = TypeVar("ListOfExpirationsT", bound=ListOfExpirations)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
)
|
|
40
|
+
OptListOfExpirations = ListOfExpirations | None
|
|
41
|
+
OptListOfExpirationsT = TypeVar("OptListOfExpirationsT", bound=OptListOfExpirations)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class ExpirationsMixin(BaseModel, Generic[OptListOfExpirationsT]):
|
|
45
|
+
expirations: Annotated[OptListOfExpirationsT, Field(..., description="Expirations")]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
SeqOfExpirations = Sequence[Expiration]
|
|
49
|
+
SeqOfExpirationsT = TypeVar("SeqOfExpirationsT", bound=SeqOfExpirations)
|
|
50
|
+
OptSeqOfExpirations = SeqOfExpirations | None
|
|
51
|
+
OptSeqOfExpirationsT = TypeVar("OptSeqOfExpirationsT", bound=OptSeqOfExpirations)
|
maleo/enums/identity.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from enum import StrEnum
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from typing import Annotated, Generic, Sequence, TypeVar
|
|
4
|
+
from maleo.types.string import ListOfStrs
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class BloodType(StrEnum):
|
|
@@ -10,25 +11,33 @@ class BloodType(StrEnum):
|
|
|
10
11
|
O = "o" # noqa: E741
|
|
11
12
|
|
|
12
13
|
@classmethod
|
|
13
|
-
def choices(cls) ->
|
|
14
|
+
def choices(cls) -> ListOfStrs:
|
|
14
15
|
return [e.value for e in cls]
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
BloodTypeT = TypeVar("BloodTypeT", bound=BloodType)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
OptBloodType = BloodType | None
|
|
20
|
+
OptBloodTypeT = TypeVar("OptBloodTypeT", bound=OptBloodType)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class BloodTypeMixin(BaseModel, Generic[OptBloodTypeT]):
|
|
24
|
+
blood_type: Annotated[OptBloodTypeT, Field(..., description="Blood Type")]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
ListOfBloodTypes = list[BloodType]
|
|
21
28
|
ListOfBloodTypesT = TypeVar("ListOfBloodTypesT", bound=ListOfBloodTypes)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
)
|
|
29
|
+
OptListOfBloodTypes = ListOfBloodTypes | None
|
|
30
|
+
OptListOfBloodTypesT = TypeVar("OptListOfBloodTypesT", bound=OptListOfBloodTypes)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class BloodTypesMixin(BaseModel, Generic[OptListOfBloodTypesT]):
|
|
34
|
+
blood_types: Annotated[OptListOfBloodTypesT, Field(..., description="Blood Types")]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
SeqOfBloodTypes = Sequence[BloodType]
|
|
38
|
+
SeqOfBloodTypesT = TypeVar("SeqOfBloodTypesT", bound=SeqOfBloodTypes)
|
|
39
|
+
OptSeqOfBloodTypes = SeqOfBloodTypes | None
|
|
40
|
+
OptSeqOfBloodTypesT = TypeVar("OptSeqOfBloodTypesT", bound=OptSeqOfBloodTypes)
|
|
32
41
|
|
|
33
42
|
|
|
34
43
|
class Gender(StrEnum):
|
|
@@ -37,20 +46,30 @@ class Gender(StrEnum):
|
|
|
37
46
|
MALE = "male"
|
|
38
47
|
|
|
39
48
|
@classmethod
|
|
40
|
-
def choices(cls) ->
|
|
49
|
+
def choices(cls) -> ListOfStrs:
|
|
41
50
|
return [e.value for e in cls]
|
|
42
51
|
|
|
43
52
|
|
|
44
53
|
GenderT = TypeVar("GenderT", bound=Gender)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
OptGender = Gender | None
|
|
55
|
+
OptGenderT = TypeVar("OptGenderT", bound=OptGender)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class GenderMixin(BaseModel, Generic[OptGenderT]):
|
|
59
|
+
gender: Annotated[OptGenderT, Field(..., description="Gender")]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
ListOfGenders = list[Gender]
|
|
48
63
|
ListOfGendersT = TypeVar("ListOfGendersT", bound=ListOfGenders)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
OptListOfGenders = ListOfGenders | None
|
|
65
|
+
OptListOfGendersT = TypeVar("OptListOfGendersT", bound=OptListOfGenders)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class GendersMixin(BaseModel, Generic[OptListOfGendersT]):
|
|
69
|
+
genders: Annotated[OptListOfGendersT, Field(..., description="Genders")]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
SeqOfGenders = Sequence[Gender]
|
|
73
|
+
SeqOfGendersT = TypeVar("SeqOfGendersT", bound=SeqOfGenders)
|
|
74
|
+
OptSeqOfGenders = SeqOfGenders | None
|
|
75
|
+
OptSeqOfGendersT = TypeVar("OptSeqOfGendersT", bound=OptSeqOfGenders)
|